Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/adherents/subscription/list.php
	htdocs/comm/action/index.php
	htdocs/core/modules/propale/doc/pdf_azur.modules.php
	htdocs/core/modules/propale/doc/pdf_cyan.modules.php
	htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
	htdocs/cron/class/cronjob.class.php
	htdocs/eventorganization/class/conferenceorbooth.class.php
	htdocs/modulebuilder/template/myobject_list.php
	htdocs/public/ticket/list.php
	htdocs/supplier_proposal/list.php
	htdocs/ticket/class/ticket.class.php
This commit is contained in:
Laurent Destailleur 2023-05-17 00:57:17 +02:00
commit 476f95c4f6
51 changed files with 536 additions and 378 deletions

View file

@ -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 '<td class="liste_titre">';
$form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth150');
$form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth100');
print '</td>';
}
@ -692,14 +692,14 @@ while ($i < $imaxinloop) {
// Lastname
if (!empty($arrayfields['d.lastname']['checked'])) {
print '<td class="tdoverflowmax150">'.$adherent->getNomUrl(-1, 0, 'card', 'lastname').'</td>';
print '<td class="tdoverflowmax125">'.$adherent->getNomUrl(-1, 0, 'card', 'lastname').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Firstname
if (!empty($arrayfields['d.firstname']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->firstname).'">'.$adherent->firstname.'</td>';
print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($adherent->firstname).'">'.dol_escape_htmltag($adherent->firstname).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -707,7 +707,7 @@ while ($i < $imaxinloop) {
// Login
if (!empty($arrayfields['d.login']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->login).'">'.$adherent->login.'</td>';
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->login).'">'.dol_escape_htmltag($adherent->login).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -716,7 +716,7 @@ while ($i < $imaxinloop) {
// Label
if (!empty($arrayfields['t.libelle']['checked'])) {
print '<td class="tdoverflowmax400" title="'.dol_escape_htmltag($obj->note).'">';
print $obj->note;
print dol_escape_htmltag(dolGetFirstLineOfText($obj->note_private));
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@ -725,7 +725,7 @@ while ($i < $imaxinloop) {
// Banque
if (!empty($arrayfields['d.bank']['checked'])) {
print '<td class="tdmaxoverflow150">';
print '<td class="tdmaxoverflow100">';
if ($obj->fk_account > 0) {
$accountstatic->id = $obj->fk_account;
$accountstatic->fetch($obj->fk_account);

View file

@ -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);
}

View file

@ -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").",";

View file

@ -584,8 +584,16 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
// Local calendar
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_mytasks" name="check_mytasks" value="1" checked disabled> '.$langs->trans("LocalAgenda").' &nbsp; </div>';
// Holiday calendar
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="check_holiday"'.($check_holiday ? ' checked' : '').'><label for="check_holiday"> <span class="check_holiday_text">'.$langs->trans("Holidays").'</span></label> &nbsp; </div>';
if ($user->rights->holiday->read) {
// Holiday calendar
$s .= '
<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="check_holiday"' . ($check_holiday
? ' checked' : '') . '>
<label for="check_holiday">
<span class="check_holiday_text">' . $langs->trans("Holidays") . '</span>
</label> &nbsp;
</div>';
}
// 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++;
}
}

View file

@ -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);

View file

@ -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)

View file

@ -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 .= '<div class="error">'.$mailfile->error.'</div>';
} else {

View file

@ -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();

View file

@ -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;
}
}

View file

@ -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)";
}
}

View file

@ -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 '</td></tr>';
// 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 '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
@ -819,7 +822,7 @@ class FormTicket
if (is_array($ticketstat->cache_category_tickets) && count($ticketstat->cache_category_tickets)) {
foreach ($ticketstat->cache_category_tickets as $id => $arraycategories) {
// Exclude some record
if ($filtertype == 'public=1') {
if ($publicgroups) {
if (empty($arraycategories['public'])) {
continue;
}
@ -1392,7 +1395,7 @@ class FormTicket
print '});
</script>';
print '<form method="post" name="ticket" enctype="multipart/form-data" action="'.$this->param["returnurl"].'">';
print '<form method="post" name="ticket" id="ticket" enctype="multipart/form-data" action="'.$this->param["returnurl"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="'.$this->action.'">';
print '<input type="hidden" name="actionbis" value="add_message">';
@ -1544,6 +1547,14 @@ class FormTicket
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
$out .= '<script nonce="'.getNonce().'" type="text/javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' jQuery("#'.$addfileaction.'").prop("disabled", true);';
$out .= ' jQuery("#addedfile").on("change", function() {';
$out .= ' if (jQuery(this).val().length) {';
$out .= ' jQuery("#'.$addfileaction.'").prop("disabled", false);';
$out .= ' } else {';
$out .= ' jQuery("#'.$addfileaction.'").prop("disabled", true);';
$out .= ' }';
$out .= ' });';
$out .= ' jQuery(".removedfile").click(function() {';
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());';
$out .= ' });';
@ -1637,8 +1648,13 @@ class FormTicket
print '</table>';
print '<center><br>';
print '<input type="submit" class="button" name="btn_add_message" value="'.$langs->trans("Add").'" />';
if ($this->withcancel) {
print '<input type="submit" class="button" name="btn_add_message" value="'.$langs->trans("Add").'"';
// Add a javascript test to avoid to forget to submit file before sending email
if ($this->withfile == 2 && !empty($conf->use_javascript_ajax)) {
print ' onClick="if (document.ticket.addedfile.value != \'\') { alert(\''.dol_escape_js($langs->trans("FileWasNotUploaded")).'\'); return false; } else { return true; }"';
}
print ' />';
if (!empty($this->withcancel)) {
print " &nbsp; &nbsp; ";
print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
}
@ -1647,6 +1663,23 @@ class FormTicket
print '<input type="hidden" name="page_y">'."\n";
print "</form>\n";
// Disable enter key if option MAIN_MAILFORM_DISABLE_ENTERKEY is set
if (!empty($conf->global->MAIN_MAILFORM_DISABLE_ENTERKEY)) {
print '<script type="text/javascript">';
print 'jQuery(document).ready(function () {';
print ' $(document).on("keypress", \'#ticket\', function (e) { /* Note this is called at every key pressed ! */
var code = e.keyCode || e.which;
if (code == 13) {
console.log("Enter was intercepted and blocked");
e.preventDefault();
return false;
}
});';
print '})';
print '</script>';
}
print "<!-- End form TICKET -->\n";
}
}

View file

@ -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.

View file

@ -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

View file

@ -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');
}
}

