Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur (aka Eldy) 2024-12-17 16:59:13 +01:00
commit 81e64ed9a4
18 changed files with 117 additions and 77 deletions

View File

@ -18,3 +18,4 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/changed-lines-count-labeler.yml
continue-on-error: true

View File

@ -3,7 +3,8 @@
* Copyright (C) 2015-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2020 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Jose MARTINEZ <jose.martinez@pichinov.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -324,7 +325,7 @@ class BookKeeping extends CommonObject
$this->piece_num = 0;
// First check if line not yet already in bookkeeping.
// Note that we must include 'doc_type - fk_doc - numero_compte - label' to be sure to have unicity of line (because we may have several lines
// Note that we must include 'doc_type - fk_doc - numero_compte - label - subledger_account (if not empty)' to be sure to have unicity of line (because we may have several lines
// with same doc_type, fk_doc, numero_compte for 1 invoice line when using localtaxes with same account)
// WARNING: This is not reliable, label may have been modified. This is just a small protection.
// The page that make transfer make the test on couple (doc_type - fk_doc) only.
@ -338,6 +339,9 @@ class BookKeeping extends CommonObject
}
$sql .= " AND numero_compte = '".$this->db->escape($this->numero_compte)."'";
$sql .= " AND label_operation = '".$this->db->escape($this->label_operation)."'";
if (!empty($this->subledger_account)) {
$sql .= " AND subledger_account = '".$this->db->escape($this->subledger_account)."'";
}
$sql .= " AND entity = ".$conf->entity; // Do not use getEntity for accounting features
$resql = $this->db->query($sql);
@ -2863,10 +2867,8 @@ class BookKeeping extends CommonObject
$sql = 'SELECT';
$sql .= " t.numero_compte,";
$sql .= " t.label_compte,";
if ($separate_auxiliary_account) {
$sql .= " t.subledger_account,";
$sql .= " t.subledger_label,";
$sql .= " NULLIF(t.subledger_account, '') as subledger_account,"; // fix db issues with Null or "" values
}
$sql .= " aa.pcg_type,";
$sql .= " (SUM(t.credit) - SUM(t.debit)) as opening_balance";
@ -2878,10 +2880,11 @@ class BookKeeping extends CommonObject
$sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')';
$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'";
$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'";
$sql .= ' GROUP BY t.numero_compte, t.label_compte, aa.pcg_type';
$sql .= ' GROUP BY t.numero_compte, aa.pcg_type';
if ($separate_auxiliary_account) {
$sql .= ' ,t.subledger_account, t.subledger_label';
$sql .= " , NULLIF(t.subledger_account, '')";
}
$sql .= ' HAVING (SUM(t.credit) - SUM(t.debit)) != 0 '; // Exclude rows with opening_balance = 0
$sql .= $this->db->order("t.numero_compte", "ASC");
$resql = $this->db->query($sql);
@ -2902,24 +2905,41 @@ class BookKeeping extends CommonObject
$bookkeeping = new BookKeeping($this->db);
$bookkeeping->doc_date = $new_fiscal_period->date_start;
$bookkeeping->date_lim_reglement = 0;
$bookkeeping->doc_ref = $new_fiscal_period->label;
$bookkeeping->date_lim_reglement = '';
$bookkeeping->doc_ref = $fiscal_period->label;
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'closure';
$bookkeeping->fk_doc = $new_fiscal_period->id;
$bookkeeping->fk_doc = $fiscal_period->id;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = '';
if ($separate_auxiliary_account) {
$bookkeeping->subledger_account = $obj->subledger_account;
$bookkeeping->subledger_label = $obj->subledger_label;
$sql = 'SELECT';
$sql .= " subledger_label";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'";
$sql .= " ORDER BY doc_date DESC";
$sql .= " LIMIT 1";
$result = $this->db->query($sql);
if (!$result) {
$this->errors[] = 'Error: ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
$error++;
}
$objtmp = $this->db->fetch_object($result);
$bookkeeping->subledger_label = $objtmp->subledger_label; // latest subledger label used
} else {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->subledger_account = null;
$bookkeeping->subledger_label = null;
}
$bookkeeping->numero_compte = $obj->numero_compte;
$bookkeeping->label_compte = $obj->label_compte;
$accountingaccount = new AccountingAccount($this->db);
$accountingaccount->fetch('', $obj->numero_compte);
$bookkeeping->label_compte = $accountingaccount->label; // latest account label used
$bookkeeping->label_operation = $new_fiscal_period->label;
$bookkeeping->montant = $mt;
@ -2949,21 +2969,35 @@ class BookKeeping extends CommonObject
$bookkeeping = new BookKeeping($this->db);
$bookkeeping->doc_date = $new_fiscal_period->date_start;
$bookkeeping->date_lim_reglement = 0;
$bookkeeping->doc_ref = $new_fiscal_period->label;
$bookkeeping->date_lim_reglement = '';
$bookkeeping->doc_ref = $fiscal_period->label;
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'closure';
$bookkeeping->fk_doc = $new_fiscal_period->id;
$bookkeeping->fk_doc = $fiscal_period->id;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = '';
if ($separate_auxiliary_account) {
$bookkeeping->subledger_label = '';
$bookkeeping->subledger_account = $obj->subledger_account;
$bookkeeping->subledger_label = $obj->subledger_label;
$sql = 'SELECT';
$sql .= " subledger_label";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'";
$sql .= " ORDER BY doc_date DESC";
$sql .= " LIMIT 1";
$result = $this->db->query($sql);
if (!$result) {
$this->errors[] = 'Error: ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
$error++;
}
$objtmp = $this->db->fetch_object($result);
$bookkeeping->subledger_label = $objtmp->subledger_label; // latest subledger label used
} else {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->subledger_account = null;
$bookkeeping->subledger_label = null;
}
$bookkeeping->numero_compte = $accountingaccount->account_number;

