From 86ce4315be47810bb50e2167ef002abd49c56e62 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Mon, 7 Sep 2020 15:19:58 +0200 Subject: [PATCH 01/29] FIX load default linked options for linked sellist extra fields --- htdocs/core/class/commonobject.class.php | 1 + htdocs/core/tpl/extrafields_view.tpl.php | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 103d704a546..ba99831c5b1 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6571,6 +6571,7 @@ abstract class CommonObject $("select[name=\""+parent_list+"\"]").change(function() { showOptions(child_list, parent_list); }); + showOptions(child_list, parent_list); }); } diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index a34308432e4..2618b1e12b4 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -199,6 +199,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] $("select[name=\""+parent_list+"\"]").change(function() { showOptions(child_list, parent_list); }); + showOptions(child_list, parent_list); }); } setListDependencies(); From f2fafe04b67958cf095fb76fc129630beabd1656 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 17 Oct 2020 18:16:03 +0200 Subject: [PATCH 02/29] Update doc --- htdocs/core/class/commonobject.class.php | 4 +++- htdocs/core/tpl/extrafields_view.tpl.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ba99831c5b1..afb6909c340 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6568,10 +6568,12 @@ abstract class CommonObject var parent = $(this).find("option[parent]:first").attr("parent"); var infos = parent.split(":"); var parent_list = infos[0]; + showOptions(child_list, parent_list); + + /* Activate the handler to call showOptions on each future change */ $("select[name=\""+parent_list+"\"]").change(function() { showOptions(child_list, parent_list); }); - showOptions(child_list, parent_list); }); } diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 2618b1e12b4..7ee3e624e58 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -196,10 +196,12 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] var parent = $(this).find("option[parent]:first").attr("parent"); var infos = parent.split(":"); var parent_list = infos[0]; + showOptions(child_list, parent_list); + + /* Activate the handler to call showOptions on each future change */ $("select[name=\""+parent_list+"\"]").change(function() { showOptions(child_list, parent_list); }); - showOptions(child_list, parent_list); }); } setListDependencies(); From a2d242356a600b8e1557e8c04def6868053c0971 Mon Sep 17 00:00:00 2001 From: jcp Date: Tue, 20 Oct 2020 10:17:42 +0200 Subject: [PATCH 03/29] Fix BankTransfer (V12.0.2) --- htdocs/compta/prelevement/card.php | 6 ++-- .../class/bonprelevement.class.php | 7 +++-- .../class/rejetprelevement.class.php | 28 ++++++++++++++----- htdocs/compta/prelevement/index.php | 0 htdocs/compta/prelevement/line.php | 13 +++++---- 5 files changed, 35 insertions(+), 19 deletions(-) mode change 100644 => 100755 htdocs/compta/prelevement/card.php mode change 100644 => 100755 htdocs/compta/prelevement/class/bonprelevement.class.php mode change 100644 => 100755 htdocs/compta/prelevement/class/rejetprelevement.class.php mode change 100644 => 100755 htdocs/compta/prelevement/index.php mode change 100644 => 100755 htdocs/compta/prelevement/line.php diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php old mode 100644 new mode 100755 index 00bcd088e27..7fce5fb306e --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -225,7 +225,7 @@ if ($id > 0 || $ref) print ''; $acc = new Account($db); - $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT); + $result = $acc->fetch(($object->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT));//v20 print ''; @@ -430,7 +430,7 @@ if ($id > 0 || $ref) if ($user->rights->prelevement->bons->credit) { //print ''.$langs->trans("StandingOrderReject").''; - print ''.$langs->trans("StandingOrderReject").''; + print ''.$langs->trans("StandingOrderReject").''; } else { diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php old mode 100644 new mode 100755 index b1e7e29a698..b125b9075d4 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -469,7 +469,7 @@ class BonPrelevement extends CommonObject $message = $langs->trans("InfoCreditMessage", $this->ref, dol_print_date($date, 'dayhour')); //Add payment of withdrawal into bank - $bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT; + $bankaccount = ($this->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT); //V20 $facs = array(); $amounts = array(); $amountsperthirdparty = array(); @@ -1766,7 +1766,7 @@ class BonPrelevement extends CommonObject fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); - fputs($this->file, ' '.$conf->global->PRELEVEMENT_ICS.''.$CrLf); + fputs($this->file, ' '.$conf->global->PAYMENTBYBANKTRANSFER_ICS.''.$CrLf);//v20 fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); @@ -2185,7 +2185,8 @@ class BonPrelevement extends CommonObject $dateTime_YMDHMS = dol_print_date($ladate, '%Y-%m-%dT%H:%M:%S'); // Get data of bank account - $id = $configuration->global->PRELEVEMENT_ID_BANKACCOUNT; + //$id = $configuration->global->PRELEVEMENT_ID_BANKACCOUNT; + $id=($type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT); //V20 $account = new Account($this->db); if ($account->fetch($id) > 0) { diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php old mode 100644 new mode 100755 index 8c033353637..aae73718d79 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -39,6 +39,8 @@ class RejetPrelevement * @var DoliDB Database handler. */ public $db; + + public $type; //prelevement or bank transfer. v20 /** @@ -47,12 +49,13 @@ class RejetPrelevement * @param DoliDb $db Database handler * @param User $user Objet user */ - public function __construct($db, $user) + public function __construct($db, $user, $type) { global $langs; $this->db = $db; $this->user = $user; + $this->type = $type;//v20 $this->motifs = array(); $this->facturer = array(); @@ -92,7 +95,7 @@ class RejetPrelevement $now = dol_now(); dol_syslog("RejetPrelevement::Create id $id"); - $bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT; + $bankaccount = ($this->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT); //V20 $facs = $this->getListInvoices(1); $this->db->begin(); @@ -137,11 +140,19 @@ class RejetPrelevement $num = count($facs); for ($i = 0; $i < $num; $i++) { - $fac = new Facture($this->db); + if($this->type == 'bank-transfer'){ + $fac = new FactureFournisseur($this->db); //v20 + $pai = new PaiementFourn($this->db); + } + else{ + $fac = new Facture($this->db); + $pai = new Paiement($this->db); + } + $fac->fetch($facs[$i][0]); // Make a negative payment - $pai = new Paiement($this->db); + //$pai = new Paiement($this->db); $pai->amounts = array(); @@ -150,7 +161,7 @@ class RejetPrelevement * PHP installs sends only the part integer negative */ - $pai->amounts[$facs[$i][0]] = price2num($facs[$i][1] * -1); + $pai->amounts[$facs[$i][0]] = price2num($facs[$i][1] * ($this->type == 'bank-transfer' ? 1: -1));//v20 $pai->datepaye = $date_rejet; $pai->paiementid = 3; // type of payment: withdrawal $pai->num_paiement = $fac->ref; @@ -216,7 +227,7 @@ class RejetPrelevement $sql = "SELECT fk_user_demande"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " WHERE pfd.fk_prelevement_bons = ".$this->bon_id; - $sql .= " AND pfd.fk_facture = ".$fac->id; + $sql .= " AND pfd.fk_facture".($this->type == 'bank-transfer' ? '_fourn=': '=').$fac->id;//v20 $resql = $this->db->query($sql); if ($resql) @@ -293,7 +304,10 @@ class RejetPrelevement //Returns all invoices of a withdrawal $sql = "SELECT f.rowid as facid, pl.amount"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture as pf"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON (pf.fk_facture = f.rowid)"; + //$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON (pf.fk_facture = f.rowid)";//v20 + if($this->type == 'bank-transfer') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON (pf.fk_facture_fourn = f.rowid)"; + else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON (pf.fk_facture = f.rowid)"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_lignes as pl ON (pf.fk_prelevement_lignes = pl.rowid)"; $sql .= " WHERE pf.fk_prelevement_lignes = ".$this->id; $sql .= " AND f.entity IN (".getEntity('invoice').")"; diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php old mode 100644 new mode 100755 diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php old mode 100644 new mode 100755 index d6124113321..cbe51e89891 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -97,11 +97,11 @@ if ($action == 'confirm_rejet') if ($lipre->fetch($id) == 0) { - $rej = new RejetPrelevement($db, $user); + $rej = new RejetPrelevement($db, $user,$type); $rej->create($user, $id, GETPOST('motif', 'alpha'), $daterej, $lipre->bon_rowid, GETPOST('facturer', 'int')); - header("Location: line.php?id=".$id); + header("Location: line.php?id=".$id.'&type='.$type);//v20 exit; } } @@ -112,7 +112,7 @@ if ($action == 'confirm_rejet') } else { - header("Location: line.php?id=".$id); + header("Location: line.php?id=".$id.'&type='.$type);//v20 exit; } } @@ -134,7 +134,7 @@ llxHeader('', $title); $head = array(); $h = 0; -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$id; +$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$id.'&type='.$type;//v20 $head[$h][1] = $title; $hselected = $h; $h++; @@ -203,11 +203,12 @@ if ($id) $soc = new Societe($db); $soc->fetch($lipre->socid); - $rej = new RejetPrelevement($db, $user); + $rej = new RejetPrelevement($db, $user,$type);//V20 print ''; print ''; print ''; + print ''; //v20 print '
'; $labelofbankfield = "BankToReceiveWithdraw"; @@ -404,7 +404,7 @@ if ($id > 0 || $ref) print ""; print $ligne->LibStatut($obj->statut, 2); print " "; - print ''; + print '';//v20 print sprintf("%06s", $obj->rowid); print '
'; print ''; @@ -258,7 +259,7 @@ if ($id) if ($lipre->statut == 2) { if ($user->rights->prelevement->bons->credit) { - print ''.$langs->trans("StandingOrderReject").''; + print ''.$langs->trans("StandingOrderReject").'';//v20 } else { From b09a618f38286aa72b5e140d7fc45d70ed5790d6 Mon Sep 17 00:00:00 2001 From: jcp Date: Tue, 20 Oct 2020 12:15:06 +0200 Subject: [PATCH 04/29] Fix Bank Transfer --- htdocs/compta/prelevement/card.php | 4 ++-- .../prelevement/class/bonprelevement.class.php | 6 +++--- .../prelevement/class/rejetprelevement.class.php | 14 +++++++------- htdocs/compta/prelevement/line.php | 12 ++++++------ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 7fce5fb306e..959fc7f161d 100755 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -225,7 +225,7 @@ if ($id > 0 || $ref) print '
'; $acc = new Account($db); - $result = $acc->fetch(($object->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT));//v20 + $result = $acc->fetch(($object->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT)); print ''; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index b125b9075d4..16d8e89bf6b 100755 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -469,7 +469,7 @@ class BonPrelevement extends CommonObject $message = $langs->trans("InfoCreditMessage", $this->ref, dol_print_date($date, 'dayhour')); //Add payment of withdrawal into bank - $bankaccount = ($this->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT); //V20 + $bankaccount = ($this->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT); $facs = array(); $amounts = array(); $amountsperthirdparty = array(); @@ -1766,7 +1766,7 @@ class BonPrelevement extends CommonObject fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); - fputs($this->file, ' '.$conf->global->PAYMENTBYBANKTRANSFER_ICS.''.$CrLf);//v20 + fputs($this->file, ' '.$conf->global->PAYMENTBYBANKTRANSFER_ICS.''.$CrLf); fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); @@ -2186,7 +2186,7 @@ class BonPrelevement extends CommonObject // Get data of bank account //$id = $configuration->global->PRELEVEMENT_ID_BANKACCOUNT; - $id=($type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT); //V20 + $id=($type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT); $account = new Account($this->db); if ($account->fetch($id) > 0) { diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index aae73718d79..00e43b4793c 100755 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -40,7 +40,7 @@ class RejetPrelevement */ public $db; - public $type; //prelevement or bank transfer. v20 + public $type; //prelevement or bank transfer /** @@ -55,7 +55,7 @@ class RejetPrelevement $this->db = $db; $this->user = $user; - $this->type = $type;//v20 + $this->type = $type; $this->motifs = array(); $this->facturer = array(); @@ -95,7 +95,7 @@ class RejetPrelevement $now = dol_now(); dol_syslog("RejetPrelevement::Create id $id"); - $bankaccount = ($this->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT); //V20 + $bankaccount = ($this->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT); $facs = $this->getListInvoices(1); $this->db->begin(); @@ -141,7 +141,7 @@ class RejetPrelevement for ($i = 0; $i < $num; $i++) { if($this->type == 'bank-transfer'){ - $fac = new FactureFournisseur($this->db); //v20 + $fac = new FactureFournisseur($this->db); $pai = new PaiementFourn($this->db); } else{ @@ -161,7 +161,7 @@ class RejetPrelevement * PHP installs sends only the part integer negative */ - $pai->amounts[$facs[$i][0]] = price2num($facs[$i][1] * ($this->type == 'bank-transfer' ? 1: -1));//v20 + $pai->amounts[$facs[$i][0]] = price2num($facs[$i][1] * ($this->type == 'bank-transfer' ? 1: -1)); $pai->datepaye = $date_rejet; $pai->paiementid = 3; // type of payment: withdrawal $pai->num_paiement = $fac->ref; @@ -227,7 +227,7 @@ class RejetPrelevement $sql = "SELECT fk_user_demande"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " WHERE pfd.fk_prelevement_bons = ".$this->bon_id; - $sql .= " AND pfd.fk_facture".($this->type == 'bank-transfer' ? '_fourn=': '=').$fac->id;//v20 + $sql .= " AND pfd.fk_facture".($this->type == 'bank-transfer' ? '_fourn=': '=').$fac->id; $resql = $this->db->query($sql); if ($resql) @@ -304,7 +304,7 @@ class RejetPrelevement //Returns all invoices of a withdrawal $sql = "SELECT f.rowid as facid, pl.amount"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture as pf"; - //$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON (pf.fk_facture = f.rowid)";//v20 + //$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON (pf.fk_facture = f.rowid)"; if($this->type == 'bank-transfer') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON (pf.fk_facture_fourn = f.rowid)"; else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON (pf.fk_facture = f.rowid)"; diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index cbe51e89891..abffc07880b 100755 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -101,7 +101,7 @@ if ($action == 'confirm_rejet') $rej->create($user, $id, GETPOST('motif', 'alpha'), $daterej, $lipre->bon_rowid, GETPOST('facturer', 'int')); - header("Location: line.php?id=".$id.'&type='.$type);//v20 + header("Location: line.php?id=".$id.'&type='.$type); exit; } } @@ -112,7 +112,7 @@ if ($action == 'confirm_rejet') } else { - header("Location: line.php?id=".$id.'&type='.$type);//v20 + header("Location: line.php?id=".$id.'&type='.$type); exit; } } @@ -134,7 +134,7 @@ llxHeader('', $title); $head = array(); $h = 0; -$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$id.'&type='.$type;//v20 +$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$id.'&type='.$type; $head[$h][1] = $title; $hselected = $h; $h++; @@ -203,12 +203,12 @@ if ($id) $soc = new Societe($db); $soc->fetch($lipre->socid); - $rej = new RejetPrelevement($db, $user,$type);//V20 + $rej = new RejetPrelevement($db, $user,$type); print ''; print ''; print ''; - print ''; //v20 + print ''; print '
'; $labelofbankfield = "BankToReceiveWithdraw"; @@ -404,7 +404,7 @@ if ($id > 0 || $ref) print ""; print $ligne->LibStatut($obj->statut, 2); print " "; - print '';//v20 + print ''; print sprintf("%06s", $obj->rowid); print '
'; print ''; @@ -259,7 +259,7 @@ if ($id) if ($lipre->statut == 2) { if ($user->rights->prelevement->bons->credit) { - print ''.$langs->trans("StandingOrderReject").'';//v20 + print ''.$langs->trans("StandingOrderReject").''; } else { From 529dfb8dfb0a1ca65a656e10db5d9aae29e57659 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Tue, 20 Oct 2020 16:37:15 +0200 Subject: [PATCH 05/29] FIX 9.0 - supplier proposals as linked objects of events are not correctly fetched --- htdocs/core/lib/functions2.lib.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 37bc6c1cd5e..739370298c0 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1872,6 +1872,12 @@ function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='') $classpath = 'fourn/class'; $module='fournisseur'; } + elseif ($objecttype == 'supplier_proposal') { + $classfile = 'supplier_proposal'; + $classname = 'SupplierProposal'; + $classpath = 'supplier_proposal/class'; + $module = 'supplier_proposal'; + } elseif ($objecttype == 'stock') { $classpath = 'product/stock/class'; $classfile='entrepot'; From d4fd71d0b3cc1c2367fd750d6f468126db9fec9f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 20 Oct 2020 19:58:11 +0200 Subject: [PATCH 06/29] fix #14649 --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5fa301123d3..45b8d4bf0c1 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7186,7 +7186,7 @@ abstract class CommonObject // HTML, select, integer and text add default value if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'select', 'int'))) { - if ($action == 'create') $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) ? GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none', 3) : $extrafields->attributes[$this->table_element]['default'][$key]; + if ($action == 'create') $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) ? GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none', 3) : ($this->array_options['options_'.$key] ? $this->array_options['options_'.$key] : $extrafields->attributes[$this->table_element]['default'][$key]); else $value = $this->array_options['options_'.$key]; } From 13dfa56c2f4392653afa70be91b807b0b757410b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 21 Oct 2020 13:18:11 +0200 Subject: [PATCH 07/29] fix recipt when no dispatch --- htdocs/fourn/class/fournisseur.commande.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index ab489d02578..6ab78aca9bb 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2298,8 +2298,7 @@ class CommandeFournisseur extends CommonOrder // TODO LDR01 Add a control test to accept only if ALL predefined products are received (same qty). - - if (!$error) + if (empty($error)) { $this->db->begin(); @@ -2312,7 +2311,7 @@ class CommandeFournisseur extends CommonOrder $resql = $this->db->query($sql); if ($resql) { - $result = 0; + $result = 0; $old_statut = $this->statut; $this->statut = $statut; $this->actionmsg2 = $comment; @@ -2320,9 +2319,10 @@ class CommandeFournisseur extends CommonOrder // Call trigger $result = $this->call_trigger('ORDER_SUPPLIER_RECEIVE', $user); if ($result < 0) $error++; + else $result = 1; // End call triggers - if (!$error) + if (empty($error)) { $this->db->commit(); } From a5e195d1c7efd080eeb418ad00bab5944ac84120 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 21 Oct 2020 13:20:17 +0200 Subject: [PATCH 08/29] better rix --- htdocs/fourn/class/fournisseur.commande.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 6ab78aca9bb..fb14b96ac9c 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2311,15 +2311,14 @@ class CommandeFournisseur extends CommonOrder $resql = $this->db->query($sql); if ($resql) { - $result = 0; + $result = 1; $old_statut = $this->statut; $this->statut = $statut; $this->actionmsg2 = $comment; // Call trigger - $result = $this->call_trigger('ORDER_SUPPLIER_RECEIVE', $user); + $result += $this->call_trigger('ORDER_SUPPLIER_RECEIVE', $user); if ($result < 0) $error++; - else $result = 1; // End call triggers if (empty($error)) From b0641e6d69d8e83528f7ec32c32ccf394ce4aab4 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 21 Oct 2020 13:22:32 +0200 Subject: [PATCH 09/29] better rix --- htdocs/fourn/class/fournisseur.commande.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index fb14b96ac9c..2b90af268c5 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2317,8 +2317,9 @@ class CommandeFournisseur extends CommonOrder $this->actionmsg2 = $comment; // Call trigger - $result += $this->call_trigger('ORDER_SUPPLIER_RECEIVE', $user); - if ($result < 0) $error++; + $result_trigger = $this->call_trigger('ORDER_SUPPLIER_RECEIVE', $user); + if ($result_trigger < 0) $error++; + else $result += (int) $result_trigger; // End call triggers if (empty($error)) From e23a289553a729261928064a966707afd3322947 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 21 Oct 2020 13:26:28 +0200 Subject: [PATCH 10/29] fix form token missing --- htdocs/margin/checkMargins.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/margin/checkMargins.php b/htdocs/margin/checkMargins.php index 337791238ce..d11b270551f 100644 --- a/htdocs/margin/checkMargins.php +++ b/htdocs/margin/checkMargins.php @@ -158,6 +158,7 @@ $head = marges_prepare_head($user); $picto = 'margin'; print ''; +print ''; dol_fiche_head($head, $langs->trans('checkMargins'), $title, 0, $picto); From d9074e70e1fa6387f23b6f619b90931cbefd7b71 Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 21 Oct 2020 13:27:37 +0200 Subject: [PATCH 11/29] FIX admin conf selected --- htdocs/admin/facture_situation.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/htdocs/admin/facture_situation.php b/htdocs/admin/facture_situation.php index 223045db2e9..5aeb09bb789 100644 --- a/htdocs/admin/facture_situation.php +++ b/htdocs/admin/facture_situation.php @@ -104,12 +104,7 @@ $arrayAvailableType = array( Facture::TYPE_SITUATION => $langs->trans("InvoiceSituation"), Facture::TYPE_STANDARD.'+'.Facture::TYPE_SITUATION => $langs->trans("InvoiceSituation").' + '.$langs->trans("InvoiceStandard"), ); -$selected = array(); -$implodeglue = '+'; -if (!empty($conf->global->{$confkey}) && !is_array($conf->global->{$confkey})) { - $selected = explode('+', $conf->global->{$confkey}); -} - +$selected = $conf->global->{$confkey}; $curentInput = (empty($inputCount) ? 1 : ($inputCount + 1)); $formSelectInvoiceType = $form->selectarray('value'.$curentInput, $arrayAvailableType, $selected, 1); _printInputFormPart($confkey, $langs->trans('AllowedInvoiceForRetainedWarranty'), '', array(), $formSelectInvoiceType); From c9e62845e8e7700e3c6c52589b771fac023b2ed2 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 21 Oct 2020 13:41:17 +0200 Subject: [PATCH 12/29] fix is no PDF default model for expense report, no PDF created --- htdocs/expensereport/class/expensereport.class.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 7bc2ba9fab2..730cb01c82b 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2264,7 +2264,6 @@ class ExpenseReport extends CommonObject $langs->load("trips"); if (!dol_strlen($modele)) { - $modele = 'standard'; if ($this->modelpdf) { $modele = $this->modelpdf; @@ -2272,10 +2271,14 @@ class ExpenseReport extends CommonObject $modele = $conf->global->EXPENSEREPORT_ADDON_PDF; } } + if (!empty($modele)) { + $modelpath = "core/modules/expensereport/doc/"; - $modelpath = "core/modules/expensereport/doc/"; + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + } else { + return 0; + } - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } /** From 70790009a95b91a93bb6a1203de42df9d4151880 Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 21 Oct 2020 14:49:51 +0200 Subject: [PATCH 13/29] Fix display warranty fields on page load --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 2038fea438c..59cfb5b601a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3497,7 +3497,7 @@ if ($action == 'create') } }); - $("[name=\'type\']").trigger("change"); + $("[name=\'type\']:checked").trigger("change"); }); '; } From 7605cb18718086ea270000fa5724692f2e554ff9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Oct 2020 19:54:28 +0200 Subject: [PATCH 14/29] Update facture_situation.php --- htdocs/admin/facture_situation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/facture_situation.php b/htdocs/admin/facture_situation.php index 5aeb09bb789..e3d2bf278a9 100644 --- a/htdocs/admin/facture_situation.php +++ b/htdocs/admin/facture_situation.php @@ -104,7 +104,7 @@ $arrayAvailableType = array( Facture::TYPE_SITUATION => $langs->trans("InvoiceSituation"), Facture::TYPE_STANDARD.'+'.Facture::TYPE_SITUATION => $langs->trans("InvoiceSituation").' + '.$langs->trans("InvoiceStandard"), ); -$selected = $conf->global->{$confkey}; +$selected = $conf->global->$confkey; $curentInput = (empty($inputCount) ? 1 : ($inputCount + 1)); $formSelectInvoiceType = $form->selectarray('value'.$curentInput, $arrayAvailableType, $selected, 1); _printInputFormPart($confkey, $langs->trans('AllowedInvoiceForRetainedWarranty'), '', array(), $formSelectInvoiceType); From 0a9293c9c6f0a06a9a46febce87e540394ea8bd3 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 21 Oct 2020 20:40:53 +0200 Subject: [PATCH 15/29] fix token CSRF check for getSupplierPrice ajax call --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- htdocs/core/tpl/objectline_edit.tpl.php | 2 +- htdocs/fourn/ajax/getSupplierPrices.php | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 0f6e056dce5..a173d9ec5b9 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -667,7 +667,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) $("#buying_price").val("").show(); /* Call post to load content of combo list fournprice_predef */ - $.post('/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val() }, function(data) { + $.post('/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val(), 'token': '' }, function(data) { if (data && data.length > 0) { var options = ''; var defaultkey = ''; var defaultprice = ''; var bestpricefound = 0; diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index fb9e8bbd208..85ab1291a4d 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -430,7 +430,7 @@ jQuery(document).ready(function() }); /* Init field buying_price and fournprice */ - $.post('/fourn/ajax/getSupplierPrices.php', {'idprod': fk_product ? $line->fk_product : 0; ?>}, function(data) { + $.post('/fourn/ajax/getSupplierPrices.php', {'idprod': fk_product ? $line->fk_product : 0; ?>, 'token': ''}, function(data) { if (data && data.length > 0) { var options = ''; var trouve=false; diff --git a/htdocs/fourn/ajax/getSupplierPrices.php b/htdocs/fourn/ajax/getSupplierPrices.php index 0c0d8f42c9e..68f1cbbe0d8 100644 --- a/htdocs/fourn/ajax/getSupplierPrices.php +++ b/htdocs/fourn/ajax/getSupplierPrices.php @@ -26,6 +26,7 @@ if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); +//if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; @@ -48,6 +49,7 @@ top_httphead(); if ($idprod > 0) { + $producttmp = new ProductFournisseur($db); $producttmp->fetch($idprod); From 93a97492ae819e84913e883a33b45af2903aadf6 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 21 Oct 2020 20:41:50 +0200 Subject: [PATCH 16/29] review --- htdocs/fourn/ajax/getSupplierPrices.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/fourn/ajax/getSupplierPrices.php b/htdocs/fourn/ajax/getSupplierPrices.php index 68f1cbbe0d8..0c0d8f42c9e 100644 --- a/htdocs/fourn/ajax/getSupplierPrices.php +++ b/htdocs/fourn/ajax/getSupplierPrices.php @@ -26,7 +26,6 @@ if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); -//if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; @@ -49,7 +48,6 @@ top_httphead(); if ($idprod > 0) { - $producttmp = new ProductFournisseur($db); $producttmp->fetch($idprod); From 509819c1191293c0fbc88097d6825ac3cbbaf72a Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Wed, 21 Oct 2020 23:19:29 +0200 Subject: [PATCH 17/29] FIX 12.0 - third party of object is not always fetched when initiating the e-mail presend action (e.g. from an order) --- htdocs/core/tpl/card_presend.tpl.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 24fcaa62afa..479b4b694aa 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -180,6 +180,9 @@ if ($action == 'presend') } else { + if (!empty($object->socid) && empty($object->thirdparty)) { + $object->fetch_thirdparty(); + } if (is_object($object->thirdparty)) { foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) { From 56db7d6c647f5c0b4708977ab3592c1e4d791b66 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Thu, 22 Oct 2020 15:09:48 +0200 Subject: [PATCH 18/29] FIX: also check if there is a method $object->fetch_thirdparty() before calling it --- htdocs/core/tpl/card_presend.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 479b4b694aa..d9097ee0919 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -180,7 +180,7 @@ if ($action == 'presend') } else { - if (!empty($object->socid) && empty($object->thirdparty)) { + if (!empty($object->socid) && empty($object->thirdparty) && method_exists($object, 'fetch_thirdparty')) { $object->fetch_thirdparty(); } if (is_object($object->thirdparty)) From 46a31f443d7cd952740874192dc9ae5f84eab492 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Oct 2020 15:11:01 +0200 Subject: [PATCH 19/29] Update objectline_create.tpl.php --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index a173d9ec5b9..8da4d30af02 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -667,7 +667,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) $("#buying_price").val("").show(); /* Call post to load content of combo list fournprice_predef */ - $.post('/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val(), 'token': '' }, function(data) { + $.post('/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val(), 'token': '' }, function(data) { if (data && data.length > 0) { var options = ''; var defaultkey = ''; var defaultprice = ''; var bestpricefound = 0; From d521ad6db4fe4bd18d876de2e74dc58a2555ac28 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Oct 2020 15:11:54 +0200 Subject: [PATCH 20/29] Update objectline_edit.tpl.php --- htdocs/core/tpl/objectline_edit.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 85ab1291a4d..b3e360b8e2c 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -430,7 +430,7 @@ jQuery(document).ready(function() }); /* Init field buying_price and fournprice */ - $.post('/fourn/ajax/getSupplierPrices.php', {'idprod': fk_product ? $line->fk_product : 0; ?>, 'token': ''}, function(data) { + $.post('/fourn/ajax/getSupplierPrices.php', {'idprod': fk_product ? $line->fk_product : 0; ?>, 'token': ''}, function(data) { if (data && data.length > 0) { var options = ''; var trouve=false; From a232a19e7d7fe0f97cf2288a58d6d23cfe99b8a8 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 22 Oct 2020 15:16:33 +0200 Subject: [PATCH 21/29] FIX: virtual products: supplier discount was not applied in component list --- htdocs/product/composition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index a3b444db6b7..a22b34d5f6f 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -365,7 +365,7 @@ if ($id > 0 || ! empty($ref)) $total+=$totalline; print ''; // Best selling price From 10a8ce82a9743b28db8275482e38223273820c1d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Oct 2020 15:57:25 +0200 Subject: [PATCH 22/29] Update bonprelevement.class.php --- htdocs/compta/prelevement/class/bonprelevement.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 16d8e89bf6b..483df326566 100755 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -2186,7 +2186,7 @@ class BonPrelevement extends CommonObject // Get data of bank account //$id = $configuration->global->PRELEVEMENT_ID_BANKACCOUNT; - $id=($type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT); + $id = ($type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT); $account = new Account($this->db); if ($account->fetch($id) > 0) { From b9e6b188bcc494a03fb32e933bf43b9e2119873b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Oct 2020 15:58:24 +0200 Subject: [PATCH 23/29] Update rejetprelevement.class.php --- htdocs/compta/prelevement/class/rejetprelevement.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 00e43b4793c..c831d4f3e0f 100755 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -305,7 +305,7 @@ class RejetPrelevement $sql = "SELECT f.rowid as facid, pl.amount"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture as pf"; //$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON (pf.fk_facture = f.rowid)"; - if($this->type == 'bank-transfer') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON (pf.fk_facture_fourn = f.rowid)"; + if ($this->type == 'bank-transfer') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON (pf.fk_facture_fourn = f.rowid)"; else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON (pf.fk_facture = f.rowid)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_lignes as pl ON (pf.fk_prelevement_lignes = pl.rowid)"; From ca93f732c8e74d633b2ae47b58e22ee67cb64cc2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Oct 2020 15:59:04 +0200 Subject: [PATCH 24/29] Update line.php --- htdocs/compta/prelevement/line.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index abffc07880b..78a0723aef2 100755 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -203,7 +203,7 @@ if ($id) $soc = new Societe($db); $soc->fetch($lipre->socid); - $rej = new RejetPrelevement($db, $user,$type); + $rej = new RejetPrelevement($db, $user, $type); print ''; print ''; From c2ad40043f88598f803f4eb07acef1cced49326f Mon Sep 17 00:00:00 2001 From: Got2be Date: Thu, 22 Oct 2020 16:10:47 +0200 Subject: [PATCH 25/29] FIX : WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING must not consider services while STOCK_SUPPORTS_SERVICES is empty --- .../triggers/interface_20_modWorkflow_WorkflowManager.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 3af9319c7fa..ca0c4d1f0fc 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -299,6 +299,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers //Build array of quantity ordered by product if (is_array($order->lines) && count($order->lines)>0) { foreach($order->lines as $orderline) { + if(empty($conf->global->STOCK_SUPPORTS_SERVICES) && $orderline->product_type > 0) continue; $qtyordred[$orderline->fk_product]+=$orderline->qty; } } From a9117fe864ffef5a754890d1d145acbe01276697 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Oct 2020 16:18:00 +0200 Subject: [PATCH 26/29] Update interface_20_modWorkflow_WorkflowManager.class.php --- .../triggers/interface_20_modWorkflow_WorkflowManager.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index ca0c4d1f0fc..bbdbc06fd76 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -299,7 +299,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers //Build array of quantity ordered by product if (is_array($order->lines) && count($order->lines)>0) { foreach($order->lines as $orderline) { - if(empty($conf->global->STOCK_SUPPORTS_SERVICES) && $orderline->product_type > 0) continue; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES) && $orderline->product_type > 0) continue; $qtyordred[$orderline->fk_product]+=$orderline->qty; } } From 34dd486b6cfb947cada1e1318a99736551a5ab9a Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 22 Oct 2020 16:18:37 +0200 Subject: [PATCH 27/29] FIX: virtual products: displayed value is by unit --- htdocs/product/composition/card.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index a22b34d5f6f..0445844c7ce 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -361,11 +361,12 @@ if ($id > 0 || ! empty($ref)) $fourn_remise_percent = (!empty($product_fourn->fourn_remise_percent)?$product_fourn->fourn_remise_percent:0); $fourn_remise = (!empty($product_fourn->fourn_remise)?$product_fourn->fourn_remise:0); - $totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT'); + $unitline = price2num(($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT'); + $totalline = $value['nb'] * $unitline; $total+=$totalline; print ''; // Best selling price From 3369379ba17d80de3adf4922180133378d4143a0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Oct 2020 16:34:23 +0200 Subject: [PATCH 28/29] Update card.php --- htdocs/product/composition/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 0445844c7ce..2183fcb3121 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -361,9 +361,9 @@ if ($id > 0 || ! empty($ref)) $fourn_remise_percent = (!empty($product_fourn->fourn_remise_percent)?$product_fourn->fourn_remise_percent:0); $fourn_remise = (!empty($product_fourn->fourn_remise)?$product_fourn->fourn_remise:0); - $unitline = price2num(($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT'); - $totalline = $value['nb'] * $unitline; - $total+=$totalline; + $unitline = price2num(($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MU'); + $totalline = price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT'); + $total += $totalline; print '"; print '';
'; - print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($fourn_unitprice, '', '', 0, 0, -1, $conf->currency)); + print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($totalline, '', '', 0, 0, -1, $conf->currency)); print ''; - print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($totalline, '', '', 0, 0, -1, $conf->currency)); + print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($unitline, '', '', 0, 0, -1, $conf->currency)); print ''; print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($unitline, '', '', 0, 0, -1, $conf->currency)); From 10a3786bab4c9d113611fbd95f597a028e6ff138 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 22 Oct 2020 16:38:59 +0200 Subject: [PATCH 29/29] fix MAIN_AUTOFILL_DATE for expense payment date --- htdocs/expensereport/payment/payment.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index 872bd5a0792..517da887c21 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -249,8 +249,8 @@ if ($action == 'create' || empty($action)) print '
'.$langs->trans("Date").''; $datepaid = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST("reday", 'int'), GETPOST("reyear", 'int')); - $datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (empty($_POST["remonth"]) ?-1 : $datepaid) : 0; - print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); + $datepayment = ($datepaid == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datepaid); + print $form->selectDate($datepayment, '', '', '', 0, "add_payment", 1, 1); print "