View file

@ -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
);

View file

@ -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');
}
}

View file

@ -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
);

View file

@ -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');
}
}

View file

@ -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
);

View file

@ -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;

View file

@ -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');

View file

@ -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');

View file

@ -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');
}
}

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
*
* 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<br>Contact:con
<input type="hidden" name="attrname" value="<?php echo $attrname; ?>">
<input type="hidden" name="action" value="update">
<input type="hidden" name="rowid" value="<?php echo (empty($rowid) ? '' : $rowid) ?>">
<input type="hidden" name="enabled" value="<?php echo $extrafields->attributes[$elementtype]['enabled'][$attrname]; ?>">
<input type="hidden" name="enabled" value="<?php echo dol_escape_htmltag($extrafields->attributes[$elementtype]['enabled'][$attrname]); ?>">
<?php print dol_get_fiche_head(); ?>

View file

@ -13,13 +13,28 @@ if (isset($totalarray['pos'])) {
while ($i < $totalarray['nbfield']) {
$i++;
if (!empty($totalarray['pos'][$i])) {
print '<td class="right">';
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 '<td class="right">';
print (!empty($totalarray['val'][$totalarray['pos'][$i]])?convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin'):0);
print '</td>';
break;
case 'string';
print '<td class="left">';
print (!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : '');
print '</td>';
break;
case 'stock';
print '<td class="right">';
print price2num(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : 0, 'MS');
print '</td>';
break;
default;
print '<td class="right">';
print price(!empty($totalarray['val'][$totalarray['pos'][$i]])?$totalarray['val'][$totalarray['pos'][$i]]:0);
print '</td>';
break;
}
print '</td>';
} else {
if ($i == 1) {
if (is_null($limit) || $num < $limit) {

View file

@ -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++;
}

View file

@ -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']).'"';
}
}

View file

@ -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',),

View file

@ -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

View file

@ -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;

View file

@ -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
}

View file

@ -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.

View file

@ -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

View file

@ -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

View file

@ -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é <br> <br> <u> Valeurs prises en charge : </u> <br> - Garder vide : peut lier des éléments avec n'importe quel projet de la même société (par défaut) <br> - "tous" : peut lier des éléments avec n'importe quel projet, même projets d'autres sociétés <br> - 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) <br>
AllowToLinkFromOtherCompany=Permet de lier un élément avec un projet d'une autre société <br> <br> <u> Valeurs prises en charge : </u> <br> - Garder vide : peut lier des éléments avec n'importe quel projet de la même société (par défaut) <br> - "all" : peut lier des éléments avec n'importe quel projet, même projets d'autres sociétés <br> - 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) <br>
LatestProjects=Les %s derniers projets
LatestModifiedProjects=Les %s derniers projets modifiés
OtherFilteredTasks=Autres tâches filtrées

View file

@ -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

View file

@ -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=.

View file

@ -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;
*/

View file