View File

@ -1983,8 +1983,8 @@ while ($i < $imaxinloop) {
}
// Country
if (!empty($arrayfields['country.code_iso']['checked'])) {
print '<td class="center">';
$tmparray = getCountry($obj->fk_pays, 'all');
print '<td class="center tdoverflowmax100" title="'.dolPrintHTML($tmparray['label']).'">';
print $tmparray['label'];
print '</td>';
if (!$i) {

View File

@ -1108,7 +1108,7 @@ if (empty($reshook)) {
$object->fk_incoterms = GETPOSTINT('incoterm_id');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx');
$object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx');
// Special properties of replacement invoice
$object->fk_facture_source = GETPOSTINT('fac_replacement');
@ -1169,7 +1169,7 @@ if (empty($reshook)) {
$object->fk_incoterms = GETPOSTINT('incoterm_id');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx');
$object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx');
// Special properties of replacement invoice
$object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : '';
@ -1408,7 +1408,7 @@ if (empty($reshook)) {
$object->fk_incoterms = GETPOSTINT('incoterm_id');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx');
$object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx');
// Source facture
$object->fac_rec = GETPOSTINT('fac_rec');
@ -1495,7 +1495,7 @@ if (empty($reshook)) {
$object->fk_incoterms = GETPOSTINT('incoterm_id');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx');
$object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx');
if (GETPOST('type') == Facture::TYPE_SITUATION) {
$object->situation_counter = 1;
@ -2766,7 +2766,7 @@ if (empty($reshook)) {
// Invoice situation
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
$previousprogress = $line->getAllPrevProgress($line->fk_facture);
$fullprogress = price2num(GETPOST('progress', 'alpha'));
$fullprogress = price2num(GETPOST('progress', 'alpha'), 2);
if ($fullprogress < $previousprogress) {
$error++;

View File

@ -312,7 +312,7 @@ print '</td></tr>';
// ThirdParty Type
print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
$sortparam_typent = (!getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
$sortparam_typent = getDolGlobalString('SOCIETE_SORT_ON_TYPEENT', 'ASC'); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1);
if ($user->admin) {
print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
@ -342,7 +342,7 @@ if (isModEnabled('category')) {
// User
print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>';
print img_picto('', 'user', 'class="pictofixedwidth"');
print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300');
print $form->select_dolusers($userid ? $userid : -1, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300');
print '</td></tr>';
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td>';

View File

@ -455,7 +455,7 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $
print '<tr class="oddeven">';
print '<td class="nowrap"><a href="'.DOL_URL_ROOT.'/compta/localtax/quadri_detail.php?leftmenu=tax_vat&month='.$m.'&year='.$y.'">'.dol_print_date(dol_mktime(0, 0, 0, (int) $m, 1, (int) $y), "%b %Y").'</a></td>';
print '<td class="nowrap"><a href="'.DOL_URL_ROOT.'/compta/localtax/quadri_detail.php?leftmenu=tax_vat&month='.$m.'&year='.$y.'&localTaxType='.$localTaxType.'">'.dol_print_date(dol_mktime(0, 0, 0, (int) $m, 1, (int) $y), "%b %Y").'</a></td>';
$x_coll_sum = 0;
foreach (array_keys($x_coll) as $rate) {

View File

@ -282,7 +282,7 @@ if (!class_exists('MenuManager')) {
$menufound = 0;
$dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
foreach ($dirmenus as $dirmenu) {
$menufound = dol_include_once($dirmenu."standard/".$file_menu);
$menufound = dol_include_once($dirmenu."standard/".dol_sanitizeFileName($file_menu));
if ($menufound) {
break;
}
@ -290,7 +290,7 @@ if (!class_exists('MenuManager')) {
if (!$menufound) { // If failed to include, we try with standard
dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING);
$file_menu = 'eldy_menu.php';
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".dol_sanitizeFileName($file_menu);
}
}
// @phan-suppress-next-line PhanRedefinedClassReference

View File

@ -2629,8 +2629,11 @@ function pdf_getLinkedObjects(&$object, $outputlangs)
if (is_object($hookmanager)) {
$parameters = array('linkedobjects' => $linkedobjects, 'outputlangs' => $outputlangs);
$action = '';
$hookmanager->executeHooks('pdf_getLinkedObjects', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($hookmanager->resArray)) {
$reshook = $hookmanager->executeHooks('pdf_getLinkedObjects', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
$linkedobjects = array_replace($linkedobjects, $hookmanager->resArray); // array_replace is used to preserve keys
} elseif ($reshook>0) {
// The array must be reinserted even if it is empty because clearing the array could be one of the actions performed by the hook.
$linkedobjects = $hookmanager->resArray;
}
}

View File

@ -224,7 +224,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers
case 'ORDER_CLASSIFY_BILLED':
case 'ORDER_SETDRAFT':
case 'LINEORDER_INSERT':
case 'LINEORDER_UPDATE':
case 'LINEORDER_MODIFY':
case 'LINEORDER_DELETE':
break;
// Supplier orders
@ -239,7 +239,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers
// case 'ORDER_SUPPLIER_RECEIVE':
// case 'LINEORDER_SUPPLIER_DISPATCH':
// case 'LINEORDER_SUPPLIER_CREATE':
// case 'LINEORDER_SUPPLIER_UPDATE':
// case 'LINEORDER_SUPPLIER_MODIFY':
// Proposals
// case 'PROPAL_CREATE':
@ -251,7 +251,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers
// case 'PROPAL_CLOSE_REFUSED':
// case 'PROPAL_DELETE':
// case 'LINEPROPAL_INSERT':
// case 'LINEPROPAL_UPDATE':
// case 'LINEPROPAL_MODIFY':
// case 'LINEPROPAL_DELETE':
// SupplierProposal
@ -264,7 +264,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers
// case 'SUPPLIER_PROPOSAL_CLOSE_REFUSED':
// case 'SUPPLIER_PROPOSAL_DELETE':
// case 'LINESUPPLIER_PROPOSAL_INSERT':
// case 'LINESUPPLIER_PROPOSAL_UPDATE':
// case 'LINESUPPLIER_PROPOSAL_MODIFY':
// case 'LINESUPPLIER_PROPOSAL_DELETE':
// Contracts
@ -274,7 +274,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers
// case 'CONTRACT_CLOSE':
// case 'CONTRACT_DELETE':
// case 'LINECONTRACT_INSERT':
// case 'LINECONTRACT_UPDATE':
// case 'LINECONTRACT_MODIFY':
// case 'LINECONTRACT_DELETE':
// Bills
@ -288,19 +288,19 @@ class InterfaceZapierTriggers extends DolibarrTriggers
// case 'BILL_DELETE':
// case 'BILL_PAYED':
// case 'LINEBILL_INSERT':
// case 'LINEBILL_UPDATE':
// case 'LINEBILL_MODIFY':
// case 'LINEBILL_DELETE':
//Supplier Bill
// case 'BILL_SUPPLIER_CREATE':
// case 'BILL_SUPPLIER_UPDATE':
// case 'BILL_SUPPLIER_MODIFY':
// case 'BILL_SUPPLIER_DELETE':
// case 'BILL_SUPPLIER_PAYED':
// case 'BILL_SUPPLIER_UNPAYED':
// case 'BILL_SUPPLIER_VALIDATE':
// case 'BILL_SUPPLIER_UNVALIDATE':
// case 'LINEBILL_SUPPLIER_CREATE':
// case 'LINEBILL_SUPPLIER_UPDATE':
// case 'LINEBILL_SUPPLIER_MODIFY':
// case 'LINEBILL_SUPPLIER_DELETE':
// Payments
@ -316,7 +316,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers
// Donation
// case 'DON_CREATE':
// case 'DON_UPDATE':
// case 'DON_MODIFY':
// case 'DON_DELETE':
// Interventions
@ -325,7 +325,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers
// case 'FICHINTER_VALIDATE':
// case 'FICHINTER_DELETE':
// case 'LINEFICHINTER_CREATE':
// case 'LINEFICHINTER_UPDATE':
// case 'LINEFICHINTER_MODIFY':
// case 'LINEFICHINTER_DELETE':
// Members

View File

@ -1875,7 +1875,7 @@ if ($action == 'create') {
print '</tr>';
}
if ($object->status == $object::STATUS_CLOSED) {
if ($object->status == ExpenseReport::STATUS_CLOSED) {
/* TODO this fields are not yet filled
print '<tr>';
print '<td>'.$langs->trans("AUTHORPAIEMENT").'</td>';
@ -2615,12 +2615,12 @@ if ($action == 'create') {
// Unit price net
print '<td class="right inputpricenet">';
print '<input type="text" class="right maxwidth50" id="value_unit_ht" name="value_unit_ht" value="'.dol_escape_htmltag((!empty($value_unit_ht) ? $value_unit_ht : 0)).'"'.$taxlessUnitPriceDisabled.' />';
print '<input type="text" class="right maxwidth50" id="value_unit_ht" name="value_unit_ht" value="'.dol_escape_htmltag((!empty($value_unit_ht) ? $value_unit_ht : "")).'"'.$taxlessUnitPriceDisabled.' />';
print '</td>';
// Unit price with tax
print '<td class="right inputtax">';
print '<input type="text" class="right maxwidth50" id="value_unit" name="value_unit" value="'.dol_escape_htmltag((!empty($value_unit) ? $value_unit : 0)).'">';
print '<input type="text" class="right maxwidth50" id="value_unit" name="value_unit" value="'.dol_escape_htmltag((!empty($value_unit) ? $value_unit : "")).'">';
print '</td>';
// Quantity

View File

@ -1943,7 +1943,7 @@ class ExpenseReport extends CommonObject
dol_syslog(get_class($this)."::addline qty=$qty, up=$up, fk_c_type_fees=$fk_c_type_fees, vatrate=$vatrate, date=$date, fk_project=$fk_project, type=$type, comments=$comments", LOG_DEBUG);
if ($this->status == self::STATUS_DRAFT) {
if ($this->status == self::STATUS_DRAFT || $this->status == self::STATUS_REFUSED) {
if (empty($qty)) {
$qty = 0;
}
@ -2037,7 +2037,7 @@ class ExpenseReport extends CommonObject
}
} else {
dol_syslog(get_class($this)."::addline status of expense report must be Draft to allow use of ->addline()", LOG_ERR);
$this->error = 'ErrorExpenseNotDraft';
$this->error = 'ErrorExpenseNotDraftAndNotRefused';
return -3;
}
}

View File

@ -1025,7 +1025,7 @@ class ProductFournisseur extends Product
}
}
if ($fourn_unitprice < $min || $min == -1) {
if ($fourn_unitprice_with_discount < $min || $min == -1) {
$this->id = $prodid;
$this->product_fourn_price_id = $record["product_fourn_price_id"];
$this->ref_supplier = $record["ref_fourn"];
@ -1050,7 +1050,7 @@ class ProductFournisseur extends Product
$this->fourn_multicurrency_id = $record["fk_multicurrency"];
$this->fourn_multicurrency_code = $record["multicurrency_code"];
$min = $fourn_unitprice;
$min = $fourn_unitprice_with_discount;
}
}
}

View File

@ -844,7 +844,7 @@ if (empty($reshook)) {
$object->fk_incoterms = GETPOSTINT('incoterm_id');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx');
$object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx');
$object->transport_mode_id = GETPOSTINT('transport_mode_id');
// Proprietes particulieres a facture de replacement
@ -4063,7 +4063,7 @@ if ($action == 'create') {
}
// Reverse back money or convert to reduction
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT || $object->type == FactureFournisseur::TYPE_STANDARD) {
if ($object->status != FactureFournisseur::STATUS_DRAFT && ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT || $object->type == FactureFournisseur::TYPE_STANDARD)) {
// For credit note only
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $object->status == 1 && $object->paid == 0) {
if ($resteapayer == 0) {

View File

@ -143,7 +143,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
//case 'ORDER_CLASSIFY_UNBILLED': // TODO Replace it with ORDER_UNBILLED
//case 'ORDER_SETDRAFT':
//case 'LINEORDER_INSERT':
//case 'LINEORDER_UPDATE':
//case 'LINEORDER_MODIFY':
//case 'LINEORDER_DELETE':
// Supplier orders
@ -160,7 +160,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
//case 'ORDER_SUPPLIER_RECEIVE':
//case 'LINEORDER_SUPPLIER_DISPATCH':
//case 'LINEORDER_SUPPLIER_CREATE':
//case 'LINEORDER_SUPPLIER_UPDATE':
//case 'LINEORDER_SUPPLIER_MODIFY':
//case 'LINEORDER_SUPPLIER_DELETE':
// Proposals
@ -174,7 +174,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
//case 'PROPAL_CLOSE_REFUSED':
//case 'PROPAL_DELETE':
//case 'LINEPROPAL_INSERT':
//case 'LINEPROPAL_UPDATE':
//case 'LINEPROPAL_MODIFY':
//case 'LINEPROPAL_DELETE':
// SupplierProposal
@ -186,7 +186,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
//case 'SUPPLIER_PROPOSAL_CLOSE_REFUSED':
//case 'SUPPLIER_PROPOSAL_DELETE':
//case 'LINESUPPLIER_PROPOSAL_INSERT':
//case 'LINESUPPLIER_PROPOSAL_UPDATE':
//case 'LINESUPPLIER_PROPOSAL_MODIFY':
//case 'LINESUPPLIER_PROPOSAL_DELETE':
// Contracts
@ -197,7 +197,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
//case 'CONTRACT_CLOSE':
//case 'CONTRACT_DELETE':
//case 'LINECONTRACT_INSERT':
//case 'LINECONTRACT_UPDATE':
//case 'LINECONTRACT_MODIFY':
//case 'LINECONTRACT_DELETE':
// Bills
@ -210,7 +210,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
//case 'BILL_DELETE':
//case 'BILL_PAYED':
//case 'LINEBILL_INSERT':
//case 'LINEBILL_UPDATE':
//case 'LINEBILL_MODIFY':
//case 'LINEBILL_DELETE':
// Recurring Bills
@ -222,14 +222,14 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
//Supplier Bill
//case 'BILL_SUPPLIER_CREATE':
//case 'BILL_SUPPLIER_UPDATE':
//case 'BILL_SUPPLIER_MODIFY':
//case 'BILL_SUPPLIER_DELETE':
//case 'BILL_SUPPLIER_PAYED':
//case 'BILL_SUPPLIER_UNPAYED':
//case 'BILL_SUPPLIER_VALIDATE':
//case 'BILL_SUPPLIER_UNVALIDATE':
//case 'LINEBILL_SUPPLIER_CREATE':
//case 'LINEBILL_SUPPLIER_UPDATE':
//case 'LINEBILL_SUPPLIER_MODIFY':
//case 'LINEBILL_SUPPLIER_DELETE':
// Payments
@ -245,7 +245,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
// Donation
//case 'DON_CREATE':
//case 'DON_UPDATE':
//case 'DON_MODIFY':
//case 'DON_DELETE':
// Interventions
@ -256,7 +256,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
//case 'FICHINTER_CLASSIFY_UNBILLED': // TODO Replace it with FICHINTER_UNBILLED
//case 'FICHINTER_DELETE':
//case 'LINEFICHINTER_CREATE':
//case 'LINEFICHINTER_UPDATE':
//case 'LINEFICHINTER_MODIFY':
//case 'LINEFICHINTER_DELETE':
// Members

View File

@ -1544,7 +1544,7 @@ class Product extends CommonObject
$sql .= ", sell_or_eat_by_mandatory = ".((empty($this->sell_or_eat_by_mandatory) || $this->sell_or_eat_by_mandatory < 0) ? 0 : (int) $this->sell_or_eat_by_mandatory);
$sql .= ", batch_mask = '".$this->db->escape($this->batch_mask)."'";
$sql .= ", finished = ".((!isset($this->finished) || $this->finished < 0 || $this->finished == '') ? "null" : (int) $this->finished);
$sql .= ", finished = ".((!isset($this->finished) || $this->finished < 0 || $this->finished === '') ? "null" : (int) $this->finished);
$sql .= ", fk_default_bom = ".((!isset($this->fk_default_bom) || $this->fk_default_bom < 0 || $this->fk_default_bom == '') ? "null" : (int) $this->fk_default_bom);
$sql .= ", net_measure = ".($this->net_measure != '' ? "'".$this->db->escape($this->net_measure)."'" : 'null');
$sql .= ", net_measure_units = ".($this->net_measure_units != '' ? "'".$this->db->escape($this->net_measure_units)."'" : 'null');
@ -3078,7 +3078,7 @@ class Product extends CommonObject
// Load multiprices array
if ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && empty($ignore_price_load)) { // prices per segment
$produit_multiprices_limit = getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT');
$produit_multiprices_limit = getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT');
for ($i = 1; $i <= $produit_multiprices_limit; $i++) {
$sql = "SELECT price, price_ttc, price_min, price_min_ttc,";
$sql .= " price_base_type, tva_tx, default_vat_code, tosell, price_by_qty, rowid, recuperableonly";
@ -3195,7 +3195,7 @@ class Product extends CommonObject
return -1;
}
} elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') && empty($ignore_price_load)) { // prices per customer and quantity
$produit_multiprices_limit = getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT');
$produit_multiprices_limit = getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT');
for ($i = 1; $i <= $produit_multiprices_limit; $i++) {
$sql = "SELECT price, price_ttc, price_min, price_min_ttc,";
$sql .= " price_base_type, tva_tx, default_vat_code, tosell, price_by_qty, rowid, recuperableonly";

View File

@ -98,7 +98,6 @@ if (!isModEnabled('ticket')) {
}
/*
* Actions
*/

View File

@ -550,13 +550,13 @@ class ProductCombination
// MultiPrix
if (getDolGlobalString('PRODUIT_MULTIPRICES')) {
$produit_multiprices_limit = getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT');
$produit_multiprices_limit = getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT');
for ($i = 1; $i <= $produit_multiprices_limit; $i++) {
if ($parent->multiprices[$i] != '' || isset($this->combination_price_levels[$i]->variation_price)) {
$new_type = empty($parent->multiprices_base_type[$i]) ? 'HT' : $parent->multiprices_base_type[$i];
$new_min_price = $parent->multiprices_min[$i];
$variation_price = (float) (!isset($this->combination_price_levels[$i]->variation_price) ? $this->variation_price : $this->combination_price_levels[$i]->variation_price);
$variation_price_percentage = (float) (!isset($this->combination_price_levels[$i]->variation_price_percentage) ? $this->variation_price_percentage : $this->combination_price_levels[$i]->variation_price_percentage);
$variation_price_percentage = (bool) (!isset($this->combination_price_levels[$i]->variation_price_percentage) ? $this->variation_price_percentage : $this->combination_price_levels[$i]->variation_price_percentage);
if ($parent->prices_by_qty_list[$i]) {
$new_psq = 1;
@ -867,14 +867,14 @@ class ProductCombination
$newproduct->description .= '<strong>'.$prodattr->label.':</strong> '.$prodattrval->value;
}
$newcomb->variation_price_percentage = $price_var_percent[1];
$newcomb->variation_price_percentage = (bool) $price_var_percent[1];
$newcomb->variation_price = $price_impact[1];
$newcomb->variation_weight = $weight_impact;
$newcomb->variation_ref_ext = $this->db->escape($ref_ext);
// Init price level
if (getDolGlobalString('PRODUIT_MULTIPRICES')) {
$produit_multiprices_limit = getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT');
$produit_multiprices_limit = getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT');
for ($i = 1; $i <= $produit_multiprices_limit; $i++) {
$productCombinationLevel = new ProductCombinationLevel($this->db);
$productCombinationLevel->fk_product_attribute_combination = $newcomb->id;
@ -882,7 +882,7 @@ class ProductCombination
$productCombinationLevel->variation_price = $price_impact[$i];
if (is_array($price_var_percent)) {
$productCombinationLevel->variation_price_percentage = (empty($price_var_percent[$i]) ? false : $price_var_percent[$i]);
$productCombinationLevel->variation_price_percentage = (bool) $price_var_percent[$i] ;
} else {
$productCombinationLevel->variation_price_percentage = $price_var_percent;
}

View File

@ -302,7 +302,8 @@ if (($action == 'add' || $action == 'create') && $usercancreate && empty($massac
if (getDolGlobalString('PRODUIT_MULTIPRICES')) {
$prodcomb->combination_price_levels = array();
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) {
$maxi = getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT');
for ($i = 1; $i <= $maxi; $i++) {
$productCombinationLevel = new ProductCombinationLevel($db);
$productCombinationLevel->fk_product_attribute_combination = $prodcomb->id;
$productCombinationLevel->fk_price_level = $i;
@ -723,14 +724,16 @@ if (!empty($id) || !empty($ref)) {
<tr>
<td><label for="price_impact"><?php echo $langs->trans('PriceImpact') ?></label></td>
<td><input type="text" id="price_impact" name="price_impact" value="<?php echo price($price_impact) ?>">
<input type="checkbox" id="price_impact_percent" name="price_impact_percent" <?php echo $price_impact_percent ? ' checked' : '' ?>> <label for="price_impact_percent"><?php echo $langs->trans('PercentageVariation') ?></label>
<input type="checkbox" id="price_impact_percent" name="price_impact_percent" <?php echo ($price_impact_percent ? ' checked' : '') ?>> <label for="price_impact_percent"><?php echo $langs->trans('PercentageVariation') ?></label>
</td>
</tr>
<?php
} else {
$prodcomb->fetchCombinationPriceLevels();
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) {
$maxi = getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT');
for ($i = 1; $i <= $maxi; $i++) {
$keyforlabel = 'PRODUIT_MULTIPRICES_LABEL'.$i;
$text = $langs->trans('ImpactOnPriceLevel', $i).' - '.getDolGlobalString($keyforlabel);
print '<tr>';
@ -740,7 +743,7 @@ if (!empty($id) || !empty($ref)) {
}
print '</td>';
print '<td><input type="text" class="level_price_impact" id="level_price_impact_'.$i.'" name="level_price_impact['.$i.']" value="'.price($prodcomb->combination_price_levels[$i]->variation_price).'">';
print '<input type="checkbox" class="level_price_impact_percent" id="level_price_impact_percent_'.$i.'" name="level_price_impact_percent['.$i.']" '.(!empty($prodcomb->combination_price_levels[$i]->variation_price_percentage) ? ' checked' : '').'> <label for="level_price_impact_percent_'.$i.'">'.$langs->trans('PercentageVariation').'</label>';
print '<input type="checkbox" class="level_price_impact_percent" id="level_price_impact_percent_'.$i.'" name="level_price_impact_percent['.$i.']" '.($prodcomb->combination_price_levels[$i]->variation_price_percentage ? ' checked' : '').'> <label for="level_price_impact_percent_'.$i.'">'.$langs->trans('PercentageVariation').'</label>';
print '</td>';
print '</tr>';
@ -767,7 +770,7 @@ if (!empty($id) || !empty($ref)) {
let priceImpact = $( "#level_price_impact_1" ).val();
let priceImpactPrecent = $( "#level_price_impact_percent_1" ).prop("checked");
var multipricelimit = <?php print intval($conf->global->PRODUIT_MULTIPRICES_LIMIT); ?>
let multipricelimit = <?php print getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT'); ?>
for (let i = 2; i <= multipricelimit; i++) {
$( "#level_price_impact_" + i ).val(priceImpact);