Osclass Support Forums

Osclass plugin support => Backoffice Manager Plugin => Topic started by: Vlad7 on June 03, 2022, 09:59:38 PM

Title: Error publishing list
Post by: Vlad7 on June 03, 2022, 09:59:38 PM
Hello, please help me figure out why. An error occurred while publishing and editing the list

03-Jun-2022 22:54:40 Europe/Kiev] PHP Warning:  Undefined variable $status in /home2/ukagroco/public_html/oc-content/plugins/backoffice_manager/index.php on line 424
[03-Jun-2022 22:54:40 Europe/Kiev] PHP Warning:  Trying to access array offset on value of type null in /home2/ukagroco/public_html/oc-content/plugins/backoffice_manager/index.php on line 424
Title: Re: Error publishing list
Post by: MB Themes on June 06, 2022, 12:17:35 PM
@Vlad7
Update bo_mgr_form_post function in index.php with following:
Code: [Select]
function bo_mgr_form_post($item) {
  $status_email = osc_get_preference('bo_mgr_status_email', 'plugin-bo_mgr') <> '' ? osc_get_preference('bo_mgr_status_email', 'plugin-bo_mgr') : 1;
  $detail = ModelBO::newInstance()->getItem( $item['pk_i_id'] );
  $status = array();
 
  if(Params::getParam('bo_mgr_status') <> '') {
    //$status = ModelLS::newInstance()->getStatus( $status_id );
    $status = ModelLS::newInstance()->getStatus(Params::getParam('bo_mgr_status'));
  }

  if(isset($detail['pk_i_id']) && $detail['pk_i_id'] > 0) {
    ModelBO::newInstance()->updateItem( $item['pk_i_id'], $detail['republish_times'], $detail['form_used'], Params::getParam('bo_mgr_passwrd'), Params::getParam('bo_mgr_mobile'), Params::getParam('bo_mgr_status'), Params::getParam('bo_mgr_autorepublish') );

    //if status is "Sold" status, set item to expired
    if(isset($status['status_sold']) && $status['status_sold'] == 1) {
      $today = date('Y-m-d', strtotime(' -1 day', time()));
      ModelLS::newInstance()->itemToExpired($item['pk_i_id'], $today);
    }
  } else {
    ModelBO::newInstance()->addItem( $item['pk_i_id'], 0, 0, Params::getParam('bo_mgr_passwrd'), Params::getParam('bo_mgr_mobile'), Params::getParam('bo_mgr_status'), Params::getParam('bo_mgr_autorepublish') );

    if($status_email == 1) {
      email_status($item['pk_i_id']);
    }
  }
}