|
@@ -218,7 +218,7 @@ discard block |
|
|
block discarded – undo |
|
218
|
218
|
throw new RestException(500, 'Error generating document'); |
|
219
|
219
|
} |
|
220
|
220
|
} elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') { |
|
221
|
|
- require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; |
|
|
221
|
+ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; |
|
222
|
222
|
$tmpobject = new FactureFournisseur($this->db); |
|
223
|
223
|
$result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); |
|
224
|
224
|
if (!$result) { |
|
@@ -255,7 +255,7 @@ discard block |
|
|
block discarded – undo |
|
255
|
255
|
throw new RestException(500, 'Error generating document'); |
|
256
|
256
|
} |
|
257
|
257
|
} elseif ($modulepart == 'contrat' || $modulepart == 'contract') { |
|
258
|
|
- require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
|
258
|
+ require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
259
|
259
|
|
|
260
|
260
|
$tmpobject = new Contrat($this->db); |
|
261
|
261
|
$result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); |
|
@@ -271,7 +271,7 @@ discard block |
|
|
block discarded – undo |
|
271
|
271
|
throw new RestException(500, 'Error generating document'); |
|
272
|
272
|
} |
|
273
|
273
|
} elseif ($modulepart == 'expedition' || $modulepart == 'shipment') { |
|
274
|
|
- require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; |
|
|
274
|
+ require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; |
|
275
|
275
|
|
|
276
|
276
|
$tmpobject = new Expedition($this->db); |
|
277
|
277
|
$result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); |
|
@@ -287,7 +287,7 @@ discard block |
|
|
block discarded – undo |
|
287
|
287
|
throw new RestException(500, 'Error generating document'); |
|
288
|
288
|
} |
|
289
|
289
|
} elseif ($modulepart == 'mrp') { |
|
290
|
|
- require_once DOL_DOCUMENT_ROOT . '/mrp/class/mo.class.php'; |
|
|
290
|
+ require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; |
|
291
|
291
|
|
|
292
|
292
|
$tmpobject = new Mo($this->db); |
|
293
|
293
|
$result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); |
|
@@ -319,7 +319,7 @@ discard block |
|
|
block discarded – undo |
|
319
|
319
|
throw new RestException(500, 'Error generating document'); |
|
320
|
320
|
} |
|
321
|
321
|
} elseif ($modulepart == 'product') { |
|
322
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
|
322
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
323
|
323
|
|
|
324
|
324
|
$tmpobject = new Product($this->db); |
|
325
|
325
|
$result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); |
|
@@ -335,7 +335,7 @@ discard block |
|
|
block discarded – undo |
|
335
|
335
|
throw new RestException(500, 'Error generating document'); |
|
336
|
336
|
} |
|
337
|
337
|
} elseif ($modulepart == 'stock' || $modulepart == 'entrepot') { |
|
338
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; |
|
|
338
|
+ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
|
339
|
339
|
|
|
340
|
340
|
$tmpobject = new Entrepot($this->db); |
|
341
|
341
|
$result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); |
|
@@ -351,7 +351,7 @@ discard block |
|
|
block discarded – undo |
|
351
|
351
|
throw new RestException(500, 'Error generating document'); |
|
352
|
352
|
} |
|
353
|
353
|
} elseif ($modulepart == 'fichinter' || $modulepart == 'intervention') { |
|
354
|
|
- require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php'; |
|
|
354
|
+ require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; |
|
355
|
355
|
|
|
356
|
356
|
$tmpobject = new Fichinter($this->db); |
|
357
|
357
|
$result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); |
|
@@ -455,7 +455,7 @@ discard block |
|
|
block discarded – undo |
|
455
|
455
|
throw new RestException(404, 'User not found'); |
|
456
|
456
|
} |
|
457
|
457
|
|
|
458
|
|
- $upload_dir = getMultidirOutput($object) . '/'.get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id; |
|
|
458
|
+ $upload_dir = getMultidirOutput($object).'/'.get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id; |
|
459
|
459
|
} elseif ($modulepart == 'adherent' || $modulepart == 'member') { |
|
460
|
460
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
461
|
461
|
|
|
@@ -469,7 +469,7 @@ discard block |
|
|
block discarded – undo |
|
469
|
469
|
throw new RestException(404, 'Member not found'); |
|
470
|
470
|
} |
|
471
|
471
|
|
|
472
|
|
- $upload_dir = getMultidirOutput($object) . "/".get_exdir(0, 0, 0, 1, $object, 'member'); |
|
|
472
|
+ $upload_dir = getMultidirOutput($object)."/".get_exdir(0, 0, 0, 1, $object, 'member'); |
|
473
|
473
|
} elseif ($modulepart == 'propal' || $modulepart == 'proposal') { |
|
474
|
474
|
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
475
|
475
|
|
|
@@ -511,7 +511,7 @@ discard block |
|
|
block discarded – undo |
|
511
|
511
|
throw new RestException(404, 'Order not found'); |
|
512
|
512
|
} |
|
513
|
513
|
|
|
514
|
|
- $upload_dir = getMultidirOutput($object). "/".get_exdir(0, 0, 0, 1, $object, 'commande'); |
|
|
514
|
+ $upload_dir = getMultidirOutput($object)."/".get_exdir(0, 0, 0, 1, $object, 'commande'); |
|
515
|
515
|
} elseif ($modulepart == 'commande_fournisseur' || $modulepart == 'supplier_order') { |
|
516
|
516
|
$modulepart = 'supplier_order'; |
|
517
|
517
|
|
|
@@ -527,7 +527,7 @@ discard block |
|
|
block discarded – undo |
|
527
|
527
|
throw new RestException(404, 'Purchase order not found'); |
|
528
|
528
|
} |
|
529
|
529
|
|
|
530
|
|
- $upload_dir = getMultidirOutput($object) . "/commande/".dol_sanitizeFileName($object->ref); |
|
|
530
|
+ $upload_dir = getMultidirOutput($object)."/commande/".dol_sanitizeFileName($object->ref); |
|
531
|
531
|
} elseif ($modulepart == 'shipment' || $modulepart == 'expedition') { |
|
532
|
532
|
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; |
|
533
|
533
|
|
|
@@ -541,7 +541,7 @@ discard block |
|
|
block discarded – undo |
|
541
|
541
|
throw new RestException(404, 'Shipment not found'); |
|
542
|
542
|
} |
|
543
|
543
|
|
|
544
|
|
- $upload_dir = getMultidirOutput($object) . "/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment'); |
|
|
544
|
+ $upload_dir = getMultidirOutput($object)."/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment'); |
|
545
|
545
|
} elseif ($modulepart == 'facture' || $modulepart == 'invoice') { |
|
546
|
546
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
|
547
|
547
|
|
|
@@ -555,7 +555,7 @@ discard block |
|
|
block discarded – undo |
|
555
|
555
|
throw new RestException(404, 'Invoice not found'); |
|
556
|
556
|
} |
|
557
|
557
|
|
|
558
|
|
- $upload_dir = getMultidirOutput($object) . "/".get_exdir(0, 0, 0, 1, $object, 'invoice'); |
|
|
558
|
+ $upload_dir = getMultidirOutput($object)."/".get_exdir(0, 0, 0, 1, $object, 'invoice'); |
|
559
|
559
|
} elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice') { |
|
560
|
560
|
$modulepart = 'supplier_invoice'; |
|
561
|
561
|
|
|
@@ -571,7 +571,7 @@ discard block |
|
|
block discarded – undo |
|
571
|
571
|
throw new RestException(404, 'Invoice not found'); |
|
572
|
572
|
} |
|
573
|
573
|
|
|
574
|
|
- $upload_dir = getMultidirOutput($object) . "/".get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').dol_sanitizeFileName($object->ref); |
|
|
574
|
+ $upload_dir = getMultidirOutput($object)."/".get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').dol_sanitizeFileName($object->ref); |
|
575
|
575
|
} elseif ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'service') { |
|
576
|
576
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
577
|
577
|
|
|
@@ -601,7 +601,7 @@ discard block |
|
|
block discarded – undo |
|
601
|
601
|
throw new RestException(404, 'Event not found'); |
|
602
|
602
|
} |
|
603
|
603
|
|
|
604
|
|
- $upload_dir = getMultidirOutput($object) . '/'.dol_sanitizeFileName($object->ref); |
|
|
604
|
+ $upload_dir = getMultidirOutput($object).'/'.dol_sanitizeFileName($object->ref); |
|
605
|
605
|
} elseif ($modulepart == 'expensereport') { |
|
606
|
606
|
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; |
|
607
|
607
|
|
|
@@ -615,7 +615,7 @@ discard block |
|
|
block discarded – undo |
|
615
|
615
|
throw new RestException(404, 'Expense report not found'); |
|
616
|
616
|
} |
|
617
|
617
|
|
|
618
|
|
- $upload_dir = getMultidirOutput($object) . '/'.dol_sanitizeFileName($object->ref); |
|
|
618
|
+ $upload_dir = getMultidirOutput($object).'/'.dol_sanitizeFileName($object->ref); |
|
619
|
619
|
} elseif ($modulepart == 'ticket') { |
|
620
|
620
|
require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
|
621
|
621
|
|
|
@@ -643,7 +643,7 @@ discard block |
|
|
block discarded – undo |
|
643
|
643
|
throw new RestException(404, 'KM article not found'); |
|
644
|
644
|
} |
|
645
|
645
|
|
|
646
|
|
- $upload_dir = getMultidirOutput($object) . '/knowledgerecord/'.dol_sanitizeFileName($object->ref); |
|
|
646
|
+ $upload_dir = getMultidirOutput($object).'/knowledgerecord/'.dol_sanitizeFileName($object->ref); |
|
647
|
647
|
} elseif ($modulepart == 'categorie' || $modulepart == 'category') { |
|
648
|
648
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
649
|
649
|
|
|
@@ -676,7 +676,7 @@ discard block |
|
|
block discarded – undo |
|
676
|
676
|
// $recursive = 0; |
|
677
|
677
|
} elseif ($modulepart == 'contrat' || $modulepart == 'contract') { |
|
678
|
678
|
$modulepart = 'contrat'; |
|
679
|
|
- require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
|
679
|
+ require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
680
|
680
|
|
|
681
|
681
|
$object = new Contrat($this->db); |
|
682
|
682
|
$result = $object->fetch($id, $ref); |
|
@@ -684,10 +684,10 @@ discard block |
|
|
block discarded – undo |
|
684
|
684
|
throw new RestException(404, 'Contract not found'); |
|
685
|
685
|
} |
|
686
|
686
|
|
|
687
|
|
- $upload_dir = getMultidirOutput($object) . "/" . get_exdir(0, 0, 0, 1, $object, 'contract'); |
|
|
687
|
+ $upload_dir = getMultidirOutput($object)."/".get_exdir(0, 0, 0, 1, $object, 'contract'); |
|
688
|
688
|
} elseif ($modulepart == 'intervention' || $modulepart == 'ficheinter') { |
|
689
|
689
|
$modulepart = 'ficheinter'; |
|
690
|
|
- require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php'; |
|
|
690
|
+ require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; |
|
691
|
691
|
|
|
692
|
692
|
$object = new Fichinter($this->db); |
|
693
|
693
|
$result = $object->fetch($id, $ref); |
|
@@ -695,20 +695,20 @@ discard block |
|
|
block discarded – undo |
|
695
|
695
|
throw new RestException(404, 'Interventional not found'); |
|
696
|
696
|
} |
|
697
|
697
|
|
|
698
|
|
- $upload_dir = $conf->ficheinter->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'ficheinter'); |
|
|
698
|
+ $upload_dir = $conf->ficheinter->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'ficheinter'); |
|
699
|
699
|
} elseif ($modulepart == 'projet' || $modulepart == 'project') { |
|
700
|
700
|
$modulepart = 'project'; |
|
701
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
|
701
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
702
|
702
|
|
|
703
|
703
|
$object = new Project($this->db); |
|
704
|
704
|
$result = $object->fetch($id, $ref); |
|
705
|
705
|
if (!$result) { |
|
706
|
706
|
throw new RestException(404, 'Project not found'); |
|
707
|
707
|
} |
|
708
|
|
- $upload_dir = $conf->project->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'project'); |
|
|
708
|
+ $upload_dir = $conf->project->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'project'); |
|
709
|
709
|
} elseif ($modulepart == 'task' || $modulepart == 'project_task') { |
|
710
|
710
|
$modulepart = 'project_task'; |
|
711
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php'; |
|
|
711
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; |
|
712
|
712
|
|
|
713
|
713
|
if (!DolibarrApiAccess::$user->hasRight('projet', 'lire')) { |
|
714
|
714
|
throw new RestException(403); |
|
@@ -726,10 +726,10 @@ discard block |
|
|
block discarded – undo |
|
726
|
726
|
throw new RestException(500, 'Error while fetching project for task'); |
|
727
|
727
|
} |
|
728
|
728
|
|
|
729
|
|
- $upload_dir = $conf->project->dir_output . "/" . dol_sanitizeFileName($object->project->ref) . "/" . dol_sanitizeFileName($object->ref); |
|
|
729
|
+ $upload_dir = $conf->project->dir_output."/".dol_sanitizeFileName($object->project->ref)."/".dol_sanitizeFileName($object->ref); |
|
730
|
730
|
} elseif ($modulepart == 'mrp') { |
|
731
|
731
|
$modulepart = 'mrp'; |
|
732
|
|
- require_once DOL_DOCUMENT_ROOT . '/mrp/class/mo.class.php'; |
|
|
732
|
+ require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; |
|
733
|
733
|
|
|
734
|
734
|
$object = new Mo($this->db); |
|
735
|
735
|
$result = $object->fetch($id, $ref); |
|
@@ -737,17 +737,17 @@ discard block |
|
|
block discarded – undo |
|
737
|
737
|
throw new RestException(404, 'MO not found'); |
|
738
|
738
|
} |
|
739
|
739
|
|
|
740
|
|
- $upload_dir = getMultidirOutput($object) . "/" . get_exdir(0, 0, 0, 1, $object, 'mrp'); |
|
|
740
|
+ $upload_dir = getMultidirOutput($object)."/".get_exdir(0, 0, 0, 1, $object, 'mrp'); |
|
741
|
741
|
} elseif ($modulepart == 'contact' || $modulepart == 'socpeople') { |
|
742
|
742
|
$modulepart = 'contact'; |
|
743
|
743
|
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
|
744
|
744
|
|
|
745
|
745
|
$object = new Contact($this->db); |
|
746
|
|
- $result = $object->fetch($id?$id:$ref); |
|
|
746
|
+ $result = $object->fetch($id ? $id : $ref); |
|
747
|
747
|
if (!$result) { |
|
748
|
748
|
throw new RestException(404, 'Contact not found'); |
|
749
|
749
|
} |
|
750
|
|
- $upload_dir = $conf->societe->multidir_output[$object->entity ?? $conf->entity] . "/contact/" . get_exdir(0, 0, 0, 1, $object, 'contact'); |
|
|
750
|
+ $upload_dir = $conf->societe->multidir_output[$object->entity ?? $conf->entity]."/contact/".get_exdir(0, 0, 0, 1, $object, 'contact'); |
|
751
|
751
|
} elseif ($modulepart == 'stock') { |
|
752
|
752
|
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
|
753
|
753
|
|
|
@@ -766,7 +766,7 @@ discard block |
|
|
block discarded – undo |
|
766
|
766
|
} |
|
767
|
767
|
|
|
768
|
768
|
$objectType = $modulepart; |
|
769
|
|
- if (! empty($object->id) && ! empty($object->table_element)) { |
|
|
769
|
+ if (!empty($object->id) && !empty($object->table_element)) { |
|
770
|
770
|
$objectType = $object->table_element; |
|
771
|
771
|
} |
|
772
|
772
|
|
|
@@ -784,7 +784,7 @@ discard block |
|
|
block discarded – undo |
|
784
|
784
|
throw new RestException(503, 'Error when retrieve ecm list : '.$this->db->lasterror()); |
|
785
|
785
|
} elseif (is_array($ecmfile->lines) && count($ecmfile->lines) > 0) { |
|
786
|
786
|
$count = count($filearray); |
|
787
|
|
- for ($i = 0 ; $i < $count ; $i++) { |
|
|
787
|
+ for ($i = 0; $i < $count; $i++) { |
|
788
|
788
|
foreach ($ecmfile->lines as $line) { |
|
789
|
789
|
unset($line->db); |
|
790
|
790
|
if ($filearray[$i]['name'] == $line->filename) { |
|
@@ -964,7 +964,7 @@ discard block |
|
|
block discarded – undo |
|
964
|
964
|
$object = new Propal($this->db); |
|
965
|
965
|
} elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') { |
|
966
|
966
|
$modulepart = 'agenda'; |
|
967
|
|
- require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; |
|
|
967
|
+ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
|
968
|
968
|
$object = new ActionComm($this->db); |
|
969
|
969
|
} elseif ($modulepart == 'contact' || $modulepart == 'socpeople') { |
|
970
|
970
|
$modulepart = 'contact'; |
|
@@ -976,27 +976,27 @@ discard block |
|
|
block discarded – undo |
|
976
|
976
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
|
977
|
977
|
$object = new Societe($this->db); |
|
978
|
978
|
$fetchbyid = true; |
|
979
|
|
- } elseif ($modulepart == 'knowledgemanagement' ) { |
|
|
979
|
+ } elseif ($modulepart == 'knowledgemanagement') { |
|
980
|
980
|
$modulepart = 'knowledgemanagement'; |
|
981
|
981
|
require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php'; |
|
982
|
982
|
$object = new KnowledgeRecord($this->db); |
|
983
|
983
|
$fetchbyid = true; |
|
984
|
|
- } elseif ($modulepart == 'ticket' ) { |
|
|
984
|
+ } elseif ($modulepart == 'ticket') { |
|
985
|
985
|
$modulepart = 'ticket'; |
|
986
|
986
|
require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
|
987
|
987
|
$object = new Ticket($this->db); |
|
988
|
988
|
$fetchbyid = true; |
|
989
|
989
|
} elseif ($modulepart == 'contrat' || $modulepart == 'contract') { |
|
990
|
990
|
$modulepart = 'contrat'; |
|
991
|
|
- require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
|
991
|
+ require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
992
|
992
|
$object = new Contrat($this->db); |
|
993
|
993
|
} elseif ($modulepart == 'mrp') { |
|
994
|
994
|
$modulepart = 'mrp'; |
|
995
|
|
- require_once DOL_DOCUMENT_ROOT . '/mrp/class/mo.class.php'; |
|
|
995
|
+ require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; |
|
996
|
996
|
$object = new Mo($this->db); |
|
997
|
997
|
} elseif ($modulepart == 'stock') { |
|
998
|
998
|
$modulepart = 'stock'; |
|
999
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; |
|
|
999
|
+ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
|
1000
|
1000
|
$object = new Entrepot($this->db); |
|
1001
|
1001
|
} elseif ($modulepart == 'ecm') { |
|
1002
|
1002
|
throw new RestException(500, 'Using a non empty "ref" is not compatible with using modulepart = '.$modulepart); |