@ -595,35 +595,60 @@ if ($action == 'create') {
print '<br>';
$totalarray = array();
$totalarray['val'] = array ();
$totalarray['pos'] = array ();
$totalarray['type'] = array ();
$totalarray['nbfield'] = 0;
// TODO Create $arrayfields with all fields to show
print '<table class="noborder centpercent">';
print "<tr class=\"liste_titre\">";
$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", "&amp;id=".$id, "", "", $sortfield, $sortorder);
print_liste_field_titre("Label", "", "p.label", "&amp;id=".$id, "", "", $sortfield, $sortorder);
print_liste_field_titre("NumberOfUnit", "", "ps.reel", "&amp;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", "&amp;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", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
$totalarray['nbfield']++;
print_liste_field_titre("EstimatedStockValueShort", "", "", "&amp;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", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
$totalarray['nbfield']++;
}
if (empty($conf->global->PRODUIT_MULTIPRICES)) {
print_liste_field_titre("EstimatedStockValueSellShort", "", "", "&amp;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 "</tr>\n";
@ -708,7 +733,7 @@ if ($action == 'create') {
//print '<td>'.dol_print_date($objp->datem).'</td>';
print '<tr class="oddeven">';
$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 '<tr class="liste_total"><td class="liste_total" colspan="2">'.$langs->trans("Total").'</td>';
print '<td class="liste_total right">';
$valtoshow = price2num($totalunit, 'MS');
if (empty($conf->global->PRODUCT_USE_UNITS) || $sameunits) {
print empty($valtoshow) ? '0' : $valtoshow;
}
print '</td>';
print '<td class="liste_total">';
if (empty($conf->global->PRODUCT_USE_UNITS) && $sameunits) {
print $langs->trans($productstatic->getLabelOfUnit());
}
print '</td>';
print '<td class="liste_total right">'.price(price2num($totalvalue, 'MT')).'</td>';
if (empty($conf->global->PRODUIT_MULTIPRICES)) {
print '<td class="liste_total">&nbsp;</td>';
print '<td class="liste_total right">'.price(price2num($totalvaluesell, 'MT')).'</td>';
$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 '<td class="liste_total">&nbsp;</td>';
}
if ($user->rights->stock->creer) {
print '<td class="liste_total">&nbsp;</td>';
}
print '</tr>';
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
} else {
dol_print_error($db);
}

View file

@ -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;
}

View file

@ -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 '<td class="left" width="200">';
$tooltiponprofit = $langs->trans("ProfitIsCalculatedWith")."<br>\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 = '';

View file

@ -826,7 +826,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
print '</tr>';
// 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;
}

View file

@ -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) {

View file

@ -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) {

View file

@ -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');

View file

@ -86,7 +86,7 @@ print '<p style="text-align: center">'.(getDolGlobalString("TICKET_PUBLIC_TEXT_H
print '<br>';
print '<div class="ticketform">';
print '<a href="'.DOL_URL_ROOT.'/public/ticket/create_ticket.php?action=create'.(!empty($entity) && isModEnabled('multicompany')?'&entity='.$entity:'').'" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_create bigrounded"><span class="fa fa-15 fa-plus-circle valignmiddle btnTitle-icon"></span><br>'.dol_escape_htmltag($langs->trans("CreateTicket")).'</div></a>';
print '<a href="'.DOL_URL_ROOT.'/public/ticket/create_ticket.php?action=create'.(!empty($entity) && isModEnabled('multicompany')?'&entity='.$entity:'').'&token='.newToken().'" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_create bigrounded"><span class="fa fa-15 fa-plus-circle valignmiddle btnTitle-icon"></span><br>'.dol_escape_htmltag($langs->trans("CreateTicket")).'</div></a>';
print '<a href="list.php'.(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'').'" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_display bigrounded"><span class="fa fa-15 fa-list-alt valignmiddle btnTitle-icon"></span><br>'.dol_escape_htmltag($langs->trans("ViewMyTicketList")).'</div></a>';
print '<a href="view.php'.(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'').'" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_display bigrounded">'.img_picto('', 'ticket', 'class="fa-15"').'<br>'.dol_escape_htmltag($langs->trans("ShowTicketWithTrackId")).'</div></a>';
print '<div class="clearboth"></div>';

View file

@ -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 '<form method="POST" action="'.$_SERVER['PHP_SELF'].(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'').'" id="searchFormList" >'."\n";
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="view_ticketlist">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';

View file

@ -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 '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=presend&mode=init&track_id='.$object->dao->track_id.(!empty($entity) && isModEnabled('multicompany')?'&entity='.$entity:'').'">'.$langs->trans('TicketAddMessage').'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=presend&mode=init&track_id='.$object->dao->track_id.(!empty($entity) && isModEnabled('multicompany')?'&entity='.$entity:'').'&token='.newToken().'">'.$langs->trans('TicketAddMessage').'</a></div>';
// Close ticket
if ($object->dao->fk_statut >= Ticket::STATUS_NOT_READ && $object->dao->fk_statut < Ticket::STATUS_CLOSED) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=close&token='.newToken().'&track_id='.$object->dao->track_id.(!empty($entity) && isModEnabled('multicompany')?'&entity='.$entity:'').'">'.$langs->trans('CloseTicket').'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=close&track_id='.$object->dao->track_id.(!empty($entity) && isModEnabled('multicompany')?'&entity='.$entity:'').'&token='.newToken().'">'.$langs->trans('CloseTicket').'</a></div>';
}
}

View file

@ -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 '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
// Fields title search
// --------------------------------------------------------------------
print '<tr class="liste_titre_filter">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre middle">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons('left');
print $searchpicto;
print '</td>';
@ -865,7 +871,7 @@ if ($resql) {
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre middle">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';

View file

@ -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('<div class="confirm">'.$langs->trans('TicketDeletedSuccess').'</div>', 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

View file

@ -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'];