mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
fbc5dd4822
|
|
@ -124,14 +124,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("ErrorModuleSetupNotComplete"), null, 'errors');
|
||||
}
|
||||
if (!getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT')) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorModuleSetupNotComplete"), 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');
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ restrictedArea($user, 'bookmark', $object);
|
|||
|
||||
$permissiontoread = $user->hasRight('bookmark', 'lire');
|
||||
$permissiontoadd = $user->hasRight('bookmark', 'creer');
|
||||
$permissiontodelete = $user->hasRight('bookmark', 'supprimer');
|
||||
$permissiontodelete = ($user->hasRight('bookmark', 'supprimer') || ($permissiontoadd && $object->fk_user == $user->id)); // Can always delete its own bookmark
|
||||
|
||||
|
||||
|
||||
|
|
@ -326,7 +326,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) {
|
|||
|
||||
// Buttons
|
||||
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
print '<div class="tabsAction">'."\n";
|
||||
|
||||
// Edit
|
||||
if ($permissiontoadd && $action != 'edit') {
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ if ($resql) {
|
|||
if (($nbtotalofrecords <= $num) && $totalamount_requested != (float) $object->amount) {
|
||||
$langs->load("errors");
|
||||
// Warning, amount of file (%s) differs from the sum of lines (%s)
|
||||
print img_warning($langs->trans("WarningAmountOfFileDiffersFromSumOfLines", price($object->amount), price($totalamount_requested)));
|
||||
print img_warning($langs->trans("WarningAmountOfFileDiffersFromSumOfLines", price((float) $object->amount), price($totalamount_requested)));
|
||||
}
|
||||
print price($totalamount_requested);
|
||||
print "</td>\n";
|
||||
|
|
|
|||
|
|
@ -575,7 +575,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
|||
|
||||
// Quantity
|
||||
print '<td class="right">';
|
||||
print $qty[$key];
|
||||
print price($qty[$key], 1, $langs, 0, 0);
|
||||
print '</td>';
|
||||
|
||||
// Percent;
|
||||
|
|
|
|||
|
|
@ -1776,7 +1776,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
|
||||
|
|
@ -1882,7 +1882,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -362,6 +362,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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9035,7 +9035,7 @@ abstract class CommonObject
|
|||
$value = $getposttemp;
|
||||
}
|
||||
} elseif (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('int'))) {
|
||||
$value = (!empty($this->array_options["options_".$key]) || $this->array_options["options_".$key] === '0') ? $this->array_options["options_".$key] : '';
|
||||
$value = (!empty($this->array_options["options_".$key]) || (isset($this->array_options["options_".$key]) && $this->array_options["options_".$key] === '0')) ? $this->array_options["options_".$key] : '';
|
||||
} else {
|
||||
$value = (!empty($this->array_options["options_".$key]) ? $this->array_options["options_".$key] : ''); // No GET, no POST, no default value, so we take value of object.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,6 +150,7 @@ class ExtraFields
|
|||
|
||||
$result = 0;
|
||||
|
||||
// Clean properties
|
||||
if ($type == 'separator' || $type == 'separate') {
|
||||
$type = 'separate';
|
||||
$unique = 0;
|
||||
|
|
@ -161,6 +162,11 @@ class ExtraFields
|
|||
if ($elementtype == 'contact') {
|
||||
$elementtype = 'socpeople';
|
||||
}
|
||||
// If property has a computed formula, it must not be a required or unique field
|
||||
if (!empty($computed)) {
|
||||
$required = 0;
|
||||
$unique = 0;
|
||||
}
|
||||
|
||||
// Create field into database except for separator type which is not stored in database
|
||||
if ($type != 'separate') {
|
||||
|
|
@ -665,6 +671,7 @@ class ExtraFields
|
|||
}
|
||||
|
||||
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/", $attrname)) {
|
||||
// Clean parameters
|
||||
if ($type == 'boolean') {
|
||||
$typedb = 'int';
|
||||
$lengthdb = '1';
|
||||
|
|
@ -713,6 +720,12 @@ class ExtraFields
|
|||
}
|
||||
$field_desc = array('type' => $typedb, 'value' => $lengthdb, 'null' => ($required ? 'NOT NULL' : 'NULL'), 'default' => $default);
|
||||
|
||||
// If property has a computed formula, it must not be a required or unique field
|
||||
if (!empty($computed)) {
|
||||
$required = 0;
|
||||
$unique = 0;
|
||||
}
|
||||
|
||||
if (is_object($hookmanager)) {
|
||||
$hookmanager->initHooks(array('extrafieldsdao'));
|
||||
$parameters = array('field_desc' => &$field_desc, 'table' => $table, 'attr_name' => $attrname, 'label' => $label, 'type' => $type, 'length' => $length, 'unique' => $unique, 'required' => $required, 'pos' => $pos, 'param' => $param, 'alwayseditable' => $alwayseditable, 'perms' => $perms, 'list' => $list, 'help' => $help, 'default' => $default, 'computed' => $computed, 'entity' => $entity, 'langfile' => $langfile, 'enabled' => $enabled, 'totalizable' => $totalizable, 'printable' => $printable);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1010,7 +1010,7 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayrep
|
|||
*/
|
||||
function dol_move($srcfile, $destfile, $newmask = '0', $overwriteifexists = 1, $testvirus = 0, $indexdatabase = 1, $moreinfo = array())
|
||||
{
|
||||
global $user, $db, $conf;
|
||||
global $user, $db;
|
||||
$result = false;
|
||||
|
||||
dol_syslog("files.lib.php::dol_move srcfile=".$srcfile." destfile=".$destfile." newmask=".$newmask." overwritifexists=".$overwriteifexists);
|
||||
|
|
@ -2601,7 +2601,7 @@ function dol_uncompress($inputfile, $outputdir)
|
|||
* @param string $mode 'zip'
|
||||
* @param string $excludefiles A regex pattern to exclude files. For example: '/\.log$|\/temp\//'
|
||||
* @param string $rootdirinzip Add a root dir level in zip file
|
||||
* @param string $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK). Example: '0666'
|
||||
* @param string $newmask Mask for new file ('0' by default means getDolGlobalString('MAIN_UMASK')). Example: '0666'
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @see dol_uncompress(), dol_compress_file()
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonorder.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.ligne.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.orderline.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
|
||||
if (isModEnabled('productbatch')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php';
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/fourn/class/fournisseur.commande.ligne.class.php
|
||||
* \file htdocs/fourn/class/fournisseur.orderline.class.php
|
||||
* \ingroup fournisseur,commande
|
||||
* \brief File of class to manage supplier order lines
|
||||
*/
|
||||
|
|
@ -527,14 +527,14 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
|||
return -1;
|
||||
}
|
||||
|
||||
$sql1 = 'UPDATE '.$this->db->prefix()."commandedet SET fk_commandefourndet = NULL WHERE rowid=".((int) $this->id);
|
||||
$sql1 = 'UPDATE '.$this->db->prefix()."commandedet SET fk_commandefourndet = NULL WHERE fk_commandefourndet = ".((int) $this->id);
|
||||
$resql = $this->db->query($sql1);
|
||||
if (!$resql) {
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql2 = 'DELETE FROM '.$this->db->prefix()."commande_fournisseurdet WHERE rowid=".((int) $this->id);
|
||||
$sql2 = 'DELETE FROM '.$this->db->prefix()."commande_fournisseurdet WHERE rowid = ".((int) $this->id);
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql2);
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -140,3 +140,4 @@ QtyCantBeSplit= Quantity cannot be split
|
|||
NoRemainQtyToDispatch=No quantity remaining to divide
|
||||
THMOperatorEstimatedHelp=Estimated cost of operator per hour. Will be used to estimate cost of a BOM using this workstation.
|
||||
THMMachineEstimatedHelp=Estimated cost of machine per hour. Will be used to estimate cost of a BOM using this workstation.
|
||||
BadValueForquantityToConsume=Quantity to consume for a material cannot be 0 or negative
|
||||
|
|
|
|||
|
|
@ -140,3 +140,4 @@ QtyCantBeSplit= Quantité non fractionnable
|
|||
NoRemainQtyToDispatch=Aucune quantité restant à fractionner
|
||||
THMOperatorEstimatedHelp=Coût estimé de l'opérateur par heure. Sera utilisé pour estimer le coût d'une nomenclature utilisant ce poste de travail.
|
||||
THMMachineEstimatedHelp=Coût estimé de la machine par heure. Sera utilisé pour estimer le coût d'une nomenclature utilisant ce poste de travail.
|
||||
BadValueForquantityToConsume=La quantité à consommer d'un composant ne peut être 0 ou négative
|
||||
|
|
|
|||
|
|
@ -793,6 +793,7 @@ class Mo extends CommonObject
|
|||
if ($moline->qty <= 0) {
|
||||
$error++;
|
||||
$this->error = "BadValueForquantityToConsume";
|
||||
$this->errors[] = $this->error;
|
||||
break;
|
||||
} else {
|
||||
$moline->fk_product = $line->fk_product;
|
||||
|
|
@ -808,7 +809,8 @@ class Mo extends CommonObject
|
|||
if ($resultline <= 0) {
|
||||
$error++;
|
||||
$this->error = $moline->error;
|
||||
$this->errors = $moline->errors;
|
||||
$this->errors[] = $moline->error;
|
||||
$this->errors = array_merge($this->errors, $moline->errors);
|
||||
dol_print_error($this->db, $moline->error, $moline->errors);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user