diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 833c0518d9a..9a2243f4fea 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -176,7 +176,7 @@ $sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, d.photo, d. $sql .= " d.gender, d.email, d.morphy,"; $sql .= " c.rowid as crowid, c.fk_type, c.subscription,"; $sql .= " c.dateadh, c.datef, c.datec as date_creation, c.tms as date_update,"; -$sql .= " c.fk_bank as bank, c.note,"; +$sql .= " c.fk_bank as bank, c.note as note_private,"; $sql .= " b.fk_account"; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { @@ -471,7 +471,7 @@ if (!empty($arrayfields['t.libelle']['checked'])) { if (!empty($arrayfields['d.bank']['checked'])) { print ''; - $form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth150'); + $form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth100'); print ''; } @@ -692,14 +692,14 @@ while ($i < $imaxinloop) { // Lastname if (!empty($arrayfields['d.lastname']['checked'])) { - print ''.$adherent->getNomUrl(-1, 0, 'card', 'lastname').''; + print ''.$adherent->getNomUrl(-1, 0, 'card', 'lastname').''; if (!$i) { $totalarray['nbfield']++; } } // Firstname if (!empty($arrayfields['d.firstname']['checked'])) { - print ''.$adherent->firstname.''; + print ''.dol_escape_htmltag($adherent->firstname).''; if (!$i) { $totalarray['nbfield']++; } @@ -707,7 +707,7 @@ while ($i < $imaxinloop) { // Login if (!empty($arrayfields['d.login']['checked'])) { - print ''.$adherent->login.''; + print ''.dol_escape_htmltag($adherent->login).''; if (!$i) { $totalarray['nbfield']++; } @@ -716,7 +716,7 @@ while ($i < $imaxinloop) { // Label if (!empty($arrayfields['t.libelle']['checked'])) { print ''; - print $obj->note; + print dol_escape_htmltag(dolGetFirstLineOfText($obj->note_private)); print ''; if (!$i) { $totalarray['nbfield']++; @@ -725,7 +725,7 @@ while ($i < $imaxinloop) { // Banque if (!empty($arrayfields['d.bank']['checked'])) { - print ''; + print ''; if ($obj->fk_account > 0) { $accountstatic->id = $obj->fk_account; $accountstatic->fetch($obj->fk_account); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 210413b87f2..4cefb9630c5 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1250,6 +1250,8 @@ if ($id > 0) { $sql .= natural_search("f.code", $search_code); } elseif ($search_code != '' && $id == 2) { $sql .= natural_search("d.code_departement", $search_code); + } elseif ($search_code != '' && $id == 14) { + $sql .= natural_search("e.code", $search_code); } elseif ($search_code != '' && $id != 9) { $sql .= natural_search("code", $search_code); } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 16491ce4f88..8879e48edd6 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -454,15 +454,15 @@ class ActionComm extends CommonObject if ($this->percentage > 100) { $this->percentage = 100; } - //if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date; + if (empty($this->datep) && $this->datep != '0') { // We should not insert event in calendar without a start date + $this->datep = $now; + } if (!empty($this->datep) && !empty($this->datef)) { $this->durationp = ($this->datef - $this->datep); // deprecated } - //if (!empty($this->date) && !empty($this->dateend)) $this->durationa=($this->dateend - $this->date); if (!empty($this->datep) && !empty($this->datef) && $this->datep > $this->datef) { $this->datef = $this->datep; } - //if (!empty($this->date) && !empty($this->dateend) && $this->date > $this->dateend) $this->dateend=$this->date; if (!isset($this->fk_project) || $this->fk_project < 0) { $this->fk_project = 0; } @@ -559,8 +559,8 @@ class ActionComm extends CommonObject $sql .= "ip"; $sql .= ") VALUES ("; $sql .= "'(PROV)', "; - $sql .= "'".$this->db->idate($now)."', "; - $sql .= (strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : "null").", "; + $sql .= "'".$this->db->idate($now)."', "; // date creation + $sql .= "'".$this->db->idate($this->datep)."', "; // date start event $sql .= (strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : "null").", "; $sql .= ((isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '') ? "'".$this->db->escape($this->durationp)."'" : "null").", "; // deprecated $sql .= (isset($this->type_id) ? $this->type_id : "null").","; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index ed96199e4c3..d9089f03c14 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -584,8 +584,16 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on // Local calendar $s .= '
'.$langs->trans("LocalAgenda").'  
'; - // Holiday calendar - $s .= '
 
'; + if ($user->rights->holiday->read) { + // Holiday calendar + $s .= ' +
+   +
'; + } // External calendars if (is_array($showextcals) && count($showextcals) > 0) { @@ -1003,80 +1011,82 @@ if ($showbirthday) { } } -// LEAVE-HOLIDAY CALENDAR -$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status"; -$sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u"; -$sql .= " WHERE u.rowid = x.fk_user"; -$sql .= " AND u.statut = '1'"; // Show only active users (0 = inactive user, 1 = active user) -$sql .= " AND (x.statut = '2' OR x.statut = '3')"; // Show only public leaves (2 = leave wait for approval, 3 = leave approved) +if ($user->rights->holiday->read) { + // LEAVE-HOLIDAY CALENDAR + $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status"; + $sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u"; + $sql .= " WHERE u.rowid = x.fk_user"; + $sql .= " AND u.statut = '1'"; // Show only active users (0 = inactive user, 1 = active user) + $sql .= " AND (x.statut = '2' OR x.statut = '3')"; // Show only public leaves (2 = leave wait for approval, 3 = leave approved) -if ($mode == 'show_day') { - // Request only leaves for the current selected day - $sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time -} elseif ($mode == 'show_week') { - // Restrict on current month (we get more, but we will filter later) - $sql .= " AND date_debut < '".$db->idate(dol_get_last_day($year, $month))."'"; - $sql .= " AND date_fin >= '".$db->idate(dol_get_first_day($year, $month))."'"; -} elseif ($mode == 'show_month') { - // Restrict on current month - $sql .= " AND date_debut <= '".$db->idate(dol_get_last_day($year, $month))."'"; - $sql .= " AND date_fin >= '".$db->idate(dol_get_first_day($year, $month))."'"; -} + if ($mode == 'show_day') { + // Request only leaves for the current selected day + $sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time + } elseif ($mode == 'show_week') { + // Restrict on current month (we get more, but we will filter later) + $sql .= " AND date_debut < '".$db->idate(dol_get_last_day($year, $month))."'"; + $sql .= " AND date_fin >= '".$db->idate(dol_get_first_day($year, $month))."'"; + } elseif ($mode == 'show_month') { + // Restrict on current month + $sql .= " AND date_debut <= '".$db->idate(dol_get_last_day($year, $month))."'"; + $sql .= " AND date_fin >= '".$db->idate(dol_get_first_day($year, $month))."'"; + } -$resql = $db->query($sql); -if ($resql) { - $num = $db->num_rows($resql); - $i = 0; + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; - while ($i < $num) { - $obj = $db->fetch_object($resql); + while ($i < $num) { + $obj = $db->fetch_object($resql); - $event = new ActionComm($db); + $event = new ActionComm($db); - // Need the id of the leave object for link to it - $event->id = $obj->rowid; - $event->ref = $event->id; + // Need the id of the leave object for link to it + $event->id = $obj->rowid; + $event->ref = $event->id; - $event->type_code = 'HOLIDAY'; - $event->type_label = ''; - $event->type_color = ''; - $event->type = 'holiday'; - $event->type_picto = 'holiday'; + $event->type_code = 'HOLIDAY'; + $event->type_label = ''; + $event->type_color = ''; + $event->type = 'holiday'; + $event->type_picto = 'holiday'; - $event->datep = $db->jdate($obj->date_start) + (empty($halfday) || $halfday == 1 ? 0 : 12 * 60 * 60 - 1); - $event->datef = $db->jdate($obj->date_end) + (empty($halfday) || $halfday == -1 ? 24 : 12) * 60 * 60 - 1; - $event->date_start_in_calendar = $event->datep; - $event->date_end_in_calendar = $event->datef; + $event->datep = $db->jdate($obj->date_start) + (empty($halfday) || $halfday == 1 ? 0 : 12 * 60 * 60 - 1); + $event->datef = $db->jdate($obj->date_end) + (empty($halfday) || $halfday == -1 ? 24 : 12) * 60 * 60 - 1; + $event->date_start_in_calendar = $event->datep; + $event->date_end_in_calendar = $event->datef; - if ($obj->status == 3) { - // Show no symbol for leave with state "leave approved" - $event->percentage = -1; - } elseif ($obj->status == 2) { - // Show TO-DO symbol for leave with state "leave wait for approval" - $event->percentage = 0; + if ($obj->status == 3) { + // Show no symbol for leave with state "leave approved" + $event->percentage = -1; + } elseif ($obj->status == 2) { + // Show TO-DO symbol for leave with state "leave wait for approval" + $event->percentage = 0; + } + + if ($obj->halfday == 1) { + $event->label = $obj->lastname.' ('.$langs->trans("Morning").')'; + } elseif ($obj->halfday == -1) { + $event->label = $obj->lastname.' ('.$langs->trans("Afternoon").')'; + } else { + $event->label = $obj->lastname; + } + + $daycursor = $event->date_start_in_calendar; + $annee = dol_print_date($daycursor, '%Y', 'tzuserrel'); + $mois = dol_print_date($daycursor, '%m', 'tzuserrel'); + $jour = dol_print_date($daycursor, '%d', 'tzuserrel'); + + $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); + do { + $eventarray[$daykey][] = $event; + + $daykey += 60 * 60 * 24; + } while ($daykey <= $event->date_end_in_calendar); + + $i++; } - - if ($obj->halfday == 1) { - $event->label = $obj->lastname.' ('.$langs->trans("Morning").')'; - } elseif ($obj->halfday == -1) { - $event->label = $obj->lastname.' ('.$langs->trans("Afternoon").')'; - } else { - $event->label = $obj->lastname; - } - - $daycursor = $event->date_start_in_calendar; - $annee = dol_print_date($daycursor, '%Y', 'tzuserrel'); - $mois = dol_print_date($daycursor, '%m', 'tzuserrel'); - $jour = dol_print_date($daycursor, '%d', 'tzuserrel'); - - $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); - do { - $eventarray[$daykey][] = $event; - - $daykey += 60 * 60 * 24; - } while ($daykey <= $event->date_end_in_calendar); - - $i++; } } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index a7963191627..b3f3d387df3 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1289,6 +1289,10 @@ class Propal extends CommonObject dol_print_error($this->db); break; } + + // Set the id on created row + $line->id = $result; + // Defined the new fk_parent_line if ($result > 0 && $line->product_type == 9) { $fk_parent_line = $result; @@ -1423,6 +1427,8 @@ class Propal extends CommonObject } foreach ($object->lines as $line) { + $line->id = 0; + if ($line->fk_product > 0) { $prod = new Product($this->db); $res = $prod->fetch($line->fk_product); diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 83fd8d47c4f..a74f9c4c5a8 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -367,7 +367,7 @@ if ($action == 'update') { $computedvalue, (GETPOST('entitycurrentorall', 'alpha') ? 0 : ''), GETPOST('langfile'), - GETPOST('enabled', 'alpha'), + GETPOST('enabled', 'nohtml'), (GETPOST('totalizable', 'alpha') ? 1 : 0), GETPOST('printable', 'alpha'), array('css' => $css, 'cssview' => $cssview, 'csslist' => $csslist) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index f47d8bcdf2d..da7f2f43740 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -554,9 +554,13 @@ if (!$error && $massaction == 'confirm_presend') { $sendcontext = 'standard'; } + // Set tmp user directory (used to convert images embedded as img src=data:image) + $vardir = $conf->user->dir_output."/".$user->id; + $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path + // Send mail (substitutionarray must be done just before this) require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subjectreplaced, $sendto, $from, $messagereplaced, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1, '', '', $trackid, '', $sendcontext); + $mailfile = new CMailFile($subjectreplaced, $sendto, $from, $messagereplaced, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1, '', '', $trackid, '', $sendcontext, '', $upload_dir_tmp); if ($mailfile->error) { $resaction .= '
'.$mailfile->error.'
'; } else { diff --git a/htdocs/core/boxes/box_scheduled_jobs.php b/htdocs/core/boxes/box_scheduled_jobs.php index 915884d6f43..f0868036e9d 100644 --- a/htdocs/core/boxes/box_scheduled_jobs.php +++ b/htdocs/core/boxes/box_scheduled_jobs.php @@ -63,7 +63,7 @@ class box_scheduled_jobs extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->hasRight('service', 'lire') && $user->hasRight('contrat', 'lire')); + $this->hidden = !($user->hasRight('cron', 'read')); } /** @@ -79,7 +79,7 @@ class box_scheduled_jobs extends ModeleBoxes $langs->load("cron"); $this->info_box_head = array('text' => $langs->trans("BoxScheduledJobs", $max)); - if ($user->rights->cron->read) { + if ($user->hasRight('cron', 'read')) { include_once DOL_DOCUMENT_ROOT . '/cron/class/cronjob.class.php'; $cronstatic = new Cronjob($this->db); $resultarray = array(); diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 5c65230517f..7b801a78cd0 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1245,8 +1245,8 @@ class CMailFile $encoded = chunk_split(base64_encode($contents), 76, $this->eol); // 76 max is defined into http://tools.ietf.org/html/rfc2047 return $encoded; } else { - $this->error = "Error: Can't read file '".$sourcefile."' into _encode_file"; - dol_syslog("CMailFile::encode_file: ".$this->error, LOG_ERR); + $this->error = "Error in _encode_file() method: Can't read file '".$sourcefile."'"; + dol_syslog("CMailFile::_encode_file: ".$this->error, LOG_ERR); return -1; } } diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index c763bc1a04e..f4486bfb2b5 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -82,7 +82,7 @@ class FormContract if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) { $sql .= " AND (c.fk_soc=".((int) $socid)." OR c.fk_soc IS NULL)"; } elseif ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') { - $sql .= " AND (c.fk_soc IN (".$this->db->sanitize($socid.", ".$conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY).") "; + $sql .= " AND (c.fk_soc IN (".$this->db->sanitize(((int) $socid).",".((int) $conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)).")"; $sql .= " OR c.fk_soc IS NULL)"; } } diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 2257e563865..8a732671c07 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -341,7 +341,8 @@ class FormTicket if ($public) { $filter = 'public=1'; } - $this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', $filter, 2, 1, 0, 0, 'minwidth200'); + $selected = (GETPOST('category_code') ? GETPOST('category_code') : $this->category_code); + $this->selectGroupTickets($selected, 'category_code', $filter, 2, 1, 0, 0, 'minwidth200'); print ''; // Severity => Priority @@ -807,8 +808,10 @@ class FormTicket } $outputlangs->load("ticket"); + $publicgroups = ($filtertype == 'public=1' || $filtertype == '(public:=:1)'); + $ticketstat = new Ticket($this->db); - $ticketstat->loadCacheCategoriesTickets(); + $ticketstat->loadCacheCategoriesTickets($publicgroups ? 1 : -1); // get list of active ticket groups if ($use_multilevel <= 0) { print ''; print ''; print ''; @@ -1544,6 +1547,14 @@ class FormTicket $out .= ''."\n"; $out .= ''; + } + print "\n"; } } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 7a5e69232d4..f892b207557 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3353,6 +3353,17 @@ function dol_readcachefile($directory, $filename) return $object; } +/** + * Return the relative dirname (relative to DOL_DATA_ROOT) of a full path string. + * + * @param string $pathfile Full path of a file + * @return string Path of file relative to DOL_DATA_ROOT + */ +function dirbasename($pathfile) +{ + return preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'\//', '', $pathfile); +} + /** * Function to get list of updated or modified files. diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index dfc4e45a447..b95253bf040 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -456,6 +456,9 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', if ($featureforlistofmodule == 'produit') { $featureforlistofmodule = 'product'; } + if ($featureforlistofmodule == 'supplier_proposal') { + $featureforlistofmodule = 'supplierproposal'; + } if (!empty($user->socid) && !empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && !in_array($featureforlistofmodule, $listofmodules)) { // If limits on modules for external users, module must be into list of modules for external users $readok = 0; $nbko++; @@ -845,10 +848,13 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl $dbtablename = 'actioncomm'; } + if ($feature == 'payment_sc') { + $feature = "chargesociales"; + } $checkonentitydone = 0; // Array to define rules of checks to do - $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment'); // Test on entity only (Objects with no link to company) + $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment','chargesociales'); // Test on entity only (Objects with no link to company) $checksoc = array('societe'); // Test for object Societe $checkother = array('agenda', 'contact', 'contrat'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...). $checkproject = array('projet', 'project'); // Test for project object diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 02912e2cdfe..20e738f14c8 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -63,7 +63,7 @@ class pdf_einstein extends ModelePDFCommandes public $description; /** - * @var int Save the name of generated file as the main doc when generating a doc with this template + * @var string Save the name of generated file as the main doc when generating a doc with this template */ public $update_main_doc_field; @@ -179,8 +179,8 @@ class pdf_einstein extends ModelePDFCommandes $this->posxqty = 135; $this->posxunit = 151; } else { - $this->posxtva = 110; - $this->posxup = 126; + $this->posxtva = 106; + $this->posxup = 122; $this->posxqty = 145; $this->posxunit = 162; } @@ -735,9 +735,11 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetFont('', '', $default_font_size - 1); + $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); + // If France, show VAT mention if not applicable if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); @@ -746,14 +748,16 @@ class pdf_einstein extends ModelePDFCommandes $posxval = 52; + $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); + // Show payments conditions if ($object->cond_reglement_code || $object->cond_reglement) { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; $pdf->MultiCell(43, 4, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); @@ -795,11 +799,11 @@ class pdf_einstein extends ModelePDFCommandes // Show planed date of delivery if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':'; $pdf->MultiCell(80, 4, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); @@ -807,12 +811,12 @@ class pdf_einstein extends ModelePDFCommandes $posy = $pdf->GetY() + 1; } elseif ($object->availability_code || $object->availability) { // Show availability conditions - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("AvailabilityPeriod").':'; $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetTextColor(0, 0, 0); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_availability = $outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : ''); $lib_availability = str_replace('\n', "\n", $lib_availability); @@ -825,12 +829,12 @@ class pdf_einstein extends ModelePDFCommandes if ($object->mode_reglement_code && $object->mode_reglement_code != 'CHQ' && $object->mode_reglement_code != 'VIR') { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentMode").':'; $pdf->MultiCell(80, 5, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); @@ -842,8 +846,6 @@ class pdf_einstein extends ModelePDFCommandes if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { // Si mode reglement non force ou si force a CHQ if (!empty($conf->global->FACTURE_CHQ_NUMBER)) { - $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); - if ($conf->global->FACTURE_CHQ_NUMBER > 0) { $account = new Account($this->db); $account->fetch($conf->global->FACTURE_CHQ_NUMBER); @@ -1266,7 +1268,7 @@ class pdf_einstein extends ModelePDFCommandes } if (empty($hidetop)) { $pdf->SetXY($this->postotalht - 1, $tab_top + 1); - $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C'); + $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHTShort"), '', 'C'); } } diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 2d9573cfc44..ccb68a003bb 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -946,9 +946,11 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->SetFont('', '', $default_font_size - 1); + $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); + // If France, show VAT mention if not applicable if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); @@ -957,14 +959,16 @@ class pdf_eratosthene extends ModelePDFCommandes $posxval = 52; + $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); + // Show payments conditions if ($object->cond_reglement_code || $object->cond_reglement) { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; $pdf->MultiCell(43, 4, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); @@ -1006,23 +1010,23 @@ class pdf_eratosthene extends ModelePDFCommandes // Show planed date of delivery if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':'; $pdf->MultiCell(80, 4, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; } elseif ($object->availability_code || $object->availability) { // Show availability conditions - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("AvailabilityPeriod").':'; $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetTextColor(0, 0, 0); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_availability = $outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : ''); $lib_availability = str_replace('\n', "\n", $lib_availability); @@ -1035,12 +1039,12 @@ class pdf_eratosthene extends ModelePDFCommandes if ($object->mode_reglement_code && $object->mode_reglement_code != 'CHQ' && $object->mode_reglement_code != 'VIR') { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentMode").':'; $pdf->MultiCell(80, 5, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); @@ -1052,8 +1056,6 @@ class pdf_eratosthene extends ModelePDFCommandes if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { // Si mode reglement non force ou si force a CHQ if (!empty($conf->global->FACTURE_CHQ_NUMBER)) { - $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); - if ($conf->global->FACTURE_CHQ_NUMBER > 0) { $account = new Account($this->db); $account->fetch($conf->global->FACTURE_CHQ_NUMBER); @@ -1896,7 +1898,7 @@ class pdf_eratosthene extends ModelePDFCommandes 'width' => 26, // in mm 'status' => empty($conf->global->PDF_PROPAL_HIDE_PRICE_EXCL_TAX) ? true : false, 'title' => array( - 'textkey' => 'TotalHT' + 'textkey' => 'TotalHTShort' ), 'border-left' => true, // add left line separator ); @@ -1907,7 +1909,7 @@ class pdf_eratosthene extends ModelePDFCommandes 'width' => 26, // in mm 'status' => empty($conf->global->PDF_PROPAL_SHOW_PRICE_INCL_TAX) ? false : true, 'title' => array( - 'textkey' => 'TotalTTC' + 'textkey' => 'TotalTTCShort' ), 'border-left' => true, // add left line separator ); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 36a6bb74e84..a0aa602b9c7 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -191,8 +191,8 @@ class pdf_crabe extends ModelePDFFactures $this->posxqty = 135; $this->posxunit = 151; } else { - $this->posxtva = 110; - $this->posxup = 126; + $this->posxtva = 106; + $this->posxup = 122; $this->posxqty = 145; $this->posxunit = 162; } @@ -1793,7 +1793,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->postotalht - 1, $tab_top + 1); - $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C'); + $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHTShort"), '', 'C'); } } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 625e248895d..0f671ab6388 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -2587,7 +2587,7 @@ class pdf_sponge extends ModelePDFFactures 'width' => 19, // in mm 'status' => false, 'title' => array( - 'textkey' => 'Progress' + 'textkey' => 'ProgressShort' ), 'border-left' => true, // add left line separator ); @@ -2630,7 +2630,7 @@ class pdf_sponge extends ModelePDFFactures 'width' => 26, // in mm 'status' => empty($conf->global->PDF_PROPAL_HIDE_PRICE_EXCL_TAX) ? true : false, 'title' => array( - 'textkey' => 'TotalHT' + 'textkey' => 'TotalHTShort' ), 'border-left' => true, // add left line separator ); @@ -2641,7 +2641,7 @@ class pdf_sponge extends ModelePDFFactures 'width' => 26, // in mm 'status' => empty($conf->global->PDF_PROPAL_SHOW_PRICE_INCL_TAX) ? false : true, 'title' => array( - 'textkey' => 'TotalTTC' + 'textkey' => 'TotalTTCShort' ), 'border-left' => true, // add left line separator ); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 640e3ea70bd..093a8c5b6be 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -48,6 +48,11 @@ class pdf_azur extends ModelePDFPropales */ public $db; + /** + * @var int The environment ID when using a multicompany module + */ + public $entity; + /** * @var string model name */ @@ -925,9 +930,11 @@ class pdf_azur extends ModelePDFPropales $pdf->SetFont('', '', $default_font_size - 1); + $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); + // If France, show VAT mention if not applicable if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); @@ -944,23 +951,23 @@ class pdf_azur extends ModelePDFPropales // Show shipping date if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':'; $pdf->MultiCell(80, 4, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size -$diffsizetitle); $pdf->SetXY($posxval, $posy); $dlp = dol_print_date($object->delivery_date, $displaydate, false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; } elseif ($object->availability_code || $object->availability) { // Show availability conditions - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("AvailabilityPeriod").':'; $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetTextColor(0, 0, 0); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_availability = $outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset($object->availability); $lib_availability = str_replace('\n', "\n", $lib_availability); @@ -980,12 +987,12 @@ class pdf_azur extends ModelePDFPropales $shipping_method_code = dol_getIdFromCode($this->db, $shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); $shipping_method_label = dol_getIdFromCode($this->db, $shipping_method_id, 'c_shipment_mode', 'rowid', 'libelle'); - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("SendingMethod").':'; $pdf->MultiCell(43, 4, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_condition_paiement = ($outputlangs->transnoentities("SendingMethod".strtoupper($shipping_method_code)) != "SendingMethod".strtoupper($shipping_method_code)) ? $outputlangs->trans("SendingMethod".strtoupper($shipping_method_code)) : $shipping_method_label; $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); @@ -996,12 +1003,12 @@ class pdf_azur extends ModelePDFPropales // Show payments conditions if (empty($conf->global->PROPOSAL_PDF_HIDE_PAYMENTTERM) && $object->cond_reglement_code) { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; $pdf->MultiCell(43, 4, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); @@ -1018,11 +1025,11 @@ class pdf_azur extends ModelePDFPropales if ($object->mode_reglement_code && $object->mode_reglement_code != 'CHQ' && $object->mode_reglement_code != 'VIR') { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentMode").':'; $pdf->MultiCell(80, 5, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); @@ -1034,8 +1041,6 @@ class pdf_azur extends ModelePDFPropales if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { // Si mode reglement non force ou si force a CHQ if (getDolGlobalInt('FACTURE_CHQ_NUMBER')) { - $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); - if ($conf->global->FACTURE_CHQ_NUMBER > 0) { $account = new Account($this->db); $account->fetch(getDolGlobalInt('FACTURE_CHQ_NUMBER')); @@ -1471,7 +1476,7 @@ class pdf_azur extends ModelePDFPropales } if (empty($hidetop)) { $pdf->SetXY($this->postotalht - 1, $tab_top + 1); - $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C'); + $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHTShort"), '', 'C'); } } diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 0ada74b27a6..24ccb210f12 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1035,9 +1035,11 @@ class pdf_cyan extends ModelePDFPropales $pdf->SetFont('', '', $default_font_size - 1); + $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); + // If France, show VAT mention if not applicable if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); @@ -1054,23 +1056,23 @@ class pdf_cyan extends ModelePDFPropales // Show shipping date if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':'; $pdf->MultiCell(80, 4, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $dlp = dol_print_date($object->delivery_date, $displaydate, false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; } elseif ($object->availability_code || $object->availability) { // Show availability conditions - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("AvailabilityPeriod").':'; $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetTextColor(0, 0, 0); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_availability = $outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset($object->availability); $lib_availability = str_replace('\n', "\n", $lib_availability); @@ -1090,12 +1092,12 @@ class pdf_cyan extends ModelePDFPropales $shipping_method_code = dol_getIdFromCode($this->db, $shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); $shipping_method_label = dol_getIdFromCode($this->db, $shipping_method_id, 'c_shipment_mode', 'rowid', 'libelle'); - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("SendingMethod").':'; $pdf->MultiCell(43, 4, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_condition_paiement = ($outputlangs->transnoentities("SendingMethod".strtoupper($shipping_method_code)) != "SendingMethod".strtoupper($shipping_method_code)) ? $outputlangs->trans("SendingMethod".strtoupper($shipping_method_code)) : $shipping_method_label; $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); @@ -1106,12 +1108,12 @@ class pdf_cyan extends ModelePDFPropales // Show payments conditions if (empty($conf->global->PROPOSAL_PDF_HIDE_PAYMENTTERM) && $object->cond_reglement_code) { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; $pdf->MultiCell(43, 4, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); @@ -1128,11 +1130,11 @@ class pdf_cyan extends ModelePDFPropales if ($object->mode_reglement_code && $object->mode_reglement_code != 'CHQ' && $object->mode_reglement_code != 'VIR') { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentMode").':'; $pdf->MultiCell(80, 5, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); @@ -1144,8 +1146,6 @@ class pdf_cyan extends ModelePDFPropales if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { // Si mode reglement non force ou si force a CHQ if (getDolGlobalInt('FACTURE_CHQ_NUMBER')) { - $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); - if ($conf->global->FACTURE_CHQ_NUMBER > 0) { $account = new Account($this->db); $account->fetch(getDolGlobalInt('FACTURE_CHQ_NUMBER')); @@ -2039,7 +2039,7 @@ class pdf_cyan extends ModelePDFPropales 'width' => 26, // in mm 'status' => empty($conf->global->PDF_PROPAL_HIDE_PRICE_EXCL_TAX) ? true : false, 'title' => array( - 'textkey' => 'TotalHT' + 'textkey' => 'TotalHTShort' ), 'border-left' => true, // add left line separator ); @@ -2050,7 +2050,7 @@ class pdf_cyan extends ModelePDFPropales 'width' => 26, // in mm 'status' => empty($conf->global->PDF_PROPAL_SHOW_PRICE_INCL_TAX) ? false : true, 'title' => array( - 'textkey' => 'TotalTTC' + 'textkey' => 'TotalTTCShort' ), 'border-left' => true, // add left line separator ); diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 28f212be994..e0a4e0694dd 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -154,20 +154,24 @@ class pdf_canelle extends ModelePDFSuppliersInvoices // Define column position $this->posxdesc = $this->marge_gauche + 1; - $this->posxtva = 112; - $this->posxup = 126; - $this->posxqty = 145; - $this->posxunit = 162; - $this->posxdiscount = 162; - $this->postotalht = 174; if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->posxtva = 99; $this->posxup = 114; $this->posxqty = 130; $this->posxunit = 147; + } else { + $this->posxtva = 106; + $this->posxup = 122; + $this->posxqty = 145; + $this->posxunit = 162; } - //if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; + $this->posxdiscount = 162; + $this->postotalht = 174; + + /* if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || !empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) { + $this->posxtva = $this->posxup; + } */ $this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) { // To work with US executive format $this->posxpicture -= 20; diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 33edd09b7b7..c6e8434c955 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -890,9 +890,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders global $conf, $mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); + $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); + // If France, show VAT mention if not applicable if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); @@ -903,12 +905,12 @@ class pdf_cornas extends ModelePDFSuppliersOrders // Show payments conditions if (!empty($object->cond_reglement_code) || $object->cond_reglement) { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; $pdf->MultiCell(80, 4, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); @@ -919,12 +921,12 @@ class pdf_cornas extends ModelePDFSuppliersOrders // Show payment mode if (!empty($object->mode_reglement_code)) { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentMode").':'; $pdf->MultiCell(80, 5, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 1a0f2e7a687..31cee8d94ed 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -175,8 +175,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $this->posxqty = 132; $this->posxunit = 147; } else { - $this->posxtva = 110; - $this->posxup = 126; + $this->posxtva = 106; + $this->posxup = 122; $this->posxqty = 145; $this->posxunit = 162; } @@ -772,9 +772,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders global $conf, $mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); + $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); + // If France, show VAT mention if not applicable if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); @@ -785,12 +787,12 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Show payments conditions if (!empty($object->cond_reglement_code) || $object->cond_reglement_id) { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; $pdf->MultiCell(80, 4, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); @@ -801,12 +803,12 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Show payment mode if (!empty($object->mode_reglement_code)) { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentMode").':'; $pdf->MultiCell(80, 5, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 0142639a3b6..95b661364ad 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -164,18 +164,20 @@ class pdf_aurore extends ModelePDFSupplierProposal // Define position of columns $this->posxdesc = $this->marge_gauche + 1; - $this->posxdiscount = 162; - $this->postotalht = 174; if (getDolGlobalInt('PRODUCT_USE_UNITS')) { + //$this->posxtva = 101; $this->posxup = 112; $this->posxqty = 135; $this->posxunit = 151; } else { - $this->posxup = 120; + //$this->posxtva = 106; + $this->posxup = 122; $this->posxqty = 145; $this->posxunit = 162; } + $this->posxdiscount = 162; + $this->postotalht = 174; $this->posxpicture = $this->posxup - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) { // To work with US executive format @@ -759,6 +761,8 @@ class pdf_aurore extends ModelePDFSupplierProposal global $conf; $default_font_size = pdf_getPDFFontSize($outputlangs); + $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); + $pdf->SetFont('', '', $default_font_size - 1); $posxval = 52; @@ -766,11 +770,11 @@ class pdf_aurore extends ModelePDFSupplierProposal // Show shipping date if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':'; $pdf->MultiCell(80, 4, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); @@ -778,11 +782,11 @@ class pdf_aurore extends ModelePDFSupplierProposal $posy = $pdf->GetY() + 1; } else { $outputlangs->load("sendings"); - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':'; $pdf->MultiCell(80, 4, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); //$dlp=dol_print_date($object->delivery_date,"daytext",false,$outputlangs,true); $pdf->MultiCell(80, 4, '', 0, 'L'); @@ -808,12 +812,12 @@ class pdf_aurore extends ModelePDFSupplierProposal // Show payments conditions if (empty($conf->global->SUPPLIER_PROPOSAL_PDF_HIDE_PAYMENTTERMCOND) && ($object->cond_reglement_code || $object->cond_reglement)) { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; $pdf->MultiCell(80, 4, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy); $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); @@ -827,11 +831,11 @@ class pdf_aurore extends ModelePDFSupplierProposal if ($object->mode_reglement_code && $object->mode_reglement_code != 'CHQ' && $object->mode_reglement_code != 'VIR') { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy - 2); $titre = $outputlangs->transnoentities("PaymentMode").':'; $pdf->MultiCell(80, 5, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->SetXY($posxval, $posy - 2); $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); @@ -843,8 +847,6 @@ class pdf_aurore extends ModelePDFSupplierProposal if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { // Si mode reglement non force ou si force a CHQ if (getDolGlobalInt('FACTURE_CHQ_NUMBER')) { - $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); - if ($conf->global->FACTURE_CHQ_NUMBER > 0) { $account = new Account($this->db); $account->fetch(getDolGlobalInt('FACTURE_CHQ_NUMBER')); @@ -1227,7 +1229,7 @@ class pdf_aurore extends ModelePDFSupplierProposal } if (empty($hidetop)) { $pdf->SetXY($this->postotalht - 1, $tab_top + 1); - $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C'); + $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHTShort"), '', 'C'); } } diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 188e60fefb8..7e33d5e8364 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -1,7 +1,7 @@ * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2023 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -143,7 +143,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:con - + diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php index 288f3b8f72e..9b4fa75c751 100644 --- a/htdocs/core/tpl/list_print_total.tpl.php +++ b/htdocs/core/tpl/list_print_total.tpl.php @@ -13,13 +13,28 @@ if (isset($totalarray['pos'])) { while ($i < $totalarray['nbfield']) { $i++; if (!empty($totalarray['pos'][$i])) { - print ''; - if (isset($totalarray['type']) && $totalarray['type'][$i] == 'duration') { - print (!empty($totalarray['val'][$totalarray['pos'][$i]])?convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin'):0); - } else { - print price(!empty($totalarray['val'][$totalarray['pos'][$i]])?$totalarray['val'][$totalarray['pos'][$i]]:0); + switch ($totalarray['type'][$i]) { + case 'duration'; + print ''; + print (!empty($totalarray['val'][$totalarray['pos'][$i]])?convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin'):0); + print ''; + break; + case 'string'; + print ''; + print (!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : ''); + print ''; + break; + case 'stock'; + print ''; + print price2num(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : 0, 'MS'); + print ''; + break; + default; + print ''; + print price(!empty($totalarray['val'][$totalarray['pos'][$i]])?$totalarray['val'][$totalarray['pos'][$i]]:0); + print ''; + break; } - print ''; } else { if ($i == 1) { if (is_null($limit) || $num < $limit) { diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index c1cea5abe7d..1bb3f25e383 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -370,8 +370,8 @@ class Cronjob extends CommonObject $sql .= " ".(!isset($this->unitfrequency) ? 'NULL' : "'".$this->db->escape($this->unitfrequency)."'").","; $sql .= " ".(!isset($this->frequency) ? '0' : ((int) $this->frequency)).","; $sql .= " ".(!isset($this->status) ? '0' : ((int) $this->status)).","; - $sql .= " ".((int) $user->id).","; - $sql .= " ".((int) $user->id).","; + $sql .= " ".($user->id ? (int) $user->id : "NULL").","; + $sql .= " ".($user->id ? (int) $user->id : "NULL").","; $sql .= " ".(!isset($this->note_private) ? 'NULL' : "'".$this->db->escape($this->note_private)."'").","; $sql .= " ".(!isset($this->nbrun) ? '0' : ((int) $this->nbrun)).","; $sql .= " ".(empty($this->maxrun) ? '0' : ((int) $this->maxrun)).","; @@ -900,6 +900,11 @@ class Cronjob extends CommonObject // Clear fields $object->status = self::STATUS_DISABLED; $object->label = $langs->trans("CopyOf").' '.$langs->trans($object->label); + $object->datelastrun = null; + $object->lastresult = ''; + $object->datelastresult = null; + $object->lastoutput = ''; + $object->nbrun = 0; // Create clone $object->context['createfromclone'] = 'createfromclone'; @@ -908,6 +913,7 @@ class Cronjob extends CommonObject // Other options if ($result < 0) { $this->error = $object->error; + $this->errors = $object->errors; $error++; } diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index b83cd35da8f..c008345a61d 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1434,6 +1434,7 @@ class EmailCollector extends CommonObject //$search .= ($search ? ' ' : '').'NOT BODY "'.str_replace('"', '', $rule['rulevalue']).'"'; $searchfilterexcludebody = preg_replace('/^!/', '', $rule['rulevalue']); } else { + // Warning: Google doesn't implement IMAP properly, and only matches whole words, $search .= ($search ? ' ' : '').'BODY "'.str_replace('"', '', $rule['rulevalue']).'"'; } } diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 53b16462651..51e3f06be26 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -105,9 +105,9 @@ class ConferenceOrBooth extends ActionComm public $fields = array( 'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'csslist'=>'left', 'comment'=>"Id"), - 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1', 'autofocusoncreate'=>1), + 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax150', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1', 'autofocusoncreate'=>1), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:(t.usage_organize_event:=:1)', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>52, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'project', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'csslist'=>'tdoverflowmax125', 'css'=>'maxwidth500'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'csslist'=>'tdoverflowmax100', 'css'=>'maxwidth500'), 'note' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3), 'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width100', 'csslist'=>'tdoverflowmax100'), 'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',), diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index fff9a14b78a..5544f790585 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -71,6 +71,7 @@ $pageprev = $page - 1; $pagenext = $page + 1; // Initialize technical objects +$project = new Project($db); $object = new ConferenceOrBooth($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneration/'.$user->id; @@ -155,7 +156,6 @@ if (!$permissiontoread) accessforbidden(); */ if (preg_match('/^set/', $action) && ($projectid > 0 || $projectref) && !empty($user->rights->eventorganization->write)) { - $project = new Project($db); //If "set" fields keys is in projects fields $project_attr=preg_replace('/^set/', '', $action); if (array_key_exists($project_attr, $project->fields)) { @@ -163,6 +163,7 @@ if (preg_match('/^set/', $action) && ($projectid > 0 || $projectref) && !empty($ if ($result < 0) { setEventMessages(null, $project->errors, 'errors'); } else { + $projectid = $project->id; $project->{$project_attr}=GETPOST($project_attr); $result=$project->update($user); if ($result < 0) { @@ -239,7 +240,6 @@ $morejs = array(); $morecss = array(); if ($projectid > 0 || $projectref) { - $project = new Project($db); $result = $project->fetch($projectid, $projectref); if ($result < 0) { setEventMessages(null, $project->errors, 'errors'); @@ -641,6 +641,12 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } +if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); +} +if ($project->id > 0) { + $param .= '&projectid='.((int) $project->id); +} foreach ($search as $key => $val) { if (is_array($search[$key])) { foreach ($search[$key] as $skey) { @@ -656,9 +662,6 @@ foreach ($search as $key => $val) { $param .= '&search_'.$key.'='.urlencode($search[$key]); } } -if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); -} // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index df3c966d3b8..d659769d7a3 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -358,7 +358,6 @@ if (empty($reshook)) { //var_dump($batch_line[2]); if (($totalqty > 0 || !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) && !$error) { // There is at least one thing to ship and no error - //var_dump($_POST);exit; for ($i = 0; $i < $num; $i++) { $qty = "qtyl".$i; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index fd063b40a26..71929f7417d 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -4227,10 +4227,17 @@ function migrate_delete_old_dir($db, $langs, $conf) */ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $force = 0) { + global $user; + if (count($listofmodule) == 0) { return 0; } + if (!is_object($user)) { + include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; + $user = new User($db); // To avoid error during migration + } + dolibarr_install_syslog("upgrade2::migrate_reload_modules force=".$force.", listofmodule=".join(',', array_keys($listofmodule))); foreach ($listofmodule as $moduletoreload => $reloadmode) { // reloadmodule can be 'noboxes', 'newboxdefonly', 'forceactivate' @@ -4544,7 +4551,6 @@ function migrate_user_photospath() include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; $fuser = new User($db); - if (!is_object($user)) { $user = $fuser; // To avoid error during migration } @@ -4631,7 +4637,6 @@ function migrate_user_photospath2() include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; $fuser = new User($db); - if (!is_object($user)) { $user = $fuser; // To avoid error during migration } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index bdab6224cdc..462b265f3d8 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2222,7 +2222,7 @@ ShowProjectLabel=Project Label PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME=Include alias in thirdparty name THIRDPARTY_ALIAS=Name thirdparty - Alias thirdparty ALIAS_THIRDPARTY=Alias thirdparty - Name thirdparty -PDFIn2Languages=Show labels into PDF in 2 different languages +PDFIn2Languages=Show labels in the PDF in 2 different languages (this feature may not work for some couple of languages) PDF_USE_ALSO_LANGUAGE_CODE=If you want to have some texts in your PDF duplicated in 2 different languages in the same generated PDF, you must set here this second language so generated PDF will contains 2 different languages in same page, the one chosen when generating PDF and this one (only few PDF templates support this). Keep empty for 1 language per PDF. PDF_USE_A=Gererate PDF documents with format PDF/A instead of defaut format PDF FafaIconSocialNetworksDesc=Enter here the code of a FontAwesome icon. If you don't know what is FontAwesome, you can use the generic value fa-address-book. diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 0665c507b3c..894c9de4f13 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -146,7 +146,7 @@ OrganizationEventLinkToThirdParty=Link to third party (customer, supplier or par OrganizationEvenLabelName=Public name of the conference or booth NewSuggestionOfBooth=Application for a booth -NewSuggestionOfConference=Application for a conference +NewSuggestionOfConference=Application to hold a conference # # Vote page diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 4ce8d347730..5f9ca0e1f5e 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -200,7 +200,8 @@ TicketAssigned=Ticket is now assigned TicketChangeType=Change type TicketChangeCategory=Change analytic code TicketChangeSeverity=Change severity -TicketAddMessage=Add private message +TicketAddMessage=Add or send a message +TicketAddPrivateMessage=Add a private message MessageSuccessfullyAdded=Ticket added TicketMessageSuccessfullyAdded=Message successfully added TicketMessagesList=Message list diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang index ba39ce47dc2..2bb8168c4c1 100644 --- a/htdocs/langs/fr_FR/projects.lang +++ b/htdocs/langs/fr_FR/projects.lang @@ -242,7 +242,7 @@ OppStatusPENDING=En attente OppStatusWON=Gagné OppStatusLOST=Perdu Budget=Budget -AllowToLinkFromOtherCompany=Permet de lier un élément avec un projet d'une autre société

