Skip to content

Commit 89f218c

Browse files
committed
Merge remote-tracking branch 'dolibarr/20.0' into 20.0-mc
2 parents d67aa04 + 75590f1 commit 89f218c

21 files changed

+63
-59
lines changed

htdocs/compta/facture/class/facture.class.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2500,13 +2500,12 @@ public function update(User $user, $notrigger = 0)
25002500
if (isset($this->retained_warranty)) {
25012501
$this->retained_warranty = (float) $this->retained_warranty;
25022502
}
2503-
if (!isset($this->fk_user_author) && isset($this->user_author) ) {
2504-
$this->fk_user_author = $this->user_author;
2503+
if (!isset($this->user_creation_id) && isset($this->fk_user_author) ) {
2504+
$this->user_creation_id = $this->fk_user_author;
2505+
}
2506+
if (!isset($this->user_validation_id) && isset($this->fk_user_valid) ) {
2507+
$this->user_validation_id = $this->fk_user_valid;
25052508
}
2506-
2507-
2508-
// Check parameters
2509-
// Put here code to add control on parameters values
25102509

25112510
// Update request
25122511
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET";
@@ -2531,8 +2530,8 @@ public function update(User $user, $notrigger = 0)
25312530
$sql .= " total_ttc=".(isset($this->total_ttc) ? (float) $this->total_ttc : "null").",";
25322531
$sql .= " revenuestamp=".((isset($this->revenuestamp) && $this->revenuestamp != '') ? (float) $this->revenuestamp : "null").",";
25332532
$sql .= " fk_statut=".(isset($this->status) ? (int) $this->status : "null").",";
2534-
$sql .= " fk_user_author=".(isset($this->fk_user_author) ? ((int) $this->fk_user_author) : "null").",";
2535-
$sql .= " fk_user_valid=".(isset($this->fk_user_valid) ? (int) $this->fk_user_valid : "null").",";
2533+
$sql .= " fk_user_author=".(isset($this->user_creation_id) ? ((int) $this->user_creation_id) : "null").",";
2534+
$sql .= " fk_user_valid=".(isset($this->user_validation_id) ? (int) $this->user_validation_id : "null").",";
25362535
$sql .= " fk_facture_source=".(isset($this->fk_facture_source) ? (int) $this->fk_facture_source : "null").",";
25372536
$sql .= " fk_projet=".(isset($this->fk_project) ? (int) $this->fk_project : "null").",";
25382537
$sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? (int) $this->cond_reglement_id : "null").",";
@@ -5069,11 +5068,12 @@ public function initAsSpecimen($option = '')
50695068
//Avoid php warning Warning: mt_rand(): max(0) is smaller than min(1) when no product exists
50705069
if (empty($num_prods)) {
50715070
$num_prods = 1;
5071+
$prodids[$num_prods] = 1;
50725072
}
50735073

50745074
// Initialize parameters
50755075
$this->id = 0;
5076-
$this->entity = 1;
5076+
$this->entity = $conf->entity;
50775077
$this->ref = 'SPECIMEN';
50785078
$this->specimen = 1;
50795079
$this->socid = 1;

htdocs/contrat/services_list.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,10 +395,6 @@
395395
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
396396
$sql .= $hookmanager->resPrint;
397397

398-
$sql .= $db->order($sortfield, $sortorder);
399-
400-
//print $sql;
401-
402398
// Count total nb of records
403399
$nbtotalofrecords = '';
404400
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
@@ -410,7 +406,7 @@
410406
}
411407
}
412408

