29 require_once DOL_DOCUMENT_ROOT.
'/core/modules/project/modules_project.php';
30 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/doc.lib.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
40 if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
41 if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
42 if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
43 if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
44 if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
45 if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
46 if (!empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
47 if (!empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
48 if (!empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.
'/compta/deplacement/class/deplacement.class.php';
49 if (!empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
67 public $phpmin = array(5, 6);
73 public $version =
'dolibarr';
83 global $conf, $langs, $mysoc;
86 $langs->loadLangs(array(
"companies",
"main"));
89 $this->
name =
"ODT templates";
90 $this->
description = $langs->trans(
"DocumentModelOdt");
91 $this->scandir =
'PROJECT_ADDON_PDF_ODT_PATH';
95 $this->page_largeur = 0;
96 $this->page_hauteur = 0;
97 $this->format = array($this->page_largeur, $this->page_hauteur);
98 $this->marge_gauche = 0;
99 $this->marge_droite = 0;
100 $this->marge_haute = 0;
101 $this->marge_basse = 0;
103 $this->option_logo = 1;
104 $this->option_tva = 0;
105 $this->option_modereg = 0;
106 $this->option_condreg = 0;
107 $this->option_codeproduitservice = 0;
108 $this->option_multilang = 1;
109 $this->option_escompte = 0;
110 $this->option_credit_note = 0;
111 $this->option_freetext = 1;
112 $this->option_draft_watermark = 0;
115 $this->emetteur = $mysoc;
116 if (!$this->emetteur->pays_code) $this->emetteur->pays_code = substr($langs->defaultlang, -2);
135 $array_key.
'_id'=>$object->id,
136 $array_key.
'_ref'=>$object->ref,
137 $array_key.
'_title'=>$object->title,
138 $array_key.
'_description'=>$object->description,
139 $array_key.
'_date_creation'=>
dol_print_date($object->date_c,
'day'),
140 $array_key.
'_date_modification'=>
dol_print_date($object->date_m,
'day'),
141 $array_key.
'_date_start'=>
dol_print_date($object->date_start,
'day'),
143 $array_key.
'_note_private'=>$object->note_private,
144 $array_key.
'_note_public'=>$object->note_public,
145 $array_key.
'_public'=>$object->public,
146 $array_key.
'_statut'=>$object->getLibStatut()
149 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
151 $extrafields->fetch_name_optionals_label($object->table_element,
true);
152 $object->fetch_optionals();
173 'task_ref'=>$task->ref,
174 'task_fk_project'=>$task->fk_project,
175 'task_projectref'=>$task->projectref,
176 'task_projectlabel'=>$task->projectlabel,
177 'task_label'=>$task->label,
178 'task_description'=>$task->description,
179 'task_fk_parent'=>$task->fk_parent,
180 'task_duration'=>$task->duration,
182 'task_progress'=>$task->progress,
183 'task_public'=>$task->public,
186 'task_note_private'=>$task->note_private,
187 'task_note_public'=>$task->note_public
190 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
192 $extrafields->fetch_name_optionals_label($task->table_element,
true);
212 $pc =
'projcontacts_';
215 $pc.
'id'=>$contact[
'id'],
216 $pc.
'rowid'=>$contact[
'rowid'],
217 $pc.
'role'=>$contact[
'libelle'],
218 $pc.
'lastname'=>$contact[
'lastname'],
219 $pc.
'firstname'=>$contact[
'firstname'],
220 $pc.
'civility'=>$contact[
'civility'],
221 $pc.
'fullcivname'=>$contact[
'fullname'],
222 $pc.
'socname'=>$contact[
'socname'],
223 $pc.
'email'=>$contact[
'email']
226 if ($contact[
'source'] ==
'external') {
227 $ret[$pc.
'isInternal'] =
'';
230 $ct->fetch($contact[
'id']);
231 $ret[$pc.
'phone_pro'] = $ct->phone_pro;
232 $ret[$pc.
'phone_perso'] = $ct->phone_perso;
233 $ret[$pc.
'phone_mobile'] = $ct->phone_mobile;
236 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
238 $extrafields->fetch_name_optionals_label($ct->table_element,
true);
239 $extrafields_num = $ct->fetch_optionals();
241 foreach ($ct->array_options as $efkey => $efval) {
242 dol_syslog(get_class($this).
"::get_substitutionarray_project_contacts: +++++ Extrafield ".$efkey.
" => ".$efval, LOG_DEBUG);
243 $ret[$pc.$efkey] = $efval;
245 } elseif ($contact[
'source'] ==
'internal') {
246 $ret[$pc.
'isInternal'] =
'1';
248 $ct =
new User($this->
db);
249 $ct->fetch($contact[
'id']);
250 $ret[$pc.
'phone_pro'] = $ct->office_phone;
251 $ret[$pc.
'phone_perso'] =
'';
252 $ret[$pc.
'phone_mobile'] = $ct->user_mobile;
272 'projfile_name'=>$file[
'name'],
274 'projfile_size'=>$file[
'size']
292 'projref_type'=>$refdetail[
'type'],
293 'projref_ref'=>$refdetail[
'ref'],
295 'projref_socname'=>$refdetail[
'socname'],
296 'projref_amountht'=>
price($refdetail[
'amountht'], 0, $outputlangs),
297 'projref_amountttc'=>
price($refdetail[
'amountttc'], 0, $outputlangs),
298 'projref_status'=>$refdetail[
'status']
316 'taskressource_rowid'=>$taskressource[
'rowid'],
317 'taskressource_role'=>$taskressource[
'libelle'],
318 'taskressource_lastname'=>$taskressource[
'lastname'],
319 'taskressource_firstname'=>$taskressource[
'firstname'],
320 'taskressource_fullcivname'=>$taskressource[
'fullname'],
321 'taskressource_socname'=>$taskressource[
'socname'],
322 'taskressource_email'=>$taskressource[
'email']
340 'tasktime_rowid'=>$tasktime[
'rowid'],
341 'tasktime_task_date'=>
dol_print_date($tasktime[
'task_date'],
'day'),
342 'tasktime_task_duration_sec'=>$tasktime[
'task_duration'],
344 'tasktime_note'=>$tasktime[
'note'],
345 'tasktime_fk_user'=>$tasktime[
'fk_user'],
346 'tasktime_user_name'=>$tasktime[
'name'],
347 'tasktime_user_first'=>$tasktime[
'firstname'],
348 'tasktime_fullcivname'=>$tasktime[
'fullcivname'],
349 'tasktime_amountht'=>$tasktime[
'amountht'],
350 'tasktime_amountttc'=>$tasktime[
'amountttc'],
351 'tasktime_thm'=>$tasktime[
'thm'],
369 'tasksfile_name'=>$file[
'name'],
371 'tasksfile_size'=>$file[
'size']
384 global $conf, $langs;
387 $langs->loadLangs(array(
"companies",
"errors"));
389 $form =
new Form($this->
db);
392 $texte .=
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
393 $texte .=
'<input type="hidden" name="token" value="'.newToken().
'">';
394 $texte .=
'<input type="hidden" name="action" value="setModuleOptions">';
395 $texte .=
'<input type="hidden" name="param1" value="PROJECT_ADDON_PDF_ODT_PATH">';
396 $texte .=
'<table class="nobordernopadding" width="100%">';
399 $texte .=
'<tr><td>';
400 $texttitle = $langs->trans(
"ListOfDirectories");
401 $listofdir = explode(
',', preg_replace(
'/[\r\n]+/',
',', trim($conf->global->PROJECT_ADDON_PDF_ODT_PATH)));
402 $listoffiles = array();
403 foreach ($listofdir as $key=>$tmpdir)
405 $tmpdir = trim($tmpdir);
406 $tmpdir = preg_replace(
'/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
408 unset($listofdir[$key]);
continue;
410 if (!is_dir($tmpdir)) $texttitle .=
img_warning($langs->trans(
"ErrorDirNotFound", $tmpdir), 0);
412 $tmpfiles =
dol_dir_list($tmpdir,
'files', 0,
'\.(ods|odt)');
413 if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles);
416 $texthelp = $langs->trans(
"ListOfDirectoriesForModelGenODT");
418 $texthelp .=
'<br>'.$langs->trans(
"FollowingSubstitutionKeysCanBeUsed").
'<br>';
419 $texthelp .= $langs->transnoentitiesnoconv(
"FullListOnOnlineDocumentation");
421 $texte .= $form->textwithpicto($texttitle, $texthelp, 1,
'help',
'', 1);
422 $texte .=
'<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
423 $texte .=
'<textarea class="flat" cols="60" name="value1">';
424 $texte .= $conf->global->PROJECT_ADDON_PDF_ODT_PATH;
425 $texte .=
'</textarea>';
426 $texte .=
'</div><div style="display: inline-block; vertical-align: middle;">';
427 $texte .=
'<input type="submit" class="button" value="'.$langs->trans(
"Modify").
'" name="Button">';
428 $texte .=
'<br></div></div>';
431 $nbofiles = count($listoffiles);
432 if (!empty($conf->global->PROJECT_ADDON_PDF_ODT_PATH))
434 $texte .= $langs->trans(
"NumberOfModelFilesFound").
': <b>';
443 $texte .=
'<div id="div_'.get_class($this).
'" class="hiddenx">';
445 foreach ($listoffiles as $file) {
446 $texte .=
'- '.$file[
'name'].
' <a href="'.DOL_URL_ROOT.
'/document.php?modulepart=doctemplates&file=projects/'.urlencode(basename($file[
'name'])).
'">'.
img_picto(
'',
'listlight').
'</a><br>';
453 $texte .=
'<td rowspan="2" class="tdtop hideonsmartphone">';
454 $texte .= $langs->trans(
"ExampleOfDirectoriesForModelGen");
458 $texte .=
'</table>';
473 public function write_file($object, $outputlangs, $srctemplatepath)
476 global $user, $langs, $conf, $mysoc, $hookmanager;
478 if (empty($srctemplatepath))
480 dol_syslog(
"doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
485 if (!is_object($hookmanager))
487 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
490 $hookmanager->initHooks(array(
'odtgeneration'));
493 if (!is_object($outputlangs)) $outputlangs = $langs;
494 $sav_charset_output = $outputlangs->charset_output;
495 $outputlangs->charset_output =
'UTF-8';
498 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"projects"));
500 if ($conf->projet->dir_output)
503 if (!is_object($object))
507 $result = $object->fetch($id);
515 $object->fetch_thirdparty();
517 $dir = $conf->projet->dir_output;
519 if (!preg_match(
'/specimen/i', $objectref)) $dir .=
"/".$objectref;
520 $file = $dir.
"/".$objectref.
".odt";
522 if (!file_exists($dir))
526 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
531 if (file_exists($dir))
534 $newfile = basename($srctemplatepath);
535 $newfiletmp = preg_replace(
'/\.od(t|s)/i',
'', $newfile);
536 $newfiletmp = preg_replace(
'/template_/i',
'', $newfiletmp);
537 $newfiletmp = preg_replace(
'/modele_/i',
'', $newfiletmp);
538 $newfiletmp = $objectref.
'_'.$newfiletmp;
541 $newfileformat = substr($newfile, strrpos($newfile,
'.') + 1);
542 if (!empty($conf->global->MAIN_DOC_USE_TIMING))
544 $format = $conf->global->MAIN_DOC_USE_TIMING;
545 if ($format ==
'1') $format =
'%Y%m%d%H%M%S';
548 $filename = $newfiletmp.
'.'.$newfileformat;
550 $file = $dir.
'/'.$filename;
560 $arrayidcontact = $object->getIdContact(
'external',
'PROJECTLEADER');
561 if (count($arrayidcontact) > 0)
564 $result = $object->fetch_contact($arrayidcontact[0]);
568 $contactobject = null;
569 if (!empty($usecontact))
572 $contactobject = $object->contact;
575 $socobject = $object->thirdparty;
578 $substitutionarray = array(
579 '__FROM_NAME__' => $this->emetteur->name,
580 '__FROM_EMAIL__' => $this->emetteur->email,
584 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs,
'substitutionarray'=>&$substitutionarray);
585 $reshook = $hookmanager->executeHooks(
'ODTSubstitution', $parameters, $this, $action);
588 require_once ODTPHP_PATH.
'odf.php';
590 $odfHandler =
new odf(
593 'PATH_TO_TMP' => $conf->projet->dir_temp,
594 'ZIP_PROXY' =>
'PclZipProxy',
595 'DELIMITER_LEFT' =>
'{',
596 'DELIMITER_RIGHT' =>
'}'
600 $this->error = $e->getMessage();
620 $array_project_contact = array();
621 if ($usecontact && is_object($contactobject)) $array_project_contact = $this->
get_substitutionarray_contact($contactobject, $outputlangs,
'contact');
623 $tmparray = array_merge($substitutionarray, $array_object_from_properties, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other, $array_project_contact);
627 $parameters = array(
'odfHandler'=>&$odfHandler,
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs,
'substitutionarray'=>&$tmparray);
628 $reshook = $hookmanager->executeHooks(
'ODTSubstitution', $parameters, $this, $action);
630 foreach ($tmparray as $key=>$value)
633 if (preg_match(
'/logo$/', $key))
635 if (file_exists($value)) $odfHandler->setImage($key, $value);
636 else $odfHandler->setVars($key,
'ErrorFileNotFound',
true,
'UTF-8');
639 $odfHandler->setVars($key, $value,
true,
'UTF-8');
641 }
catch (OdfException $e)
649 $listlines = $odfHandler->setSegment(
'tasks');
651 $taskstatic =
new Task($this->
db);
655 if (!empty($object->fk_soc)) $socid = $object->fk_soc;
657 $tasksarray = $taskstatic->getTasksArray(0, 0, $object->id, $socid, 0);
660 foreach ($tasksarray as $task)
664 foreach ($tmparray as $key => $val)
667 $listlines->setVars($key, $val,
true,
'UTF-8');
668 }
catch (OdfException $e)
671 }
catch (SegmentException $e)
677 $taskobj =
new Task($this->
db);
678 $taskobj->fetch($task->id);
681 $sourcearray = array(
'internal',
'external');
682 $contact_arrray = array();
683 foreach ($sourcearray as $source) {
684 $contact_temp = $taskobj->liste_contact(-1, $source);
685 if ((is_array($contact_temp) && count($contact_temp) > 0))
687 $contact_arrray = array_merge($contact_arrray, $contact_temp);
690 if ((is_array($contact_arrray) && count($contact_arrray) > 0))
692 $listlinestaskres = $listlines->__get(
'tasksressources');
694 foreach ($contact_arrray as $contact)
696 if ($contact[
'source'] ==
'internal') {
697 $objectdetail =
new User($this->
db);
698 $objectdetail->fetch($contact[
'id']);
699 $contact[
'socname'] = $mysoc->name;
700 } elseif ($contact[
'source'] ==
'external') {
702 $objectdetail->fetch($contact[
'id']);
705 $soc->fetch($contact[
'socid']);
706 $contact[
'socname'] = $soc->name;
708 $contact[
'fullname'] = $objectdetail->getFullName($outputlangs, 1);
712 foreach ($tmparray as $key => $val)
715 $listlinestaskres->setVars($key, $val,
true,
'UTF-8');
716 }
catch (OdfException $e)
719 }
catch (SegmentException $e)
724 $listlinestaskres->merge();
729 $sql =
"SELECT t.rowid, t.task_date, t.task_duration, t.fk_user, t.note";
730 $sql .=
", u.lastname, u.firstname, t.thm";
731 $sql .=
" FROM ".MAIN_DB_PREFIX.
"projet_task_time as t";
732 $sql .=
" , ".MAIN_DB_PREFIX.
"user as u";
733 $sql .=
" WHERE t.fk_task =".$task->id;
734 $sql .=
" AND t.fk_user = u.rowid";
735 $sql .=
" ORDER BY t.task_date DESC";
744 $listlinestasktime = $listlines->__get(
'taskstimes');
747 $row[
'task_date'] =
'';
748 $row[
'task_duration'] =
'';
749 $row[
'$tasktime'] =
'';
751 $row[
'fk_user'] =
'';
753 $row[
'firstname'] =
'';
754 $row[
'fullcivname'] =
'';
755 $row[
'amountht'] =
'';
756 $row[
'amountttc'] =
'';
759 foreach ($tmparray as $key => $val)
762 $listlinestasktime->setVars($key, $val,
true,
'UTF-8');
763 }
catch (OdfException $e)
766 }
catch (SegmentException $e)
771 $listlinestasktime->merge();
775 $row = $this->
db->fetch_array(
$resql);
776 if (!empty($row[
'fk_user'])) {
777 $objectdetail =
new User($this->
db);
778 $objectdetail->fetch($row[
'fk_user']);
779 $row[
'fullcivname'] = $objectdetail->getFullName($outputlangs, 1);
781 $row[
'fullcivname'] =
'';
784 if (!empty($row[
'thm'])) {
785 $row[
'amountht'] = ($row[
'task_duration'] / 3600) * $row[
'thm'];
787 $row[
'amountttc'] =
price2num($row[
'amountht'] * (1 + ($defaultvat / 100)),
'MT');
789 $row[
'amountht'] = 0;
790 $row[
'amountttc'] = 0;
796 foreach ($tmparray as $key => $val)
799 $listlinestasktime->setVars($key, $val,
true,
'UTF-8');
800 }
catch (OdfException $e)
803 }
catch (SegmentException $e)
808 $listlinestasktime->merge();
816 $listtasksfiles = $listlines->__get(
'tasksfiles');
819 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$',
'name', SORT_ASC, 1);
822 foreach ($filearray as $filedetail)
826 foreach ($tmparray as $key => $val)
829 $listtasksfiles->setVars($key, $val,
true,
'UTF-8');
830 }
catch (OdfException $e)
833 }
catch (SegmentException $e)
838 $listtasksfiles->merge();
842 $odfHandler->mergeSegment($listlines);
843 }
catch (OdfException $e)
845 $ExceptionTrace = $e->getTrace();
847 if ($ExceptionTrace[0][
'function'] !=
'setSegment')
849 $this->error = $e->getMessage();
857 $listlines = $odfHandler->setSegment(
'projectfiles');
860 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$',
'name', SORT_ASC, 1);
862 foreach ($filearray as $filedetail)
867 foreach ($tmparray as $key => $val)
870 $listlines->setVars($key, $val,
true,
'UTF-8');
871 }
catch (OdfException $e)
874 }
catch (SegmentException $e)
881 $odfHandler->mergeSegment($listlines);
882 }
catch (OdfException $e)
884 $this->error = $e->getMessage();
890 $sourcearray = array(
'internal',
'external');
891 $contact_arrray = array();
892 foreach ($sourcearray as $source) {
893 $contact_temp = $object->liste_contact(-1, $source);
894 if ((is_array($contact_temp) && count($contact_temp) > 0))
896 $contact_arrray = array_merge($contact_arrray, $contact_temp);
899 if ((is_array($contact_arrray) && count($contact_arrray) > 0))
902 $listlines = $odfHandler->setSegment(
'projectcontacts');
904 foreach ($contact_arrray as $contact)
906 if ($contact[
'source'] ==
'internal') {
907 $objectdetail =
new User($this->
db);
908 $objectdetail->fetch($contact[
'id']);
909 $contact[
'socname'] = $mysoc->name;
910 } elseif ($contact[
'source'] ==
'external') {
912 $objectdetail->fetch($contact[
'id']);
915 $soc->fetch($contact[
'socid']);
916 $contact[
'socname'] = $soc->name;
918 $contact[
'fullname'] = $objectdetail->getFullName($outputlangs, 1);
921 foreach ($tmparray as $key => $val)
924 $listlines->setVars($key, $val,
true,
'UTF-8');
925 }
catch (OdfException $e)
928 }
catch (SegmentException $e)
935 $odfHandler->mergeSegment($listlines);
936 }
catch (OdfException $e)
938 $this->error = $e->getMessage();
946 $listofreferent = array(
948 'title' =>
"ListProposalsAssociatedProject",
951 'test' => $conf->propal->enabled && $user->rights->propale->lire
954 'title' =>
"ListOrdersAssociatedProject",
955 'class' =>
'Commande',
956 'table' =>
'commande',
957 'test' => $conf->commande->enabled && $user->rights->commande->lire
960 'title' =>
"ListInvoicesAssociatedProject",
961 'class' =>
'Facture',
962 'table' =>
'facture',
963 'test' => $conf->facture->enabled && $user->rights->facture->lire
965 'invoice_predefined' => array(
966 'title' =>
"ListPredefinedInvoicesAssociatedProject",
967 'class' =>
'FactureRec',
968 'table' =>
'facture_rec',
969 'test' => $conf->facture->enabled && $user->rights->facture->lire
971 'proposal_supplier' => array(
972 'title' =>
"ListSupplierProposalsAssociatedProject",
973 'class' =>
'SupplierProposal',
974 'table' =>
'supplier_proposal',
975 'test' => $conf->supplier_proposal->enabled && $user->rights->supplier_proposal->lire
977 'order_supplier' => array(
978 'title' =>
"ListSupplierOrdersAssociatedProject",
979 'table' =>
'commande_fournisseur',
980 'class' =>
'CommandeFournisseur',
981 'test' => (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire
983 'invoice_supplier' => array(
984 'title' =>
"ListSupplierInvoicesAssociatedProject",
985 'table' =>
'facture_fourn',
986 'class' =>
'FactureFournisseur',
987 'test' => (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire
990 'title' =>
"ListContractAssociatedProject",
991 'class' =>
'Contrat',
992 'table' =>
'contrat',
993 'test' => $conf->contrat->enabled && $user->rights->contrat->lire
995 'intervention' => array(
996 'title' =>
"ListFichinterAssociatedProject",
997 'class' =>
'Fichinter',
998 'table' =>
'fichinter',
999 'disableamount' => 1,
1000 'test' => $conf->ficheinter->enabled && $user->rights->ficheinter->lire
1002 'shipping' => array(
1003 'title' =>
"ListShippingAssociatedProject",
1004 'class' =>
'Expedition',
1005 'table' =>
'expedition',
1006 'disableamount' => 1,
1007 'test' => $conf->expedition->enabled && $user->rights->expedition->lire
1010 'title' =>
"ListTripAssociatedProject",
1011 'class' =>
'Deplacement',
1012 'table' =>
'deplacement',
1013 'disableamount' => 1,
1014 'test' => $conf->deplacement->enabled && $user->rights->deplacement->lire
1016 'expensereport' => array(
1017 'title' =>
"ListExpenseReportsAssociatedProject",
1018 'class' =>
'ExpenseReportLine',
1019 'table' =>
'expensereport_det',
1020 'test' => $conf->expensereport->enabled && $user->rights->expensereport->lire
1022 'donation' => array(
1023 'title' =>
"ListDonationsAssociatedProject",
1026 'test' => $conf->don->enabled && $user->rights->don->lire
1029 'title' =>
"ListLoanAssociatedProject",
1032 'test' => $conf->loan->enabled && $user->rights->loan->read
1034 'chargesociales' => array(
1035 'title' =>
"ListSocialContributionAssociatedProject",
1036 'class' =>
'ChargeSociales',
1037 'table' =>
'chargesociales',
1038 'urlnew' => DOL_URL_ROOT.
'/compta/sociales/card.php?action=create&projectid='.$object->id,
1039 'test' => $conf->tax->enabled && $user->rights->tax->charges->lire
1041 'stock_mouvement' => array(
1042 'title' =>
"ListMouvementStockProject",
1043 'class' =>
'MouvementStock',
1044 'table' =>
'stock_mouvement',
1045 'test' => ($conf->stock->enabled && $user->rights->stock->mouvement->lire && !empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW))
1048 'title' =>
"ListActionsAssociatedProject",
1049 'class' =>
'ActionComm',
1050 'table' =>
'actioncomm',
1051 'disableamount' => 1,
1052 'test' => $conf->agenda->enabled && $user->rights->agenda->allactions->lire
1058 $listlines = $odfHandler->setSegment(
'projectrefs');
1060 foreach ($listofreferent as $keyref => $valueref)
1062 $title = $valueref[
'title'];
1063 $tablename = $valueref[
'table'];
1064 $classname = $valueref[
'class'];
1065 $qualified = $valueref[
'test'];
1068 $elementarray = $object->get_element_list($keyref, $tablename);
1069 if (count($elementarray) > 0 && is_array($elementarray))
1073 $num = count($elementarray);
1074 for ($i = 0; $i < $num; $i++)
1076 $ref_array = array();
1077 $ref_array[
'type'] = $langs->trans($classname);
1079 $element =
new $classname($this->
db);
1080 $element->fetch($elementarray[$i]);
1081 $element->fetch_thirdparty();
1084 $ref_array[
'ref'] = $element->ref;
1087 $dateref = $element->date;
1088 if (empty($dateref)) $dateref = $element->datep;
1089 if (empty($dateref)) $dateref = $element->date_contrat;
1090 $ref_array[
'date'] = $dateref;
1093 if (is_object($element->thirdparty)) {
1094 $ref_array[
'socname'] = $element->thirdparty->name;
1096 $ref_array[
'socname'] =
'';
1100 if (empty($valueref[
'disableamount'])) {
1101 if (!empty($element->total_ht)) {
1102 $ref_array[
'amountht'] = $element->total_ht;
1103 $ref_array[
'amountttc'] = $element->total_ttc;
1105 $ref_array[
'amountht'] = 0;
1106 $ref_array[
'amountttc'] = 0;
1109 $ref_array[
'amountht'] =
'';
1110 $ref_array[
'amountttc'] =
'';
1113 $ref_array[
'status'] = $element->getLibStatut(0);
1117 foreach ($tmparray as $key => $val)
1120 $listlines->setVars($key, $val,
true,
'UTF-8');
1121 }
catch (OdfException $e)
1124 }
catch (SegmentException $e)
1129 $listlines->merge();
1133 $odfHandler->mergeSegment($listlines);
1135 }
catch (OdfException $e) {
1136 $this->error = $e->getMessage();
1142 $tmparray = $outputlangs->get_translations_for_substitutions();
1143 foreach ($tmparray as $key=>$value)
1146 $odfHandler->setVars($key, $value,
true,
'UTF-8');
1147 }
catch (OdfException $e) {
1153 $parameters = array(
'odfHandler'=>&$odfHandler,
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs,
'substitutionarray'=>&$tmparray);
1154 $reshook = $hookmanager->executeHooks(
'beforeODTSave', $parameters, $this, $action);
1158 if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
1160 $odfHandler->exportAsAttachedPDF($file);
1162 $this->error = $e->getMessage();
1167 $odfHandler->saveToDisk($file);
1169 $this->error = $e->getMessage();
1174 $parameters = array(
'odfHandler'=>&$odfHandler,
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs,
'substitutionarray'=>&$tmparray);
1175 $reshook = $hookmanager->executeHooks(
'afterODTCreation', $parameters, $this, $action);
1177 if (!empty($conf->global->MAIN_UMASK))
1178 @chmod($file, octdec($conf->global->MAIN_UMASK));
1182 $this->result = array(
'fullpath'=>$file);
1186 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
</td > param sortfield sortorder printFieldListOption< tdclass="liste_titremaxwidthsearchright"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration center DesiredStock p desiredstock right StockLimitShort p seuil_stock_alerte right stock_physique right stock_real_warehouse right Ordered right StockToBuy right SupplierRef right param sortfield sortorder printFieldListTitle warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow StockTooLow help help help< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"> stock</td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
get_substitutionarray_project_reference($refdetail, $outputlangs)
Define array with couple substitution key => substitution value.
get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive=true)
Define array with couple substitution key => substitution value.
dol_now($mode= 'auto')
Return date for now.
Class to build documents using ODF templates generator.
Class to manage Dolibarr users.
get_substitutionarray_user($user, $outputlangs)
Define array with couple substitution key => substitution value.
get_substitutionarray_object($object, $outputlangs, $array_key= 'object')
Define array with couple substitution key => substitution value.
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
info($langs)
Return description of a module.
price($amount, $form=0, $outlangs= '', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code= '')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
get_substitutionarray_project_contacts($contact, $outputlangs)
Define array with couple substitution key => substitution value.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
Return array of possible common substitutions.
get_substitutionarray_contact($object, $outputlangs, $array_key= 'object')
Define array with couple substitution key => substitution value.
get_substitutionarray_taskstime($tasktime, $outputlangs)
Define array with couple substitution key => substitution value.
Class to manage third parties objects (customers, suppliers, prospects...)
Parent class for projects models.
Class to manage projects.
write_file($object, $outputlangs, $srctemplatepath)
Function to build a document on disk using the generic odt module.
get_substitutionarray_tasksressource($taskressource, $outputlangs)
Define array with couple substitution key => substitution value.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
get_substitutionarray_thirdparty($object, $outputlangs, $array_key= 'company')
Define array with couple substitution key => substitution value.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
get_substitutionarray_mysoc($mysoc, $outputlangs)
Define array with couple substitution key => substitution value.
__construct($db)
Constructor.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
get_substitutionarray_project_file($file, $outputlangs)
Define array with couple substitution key => substitution value.
fetch_optionals($rowid=null, $optionsArray=null)
Function to get extra fields of an object into $this->array_options This method is in most cases call...
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
fill_substitutionarray_with_extrafields($object, $array_to_fill, $extrafields, $array_key, $outputlangs)
Fill array with couple extrafield key => extrafield value.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
Function that return vat rate of a product line (according to seller, buyer and product vat rate) Si ...
get_substitutionarray_other($outputlangs)
Define array with couple substitution key => substitution value.
get_substitutionarray_task_file($file, $outputlangs)
Define array with couple substitution key => substitution value.
get_substitutionarray_tasks(Task $task, $outputlangs)
Define array with couple substitution key => substitution value.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)
convertSecondToTime($iSecond, $format= 'all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...