Valeurs prises en charge :
- Garder vide : peut lier des éléments avec n'importe quel projet de la même société (par défaut)
- "tous" : peut lier des éléments avec n'importe quel projet, même projets d'autres sociétés
- Une liste d'identifiants tiers séparés par des virgules : permet de lier des éléments à n'importe quel projet de ces tiers (Exemple : 123,4795,53)
+AllowToLinkFromOtherCompany=Permet de lier un élément avec un projet d'une autre société

Valeurs prises en charge :
- Garder vide : peut lier des éléments avec n'importe quel projet de la même société (par défaut)
- "all" : peut lier des éléments avec n'importe quel projet, même projets d'autres sociétés
- Une liste d'identifiants tiers séparés par des virgules : permet de lier des éléments à n'importe quel projet de ces tiers (Exemple : 123,4795,53)
LatestProjects=Les %s derniers projets LatestModifiedProjects=Les %s derniers projets modifiés OtherFilteredTasks=Autres tâches filtrées diff --git a/htdocs/langs/fr_FR/ticket.lang b/htdocs/langs/fr_FR/ticket.lang index f7e92aa7066..1b37c50ddb5 100644 --- a/htdocs/langs/fr_FR/ticket.lang +++ b/htdocs/langs/fr_FR/ticket.lang @@ -198,7 +198,8 @@ TicketAssigned=Le ticket est à présent assigné TicketChangeType=Changer le type TicketChangeCategory=Changer le code analytique TicketChangeSeverity=Changer la sévérité -TicketAddMessage=Ajouter un message privé +TicketAddMessage=Ajouter ou envoyer un message +TicketAddPrivateMessage=Ajouter message privé MessageSuccessfullyAdded=Ticket créé TicketMessageSuccessfullyAdded=Message ajouté avec succès TicketMessagesList=Liste des messages diff --git a/htdocs/langs/tr_TR/main.lang b/htdocs/langs/tr_TR/main.lang index 87d13df4e03..aadab943fed 100644 --- a/htdocs/langs/tr_TR/main.lang +++ b/htdocs/langs/tr_TR/main.lang @@ -10,7 +10,7 @@ DIRECTION=ltr # DejaVuSans is for some Eastern languages, some Asian languages and some Arabic languages # freemono is for ru_RU or uk_UA, uz_UZ # freeserif is for Tamil -FONTFORPDF=helvetica +FONTFORPDF=DejaVuSans FONTSIZEFORPDF=10 SeparatorDecimal=, SeparatorThousand=. diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 86eaabcf670..56872c26289 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -370,7 +370,7 @@ $sql = preg_replace('/,\s*$/', '', $sql); // Add HAVING from hooks /* $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint; */ diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 8478a021b34..09c6981508f 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -595,35 +595,60 @@ if ($action == 'create') { print '
'; + $totalarray = array(); + $totalarray['val'] = array (); + $totalarray['pos'] = array (); + $totalarray['type'] = array (); + $totalarray['nbfield'] = 0; + // TODO Create $arrayfields with all fields to show print ''; 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 ''; 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 ''; - print ''; - print ''; - print ''; - if (empty($conf->global->PRODUIT_MULTIPRICES)) { - print ''; - print ''; + $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 ''; // 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 '

