verifyPackage( 'stock' ); $gBitSystem->verifyPermission( 'p_stock_update' ); if( empty( $_REQUEST['content_id'] ) || !is_numeric( $_REQUEST['content_id'] ) ) { $gBitSystem->fatalError( 'No content ID specified.' ); } $gContent = LibertyContent::getLibertyObject( (int)$_REQUEST['content_id'] ); if( !$gContent || !$gContent->isValid() ) { $gBitSystem->fatalError( 'Content not found.' ); } if( !empty( $_REQUEST['xref_id'] ) ) { $gContent->loadXref( $_REQUEST['xref_id'] ); } $gContent->verifyUpdatePermission(); if( !empty( $_REQUEST['fCancel'] ) ) { header( 'Location: '.$gContent->getDisplayUrl() ); die; } if( !empty( $_REQUEST['fSaveXref'] ) ) { if( $gContent->storeXref( $_REQUEST ) ) { header( 'Location: '.$gContent->getDisplayUrl() ); die; } $xrefInfo = $_REQUEST; $xrefInfo['data'] = $_REQUEST['edit'] ?? ''; } else { $xrefInfo = $gContent->mInfo['xref_store']['data'] ?? []; } $gBitSmarty->assign( 'gContent', $gContent ); $gBitSmarty->assign( 'xrefInfo', $xrefInfo ); $gBitSmarty->assign( 'errors', $gContent->mErrors ); $gBitSystem->display( 'bitpackage:stock/edit_xref.tpl', 'Edit Detail', [ 'display_mode' => 'edit' ] );