diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index 74f2299e269..2727feef758 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -123,14 +123,28 @@ if (empty($reshook)) { $separate_auxiliary_account = GETPOST('separate_auxiliary_account', 'aZ09'); $generate_bookkeeping_records = GETPOST('generate_bookkeeping_records', 'aZ09'); - $result = $object->closeFiscalPeriod($current_fiscal_period['id'], $new_fiscal_period_id, $separate_auxiliary_account, $generate_bookkeeping_records); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } else { - setEventMessages($langs->trans("AccountancyClosureCloseSuccessfully"), null, 'mesgs'); + $error = 0; + if ($generate_bookkeeping_records) { + if (!getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT')) { + $error++; + setEventMessages($langs->trans("ErrorSetupNotComplete"), null, 'errors'); + } + if (!getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT')) { + $error++; + setEventMessages($langs->trans("ErrorSetupNotComplete"), null, 'errors'); + } + } - header("Location: " . $_SERVER['PHP_SELF'] . (isset($current_fiscal_period) ? '?fiscal_period_id=' . $current_fiscal_period['id'] : '')); - exit; + if (!$error) { + $result = $object->closeFiscalPeriod($current_fiscal_period['id'], $new_fiscal_period_id, $separate_auxiliary_account, $generate_bookkeeping_records); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } else { + setEventMessages($langs->trans("AccountancyClosureCloseSuccessfully"), null, 'mesgs'); + + header("Location: " . $_SERVER['PHP_SELF'] . (isset($current_fiscal_period) ? '?fiscal_period_id=' . $current_fiscal_period['id'] : '')); + exit; + } } } elseif ($action == 'confirm_step_3' && $confirm == "yes") { $inventory_journal_id = GETPOSTINT('inventory_journal_id'); diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index a79d2232ff5..11054c3a05c 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -942,7 +942,7 @@ class Documents extends DolibarrApi // Move the temporary file at its final emplacement $result = dol_move($destfiletmp, $dest_file, 0, $overwriteifexists, 1, 1, $moreinfo); if (!$result) { - throw new RestException(500, "Failed to move file into '".$destfile."'"); + throw new RestException(500, "Failed to move file into '".$dest_file."'"); } return dol_basename($destfile); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index ef7e9b01501..4a4d4cca978 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1732,7 +1732,7 @@ if ($action == 'create') { $line = new ContratLigne($db); $line->id = $objp->rowid; $line->fetch_optionals(); - print $line->showOptionals($extrafields, 'view', array('class' => 'oddeven', 'style' => $moreparam, 'colspan' => $colspan), '', '', 1); + print $line->showOptionals($extrafields, 'view', array('class' => 'oddeven', 'style' => $moreparam, 'colspan' => $colspan, 'tdclass' => 'notitlefieldcreate'), '', '', 1); } } else { // Line in mode update @@ -1838,7 +1838,8 @@ if ($action == 'create') { $line = new ContratLigne($db); $line->id = $objp->rowid; $line->fetch_optionals(); - print $line->showOptionals($extrafields, 'edit', array('style' => 'class="oddeven"', 'colspan' => $colspan), '', '', 1); + + print $line->showOptionals($extrafields, 'edit', array('style' => 'class="oddeven"', 'colspan' => $colspan, 'tdclass' => 'notitlefieldcreate'), '', '', 1); } } diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index e713fb51db3..43460e9e888 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -361,6 +361,10 @@ abstract class CommonDocGenerator // phpcs:enable global $extrafields; + if (!is_object($object)) { + return array(); + } + if (empty($object->country) && !empty($object->country_code)) { $object->country = $outputlangs->transnoentitiesnoconv("Country".$object->country_code); } diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 11fd4856bc7..8dccc87237c 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -561,7 +561,7 @@ class Utils } elseif ($compression == 'zstd') { fclose($handle); } - if ($ok && preg_match('/^-- (MySql|MariaDB)/i', $errormsg) || preg_match('/^\/\*!999999/', $errormsg)) { // Start of file is ok, NOT an error + if ($ok && preg_match('/^-- (MySql|MariaDB)/i', $errormsg) || preg_match('/^\/\*M?!999999/', $errormsg)) { // Start of file is ok, NOT an error $errormsg = ''; } else { // Rename file out into a file error diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index e89b5ade7ba..d0636d8afa0 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -370,6 +370,7 @@ ALTER TABLE llx_actioncomm_reminder ADD UNIQUE uk_actioncomm_reminder_unique (fk ALTER TABLE llx_actioncomm_reminder ADD INDEX idx_actioncomm_reminder_status (status); ALTER TABLE llx_inventorydet ADD COLUMN fk_warehouse integer DEFAULT 0; +ALTER TABLE llx_inventorydet ADD COLUMN batch varchar(128) DEFAULT NULL; ALTER TABLE llx_inventorydet ADD UNIQUE uk_inventorydet(fk_inventory, fk_warehouse, fk_product, batch); ALTER TABLE llx_commandedet ADD COLUMN ref_ext varchar(255) AFTER label;