'; -print '

'.dol_escape_htmltag($langs->trans("CreateTicket")).'
'; +print '

'.dol_escape_htmltag($langs->trans("CreateTicket")).'
'; print '

'.dol_escape_htmltag($langs->trans("ViewMyTicketList")).'
'; print '
'.img_picto('', 'ticket', 'class="fa-15"').'
'.dol_escape_htmltag($langs->trans("ShowTicketWithTrackId")).'
'; print '
'; diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 513b137d8be..005c671fd43 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -234,6 +234,8 @@ if ($action == "view_ticketlist") { $param .= '&entity='.((int) $entity); } + $param .= '&token='.newToken(); + // Definition of fields for list $arrayfields = array( 't.datec' => array('label' => $langs->trans("Date"), 'checked' => 1), @@ -419,6 +421,7 @@ if ($action == "view_ticketlist") { // Search bar print '
'."\n"; print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 12b319b7589..b6b576747e4 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -171,7 +171,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a if ($object->dao->close($user)) { setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs'); - $url = 'view.php?action=view_ticket&track_id='.GETPOST('track_id', 'alpha').(!empty($entity) && isModEnabled('multicompany')?'&entity='.$entity:''); + $url = 'view.php?action=view_ticket&track_id='.GETPOST('track_id', 'alpha').(!empty($entity) && isModEnabled('multicompany')?'&entity='.$entity:'').'&token='.newToken(); header("Location: ".$url); exit; } else { @@ -380,11 +380,11 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a if ($object->dao->fk_statut < Ticket::STATUS_CLOSED) { // New message - print ''; + print ''; // Close ticket if ($object->dao->fk_statut >= Ticket::STATUS_NOT_READ && $object->dao->fk_statut < Ticket::STATUS_CLOSED) { - print ''; + print ''; } } diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 91a28a6110a..3105a88450b 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -142,7 +142,6 @@ if (!empty($socid)) { $module = 'societe'; $dbtable = '&societe'; } -$result = restrictedArea($user, $module, $objectid, $dbtable); $diroutputmassaction = $conf->supplier_proposal->dir_output.'/temp/massgeneration/'.$user->id; @@ -199,6 +198,10 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +$result = restrictedArea($user, $module, $objectid, $dbtable); + +$permissiontoread = $user->rights->supplier_proposal->lire; +$permissiontodelete = $user->rights->supplier_proposal->supprimer; /* @@ -206,7 +209,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -218,70 +222,65 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } -include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - -// Do we click on purge search criteria ? -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers - $search_categ = ''; - $search_user = ''; - $search_sale = ''; - $search_ref = ''; - $search_societe = ''; - $search_societe_alias = ''; - $search_montant_ht = ''; - $search_montant_vat = ''; - $search_montant_ttc = ''; - $search_multicurrency_code = ''; - $search_multicurrency_tx = ''; - $search_multicurrency_montant_ht = ''; - $search_multicurrency_montant_vat = ''; - $search_multicurrency_montant_ttc = ''; - $search_login = ''; - $search_product_category = ''; - $search_town = ''; - $search_zip = ""; - $search_state = ""; - $search_type = ''; - $search_country = ''; - $search_type_thirdparty = ''; - $search_date_startday = ''; - $search_date_startmonth = ''; - $search_date_startyear = ''; - $search_date_endday = ''; - $search_date_endmonth = ''; - $search_date_endyear = ''; - $search_date_start = ''; - $search_date_end = ''; - $search_date_valid_startday = ''; - $search_date_valid_startmonth = ''; - $search_date_valid_startyear = ''; - $search_date_valid_endday = ''; - $search_date_valid_endmonth = ''; - $search_date_valid_endyear = ''; - $search_date_valid_start = ''; - $search_date_valid_end = ''; - $search_status = ''; - $object_statut = ''; -} - if (empty($reshook)) { + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers + $search_categ = ''; + $search_user = ''; + $search_sale = ''; + $search_ref = ''; + $search_societe = ''; + $search_societe_alias = ''; + $search_montant_ht = ''; + $search_montant_vat = ''; + $search_montant_ttc = ''; + $search_multicurrency_code = ''; + $search_multicurrency_tx = ''; + $search_multicurrency_montant_ht = ''; + $search_multicurrency_montant_vat = ''; + $search_multicurrency_montant_ttc = ''; + $search_login = ''; + $search_product_category = ''; + $search_town = ''; + $search_zip = ""; + $search_state = ""; + $search_type = ''; + $search_country = ''; + $search_type_thirdparty = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; + $search_date_start = ''; + $search_date_end = ''; + $search_date_valid_startday = ''; + $search_date_valid_startmonth = ''; + $search_date_valid_startyear = ''; + $search_date_valid_endday = ''; + $search_date_valid_endmonth = ''; + $search_date_valid_endyear = ''; + $search_date_valid_start = ''; + $search_date_valid_end = ''; + $search_status = ''; + $object_statut = ''; + } + $objectclass = 'SupplierProposal'; $objectlabel = 'SupplierProposals'; - $permissiontoread = $user->rights->supplier_proposal->lire; - $permissiontodelete = $user->rights->supplier_proposal->supprimer; $uploaddir = $conf->supplier_proposal->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } - /* * View */ - -$now = dol_now(); - $form = new Form($db); $formother = new FormOther($db); $formfile = new FormFile($db); @@ -289,14 +288,17 @@ $formpropal = new FormPropal($db); $companystatic = new Societe($db); $formcompany = new FormCompany($db); +$now = dol_now(); + $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $title = $langs->trans('ListOfSupplierProposals'); $help_url = 'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur'; -llxHeader('', $title, $help_url); +// Build and execute select +// -------------------------------------------------------------------- $sql = 'SELECT'; if ($sall || $search_user > 0) { $sql = 'SELECT DISTINCT'; @@ -464,7 +466,7 @@ if (!empty($searchCategoryProductList)) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= $db->order($sortfield, $sortorder); @@ -506,10 +508,14 @@ if ($resql) { $id = $obj->rowid; header("Location: ".DOL_URL_ROOT.'/supplier_proposal/card.php?id='.$id); - exit; } + // Output page + // -------------------------------------------------------------------- + + llxHeader('', $title, $help_url); + $param = ''; if (!empty($mode)) { $param .= '&mode='.urlencode($mode); @@ -709,18 +715,18 @@ if ($resql) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields - if ($massactionbutton) { - $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); - } + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields + $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; - print '
'.dol_print_date($objp->datem).'
'.$langs->trans("Total").''; - $valtoshow = price2num($totalunit, 'MS'); - if (empty($conf->global->PRODUCT_USE_UNITS) || $sameunits) { - print empty($valtoshow) ? '0' : $valtoshow; - } - print ''; - if (empty($conf->global->PRODUCT_USE_UNITS) && $sameunits) { - print $langs->trans($productstatic->getLabelOfUnit()); - } - print ''.price(price2num($totalvalue, 'MT')).' '.price(price2num($totalvaluesell, 'MT')).'  
'; $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 '
'."\n"; + print '
'."\n"; + // Fields title search + // -------------------------------------------------------------------- print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; @@ -865,7 +871,7 @@ if ($resql) { } // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index f1f35f2c73f..4c318197b1e 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -59,6 +59,7 @@ $projectid = GETPOST('projectid', 'int'); $cancel = GETPOST('cancel', 'alpha'); $action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); +$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $contactid = GETPOST('contactid', 'int'); $notifyTiers = GETPOST("notify_tiers_at_create", 'alpha'); @@ -116,6 +117,10 @@ if ($id || $track_id || $ref) { } } +$now = dol_now(); + +$actionobject = new ActionsTicket($db); + // Store current page url $url_page_current = DOL_URL_ROOT.'/ticket/card.php'; @@ -124,13 +129,12 @@ if ($user->socid > 0) $socid = $user->socid; $result = restrictedArea($user, 'ticket', $object->id); $triggermodname = 'TICKET_MODIFY'; -$permissiontoadd = $user->rights->ticket->write; - -$actionobject = new ActionsTicket($db); +$permissiontoread = $user->hasRight('ticket', 'read'); +$permissiontoadd = $user->hasRight('ticket', 'write'); +$permissiontodelete = $user->hasRight('ticket', 'delete'); $upload_dir = $conf->ticket->dir_output; -$now = dol_now(); /* @@ -175,7 +179,7 @@ if (empty($reshook)) { } // Action to add an action (not a message) - if (GETPOST('save', 'alpha') && !empty($user->rights->ticket->write)) { + if (GETPOST('save', 'alpha') && $permissiontoadd) { $error = 0; if (!GETPOST("type_code", 'alpha')) { @@ -313,7 +317,7 @@ if (empty($reshook)) { } } - if ($action == 'update' && $user->rights->ticket->write && $object->status < Ticket::STATUS_CLOSED) { + if ($action == 'update' && $permissiontoadd && $object->status < Ticket::STATUS_CLOSED) { $error = 0; $ret = $object->fetch(GETPOST('id', 'int'), GETPOST('ref', 'alpha'), GETPOST('track_id', 'alpha')); @@ -378,7 +382,7 @@ if (empty($reshook)) { } // Mark as Read - if ($action == "mark_ticket_read" && $user->rights->ticket->write) { + if ($action == "mark_ticket_read" && $permissiontoadd) { $object->fetch('', '', GETPOST("track_id", 'alpha')); if ($object->markAsRead($user) > 0) { @@ -393,7 +397,7 @@ if (empty($reshook)) { } // Assign to someone - if ($action == "assign_user" && GETPOST('btn_assign_user', 'alpha') && $user->rights->ticket->write) { + if ($action == "assign_user" && GETPOST('btn_assign_user', 'alpha') && $permissiontoadd) { $object->fetch('', '', GETPOST("track_id", 'alpha')); $useroriginassign = $object->fk_user_assign; $usertoassign = GETPOST('fk_user_assign', 'int'); @@ -452,7 +456,7 @@ if (empty($reshook)) { // Action to add a message (private or not, with email or not). // This may also send an email (concatenated with email_intro and email footer if checkbox was selected) - if ($action == 'add_message' && GETPOSTISSET('btn_add_message') && $user->rights->ticket->read) { + if ($action == 'add_message' && GETPOSTISSET('btn_add_message') && $permissiontoread) { $ret = $object->newMessage($user, $action, (GETPOST('private_message', 'alpha') == "on" ? 1 : 0), 0); if ($ret > 0) { @@ -470,7 +474,7 @@ if (empty($reshook)) { } } - if (($action == "confirm_close" || $action == "confirm_abandon") && GETPOST('confirm', 'alpha') == 'yes' && $user->rights->ticket->write) { + if (($action == "confirm_close" || $action == "confirm_abandon") && GETPOST('confirm', 'alpha') == 'yes' && $permissiontoadd) { $object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')); if ($object->close($user, ($action == "confirm_abandon" ? 1 : 0))) { @@ -484,7 +488,7 @@ if (empty($reshook)) { } } - if ($action == "confirm_public_close" && GETPOST('confirm', 'alpha') == 'yes') { + if ($action == "confirm_public_close" && GETPOST('confirm', 'alpha') == 'yes' && $permissiontoadd) { $object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')); if ($_SESSION['email_customer'] == $object->origin_email || $_SESSION['email_customer'] == $object->thirdparty->email) { $object->close($user); @@ -502,7 +506,7 @@ if (empty($reshook)) { } } - if ($action == 'confirm_delete_ticket' && GETPOST('confirm', 'alpha') == "yes" && $user->rights->ticket->delete) { + if ($action == 'confirm_delete_ticket' && GETPOST('confirm', 'alpha') == "yes" && $permissiontodelete) { if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { if ($object->delete($user) > 0) { setEventMessages('
'.$langs->trans('TicketDeletedSuccess').'
', null, 'mesgs'); @@ -587,7 +591,7 @@ if (empty($reshook)) { } } } - } elseif ($action == 'classin' && $user->rights->ticket->write) { + } elseif ($action == 'classin' && $permissiontoadd) { // Categorisation dans projet if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { $object->setProject($projectid); @@ -595,7 +599,7 @@ if (empty($reshook)) { header("Location: ".$url); exit(); } - } elseif ($action == 'setcontract' && $user->rights->ticket->write) { + } elseif ($action == 'setcontract' && $permissiontoadd) { // Categorisation dans contrat if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { $object->setContract(GETPOST('contractid', 'int')); @@ -626,7 +630,7 @@ if (empty($reshook)) { } $action = 'view'; - } elseif ($action == 'confirm_set_status' && $user->rights->ticket->write && !GETPOST('cancel')) { + } elseif ($action == 'confirm_set_status' && $permissiontoadd && !GETPOST('cancel')) { // Reopen ticket if ($object->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) { $new_status = GETPOST('new_status', 'int'); @@ -647,7 +651,7 @@ if (empty($reshook)) { } // Action to update one extrafield - if ($action == "update_extras" && !empty($permissiontoadd)) { + if ($action == "update_extras" && $permissiontoadd) { $object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')); $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); @@ -671,7 +675,7 @@ if (empty($reshook)) { } } - if ($action == "change_property" && GETPOST('btn_update_ticket_prop', 'alpha') && $user->rights->ticket->write) { + if ($action == "change_property" && GETPOST('btn_update_ticket_prop', 'alpha') && $permissiontoadd) { $object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')); $object->type_code = GETPOST('update_value_type', 'aZ09'); @@ -695,7 +699,6 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once // Actions to build doc - $permissiontoadd = $user->rights->ticket->write; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; //var_dump($action);exit; @@ -1423,7 +1426,7 @@ if ($action == 'create' || $action == 'presend') { // Show link to add a message (if read and not closed) if (isset($object->status) && $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") { - print dolGetButtonAction('', $langs->trans('TicketAddMessage'), 'default', $_SERVER["PHP_SELF"].'?action=presend_addmessage&mode=init&token='.newToken().'&track_id='.$object->track_id.'#formmailbeforetitle', ''); + print dolGetButtonAction('', $langs->trans('TicketAddPrivateMessage'), 'default', $_SERVER["PHP_SELF"].'?action=presend_addmessage&mode=init&token='.newToken().'&track_id='.$object->track_id.'#formmailbeforetitle', ''); } // Link to create an intervention diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index cf7c1f19a33..2e36775bc0c 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1265,13 +1265,14 @@ class Ticket extends CommonObject /** * Load into a cache array, the list of ticket categories (setup done into dictionary) * - * @return int Number of lines loaded, 0 if already loaded, <0 if KO + * @param int $publicgroup 0=No public group, 1=Public group only, -1=All + * @return int Number of lines loaded, 0 if already loaded, <0 if KO */ - public function loadCacheCategoriesTickets() + public function loadCacheCategoriesTickets($publicgroup = -1) { global $conf, $langs; - if (!empty($this->cache_category_tickets) && count($this->cache_category_tickets)) { + if ($publicgroup == -1 && !empty($this->cache_category_ticket) && count($this->cache_category_tickets)) { // Cache already loaded return 0; } @@ -1279,8 +1280,13 @@ class Ticket extends CommonObject $sql = "SELECT rowid, code, label, use_default, pos, description, public, active, force_severity, fk_parent"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category"; $sql .= " WHERE active > 0 AND entity = ".((int) $conf->entity); + if ($publicgroup > -1) { + $sql .= " AND public = ".((int) $publicgroup); + } $sql .= " ORDER BY pos"; + dol_syslog(get_class($this)."::load_cache_categories_tickets", LOG_DEBUG); + $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -2335,8 +2341,8 @@ class Ticket extends CommonObject * Used for files linked into messages. * Files may be renamed during copy to avoid overwriting existing files. * - * @param string $forcetrackid Force trackid - * @return array Array with final path/name/mime of files. + * @param string $forcetrackid Force trackid used for $keytoavoidconflict into get_attached_files() + * @return array|int Array with final path/name/mime of files. */ public function copyFilesForTicket($forcetrackid = null) { @@ -2356,7 +2362,7 @@ class Ticket extends CommonObject $formmail->trackid = (is_null($forcetrackid) ? 'tic'.$this->id : ''); $attachedfiles = $formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; + $filepath = $attachedfiles['paths']; // path is for example user->dir_temp.'/'.$user->id.'/'... $filename = $attachedfiles['names']; $mimetype = $attachedfiles['mimes']; @@ -2379,16 +2385,23 @@ class Ticket extends CommonObject } $res = dol_move($filepath[$i], $destfile, 0, 1, 0, 1); - - if (image_format_supported($destfile) == 1) { - // Create small thumbs for image (Ratio is near 16/9) - // Used on logon for example - $imgThumbSmall = vignette($destfile, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs"); - // Create mini thumbs for image (Ratio is near 16/9) - // Used on menu or for setup page for example - $imgThumbMini = vignette($destfile, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs"); + if (!$res) { + // Move has failed + $this->error = "Failed to move file ".dirbasename($filepath[$i])." into ".dirbasename($destfile); + return -1; + } else { + // If file is an image, we create thumbs + if (image_format_supported($destfile) == 1) { + // Create small thumbs for image (Ratio is near 16/9) + // Used on logon for example + $imgThumbSmall = vignette($destfile, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs"); + // Create mini thumbs for image (Ratio is near 16/9) + // Used on menu or for setup page for example + $imgThumbMini = vignette($destfile, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs"); + } } + // Clear variables into session $formmail->remove_attached_files($i); // Fill array with new names @@ -2449,11 +2462,11 @@ class Ticket extends CommonObject * Add new message on a ticket (private/public area). * Can also send it by email if GETPOST('send_email', 'int') is set. For such email, header and footer is added. * - * @param User $user User for action - * @param string $action Action string - * @param int $private 1=Message is private. TODO Implement this. What does this means ? - * @param int $public_area 1=Is the public area - * @return int + * @param User $user User for action + * @param string $action Action string + * @param int $private 1=Message is private. TODO Implement this. What does this means ? + * @param int $public_area 1=Is the public area + * @return int <0 if KO, >= 0 if OK */ public function newMessage($user, &$action, $private = 1, $public_area = 0) { @@ -2490,6 +2503,10 @@ class Ticket extends CommonObject // Copy attached files (saved into $_SESSION) as linked files to ticket. Return array with final name used. $resarray = $object->copyFilesForTicket(); + if (is_numeric($resarray) && $resarray == -1) { + setEventMessages($object->error, $object->errors, 'errors'); + return -1; + } $listofpaths = $resarray['listofpaths']; $listofnames = $resarray['listofnames'];
'; + print ''; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; print ''; + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print '