WebsiteBaker Community Forum

WebsiteBaker Support (2.12.x) => Modules => Topic started by: Gast on June 04, 2019, 12:02:22 PM

Title: OFA - Duplicate Item / Issue in MySQL-Strict Mode
Post by: Gast on June 04, 2019, 12:02:22 PM
damit man es auch wieder findet

der Vorgang "Item duplizieren" erzeugt unter MYSQL-Strict Mode auf Grund einer unvollständigen Anweisung keinen Insert.
Zur Behebung in Datei save_item.php  ~ Zeile 603 diesen Original-Code

engl Translation
The "Duplicate Item" operation does not create an insert under MYSQL-Strict Mode due to an incomplete statement.
To fix in file save_item.php ~ line 603 this original code

Code: [Select]
// Insert new row into database
$database->query('INSERT INTO `'.TABLE_PREFIX.'mod_'.$mod_name.'_items` (`section_id`, `page_id`, `position`) VALUES ('.(int)$section_id.', '.(int)$page_id.', '.(int)$position.')');

ersetzen durch / replace with
Code: [Select]
// Insert new row into database
    $sql = 'INSERT INTO `'.TABLE_PREFIX.'mod_'.$mod_name.'_items` SET '
      .   '`section_id` = '.(int)$section_id.', '
      .   '`page_id` = '.(int)$page_id.', '
      .   '`title` = \'\', '
      .   '`link` = \'\', '
      .   '`description` = \'\', '
      .   '`position` = '.(int)$position.', '
      .   '`scheduling` = \'\', '
      .   '`main_image` = \'\', '
      .   '`modified_when` = \''.time().'\', '
      .   '`modified_by` = '.(int)$admin->get_user_id().' ';
   
    // Check if there was a db error
    if (!$database->query($sql)){
      $admin->print_error($database->get_error());
    }