';
print "";
- $parameters = array();
+ $parameters = array('totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
+
print_liste_field_titre("Product", "", "p.ref", "&id=".$id, "", "", $sortfield, $sortorder);
print_liste_field_titre("Label", "", "p.label", "&id=".$id, "", "", $sortfield, $sortorder);
print_liste_field_titre("NumberOfUnit", "", "ps.reel", "&id=".$id, "", '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield'] += 3;
+ $totalarray['pos'][$totalarray['nbfield']] = 'totalunit';
+ $totalarray['type'][$totalarray['nbfield']] = 'stock';
+
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
print_liste_field_titre("Unit", "", "p.fk_unit", "&id=".$id, "", 'align="left"', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+ $totalarray['pos'][$totalarray['nbfield']] = 'units';
+ $totalarray['type'][$totalarray['nbfield']] = 'string';
}
+
print_liste_field_titre($form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")), "", "p.pmp", "&id=".$id, "", '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+
print_liste_field_titre("EstimatedStockValueShort", "", "", "&id=".$id, "", '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+ $totalarray['pos'][$totalarray['nbfield']] = 'totalvalue';
+
if (empty($conf->global->PRODUIT_MULTIPRICES)) {
print_liste_field_titre("SellPriceMin", "", "p.price", "&id=".$id, "", '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
}
if (empty($conf->global->PRODUIT_MULTIPRICES)) {
print_liste_field_titre("EstimatedStockValueSellShort", "", "", "&id=".$id, "", '', $sortfield, $sortorder, 'right ');
+ $totalarray['nbfield']++;
+ $totalarray['pos'][$totalarray['nbfield']] = 'totalvaluesell';
}
if ($user->rights->stock->mouvement->creer) {
print_liste_field_titre('');
+ $totalarray['nbfield']++;
}
if ($user->rights->stock->creer) {
print_liste_field_titre('');
+ $totalarray['nbfield']++;
}
// Hook fields
- $parameters = array('sortfield'=>$sortfield, 'sortorder'=>$sortorder);
+ $parameters = array('sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "
\n";
@@ -708,7 +733,7 @@ if ($action == 'create') {
//print ''.dol_print_date($objp->datem).' | ';
print '';
- $parameters = array('obj'=>$objp);
+ $parameters = array('obj'=>$objp, 'totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
@@ -807,34 +832,20 @@ if ($action == 'create') {
}
$db->free($resql);
- // Total
- print '
| '.$langs->trans("Total").' | ';
- print '';
- $valtoshow = price2num($totalunit, 'MS');
- if (empty($conf->global->PRODUCT_USE_UNITS) || $sameunits) {
- print empty($valtoshow) ? '0' : $valtoshow;
- }
- print ' | ';
- print '';
- if (empty($conf->global->PRODUCT_USE_UNITS) && $sameunits) {
- print $langs->trans($productstatic->getLabelOfUnit());
- }
- print ' | ';
- print ''.price(price2num($totalvalue, 'MT')).' | ';
- if (empty($conf->global->PRODUIT_MULTIPRICES)) {
- print ' | ';
- print ''.price(price2num($totalvaluesell, 'MT')).' | ';
+ $totalarray['val']['totalunit'] = $totalunit;
+ $totalarray['val']['totalvalue'] = price2num($totalvalue, 'MT');
+ $totalarray['val']['totalvaluesell'] = price2num($totalvaluesell, 'MT');
+ $totalarray['val']['units'] = $langs->trans($productstatic->getLabelOfUnit());
+
+ $parameters = array('totalarray' => &$totalarray);
+ // Note that $action and $object may have been modified by hook
+ $reshook = $hookmanager->executeHooks('printFieldListTotal', $parameters, $object);
+ if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors);
}
- if ($user->rights->stock->mouvement->creer) {
- print ' | ';
- }
-
- if ($user->rights->stock->creer) {
- print ' | ';
- }
-
- print '
';
+ // Show total line
+ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
} else {
dol_print_error($db);
}
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 984c24f6ef6..e2f180ed889 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -1251,7 +1251,7 @@ class Task extends CommonObjectLine
if (isset($this->timespent_note)) {
$this->timespent_note = trim($this->timespent_note);
}
- if (empty($this->timespent_datehour)) {
+ if (empty($this->timespent_datehour) || ($this->timespent_date != $this->timespent_datehour)) {
$this->timespent_datehour = $this->timespent_date;
}
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index daadc99410a..9dc6090c3d7 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -425,7 +425,7 @@ $listofreferent = array(
'testnew'=>$user->hasRight('facture', 'creer'),
'test'=>isModEnabled('facture') && $user->hasRight('facture', 'lire')),
'proposal_supplier'=>array(
- 'name'=>"SuppliersProposals",
+ 'name'=>"SupplierProposals",
'title'=>"ListSupplierProposalsAssociatedProject",
'class'=>'SupplierProposal',
'table'=>'supplier_proposal',
@@ -729,6 +729,9 @@ print '';
$tooltiponprofit = $langs->trans("ProfitIsCalculatedWith")." \n";
$tooltiponprofitplus = $tooltiponprofitminus = '';
foreach ($listofreferent as $key => $value) {
+ if (!empty($value['lang'])) {
+ $langs->load($value['lang']);
+ }
$name = $langs->trans($value['name']);
$qualified = $value['test'];
$margin = empty($value['margin']) ? 0 : $value['margin'];
@@ -988,7 +991,6 @@ foreach ($listofreferent as $key => $value) {
$tablename = $value['table'];
$datefieldname = $value['datefieldname'];
$qualified = $value['test'];
- $langtoload = empty($value['lang']) ? '' : $value['lang'];
$urlnew = empty($value['urlnew']) ? '' : $value['urlnew'];
$buttonnew = empty($value['buttonnew']) ? '' : $value['buttonnew'];
$testnew = empty($value['testnew']) ? '' : $value['testnew'];
@@ -1004,10 +1006,6 @@ foreach ($listofreferent as $key => $value) {
// If we want the project task array to have details of users
//if ($key == 'project_task') $key = 'project_task_time';
- if ($langtoload) {
- $langs->load($langtoload);
- }
-
$element = new $classname($db);
$addform = '';
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index 742867781f5..021537f1d58 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -826,7 +826,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
print '';
// Other options
- $parameters = array();
+ $parameters = array('arrayfields' => &$arrayfields);
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $taskstatic, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
@@ -1112,7 +1112,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
$j = 0; $level = 0;
$nboftaskshown = projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->usage_bill_time ? 1 : 0), $arrayfields, $arrayofselected);
} else {
- $colspan = 11;
+ $colspan = count($arrayfields);
if ($object->usage_bill_time) {
$colspan += 2;
}
diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php
index 6c1f88ecb42..21b12419054 100644
--- a/htdocs/public/project/suggestbooth.php
+++ b/htdocs/public/project/suggestbooth.php
@@ -243,6 +243,8 @@ if (empty($reshook) && $action == 'add') {
$errors = array_merge($errors, $thirdparty->errors);
} elseif ($resultfetchthirdparty == 0) { // No thirdparty found + a payment is expected
// Creation of a new thirdparty
+ $genericcompanyname = 'Unknown company';
+
if (!empty($societe)) {
$thirdparty->name = $societe;
} else {
@@ -508,7 +510,7 @@ if (empty($reshook) && $action == 'add') {
}
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty);
- complete_substitutions_array($substitutionarray, $outputlangs, $object);
+ complete_substitutions_array($substitutionarray, $outputlangs, $project);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
@@ -516,10 +518,11 @@ if (empty($reshook) && $action == 'add') {
$sendto = $thirdparty->email;
$from = $conf->global->MAILING_EMAIL_FROM;
$urlback = $_SERVER["REQUEST_URI"];
+ $trackid = 'proj'.$project->id;
$ishtml = dol_textishtml($texttosend); // May contain urls
- $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml);
+ $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml, '', '', $trackid);
$result = $mailfile->sendfile();
if ($result) {
diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php
index c709cee8b4d..3c7212fa8c5 100644
--- a/htdocs/public/project/suggestconference.php
+++ b/htdocs/public/project/suggestconference.php
@@ -244,6 +244,8 @@ if (empty($reshook) && $action == 'add') {
$errors = array_merge($errors, $thirdparty->errors);
} elseif ($resultfetchthirdparty == 0) { // No thirdparty found + a payment is expected
// Creation of a new thirdparty
+ $genericcompanyname = 'Unknown company';
+
if (!empty($societe)) {
$thirdparty->name = $societe;
} else {
@@ -439,7 +441,7 @@ if (empty($reshook) && $action == 'add') {
}
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty);
- complete_substitutions_array($substitutionarray, $outputlangs, $object);
+ complete_substitutions_array($substitutionarray, $outputlangs, $project);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
@@ -447,10 +449,11 @@ if (empty($reshook) && $action == 'add') {
$sendto = $thirdparty->email;
$from = $conf->global->MAILING_EMAIL_FROM;
$urlback = $_SERVER["REQUEST_URI"];
+ $trackid = 'proj'.$project->id;
$ishtml = dol_textishtml($texttosend); // May contain urls
- $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml);
+ $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml, '', '', $trackid);
$result = $mailfile->sendfile();
if ($result) {
diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php
index 68cd4eb87d6..464f43cb1a7 100644
--- a/htdocs/public/ticket/create_ticket.php
+++ b/htdocs/public/ticket/create_ticket.php
@@ -117,12 +117,10 @@ if (empty($reshook)) {
}
if (GETPOST('addfile', 'alpha') && !GETPOST('save', 'alpha')) {
- ////$res = $object->fetch('','',GETPOST('track_id'));
- ////if($res > 0)
- ////{
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
- // Set tmp directory TODO Use a dedicated directory for temp mails files
+ // Set tmp directory
+ // TODO Use a dedicated directory for temporary emails files
$vardir = $conf->ticket->dir_output;
$upload_dir_tmp = $vardir.'/temp/'.session_id();
if (!dol_is_dir($upload_dir_tmp)) {
@@ -131,7 +129,6 @@ if (empty($reshook)) {
dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, '', 0);
$action = 'create_ticket';
- ////}
}
// Remove file
@@ -139,10 +136,11 @@ if (empty($reshook)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Set tmp directory
+ // TODO Use a dedicated directory for temporary emails files
$vardir = $conf->ticket->dir_output.'/';
$upload_dir_tmp = $vardir.'/temp/'.session_id();
- // TODO Delete only files that was uploaded from email form
+ // TODO Delete only files that was uploaded from form
dol_remove_file_process(GETPOST('removedfile'), 0, 0);
$action = 'create_ticket';
}
@@ -345,6 +343,7 @@ if (empty($reshook)) {
}
if (!$error) {
+ // Creation of the ticket
$id = $object->create($user);
if ($id <= 0) {
$error++;
@@ -465,14 +464,7 @@ if (empty($reshook)) {
}
// Copy files into ticket directory
- $destdir = $conf->ticket->dir_output.'/'.$object->ref;
- if (!dol_is_dir($destdir)) {
- dol_mkdir($destdir);
- }
- foreach ($filename as $i => $val) {
- dol_move($filepath[$i], $destdir.'/'.$filename[$i], 0, 1);
- $formmail->remove_attached_files($i);
- }
+ $object->copyFilesForTicket('');
//setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs');
diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php
index f97bdd15966..70f0b027559 100644
--- a/htdocs/public/ticket/index.php
+++ b/htdocs/public/ticket/index.php
@@ -86,7 +86,7 @@ print ''.(getDolGlobalString("TICKET_PUBLIC_TEXT_H
print ' ';
print ' |