413-
// Complete request and execute it with limit
409+
// Complete request and execute it with order and limit
414410
$sql .= $db->order($sortfield, $sortorder);
415411
if ($limit) {
416412
$sql .= $db->plimit($limit + 1, $offset);

htdocs/core/modules/modAdherent.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function __construct($db)
182182

183183
$this->const[$r][0] = "MEMBER_ADDON_PDF_ODT_PATH";
184184
$this->const[$r][1] = "chaine";
185-
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/members";
185+
$this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/members";
186186
$this->const[$r][3] = "";
187187
$this->const[$r][4] = 0;
188188
$r++;
@@ -438,8 +438,8 @@ public function init($options = '')
438438

439439
// ODT template
440440
/*
441-
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/orders/template_order.odt';
442-
$dirodt=DOL_DATA_ROOT.'/doctemplates/orders';
441+
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/members/template_member.odt';
442+
$dirodt=DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/members';
443443
$dest=$dirodt.'/template_order.odt';
444444
445445
if (file_exists($src) && ! file_exists($dest)) {

htdocs/core/modules/modBom.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function __construct($db)
127127
$this->const = array(
128128
1 => array('BOM_ADDON_PDF', 'chaine', 'generic_bom_odt', 'Name of PDF model of BOM', 0),
129129
2 => array('BOM_ADDON', 'chaine', 'mod_bom_standard', 'Name of numbering rules of BOM', 0),
130-
3 => array('BOM_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/boms', '', 0)
130+
3 => array('BOM_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT'.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/boms', '', 0)
131131
);
132132

133133
// Some keys to add into the overwriting translation tables
@@ -479,7 +479,7 @@ public function init($options = '')
479479

480480
// ODT template
481481
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/boms/template_bom.odt';
482-
$dirodt = DOL_DATA_ROOT.'/doctemplates/boms';
482+
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/boms';
483483
$dest = $dirodt.'/template_bom.odt';
484484

485485
if (file_exists($src) && !file_exists($dest)) {

htdocs/core/modules/modCommande.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function __construct($db)
9494
$r++;
9595
$this->const[$r][0] = "COMMANDE_ADDON_PDF_ODT_PATH";
9696
$this->const[$r][1] = "chaine";
97-
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/orders";
97+
$this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/orders";
9898
$this->const[$r][3] = "";
9999
$this->const[$r][4] = 0;
100100

@@ -459,7 +459,7 @@ public function init($options = '')
459459

460460
//ODT template
461461
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/orders/template_order.odt';
462-
$dirodt = DOL_DATA_ROOT.'/doctemplates/orders';
462+
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/orders';
463463
$dest = $dirodt.'/template_order.odt';
464464

465465
if (file_exists($src) && !file_exists($dest)) {

htdocs/core/modules/modContrat.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function __construct($db)
8787

8888
$this->const[$r][0] = "CONTRACT_ADDON_PDF_ODT_PATH";
8989
$this->const[$r][1] = "chaine";
90-
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/contracts";
90+
$this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/contracts";
9191
$this->const[$r][3] = "";
9292
$this->const[$r][4] = 0;
9393
$r++;
@@ -230,7 +230,7 @@ public function init($options = '')
230230

231231
//ODT template
232232
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/contracts/template_contract.odt';
233-
$dirodt = DOL_DATA_ROOT.'/doctemplates/contracts';
233+
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/contracts';
234234
$dest = $dirodt.'/template_contract.odt';
235235

236236
if (file_exists($src) && !file_exists($dest)) {

htdocs/core/modules/modExpedition.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function __construct($db)
9999

100100
$this->const[$r][0] = "EXPEDITION_ADDON_PDF_ODT_PATH";
101101
$this->const[$r][1] = "chaine";
102-
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/shipments";
102+
$this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/shipments";
103103
$this->const[$r][3] = "";
104104
$this->const[$r][4] = 0;
105105
$r++;
@@ -120,7 +120,7 @@ public function __construct($db)
120120

121121
$this->const[$r][0] = "DELIVERY_ADDON_PDF_ODT_PATH";
122122
$this->const[$r][1] = "chaine";
123-
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/deliveries";
123+
$this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/deliveries";
124124
$this->const[$r][3] = "";
125125
$this->const[$r][4] = 0;
126126
$r++;
@@ -343,7 +343,7 @@ public function init($options = '')
343343

344344
//ODT template
345345
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/shipments/template_shipment.odt';
346-
$dirodt = DOL_DATA_ROOT.'/doctemplates/shipments';
346+
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/shipments';
347347
$dest = $dirodt.'/template_shipment.odt';
348348

349349
if (file_exists($src) && !file_exists($dest)) {

htdocs/core/modules/modFacture.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function __construct($db)
9595

9696
$this->const[$r][0] = "FACTURE_ADDON_PDF_ODT_PATH";
9797
$this->const[$r][1] = "chaine";
98-
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/invoices";
98+
$this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/invoices";
9999
$this->const[$r][3] = "";
100100
$this->const[$r][4] = 0;
101101
$r++;
@@ -773,7 +773,7 @@ public function init($options = '')
773773

774774
//ODT template
775775
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/invoices/template_invoice.odt';
776-
$dirodt = DOL_DATA_ROOT.'/doctemplates/invoices';
776+
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/invoices';
777777
$dest = $dirodt.'/template_invoice.odt';
778778

779779
if (file_exists($src) && !file_exists($dest)) {

htdocs/core/modules/modFournisseur.class.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ public function __construct($db)
117117
// Add ability ODT for Supplier orders
118118
$this->const[$r][0] = "SUPPLIER_ORDER_ADDON_PDF_ODT_PATH";
119119
$this->const[$r][1] = "chaine";
120-
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/supplier_orders";
120+
$this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/supplier_orders";
121121
$this->const[$r][3] = '';
122122
$this->const[$r][4] = 0;
123123
$r++;
124124

125125
// Add ability ODT for Supplier Invoices
126126
$this->const[$r][0] = "SUPPLIER_INVOICE_ADDON_PDF_ODT_PATH";
127127
$this->const[$r][1] = "chaine";
128-
$this->const[$r][2] = "";
128+
$this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/supplier_invoices";
129129
$this->const[$r][3] = "";
130130
$this->const[$r][4] = 0;
131131
$r++;
@@ -972,7 +972,7 @@ public function init($options = '')
972972

973973
//ODT template for Supplier Orders
974974
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/supplier_orders/template_supplier_order.odt';
975-
$dirodt = DOL_DATA_ROOT.'/doctemplates/supplier_orders';
975+
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/supplier_orders';
976976
$dest = $dirodt.'/template_supplier_order.odt';
977977

978978
if (file_exists($src) && !file_exists($dest)) {
@@ -993,7 +993,7 @@ public function init($options = '')
993993

994994
//ODT template for Supplier Invoice
995995
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/supplier_invoices/template_supplier_invoices.odt';
996-
$dirodt = DOL_DATA_ROOT.'/doctemplates/supplier_invoices';
996+
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/supplier_invoices';
997997
$dest = $dirodt.'/template_supplier_invoices.odt';
998998

999999
if (file_exists($src) && !file_exists($dest)) {

htdocs/core/modules/modHoliday.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function __construct($db)
111111

112112
$this->const[$r][0] = "HOLIDAY_ADDON_PDF_ODT_PATH";
113113
$this->const[$r][1] = "chaine";
114-
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/holiday";
114+
$this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/holiday";
115115
$this->const[$r][3] = "";
116116
$this->const[$r][4] = 0;
117117
$r++;
@@ -308,7 +308,7 @@ public function init($options = '')
308308

309309
//ODT template
310310
/*$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/holiday/template_holiday.odt';
311-
$dirodt=DOL_DATA_ROOT.'/doctemplates/holiday';
311+
$dirodt=DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/holiday';
312312
$dest=$dirodt.'/template_order.odt';
313313
314314
if (file_exists($src) && ! file_exists($dest))

0 commit comments

Comments
 (0)