Merge branch 'develop' into 15a8

This commit is contained in:
Laurent Destailleur 2021-09-09 19:26:01 +02:00 committed by GitHub
commit 875b93aff2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
269 changed files with 5327 additions and 1977 deletions

View File

@ -212,7 +212,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " ".(!isset($this->position) ? 'NULL' : ((int) $this->position)).",";
$sql .= " ".(!isset($this->fk_country) ? 'NULL' : ((int) $this->fk_country)).",";
$sql .= " ".(!isset($this->active) ? 'NULL' : ((int) $this->active));
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ")";
$this->db->begin();

View File

@ -274,7 +274,7 @@ class AccountingAccount extends CommonObject
$sql .= ", reconcilable";
$sql .= ") VALUES (";
$sql .= " '".$this->db->idate($now)."'";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ", ".(empty($this->fk_pcg_version) ? 'NULL' : "'".$this->db->escape($this->fk_pcg_version)."'");
$sql .= ", ".(empty($this->pcg_type) ? 'NULL' : "'".$this->db->escape($this->pcg_type)."'");
$sql .= ", ".(empty($this->account_number) ? 'NULL' : "'".$this->db->escape($this->account_number)."'");
@ -282,7 +282,7 @@ class AccountingAccount extends CommonObject
$sql .= ", ".(empty($this->label) ? "''" : "'".$this->db->escape($this->label)."'");
$sql .= ", ".(empty($this->labelshort) ? "''" : "'".$this->db->escape($this->labelshort)."'");
$sql .= ", ".(empty($this->account_category) ? 0 : (int) $this->account_category);
$sql .= ", ".$user->id;
$sql .= ", ".((int) $user->id);
$sql .= ", ".(int) $this->active;
$sql .= ", ".(int) $this->reconcilable;
$sql .= ")";

View File

@ -382,9 +382,9 @@ class BookKeeping extends CommonObject
$sql .= ", '".$this->db->escape($this->numero_compte)."'";
$sql .= ", ".(!empty($this->label_compte) ? ("'".$this->db->escape($this->label_compte)."'") : "NULL");
$sql .= ", '".$this->db->escape($this->label_operation)."'";
$sql .= ", ".$this->debit;
$sql .= ", ".$this->credit;
$sql .= ", ".$this->montant;
$sql .= ", ".((float) $this->debit);
$sql .= ", ".((float) $this->credit);
$sql .= ", ".((float) $this->montant);
$sql .= ", ".(!empty($this->sens) ? ("'".$this->db->escape($this->sens)."'") : "NULL");
$sql .= ", '".$this->db->escape($this->fk_user_author)."'";
$sql .= ", '".$this->db->idate($now)."'";
@ -893,9 +893,7 @@ class BookKeeping extends CommonObject
$sql .= ' ORDER BY t.numero_compte ASC';
}
if (!empty($sortfield)) {
$sql .= ", ".$sortfield." ".$sortorder;
}
$sql .= $this->db->order($sortfield, $sortorder);
if (!empty($limit)) {
$sql .= $this->db->plimit($limit + 1, $offset);
}

View File

@ -610,7 +610,7 @@ if (empty($action) || $action == 'view') {
$userstatic->id = $tabuser[$key]['id'];
$userstatic->name = $tabuser[$key]['name'];
print "<td>".$userstatic->getNomUrl(0, 'user', 16).' - '.$accountingaccount->label."</td>";
print '<td class="right nowraponall amount amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print "</tr>";
}

View File

@ -205,16 +205,16 @@ print '<td>'.$langs->trans("Description").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
// Login/Pass required for members
print '<tr class="oddeven"><td>'.$langs->trans("AdherentLoginRequired").'</td><td>';
print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (!empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED) ? 0 : 1), 1);
print "</td></tr>\n";
// Mail required for members
print '<tr class="oddeven"><td>'.$langs->trans("AdherentMailRequired").'</td><td>';
print $form->selectyesno('ADHERENT_MAIL_REQUIRED', (!empty($conf->global->ADHERENT_MAIL_REQUIRED) ? $conf->global->ADHERENT_MAIL_REQUIRED : 0), 1);
print "</td></tr>\n";
// Login/Pass required for members
print '<tr class="oddeven"><td>'.$langs->trans("AdherentLoginRequired").'</td><td>';
print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (!empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED) ? 0 : 1), 1);
print "</td></tr>\n";
// Send mail information is on by default
print '<tr class="oddeven"><td>'.$langs->trans("MemberSendInformationByMailByDefault").'</td><td>';
print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? $conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL : 0), 1);

View File

@ -124,8 +124,23 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT.'/adherents/list.php';
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist;
} else {
$backtopage = DOL_URL_ROOT.'/adherents/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
}
}
}
if ($cancel) {
if (!empty($backtopage)) {
if (!empty($backtopageforcancel)) {
header("Location: ".$backtopageforcancel);
exit;
} elseif (!empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
@ -1937,7 +1952,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (!empty($conf->societe->enabled) && !$object->socid) {
if ($user->rights->societe->creer) {
if (Adherent::STATUS_DRAFT != $object->statut) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty">'.$langs->trans("CreateDolibarrThirdParty").'</a>'."\n";
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty" title="'.dol_escape_htmltag($langs->trans("CreateDolibarrThirdPartyDesc")).'">'.$langs->trans("CreateDolibarrThirdParty").'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrThirdParty").'</a>'."\n";
}
@ -1950,7 +1965,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (!$user->socid && !$object->user_id) {
if ($user->rights->user->user->creer) {
if (Adherent::STATUS_DRAFT != $object->statut) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a>'."\n";
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_user" title="'.dol_escape_htmltag($langs->trans("CreateDolibarrLoginDesc")).'">'.$langs->trans("CreateDolibarrLogin").'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrLogin").'</a>'."\n";
}

View File

@ -574,7 +574,7 @@ class Adherent extends CommonObject
$sql .= ", ".($this->login ? "'".$this->db->escape($this->login)."'" : "null");
$sql .= ", ".($user->id > 0 ? $user->id : "null"); // Can be null because member can be created by a guest or a script
$sql .= ", null, null, '".$this->db->escape($this->morphy)."'";
$sql .= ", ".$this->typeid;
$sql .= ", ".((int) $this->typeid);
$sql .= ", ".$conf->entity;
$sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null");
$sql .= ")";

View File

@ -602,7 +602,7 @@ if ($user->rights->societe->creer) {
if ($user->rights->adherent->creer && $user->rights->user->user->creer) {
$arrayofmassactions['createexternaluser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("CreateExternalUser");
}
if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) {
if (in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) {
$arrayofmassactions = array();
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
@ -962,7 +962,8 @@ while ($i < min($num, $limit)) {
// Firstname
if (!empty($arrayfields['d.firstname']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).'">';
print $obj->firstname;
print $memberstatic->getNomUrl(0, 0, 'card', 'fistname');
//print $obj->firstname;
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
@ -971,7 +972,8 @@ while ($i < min($num, $limit)) {
// Lastname
if (!empty($arrayfields['d.lastname']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).'">';
print $obj->lastname;
print $memberstatic->getNomUrl(0, 0, 'card', 'lastname');
//print $obj->lastname;
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
@ -1101,7 +1103,9 @@ while ($i < min($num, $limit)) {
}
// EMail
if (!empty($arrayfields['d.email']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->email).'">'.dol_print_email($obj->email, 0, 0, 1)."</td>\n";
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->email).'">';
print dol_print_email($obj->email, 0, 0, 1, 64, 1, 1);
print "</td>\n";
}
// End of subscription date
$datefin = $db->jdate($obj->datefin);

View File

@ -209,7 +209,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
// Subscription informations
$datesubscription = 0;
$datesubend = 0;
$paymentdate = ''; // Do not use 0 here, default value is '' that means not filled where 0 means 1970-01-01
$paymentdate = ''; // Do not use 0 here, default value is '' that means not filled where 0 means 1970-01-01
if (GETPOST("reyear", "int") && GETPOST("remonth", "int") && GETPOST("reday", "int")) {
$datesubscription = dol_mktime(0, 0, 0, GETPOST("remonth", "int"), GETPOST("reday", "int"), GETPOST("reyear", "int"));
}

View File

@ -41,8 +41,7 @@ if (!$user->admin) {
$langs->loadLangs(array('agenda', 'admin', 'other'));
$def = array();
$actiontest = GETPOST('test', 'alpha');
$actionsave = GETPOST('save', 'alpha');
$action = GETPOST('action', 'alpha');
if (empty($conf->global->AGENDA_EXT_NB)) {
$conf->global->AGENDA_EXT_NB = 5;
@ -57,14 +56,57 @@ $colorlist = array('BECEDD', 'DDBECE', 'BFDDBE', 'F598B4', 'F68654', 'CBF654', '
* Actions
*/
if ($actionsave) {
$error = 0;
$errors = array();
if (preg_match('/set_(.*)/', $action, $reg)) {
$db->begin();
$code = $reg[1];
$value = (GETPOST($code) ? GETPOST($code) : 1);
$res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
$errors[] = $db->lasterror();
}
if ($error) {
$db->rollback();
setEventMessages('', $errors, 'errors');
} else {
$db->commit();
setEventMessage($langs->trans('SetupSaved'));
header('Location: ' . $_SERVER["PHP_SELF"]);
exit();
}
} elseif (preg_match('/del_(.*)/', $action, $reg)) {
$db->begin();
$code = $reg[1];
$res = dolibarr_del_const($db, $code, $conf->entity);
if (!$res > 0) {
$error++;
$errors[] = $db->lasterror();
}
if ($error) {
$db->rollback();
setEventMessages('', $errors, 'errors');
} else {
$db->commit();
setEventMessage($langs->trans('SetupSaved'));
header('Location: ' . $_SERVER["PHP_SELF"]);
exit();
}
} elseif ($action == 'save') {
$db->begin();
$disableext = GETPOST('AGENDA_DISABLE_EXT', 'alpha');
$res = dolibarr_set_const($db, 'AGENDA_DISABLE_EXT', $disableext, 'chaine', 0, '', $conf->entity);
$i = 1; $errorsaved = 0;
$error = 0;
// Save agendas
while ($i <= $MAXAGENDA) {
@ -159,6 +201,10 @@ print dol_get_fiche_head($head, 'extsites', $langs->trans("Agenda"), -1, 'action
print '<span class="opacitymedium">'.$langs->trans("AgendaExtSitesDesc")."</span><br>\n";
print "<br>\n";
$selectedvalue=$conf->global->AGENDA_DISABLE_EXT;
if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1;
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
@ -203,31 +249,44 @@ print "<td>".$langs->trans("Name")."</td>";
print "<td>".$langs->trans("ExtSiteUrlAgenda")." (".$langs->trans("Example").': http://yoursite/agenda/agenda.ics)</td>';
print "<td>".$form->textwithpicto($langs->trans("FixTZ"), $langs->trans("FillFixTZOnlyIfRequired"), 1).'</td>';
print '<td class="right">'.$langs->trans("Color").'</td>';
print '<td class="right">'.$langs->trans("ActiveByDefault").'</td>';
print "</tr>";
$i = 1;
while ($i <= $MAXAGENDA) {
$key = $i;
$name = 'AGENDA_EXT_NAME'.$key;
$src = 'AGENDA_EXT_SRC'.$key;
$offsettz = 'AGENDA_EXT_OFFSETTZ'.$key;
$color = 'AGENDA_EXT_COLOR'.$key;
$enabled = 'AGENDA_EXT_ENABLED'.$key;
$name = 'AGENDA_EXT_NAME' . $key;
$src = 'AGENDA_EXT_SRC' . $key;
$offsettz = 'AGENDA_EXT_OFFSETTZ' . $key;
$color = 'AGENDA_EXT_COLOR' . $key;
$enabled = 'AGENDA_EXT_ENABLED' . $key;
$default = 'AGENDA_EXT_ACTIVEBYDEFAULT' . $key;
print '<tr class="oddeven">';
// Nb
print '<td width="180" class="nowrap">'.$langs->trans("AgendaExtNb", $key)."</td>";
print '<td width="180" class="nowrap">' . $langs->trans("AgendaExtNb", $key) . "</td>";
// Name
print '<td><input type="text" class="flat hideifnotset" name="AGENDA_EXT_NAME'.$key.'" value="'.(GETPOST('AGENDA_EXT_NAME'.$key) ?GETPOST('AGENDA_EXT_NAME'.$key, 'alpha') : getDolGlobalString($name)).'" size="28"></td>';
print '<td><input type="text" class="flat hideifnotset" name="AGENDA_EXT_NAME' . $key . '" value="' . (GETPOST('AGENDA_EXT_NAME' . $key) ? GETPOST('AGENDA_EXT_NAME' . $key, 'alpha') : getDolGlobalString($name)) . '" size="28"></td>';
// URL
print '<td><input type="url" class="flat hideifnotset" name="AGENDA_EXT_SRC'.$key.'" value="'.(GETPOST('AGENDA_EXT_SRC'.$key) ?GETPOST('AGENDA_EXT_SRC'.$key, 'alpha') : getDolGlobalString($src)).'" size="60"></td>';
print '<td><input type="url" class="flat hideifnotset" name="AGENDA_EXT_SRC' . $key . '" value="' . (GETPOST('AGENDA_EXT_SRC' . $key) ? GETPOST('AGENDA_EXT_SRC' . $key, 'alpha') : getDolGlobalString($src)) . '" size="60"></td>';
// Offset TZ
print '<td><input type="text" class="flat hideifnotset" name="AGENDA_EXT_OFFSETTZ'.$key.'" value="'.(GETPOST('AGENDA_EXT_OFFSETTZ'.$key) ? GETPOST('AGENDA_EXT_OFFSETTZ'.$key) : getDolGlobalString($offsettz)).'" size="2"></td>';
print '<td><input type="text" class="flat hideifnotset" name="AGENDA_EXT_OFFSETTZ' . $key . '" value="' . (GETPOST('AGENDA_EXT_OFFSETTZ' . $key) ? GETPOST('AGENDA_EXT_OFFSETTZ' . $key) : getDolGlobalString($offsettz)) . '" size="2"></td>';
// Color (Possible colors are limited by Google)
print '<td class="nowrap right">';
//print $formadmin->selectColor($conf->global->$color, "google_agenda_color".$key, $colorlist);
print $formother->selectColor((GETPOST("AGENDA_EXT_COLOR".$key) ?GETPOST("AGENDA_EXT_COLOR".$key) : getDolGlobalString($color)), "AGENDA_EXT_COLOR".$key, 'extsitesconfig', 1, '', 'hideifnotset');
print $formother->selectColor((GETPOST("AGENDA_EXT_COLOR" . $key) ? GETPOST("AGENDA_EXT_COLOR" . $key) : getDolGlobalString($color)), "AGENDA_EXT_COLOR" . $key, 'extsitesconfig', 1, '', 'hideifnotset');
print '</td>';
// Calendar active by default
print '<td class="nowrap right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('AGENDA_EXT_ACTIVEBYDEFAULT' . $key);
} else {
if (empty($conf->global->{$default})) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_AGENDA_EXT_ACTIVEBYDEFAULT' . $key . '">' . img_picto($langs->trans("Enabled"), 'on') . '</a>';
} else {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_AGENDA_EXT_ACTIVEBYDEFAULT' . $key . '">' . img_picto($langs->trans("Disabled"), 'off') . '</a>';
}
}
print '</td>';
print "</tr>";
$i++;

View File

@ -499,7 +499,7 @@ print "</tr>\n";
print '</table>';
print dol_get_fiche_end();
$form->buttonsSaveCancel("Save", '');
print $form->buttonsSaveCancel("Save", '');
print "</form>\n";

View File

@ -225,7 +225,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -174,7 +174,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -289,7 +289,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -696,7 +696,7 @@ $tooltiphelp = '';
if ($mysoc->country_code == 'FR') {
$tooltiphelp = '<i>'.$langs->trans("Example").': '.$langs->trans("VATIsUsedExampleFR")."</i>";
}
print "<label for=\"use_vat\">".$form->textwithpicto($langs->trans("VATIsUsedDesc"), $tooltiphelp)."</label>";
print '<label for="use_vat">'.$form->textwithpicto($langs->trans("VATIsUsedDesc"), $tooltiphelp)."</label>";
print "</td></tr>\n";
@ -706,7 +706,7 @@ $tooltiphelp = '';
if ($mysoc->country_code == 'FR') {
$tooltiphelp = "<i>".$langs->trans("Example").': '.$langs->trans("VATIsNotUsedExampleFR")."</i>\n";
}
print "<label for=\"no_vat\">".$form->textwithpicto($langs->trans("VATIsNotUsedDesc"), $tooltiphelp)."</label>";
print '<label for="no_vat">'.$form->textwithpicto($langs->trans("VATIsNotUsedDesc"), $tooltiphelp)."</label>";
print "</td></tr>\n";
print "</table>";
@ -721,12 +721,12 @@ print "</tr>\n";
if ($mysoc->useLocalTax(1)) {
// Note: When option is not set, it must not appears as set on on, because there is no default value for this option
print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax1" id="lt1" value="localtax1on"'.(($conf->global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on") ? " checked" : "")."> ".$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code)."</td>";
print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax1" id="lt1" value="localtax1on"'.(($conf->global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on") ? " checked" : "").'> <label for="lt1">'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code)."</label></td>";
print '<td colspan="2">';
print '<div class="nobordernopadding">';
$tooltiphelp = $langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code);
$tooltiphelp = ($tooltiphelp != "LocalTax1IsUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."</i>\n" : "");
print '<label for="lt1">'.$form->textwithpicto($langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code), $tooltiphelp)."</label>";
print $form->textwithpicto($langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code), $tooltiphelp);
if (!isOnlyOneLocalTax(1)) {
print '<br><label for="lt1">'.$langs->trans("LTRate").'</label>: ';
$formcompany->select_localtax(1, $conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1");
@ -739,11 +739,11 @@ if ($mysoc->useLocalTax(1)) {
print "</div>";
print "</td></tr>\n";
print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax1" id="nolt1" value="localtax1off"'.((empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off") ? " checked" : "")."> ".$langs->transcountry("LocalTax1IsNotUsed", $mysoc->country_code)."</td>";
print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax1" id="nolt1" value="localtax1off"'.((empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off") ? " checked" : "").'> <label for="nolt1">'.$langs->transcountry("LocalTax1IsNotUsed", $mysoc->country_code)."</label></td>";
print '<td colspan="2">';
$tooltiphelp = $langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code);
$tooltiphelp = ($tooltiphelp != "LocalTax1IsNotUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code)."</i>\n" : "");
print "<label for=\"nolt1\">".$form->textwithpicto($langs->transcountry("LocalTax1IsNotUsedDesc", $mysoc->country_code), $tooltiphelp)."</label>";
print $form->textwithpicto($langs->transcountry("LocalTax1IsNotUsedDesc", $mysoc->country_code), $tooltiphelp);
print "</td></tr>\n";
} else {
if (empty($mysoc->country_code)) {
@ -765,7 +765,7 @@ print "</tr>\n";
if ($mysoc->useLocalTax(2)) {
// Note: When option is not set, it must not appears as set on on, because there is no default value for this option
print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax2" id="lt2" value="localtax2on"'.(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on") ? " checked" : "")."> ".$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."</td>";
print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax2" id="lt2" value="localtax2on"'.(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on") ? " checked" : "").'> <label for="lt2">'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."</label></td>";
print '<td colspan="2">';
print '<div class="nobordernopadding">';
print '<label for="lt2">'.$langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)."</label>";
@ -780,7 +780,7 @@ if ($mysoc->useLocalTax(2)) {
print "</div>";
print "</td></tr>\n";
print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax2" id="nolt2" value="localtax2off"'.((empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off") ? " checked" : "")."> ".$langs->transcountry("LocalTax2IsNotUsed", $mysoc->country_code)."</td>";
print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax2" id="nolt2" value="localtax2off"'.((empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off") ? " checked" : "").'> <label for="nolt2">'.$langs->transcountry("LocalTax2IsNotUsed", $mysoc->country_code)."</label></td>";
print '<td colspan="2">';
print "<div>";
$tooltiphelp = $langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code);
@ -803,7 +803,7 @@ print "</table>";
print '<br>';
print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">';
print '<td width="25%">'.$form->textwithpicto($langs->trans("RevenueStamp"), $langs->trans("RevenueStampDesc")).'</td><td>'.$langs->trans("Description").'</td>';
print '<td>'.$form->textwithpicto($langs->trans("RevenueStamp"), $langs->trans("RevenueStampDesc")).'</td><td>'.$langs->trans("Description").'</td>';
print '<td class="right">&nbsp;</td>';
print "</tr>\n";
if ($mysoc->useRevenueStamp()) {

View File

@ -220,7 +220,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -225,7 +225,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -48,8 +48,8 @@ $arrayofparameters = array(
'EVENTORGANIZATION_TASK_LABEL'=>array('type'=>'textarea','enabled'=>1),
'EVENTORGANIZATION_CATEG_THIRDPARTY_CONF'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
'EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
//'EVENTORGANIZATION_FILTERATTENDEES_CAT'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
//'EVENTORGANIZATION_FILTERATTENDEES_TYPE'=>array('type'=>'thirdparty_type:', 'enabled'=>1),
'EVENTORGANIZATION_FILTERATTENDEES_CAT'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
'EVENTORGANIZATION_FILTERATTENDEES_TYPE'=>array('type'=>'thirdparty_type:', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
@ -445,7 +445,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -219,7 +219,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -228,7 +228,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -312,7 +312,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -284,7 +284,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -220,7 +220,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -396,7 +396,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -132,6 +132,7 @@ print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print '<td>'.$langs->trans("Example").'</td>';
print "</tr>\n";
print '<tr class="oddeven"><td>';
@ -140,7 +141,8 @@ print '<input size="32" type="text" name="MAILING_EMAIL_FROM" value="'.$conf->gl
if (!empty($conf->global->MAILING_EMAIL_FROM) && !isValidEmail($conf->global->MAILING_EMAIL_FROM)) {
print ' '.img_warning($langs->trans("BadEMail"));
}
print '</td></tr>';
print '</td><td><span class="opacitymedium">'.dol_escape_htmltag(($mysoc->name ? $mysoc->name : 'MyName').' <noreply@example.com>').'</span></td>';
print '</tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("MailingEMailError").'</td><td>';
@ -148,12 +150,14 @@ print '<input size="32" type="text" name="MAILING_EMAIL_ERRORSTO" value="'.$conf
if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && !isValidEmail($conf->global->MAILING_EMAIL_ERRORSTO)) {
print ' '.img_warning($langs->trans("BadEMail"));
}
print '</td></tr>';
print '</td><td><span class="opacitymedium">webmaster@example.com></span></td>';
print '</tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("MailingDelay").'</td><td>';
print '<input class="width75" type="text" name="MAILING_DELAY" value="'.$conf->global->MAILING_DELAY.'">';
print '</td></tr>';
print '</td><td></td>';
print '</tr>';
// Constant to add salt into the unsubscribe and check read tag.
@ -165,15 +169,17 @@ print '<input size="32" type="text" name="MAILING_EMAIL_UNSUBSCRIBE_KEY" id="MAI
if (!empty($conf->use_javascript_ajax)) {
print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
}
print '</td></tr>';
print '</td><td></td>';
print '</tr>';
// default blacklist from mailing
print '<tr class="oddeven">';
print '<td>' . $langs->trans("DefaultBlacklistMailingStatus") . '</td>';
print '<td>' . $langs->trans("DefaultBlacklistMailingStatus", $langs->transnoentitiesnoconv("No_Email")) . '</td>';
print '<td>';
$blacklist_setting=array(0=>$langs->trans('No'),1=>$langs->trans('Yes'),-1=>$langs->trans('DefaultStatusEmptyMandatory'));
$blacklist_setting=array(0=>$langs->trans('No'), 1=>$langs->trans('Yes'), 2=>$langs->trans('DefaultStatusEmptyMandatory'));
print $form->selectarray("MAILING_CONTACT_DEFAULT_BULK_STATUS", $blacklist_setting, $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS);
print '</td>';
print '<td></td>';
print '</tr>';
@ -181,7 +187,8 @@ if (!empty($conf->use_javascript_ajax) && $conf->global->MAIN_FEATURES_LEVEL >=
print '<tr class="oddeven"><td>';
print $langs->trans("MailAdvTargetRecipients").'</td><td>';
print ajax_constantonoff('EMAILING_USE_ADVANCED_SELECTOR');
print '</td></tr>';
print '</td><td></td>';
print '</tr>';
}
print '</table>';

View File

@ -69,7 +69,7 @@ if ($action == 'updateMask') {
$modele = GETPOST('module', 'alpha');
$mo = new MO($db);
$mrp->initAsSpecimen();
$mo->initAsSpecimen();
// Search template files
$file = ''; $classname = ''; $filefound = 0;
@ -88,7 +88,7 @@ if ($action == 'updateMask') {
$module = new $classname($db);
if ($module->write_file($mrp, $langs) > 0) {
if ($module->write_file($mo, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=mrp&file=SPECIMEN.pdf");
return;
} else {
@ -225,7 +225,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -178,7 +178,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -52,27 +52,60 @@ if ($cancel) {
}
if ($action == 'update') {
if (GETPOSTISSET('MAIN_PDF_FORMAT')) dolibarr_set_const($db, "MAIN_PDF_FORMAT", GETPOST("MAIN_PDF_FORMAT"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PDF_FORMAT')) {
dolibarr_set_const($db, "MAIN_PDF_FORMAT", GETPOST("MAIN_PDF_FORMAT"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PDF_MARGIN_LEFT')) dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", GETPOST("MAIN_PDF_MARGIN_LEFT"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PDF_MARGIN_RIGHT')) dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", GETPOST("MAIN_PDF_MARGIN_TOP"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PDF_MARGIN_BOTTOM')) dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", GETPOST("MAIN_PDF_MARGIN_BOTTOM"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PDF_MARGIN_LEFT')) {
dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", GETPOST("MAIN_PDF_MARGIN_LEFT"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PDF_MARGIN_RIGHT')) {
dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", GETPOST("MAIN_PDF_MARGIN_RIGHT"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PDF_MARGIN_TOP')) {
dolibarr_set_const($db, "MAIN_PDF_MARGIN_TOP", GETPOST("MAIN_PDF_MARGIN_TOP"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PDF_MARGIN_BOTTOM')) {
dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", GETPOST("MAIN_PDF_MARGIN_BOTTOM"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PROFID1_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", GETPOST("MAIN_PROFID1_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PROFID2_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", GETPOST("MAIN_PROFID2_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PROFID3_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", GETPOST("MAIN_PROFID3_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PROFID4_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", GETPOST("MAIN_PROFID4_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PROFID5_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", GETPOST("MAIN_PROFID5_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PROFID6_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", GETPOST("MAIN_PROFID6_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PROFID1_IN_ADDRESS')) {
dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", GETPOST("MAIN_PROFID1_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PROFID2_IN_ADDRESS')) {
dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", GETPOST("MAIN_PROFID2_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PROFID3_IN_ADDRESS')) {
dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", GETPOST("MAIN_PROFID3_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PROFID4_IN_ADDRESS')) {
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", GETPOST("MAIN_PROFID4_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PROFID5_IN_ADDRESS')) {
dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", GETPOST("MAIN_PROFID5_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PROFID6_IN_ADDRESS')) {
dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", GETPOST("MAIN_PROFID6_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PDF_NO_SENDER_FRAME')) dolibarr_set_const($db, "MAIN_PDF_NO_SENDER_FRAME", GETPOST("MAIN_PDF_NO_SENDER_FRAME"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PDF_NO_RECIPENT_FRAME')) dolibarr_set_const($db, "MAIN_PDF_NO_RECIPENT_FRAME", GETPOST("MAIN_PDF_NO_RECIPENT_FRAME"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PDF_NO_SENDER_FRAME')) {
dolibarr_set_const($db, "MAIN_PDF_NO_SENDER_FRAME", GETPOST("MAIN_PDF_NO_SENDER_FRAME"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PDF_NO_RECIPENT_FRAME')) {
dolibarr_set_const($db, "MAIN_PDF_NO_RECIPENT_FRAME", GETPOST("MAIN_PDF_NO_RECIPENT_FRAME"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PDF_HIDE_SENDER_NAME')) dolibarr_set_const($db, "MAIN_PDF_HIDE_SENDER_NAME", GETPOST("MAIN_PDF_HIDE_SENDER_NAME"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PDF_HIDE_SENDER_NAME')) {
dolibarr_set_const($db, "MAIN_PDF_HIDE_SENDER_NAME", GETPOST("MAIN_PDF_HIDE_SENDER_NAME"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", GETPOST("MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) {
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", GETPOST("MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_TVAINTRA_NOT_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", GETPOST("MAIN_TVAINTRA_NOT_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_TVAINTRA_NOT_IN_ADDRESS')) {
dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", GETPOST("MAIN_TVAINTRA_NOT_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
}
if (!empty($conf->projet->enabled)) {
if (GETPOST('PDF_SHOW_PROJECT_REF_OR_LABEL') == 'no') {
@ -87,24 +120,50 @@ if ($action == 'update') {
}
}
if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS')) dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_HIDE_DESC')) dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DESC"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_HIDE_REF')) dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_REF"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS')) {
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_HIDE_DESC')) {
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DESC"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_HIDE_REF')) {
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_REF"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_DOCUMENTS_LOGO_HEIGHT')) dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_INVERT_SENDER_RECIPIENT')) dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", GETPOST("MAIN_INVERT_SENDER_RECIPIENT"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PDF_USE_ISO_LOCATION')) dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", GETPOST("MAIN_PDF_USE_ISO_LOCATION"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PDF_NO_CUSTOMER_CODE')) dolibarr_set_const($db, "MAIN_PDF_NO_CUSTOMER_CODE", GETPOST("MAIN_PDF_NO_CUSTOMER_CODE"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_DOCUMENTS_LOGO_HEIGHT')) {
dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_INVERT_SENDER_RECIPIENT')) {
dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", GETPOST("MAIN_INVERT_SENDER_RECIPIENT"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PDF_USE_ISO_LOCATION')) {
dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", GETPOST("MAIN_PDF_USE_ISO_LOCATION"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PDF_NO_CUSTOMER_CODE')) {
dolibarr_set_const($db, "MAIN_PDF_NO_CUSTOMER_CODE", GETPOST("MAIN_PDF_NO_CUSTOMER_CODE"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) {
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PDF_MAIN_HIDE_SECOND_TAX')) dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_SECOND_TAX"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PDF_MAIN_HIDE_THIRD_TAX')) dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_THIRD_TAX"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PDF_MAIN_HIDE_SECOND_TAX')) {
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_SECOND_TAX"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PDF_MAIN_HIDE_THIRD_TAX')) {
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_THIRD_TAX"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE')) dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('SHOW_SUBPRODUCT_REF_IN_PDF')) dolibarr_set_const($db, "SHOW_SUBPRODUCT_REF_IN_PDF", GETPOST('SHOW_SUBPRODUCT_REF_IN_PDF', 'alpha'), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE')) {
dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('SHOW_SUBPRODUCT_REF_IN_PDF')) {
dolibarr_set_const($db, "SHOW_SUBPRODUCT_REF_IN_PDF", GETPOST('SHOW_SUBPRODUCT_REF_IN_PDF', 'alpha'), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('PDF_SHOW_LINK_TO_ONLINE_PAYMENT')) dolibarr_set_const($db, "PDF_SHOW_LINK_TO_ONLINE_PAYMENT", GETPOST('PDF_SHOW_LINK_TO_ONLINE_PAYMENT', 'alpha'), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('PDF_SHOW_LINK_TO_ONLINE_PAYMENT')) {
dolibarr_set_const($db, "PDF_SHOW_LINK_TO_ONLINE_PAYMENT", GETPOST('PDF_SHOW_LINK_TO_ONLINE_PAYMENT', 'alpha'), 'chaine', 0, '', $conf->entity);
}
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');

View File

@ -268,7 +268,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -225,7 +225,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -249,7 +249,7 @@ foreach ($arrayhandler as $key => $module) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print '<span class="opacitymedium">'.$tmp.'</span>';
}

View File

@ -246,7 +246,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -259,7 +259,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -247,7 +247,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -247,7 +247,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -513,7 +513,7 @@ if ($resql) {
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td class="tdoverflowmax300">'.$obj->name.'</td>'."\n";
print '<td class="tdoverflowmax600" title="'.dol_escape_htmltag($obj->name).'">'.dol_escape_htmltag($obj->name).'</td>'."\n";
print '<td class="tdoverflowmax300">';
if (isASecretKey($obj->name)) {
if (empty($dolibarr_main_prod)) {

View File

@ -266,7 +266,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -541,7 +541,7 @@ if ($mode == 'searchkey') {
print $form->textwithpicto('', $htmltext, 1, 'info');
} elseif (!empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) {
//print $key.'-'.$val;
print '<a class="reposition paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=overwrite&langcode='.urlencode($langcode).'&transkey='.urlencode($key).'">'.img_edit_add($langs->trans("Overwrite")).'</a>';
print '<a class="reposition paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=overwrite&langcode='.urlencode($langcode).'&transkey='.urlencode($key).'">'.img_edit_add($langs->trans("TranslationOverwriteKey")).'</a>';
}
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {

View File

@ -286,7 +286,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -80,7 +80,7 @@ class DolibarrApiAccess implements iAuthenticate
public function __isAllowed()
{
// phpcs:enable
global $conf, $db;
global $conf, $db, $user;
$login = '';
$stored_key = '';
@ -147,9 +147,15 @@ class DolibarrApiAccess implements iAuthenticate
if ($result <= 0) {
throw new RestException(503, 'Error when fetching user :'.$fuser->error.' (conf->entity='.$conf->entity.')');
}
$fuser->getrights();
// Set the property $user to the $user of API
static::$user = $fuser;
// Set also the global variable $user to the $user of API
$user = $fuser;
if ($fuser->socid) {
static::$role = 'external';
}

View File

@ -81,6 +81,8 @@ $permissionnote = $user->rights->asset->write; // Used by the include of actions
$permissiondellink = $user->rights->asset->write; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->asset->multidir_output[isset($object->entity) ? $object->entity : 1];
$error = 0;
/*
* Actions
@ -93,12 +95,17 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
$error = 0;
$backurlforlist = DOL_URL_ROOT.'/asset/list.php';
$backurlforlist = dol_buildpath('/asset/list.php', 1);
// Actions cancel, add, update or delete
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist;
} else {
$backtopage = DOL_URL_ROOT.'/compta/bank/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
}
}
}
// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';

View File

@ -126,7 +126,7 @@ class AssetType extends CommonObject
$sql .= ", '".$this->db->escape($this->accountancy_code_depreciation_asset)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code_depreciation_expense)."'";
$sql .= ", '".$this->db->escape($this->note)."'";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ")";
dol_syslog("Asset_type::create", LOG_DEBUG);

View File

@ -90,6 +90,7 @@ $hookmanager->initHooks(array('assettypecard', 'globalcard'));
$permissiontoadd = $user->rights->asset->setup_advance;
/*
* Actions
*/
@ -396,7 +397,7 @@ if ($action == 'create') {
print dol_get_fiche_end();
$form->buttonsSaveCancel("Add");
print $form->buttonsSaveCancel("Add");
print "</form>\n";
}
@ -502,12 +503,12 @@ if ($rowid > 0) {
// Edit
if ($user->rights->asset->write) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;rowid='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;rowid='.((int) $object->id).'">'.$langs->trans("Modify").'</a></div>';
}
// Delete
if ($user->rights->asset->write) {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.$object->id.'">'.$langs->trans("DeleteType").'</a></div>';
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.((int) $object->id).'">'.$langs->trans("DeleteType").'</a></div>';
}
print "</div>";

View File

@ -47,11 +47,17 @@ if ($search_showonlyerrors < 0) {
$search_showonlyerrors = 0;
}
$search_startyear = GETPOST('search_startyear', 'int');
$search_startmonth = GETPOST('search_startmonth', 'int');
$search_startday = GETPOST('search_startday', 'int');
$search_endyear = GETPOST('search_endyear', 'int');
$search_endmonth = GETPOST('search_endmonth', 'int');
$search_endday = GETPOST('search_endday', 'int');
$search_id = GETPOST('search_id', 'alpha');
$search_fk_user = GETPOST('search_fk_user', 'intcomma');
$search_start = -1;
if (GETPOST('search_startyear') != '') {
$search_start = dol_mktime(0, 0, 0, GETPOST('search_startmonth'), GETPOST('search_startday'), GETPOST('search_startyear'));
if ($search_startyear != '') {
$search_start = dol_mktime(0, 0, 0, $search_startmonth, $search_startday, $search_startyear);
}
$search_end = -1;
if (GETPOST('search_endyear') != '') {
@ -321,22 +327,22 @@ if ($search_fk_user > 0) {
$param .= '&search_fk_user='.urlencode($search_fk_user);
}
if ($search_startyear > 0) {
$param .= '&search_startyear='.urlencode(GETPOST('search_startyear', 'int'));
$param .= '&search_startyear='.urlencode($search_startyear);
}
if ($search_startmonth > 0) {
$param .= '&search_startmonth='.urlencode(GETPOST('search_startmonth', 'int'));
$param .= '&search_startmonth='.urlencode($search_startmonth);
}
if ($search_startday > 0) {
$param .= '&search_startday='.urlencode(GETPOST('search_startday', 'int'));
$param .= '&search_startday='.urlencode($search_startday);
}
if ($search_endyear > 0) {
$param .= '&search_endyear='.urlencode(GETPOST('search_endyear', 'int'));
$param .= '&search_endyear='.urlencode($search_endyear);
}
if ($search_endmonth > 0) {
$param .= '&search_endmonth='.urlencode(GETPOST('search_endmonth', 'int'));
$param .= '&search_endmonth='.urlencode($search_endmonth);
}
if ($search_endday > 0) {
$param .= '&search_endday='.urlencode(GETPOST('search_endday', 'int'));
$param .= '&search_endday='.urlencode($search_endday);
}
if ($search_showonlyerrors > 0) {
$param .= '&search_showonlyerrors='.urlencode($search_showonlyerrors);

View File

@ -1299,7 +1299,7 @@ class BOMLine extends CommonObjectLine
}
}
if (count($sqlwhere) > 0) {
$sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')';
$sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')';
}
if (!empty($sortfield)) {

View File

@ -103,7 +103,7 @@ class Categories extends DolibarrApi
if (!is_array($cats)) {
throw new RestException(500, 'Error when fetching child categories', array_merge(array($this->category->error), $this->category->errors));
}
$this->category->childs = [];
$this->category->childs = array();
foreach ($cats as $cat) {
$this->category->childs[] = $this->_cleanObjectDatas($cat);
}

View File

@ -205,10 +205,14 @@ foreach ($fulltree as $key => $val) {
$entry .= '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.$moreparam.'&backtolist='.urlencode($_SERVER["PHP_SELF"].'?type='.$type).'">'.img_view().'</a>';
$entry .= '</td>';
$entry .= '<td class="right" width="20px;">';
$entry .= '<a class="editfielda" href="'.DOL_URL_ROOT.'/categories/edit.php?id='.$val['id'].'&type='.$type.$moreparam.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type).'">'.img_edit().'</a>';
if ($user->rights->categorie->creer) {
$entry .= '<a class="editfielda" href="' . DOL_URL_ROOT . '/categories/edit.php?id=' . $val['id'] . '&type=' . $type . $moreparam . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?type=' . $type) . '">' . img_edit() . '</a>';
}
$entry .= '</td>';
$entry .= '<td class="right" width="20px;">';
$entry .= '<a class="deletefilelink" href="'.DOL_URL_ROOT.'/categories/viewcat.php?action=delete&token='.newToken().'&id='.$val['id'].'&type='.$type.$moreparam.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.$moreparam).'&backtolist='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.$moreparam).'">'.img_delete().'</a>';
if ($user->rights->categorie->supprimer) {
$entry .= '<a class="deletefilelink" href="' . DOL_URL_ROOT . '/categories/viewcat.php?action=delete&token=' . newToken() . '&id=' . $val['id'] . '&type=' . $type . $moreparam . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?type=' . $type . $moreparam) . '&backtolist=' . urlencode($_SERVER["PHP_SELF"] . '?type=' . $type . $moreparam) . '">' . img_delete() . '</a>';
}
$entry .= '</td>';
$entry .= '</tr>';

View File

@ -70,6 +70,10 @@ $offsetvalue = GETPOST('offsetvalue', 'int');
$offsetunit = GETPOST('offsetunittype_duration', 'aZ09');
$remindertype = GETPOST('selectremindertype', 'aZ09');
$modelmail = GETPOST('actioncommsendmodel_mail', 'int');
$complete = GETPOST('complete', 'alpha'); // 'na' must be allowed
if ($complete == 'na' || $complete == -2) {
$complete = -1;
}
$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'));
$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'));
@ -240,7 +244,7 @@ if (empty($reshook) && $action == 'add') {
exit;
}
$percentage = in_array(GETPOST('status'), array(-1, 100)) ?GETPOST('status') : (in_array(GETPOST('complete'), array(-1, 100)) ?GETPOST('complete') : GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status
$percentage = in_array(GETPOST('status'), array(-1, 100)) ? GETPOST('status') : (in_array($complete, array(-1, 100)) ? $complete : GETPOST("percentage", 'int')); // If status is -1 or 100, percentage is not defined and we must use status
// Clean parameters
$datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser');
@ -471,7 +475,7 @@ if (empty($reshook) && $action == 'update') {
$apmin = GETPOST('apmin', 'int');
$p2hour = GETPOST('p2hour', 'int');
$p2min = GETPOST('p2min', 'int');
$percentage = in_array(GETPOST('status'), array(-1, 100)) ?GETPOST('status') : (in_array(GETPOST('complete'), array(-1, 100)) ?GETPOST('complete') : GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status
$percentage = in_array(GETPOST('status'), array(-1, 100)) ? GETPOST('status') : (in_array($complete, array(-1, 100)) ? $complete : GETPOST("percentage", 'int')); // If status is -1 or 100, percentage is not defined and we must use status
// Clean parameters
if ($aphour == -1) {
@ -1074,15 +1078,15 @@ if ($action == 'create') {
// Status
print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
print '<td>';
$percent = GETPOST('complete')!=='' ? GETPOST('complete') : -1;
$percent = $complete !=='' ? $complete : -1;
if (GETPOSTISSET('status')) {
$percent = GETPOST('status');
} elseif (GETPOSTISSET('percentage')) {
$percent = GETPOST('percentage');
$percent = GETPOST('percentage', 'int');
} else {
if (GETPOST('complete') == '0' || GETPOST("afaire") == 1) {
if ($complete == '0' || GETPOST("afaire") == 1) {
$percent = '0';
} elseif (GETPOST('complete') == 100 || GETPOST("afaire") == 2) {
} elseif ($complete == 100 || GETPOST("afaire") == 2) {
$percent = 100;
}
}
@ -1340,7 +1344,7 @@ if ($id > 0) {
$result5 = $object->fetch_optionals();
if ($listUserAssignedUpdated || $donotclearsession) {
$percentage = in_array(GETPOST('status'), array(-1, 100)) ?GETPOST('status') : (in_array(GETPOST('complete'), array(-1, 100)) ?GETPOST('complete') : GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status
$percentage = in_array(GETPOST('status'), array(-1, 100)) ? GETPOST('status') : (in_array($complete, array(-1, 100)) ? $complete : GETPOST("percentage", 'int')); // If status is -1 or 100, percentage is not defined and we must use status
$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser');
$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
@ -1534,7 +1538,7 @@ if ($id > 0) {
// Status
print '<tr><td class="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3">';
$percent = GETPOST("percentage") ? GETPOST("percentage") : $object->percentage;
$percent = GETPOSTISSET("percentage") ? GETPOST("percentage", "int") : $object->percentage;
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
print '</td></tr>';

View File

@ -265,6 +265,7 @@ if (empty($conf->global->AGENDA_DISABLE_EXT)) {
$name = 'AGENDA_EXT_NAME'.$i;
$offsettz = 'AGENDA_EXT_OFFSETTZ'.$i;
$color = 'AGENDA_EXT_COLOR'.$i;
$default = 'AGENDA_EXT_ACTIVEBYDEFAULT'.$i;
$buggedfile = 'AGENDA_EXT_BUGGEDFILE'.$i;
if (!empty($conf->global->$source) && !empty($conf->global->$name)) {
// Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
@ -273,6 +274,7 @@ if (empty($conf->global->AGENDA_DISABLE_EXT)) {
'name'=>$conf->global->$name,
'offsettz' => (!empty($conf->global->$offsettz) ? $conf->global->$offsettz : 0),
'color'=>$conf->global->$color,
'default'=>$conf->global->$default,
'buggedfile'=>(isset($conf->global->buggedfile) ? $conf->global->buggedfile : 0)
);
}
@ -288,6 +290,7 @@ if (empty($user->conf->AGENDA_DISABLE_EXT)) {
$offsettz = 'AGENDA_EXT_OFFSETTZ_'.$user->id.'_'.$i;
$color = 'AGENDA_EXT_COLOR_'.$user->id.'_'.$i;
$enabled = 'AGENDA_EXT_ENABLED_'.$user->id.'_'.$i;
$default = 'AGENDA_EXT_ACTIVEBYDEFAULT_'.$user->id.'_'.$i;
$buggedfile = 'AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i;
if (!empty($user->conf->$source) && !empty($user->conf->$name)) {
// Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
@ -296,6 +299,7 @@ if (empty($user->conf->AGENDA_DISABLE_EXT)) {
'name'=>$user->conf->$name,
'offsettz' => (!empty($user->conf->$offsettz) ? $user->conf->$offsettz : 0),
'color'=>$user->conf->$color,
'default'=>$user->conf->$default,
'buggedfile'=>(isset($user->conf->buggedfile) ? $user->conf->buggedfile : 0)
);
}
@ -576,6 +580,15 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
if (is_array($showextcals) && count($showextcals) > 0) {
$s .= '<script type="text/javascript">'."\n";
$s .= 'jQuery(document).ready(function () {
jQuery("div input[name^=\"check_ext\"]").each(function(index, elem) {
var name = jQuery(elem).attr("name");
if (jQuery(elem).is(":checked")) {
jQuery(".family_ext" + name.replace("check_ext", "")).show();
} else {
jQuery(".family_ext" + name.replace("check_ext", "")).hide();
}
});
jQuery("div input[name^=\"check_ext\"]").click(function() {
var name = $(this).attr("name");
jQuery(".family_ext" + name.replace("check_ext", "")).toggle();
@ -585,7 +598,14 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
foreach ($showextcals as $val) {
$htmlname = md5($val['name']);
$s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_ext'.$htmlname.'" name="check_ext'.$htmlname.'" checked> <label for="check_ext'.$htmlname.'">'.$val['name'].'</label> &nbsp; </div>';
if (!empty($val['default'])) {
$default = "checked";
} else {
$default = '';
}
$s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_ext'.$htmlname.'" name="check_ext'.$htmlname.'" '.$default.'> <label for="check_ext'.$htmlname.'">'.$val['name'].'</label> &nbsp; </div>';
}
}

View File

@ -529,7 +529,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
while ($db->fetch_object($resql)) {
$nbtotalofrecords++;
}*/
/* This fast and low memory method to get and count full list converts the sql into a sql count */
/* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount);
$objforcount = $db->fetch_object($resql);

View File

@ -466,6 +466,7 @@ if (empty($reshook)) {
}
$newparam = '';
$newcardbutton = '';
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) {
$tmpforcreatebutton = dol_getdate(dol_now(), true);
@ -489,6 +490,8 @@ if ($user->rights->agenda->myactions->create || $user->rights->agenda->allaction
$newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')));
}
$num = '';
print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1, 'object_action', 0, $nav.'<span class="marginleftonly"></span>'.$newcardbutton, '', $limit, 1, 0, 1, $viewmode);
$link = '';
@ -505,6 +508,9 @@ $s = $newtitle;
print $s;
print '<div class="liste_titre liste_titre_bydiv centpercent">';
if (empty($search_status)) {
$search_status = '';
}
print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid);
print '</div>';
@ -892,15 +898,23 @@ while ($currentdaytoshow < $lastdaytoshow) {
}
} else {
/* Use this list to have for all users */
$sql = "SELECT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity";
$sql = "SELECT DISTINCT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
if ($usergroup > 0) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON u.rowid = ug.fk_user";
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
$sql .= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
$sql .= " WHERE ug.entity IN (".getEntity('usergroup').")";
$sql .= " AND ug.fk_user = u.rowid ";
} else {
if ($usergroup > 0) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON u.rowid = ug.fk_user";
}
$sql .= " WHERE u.entity IN (".getEntity('user').")";
}
$sql .= " WHERE u.statut = 1 AND u.entity IN (".getEntity('user').")";
if ($usergroup > 0) {
$sql .= " AND u.statut = 1";
if ($usergroup > 0) {
$sql .= " AND ug.fk_usergroup = ".((int) $usergroup);
}
//print $sql;
$resql = $db->query($sql);
if ($resql) {
@ -1378,10 +1392,10 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
$ids1 = '';
$ids2 = '';
if (is_array($cases1[$h]) && count($cases1[$h]) && array_keys($cases1[$h])) {
if (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) && array_keys($cases1[$h])) {
$ids1 = join(',', array_keys($cases1[$h]));
}
if (is_array($cases2[$h]) && count($cases2[$h]) && array_keys($cases2[$h])) {
if (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) && array_keys($cases2[$h])) {
$ids2 = join(',', array_keys($cases2[$h]));
}
@ -1390,7 +1404,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
} else {
echo '<td class="'.$style.' cal_peruser'.($var ? ' cal_impair '.$style.'_impair' : '').'">';
}
if (is_array($cases1[$h]) && count($cases1[$h]) == 1) { // only 1 event
if (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) == 1) { // only 1 event
$output = array_slice($cases1[$h], 0, 1);
$title1 = $langs->trans("Ref").' '.$ids1.($title1 ? ' - '.$title1 : '');
if ($output[0]['string']) {
@ -1399,12 +1413,12 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
if ($output[0]['color']) {
$color1 = $output[0]['color'];
}
} elseif (is_array($cases1[$h]) && count($cases1[$h]) > 1) {
} elseif (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) > 1) {
$title1 = $langs->trans("Ref").' '.$ids1.($title1 ? ' - '.$title1 : '');
$color1 = '222222';
}
if (is_array($cases2[$h]) && count($cases2[$h]) == 1) { // only 1 event
if (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) == 1) { // only 1 event
$output = array_slice($cases2[$h], 0, 1);
$title2 = $langs->trans("Ref").' '.$ids2.($title2 ? ' - '.$title2 : '');
if ($output[0]['string']) {
@ -1413,7 +1427,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
if ($output[0]['color']) {
$color2 = $output[0]['color'];
}
} elseif (is_array($cases2[$h]) && count($cases2[$h]) > 1) {
} elseif (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) > 1) {
$title2 = $langs->trans("Ref").' '.$ids2.($title2 ? ' - '.$title2 : '');
$color2 = '222222';
}

View File

@ -108,7 +108,7 @@ if (!$sortorder) {
if (!$sortfield) {
$sortfield = "nom";
}
$cancelbutton = GETPOST('cancel', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$object = new Client($db);
$extrafields = new ExtraFields($db);
@ -152,7 +152,7 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
if ($cancelbutton) {
if ($cancel) {
$action = "";
}
@ -1370,7 +1370,7 @@ if ($object->id > 0) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddOrder").'</a></div>';
}
if ($user->rights->contrat->creer && $object->status == 1) {
if (!empty($user->rights->contrat->creer) && $object->status == 1) {
$langs->load("contracts");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddContract").'</a></div>';
}

View File

@ -635,11 +635,11 @@ if ($object->fetch($id) >= 0) {
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td>'.$obj->email.'</td>';
print '<td>'.$obj->lastname.'</td>';
print '<td>'.$obj->firstname.'</td>';
print '<td class="tdoverflowmax150">'.img_picto('$obj->email', 'email', 'class="paddingright"').$obj->email.'</td>';
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).'">'.$obj->lastname.'</td>';
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).'">'.$obj->firstname.'</td>';
print '<td>'.$obj->other.'</td>';
print '<td class="center">';
print '<td class="center tdoverflowmax150">';
if (empty($obj->source_id) || empty($obj->source_type)) {
print empty($obj->source_url) ? '' : $obj->source_url; // For backward compatibility
} else {

View File

@ -147,8 +147,23 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT.'/comm/propal/list.php';
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist;
} else {
$backtopage = DOL_URL_ROOT.'/comm/propal/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
}
}
}
if ($cancel) {
if (!empty($backtopage)) {
if (!empty($backtopageforcancel)) {
header("Location: ".$backtopageforcancel);
exit;
} elseif (!empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
@ -384,8 +399,8 @@ if (empty($reshook)) {
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int');
$object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = price2num(GETPOST('remise_percent'), '', 2);
$object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU', 2);
$object->socid = GETPOST('socid', 'int');
$object->contact_id = GETPOST('contactid', 'int');
$object->fk_project = GETPOST('projectid', 'int');
@ -826,8 +841,8 @@ if (empty($reshook)) {
$tva_tx = '';
}
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
$remise_percent = price2num(GETPOST('remise_percent'.$predef), '', 2);
if (empty($remise_percent)) {
$remise_percent = 0;
}
@ -1214,6 +1229,8 @@ if (empty($reshook)) {
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$remise_percent = price2num(GETPOST('remise_percent'), '', 2);
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
$array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
@ -1226,7 +1243,7 @@ if (empty($reshook)) {
}
// Define special_code for special lines
$special_code = GETPOST('special_code');
$special_code = GETPOST('special_code', 'int');
if (!GETPOST('qty')) {
$special_code = 3;
}
@ -1245,7 +1262,7 @@ if (empty($reshook)) {
}
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) {
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - $remise_percent / 100) < price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++;
}
@ -1275,7 +1292,7 @@ if (empty($reshook)) {
$qty = price2num(GETPOST('qty', 'alpha'), 'MS');
$result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, price2num(GETPOST('remise_percent'), 2), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOST("units"), $pu_ht_devise);
$result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOST("units"), $pu_ht_devise);
if ($result >= 0) {
$db->commit();
@ -1343,9 +1360,9 @@ if (empty($reshook)) {
// Terms of payment
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
} elseif ($action == 'setremisepercent' && $usercancreate) {
$result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent')));
$result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent'), '', 2));
} elseif ($action == 'setremiseabsolue' && $usercancreate) {
$result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue')));
$result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU', 2));
} elseif ($action == 'setmode' && $usercancreate) {
// Payment choice
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));

View File

@ -1099,22 +1099,22 @@ class Propal extends CommonObject
$sql .= " VALUES (";
$sql .= $this->socid;
$sql .= ", 0";
$sql .= ", ".$this->remise;
$sql .= ", ".($this->remise_percent ? $this->db->escape($this->remise_percent) : 'NULL');
$sql .= ", ".($this->remise_absolue ? $this->db->escape($this->remise_absolue) : 'NULL');
$sql .= ", ".((float) $this->remise);
$sql .= ", ".($this->remise_percent ? ((float) $this->remise_percent) : 'NULL');
$sql .= ", ".($this->remise_absolue ? ((float) $this->remise_absolue) : 'NULL');
$sql .= ", 0";
$sql .= ", 0";
$sql .= ", '".$this->db->idate($this->date)."'";
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", '(PROV)'";
$sql .= ", ".($user->id > 0 ? "'".$this->db->escape($user->id)."'" : "NULL");
$sql .= ", ".($user->id > 0 ? ((int) $user->id) : "NULL");
$sql .= ", '".$this->db->escape($this->note_private)."'";
$sql .= ", '".$this->db->escape($this->note_public)."'";
$sql .= ", '".$this->db->escape($this->model_pdf)."'";
$sql .= ", ".($this->fin_validite != '' ? "'".$this->db->idate($this->fin_validite)."'" : "NULL");
$sql .= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : 'NULL');
$sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'NULL');
$sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL');
$sql .= ", ".($this->cond_reglement_id > 0 ? ((int) $this->cond_reglement_id) : 'NULL');
$sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : 'NULL');
$sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL');
$sql .= ", '".$this->db->escape($this->ref_client)."'";
$sql .= ", ".(empty($delivery_date) ? "NULL" : "'".$this->db->idate($delivery_date)."'");
$sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL');
@ -4080,21 +4080,21 @@ class PropaleLigne extends CommonObjectLine
$sql .= " ".($this->fk_product ? "'".$this->db->escape($this->fk_product)."'" : "null").",";
$sql .= " '".$this->db->escape($this->product_type)."',";
$sql .= " ".($this->fk_remise_except ? "'".$this->db->escape($this->fk_remise_except)."'" : "null").",";
$sql .= " ".price2num($this->qty).",";
$sql .= " ".price2num($this->qty, 'MS').",";
$sql .= " ".(empty($this->vat_src_code) ? "''" : "'".$this->db->escape($this->vat_src_code)."'").",";
$sql .= " ".price2num($this->tva_tx).",";
$sql .= " ".price2num($this->localtax1_tx).",";
$sql .= " ".price2num($this->localtax2_tx).",";
$sql .= " '".$this->db->escape($this->localtax1_type)."',";
$sql .= " '".$this->db->escape($this->localtax2_type)."',";
$sql .= " ".(price2num($this->subprice) !== '' ? price2num($this->subprice) : "null").",";
$sql .= " ".price2num($this->remise_percent).",";
$sql .= " ".(isset($this->info_bits) ? "'".$this->db->escape($this->info_bits)."'" : "null").",";
$sql .= " ".price2num($this->total_ht).",";
$sql .= " ".price2num($this->total_tva).",";
$sql .= " ".price2num($this->total_localtax1).",";
$sql .= " ".price2num($this->total_localtax2).",";
$sql .= " ".price2num($this->total_ttc).",";
$sql .= " ".(price2num($this->subprice) !== '' ? price2num($this->subprice, 'MU') : "null").",";
$sql .= " ".price2num($this->remise_percent, 3).",";
$sql .= " ".(isset($this->info_bits) ? ((int) $this->info_bits) : "null").",";
$sql .= " ".price2num($this->total_ht, 'MT').",";
$sql .= " ".price2num($this->total_tva, 'MT').",";
$sql .= " ".price2num($this->total_localtax1, 'MT').",";
$sql .= " ".price2num($this->total_localtax2, 'MT').",";
$sql .= " ".price2num($this->total_ttc, 'MT').",";
$sql .= " ".(!empty($this->fk_fournprice) ? "'".$this->db->escape($this->fk_fournprice)."'" : "null").",";
$sql .= " ".(isset($this->pa_ht) ? "'".price2num($this->pa_ht)."'" : "null").",";
$sql .= ' '.((int) $this->special_code).',';
@ -4104,10 +4104,10 @@ class PropaleLigne extends CommonObjectLine
$sql .= " ".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null");
$sql .= ", ".($this->fk_multicurrency > 0 ? ((int) $this->fk_multicurrency) : 'null');
$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
$sql .= ", ".$this->multicurrency_subprice;
$sql .= ", ".$this->multicurrency_total_ht;
$sql .= ", ".$this->multicurrency_total_tva;
$sql .= ", ".$this->multicurrency_total_ttc;
$sql .= ", ".price2num($this->multicurrency_subprice, 'CU');
$sql .= ", ".price2num($this->multicurrency_total_ht, 'CT');
$sql .= ", ".price2num($this->multicurrency_total_tva, 'CT');
$sql .= ", ".price2num($this->multicurrency_total_ttc, 'CT');
$sql .= ')';
dol_syslog(get_class($this).'::insert', LOG_DEBUG);

View File

@ -709,8 +709,8 @@ if ($socid > 0) {
//$sql.= " UNION ";
// Discount linked to invoices
$sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
$sql2 .= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
$sql2 .= " rc.fk_facture_source,";
$sql2 .= " rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
$sql2 .= " rc.datec as dc, rc.description, rc.fk_facture, rc.fk_facture_source,";
$sql2 .= " u.login, u.rowid as user_id,";
$sql2 .= " f.rowid as invoiceid, f.ref,";
$sql2 .= " fa.ref as invoice_source_ref, fa.type as type";
@ -850,7 +850,7 @@ if ($socid > 0) {
// Discount linked to invoice lines
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
$sql .= " rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
$sql .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,";
$sql .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line,";
$sql .= " rc.fk_invoice_supplier_source,";
$sql .= " u.login, u.rowid as user_id,";
$sql .= " f.rowid as invoiceid, f.ref as ref,";
@ -869,7 +869,8 @@ if ($socid > 0) {
//$sql.= " UNION ";
// Discount linked to invoices
$sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
$sql2 .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,";
$sql2 .= " rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
$sql2 .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier,";
$sql2 .= " rc.fk_invoice_supplier_source,";
$sql2 .= " u.login, u.rowid as user_id,";
$sql2 .= " f.rowid as invoiceid, f.ref as ref,";

View File

@ -138,8 +138,23 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT.'/commande/list.php';
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist;
} else {
$backtopage = DOL_URL_ROOT.'/commande/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
}
}
}
if ($cancel) {
if (!empty($backtopage)) {
if (!empty($backtopageforcancel)) {
header("Location: ".$backtopageforcancel);
exit;
} elseif (!empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
@ -598,9 +613,9 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'setremisepercent' && $usercancreate) {
$result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), 2));
$result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), '', 2));
} elseif ($action == 'setremiseabsolue' && $usercancreate) {
$result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU'));
$result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU', 2));
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '') {
// Define vat_rate
$vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0);
@ -630,7 +645,7 @@ if (empty($reshook)) {
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha')) : 0);
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0);
if (empty($remise_percent)) {
$remise_percent = 0;
}
@ -1020,6 +1035,8 @@ if (empty($reshook)) {
$special_code = 3;
}
$remise_percent = price2num(GETPOST('remise_percent'), '', 2);
// Check minimum price
$productid = GETPOST('productid', 'int');
if (!empty($productid)) {
@ -1035,7 +1052,7 @@ if (empty($reshook)) {
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) {
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - $remise_percent / 100) < price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++;
}
@ -1060,7 +1077,7 @@ if (empty($reshook)) {
}
}
}
$result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, price2num(GETPOST('qty'), 'MS'), price2num(GETPOST('remise_percent'), 2), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'), $pu_ht_devise);
$result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, price2num(GETPOST('qty'), 'MS'), $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'), $pu_ht_devise);
if ($result >= 0) {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {

View File

@ -717,6 +717,8 @@ class Orders extends DolibarrApi
throw new RestException(404, 'Order not found');
}
$result = $this->commande->fetch_thirdparty(); // do not check result, as failure is not fatal (used only for mail notification substitutes)
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@ -729,13 +731,6 @@ class Orders extends DolibarrApi
throw new RestException(500, 'Error when validating Order: '.$this->commande->error);
}
$result = $this->commande->fetch($id);
if (!$result) {
throw new RestException(404, 'Order not found');
}
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->commande->fetchObjectLinked();

View File

@ -4400,21 +4400,21 @@ class OrderLine extends CommonOrderLine
$sql .= ' '.((int) $this->rang).',';
$sql .= ' '.(!empty($this->fk_fournprice) ? $this->fk_fournprice : "null").',';
$sql .= ' '.price2num($this->pa_ht).',';
$sql .= " '".$this->db->escape($this->info_bits)."',";
$sql .= " ".price2num($this->total_ht).",";
$sql .= " ".price2num($this->total_tva).",";
$sql .= " ".price2num($this->total_localtax1).",";
$sql .= " ".price2num($this->total_localtax2).",";
$sql .= " ".price2num($this->total_ttc).",";
$sql .= " ".((int) $this->info_bits).",";
$sql .= " ".price2num($this->total_ht, 'MT').",";
$sql .= " ".price2num($this->total_tva, 'MT').",";
$sql .= " ".price2num($this->total_localtax1, 'MT').",";
$sql .= " ".price2num($this->total_localtax2, 'MT').",";
$sql .= " ".price2num($this->total_ttc, 'MT').",";
$sql .= " ".(!empty($this->date_start) ? "'".$this->db->idate($this->date_start)."'" : "null").',';
$sql .= " ".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null").',';
$sql .= ' '.(!$this->fk_unit ? 'NULL' : $this->fk_unit);
$sql .= ", ".(!empty($this->fk_multicurrency) ? $this->fk_multicurrency : 'NULL');
$sql .= ' '.(!$this->fk_unit ? 'NULL' : ((int) $this->fk_unit));
$sql .= ", ".(!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL');
$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
$sql .= ", ".$this->multicurrency_subprice;
$sql .= ", ".$this->multicurrency_total_ht;
$sql .= ", ".$this->multicurrency_total_tva;
$sql .= ", ".$this->multicurrency_total_ttc;
$sql .= ", ".price2num($this->multicurrency_subprice, 'CU');
$sql .= ", ".price2num($this->multicurrency_total_ht, 'CT');
$sql .= ", ".price2num($this->multicurrency_total_tva, 'CT');
$sql .= ", ".price2num($this->multicurrency_total_ttc, 'CT');
$sql .= ')';
dol_syslog(get_class($this)."::insert", LOG_DEBUG);

View File

@ -33,7 +33,6 @@
* \brief Page to list orders
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -501,16 +500,13 @@ if ($search_billed != '' && $search_billed >= 0) {
$sql .= ' AND c.facture = '.((int) $search_billed);
}
if ($search_status <> '') {
if ($search_status < 4 && $search_status > -4) {
if ($search_status <= 3 && $search_status >= -1) { // status from -1 to 3 are real status (other are virtual combination)
if ($search_status == 1 && empty($conf->expedition->enabled)) {
$sql .= ' AND c.fk_statut IN (1,2)'; // If module expedition disabled, we include order with status 'sending in process' into 'validated'
} else {
$sql .= ' AND c.fk_statut = '.((int) $search_status); // brouillon, validee, en cours, annulee
}
}
if ($search_status == 4) {
$sql .= ' AND c.facture = 1'; // invoice created
}
if ($search_status == -2) { // To process
//$sql.= ' AND c.fk_statut IN (1,2,3) AND c.facture = 0';
$sql .= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected
@ -520,8 +516,6 @@ if ($search_status <> '') {
//$sql.= ' AND c.facture = 0'; // invoice not created
$sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed
}
if ($search_status == -4) { // "validate and in progress"
$sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process
}
@ -675,9 +669,6 @@ if ($resql) {
if ($search_status == 3) {
$title .= ' - '.$langs->trans('StatusOrderToBillShort');
}
if ($search_status == 4) {
$title .= ' - '.$langs->trans('StatusOrderProcessedShort');
}
if ($search_status == -1) {
$title .= ' - '.$langs->trans('StatusOrderCanceledShort');
}
@ -1254,10 +1245,10 @@ if ($resql) {
Commande::STATUS_SHIPMENTONPROCESS=>$langs->trans("StatusOrderSentShort"),
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
-3=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort").'+'.$langs->trans("StatusOrderDelivered"),
-4=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort"),
-2=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort"),
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
);
print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1);
print $form->selectarray('search_status', $liststatus, $search_status, -5, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1);
print '</td>';
}
// Action column

View File

@ -78,7 +78,26 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT.'/compta/bank/list.php';
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist;
} else {
$backtopage = DOL_URL_ROOT.'/compta/bank/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
}
}
}
if ($cancel) {
if (!empty($backtopageforcancel)) {
header("Location: ".$backtopageforcancel);
exit;
} elseif (!empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
$action = '';
}

View File

@ -687,7 +687,7 @@ class Account extends CommonObject
$sql .= "'".$this->db->idate($now)."'";
$sql .= ", '".$this->db->escape($this->ref)."'";
$sql .= ", '".$this->db->escape($this->label)."'";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ", '".$this->db->escape($this->account_number)."'";
$sql .= ", ".($this->fk_accountancy_journal > 0 ? $this->db->escape($this->fk_accountancy_journal) : "null");
$sql .= ", '".$this->db->escape($this->bank)."'";
@ -702,8 +702,8 @@ class Account extends CommonObject
$sql .= ", '".$this->db->escape($this->owner_address)."'";
$sql .= ", '".$this->db->escape($this->currency_code)."'";
$sql .= ", ".((int) $this->rappro);
$sql .= ", ".price2num($this->min_allowed);
$sql .= ", ".price2num($this->min_desired);
$sql .= ", ".price2num($this->min_allowed, 'MT');
$sql .= ", ".price2num($this->min_desired, 'MT');
$sql .= ", '".$this->db->escape($this->comment)."'";
$sql .= ", ".($this->state_id > 0 ? ((int) $this->state_id) : "null");
$sql .= ", ".($this->country_id > 0 ? ((int) $this->country_id) : "null");
@ -2152,7 +2152,7 @@ class AccountLine extends CommonObject
$sql .= ", fk_categ";
$sql .= ") VALUES (";
$sql .= $this->id;
$sql .= ", ".$cat;
$sql .= ", ".((int) $cat);
$sql .= ")";
dol_syslog(get_class($this)."::update_conciliation", LOG_DEBUG);

View File

@ -81,7 +81,7 @@ class BankCateg // extends CommonObject
$sql .= ", entity";
$sql .= ") VALUES (";
$sql .= " ".(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'")."";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ")";
$this->db->begin();

View File

@ -467,11 +467,11 @@ class PaymentVarious extends CommonObject
$sql .= ", '".$this->db->escape($this->label)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code)."'";
$sql .= ", '".$this->db->escape($this->subledger_account)."'";
$sql .= ", ".($this->fk_project > 0 ? $this->fk_project : 0);
$sql .= ", ".$user->id;
$sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 0);
$sql .= ", ".((int) $user->id);
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", NULL"; // Filled later
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);

View File

@ -192,18 +192,18 @@ class CashControl extends CommonObject
$sql .= ", card";
$sql .= ") VALUES (";
//$sql .= "'(PROV)', ";
$sql .= $conf->entity;
$sql .= ", ".(is_numeric($this->opening) ? $this->opening : 0);
$sql .= ((int) $conf->entity);
$sql .= ", ".(is_numeric($this->opening) ? price2num($this->opening, 'MT') : 0);
$sql .= ", 0"; // Draft by default
$sql .= ", '".$this->db->idate(dol_now())."'";
$sql .= ", '".$this->db->escape($this->posmodule)."'";
$sql .= ", '".$this->db->escape($this->posnumber)."'";
$sql .= ", ".($this->day_close > 0 ? $this->day_close : "null");
$sql .= ", ".($this->month_close > 0 ? $this->month_close : "null");
$sql .= ", ".$this->year_close;
$sql .= ", ".$this->cash;
$sql .= ", ".$this->cheque;
$sql .= ", ".$this->card;
$sql .= ", ".((int) $this->year_close);
$sql .= ", ".price2num($this->cash, 'MT');
$sql .= ", ".price2num($this->cheque, 'MT');
$sql .= ", ".price2num($this->card, 'MT');
$sql .= ")";
$this->db->begin();

View File

@ -167,14 +167,14 @@ class Deplacement extends CommonObject
$sql .= ", fk_soc";
$sql .= ") VALUES (";
$sql .= " '".$this->db->idate($now)."'";
$sql .= ", ".$conf->entity;
$sql .= ", ".$user->id;
$sql .= ", ".$this->fk_user;
$sql .= ", ".((int) $conf->entity);
$sql .= ", ".((int) $user->id);
$sql .= ", ".((int) $this->fk_user);
$sql .= ", '".$this->db->escape($this->type)."'";
$sql .= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null");
$sql .= ", ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "null");
$sql .= ", ".($this->fk_project > 0 ? $this->fk_project : 0);
$sql .= ", ".($this->fk_soc > 0 ? $this->fk_soc : "null");
$sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 0);
$sql .= ", ".($this->fk_soc > 0 ? ((int) $this->fk_soc) : "null");
$sql .= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);

View File

@ -433,8 +433,8 @@ if (empty($reshook)) {
$tva_tx = '';
}
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
$remise_percent = price2num(GETPOST('remise_percent'.$predef), '', 2);
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@ -781,6 +781,8 @@ if (empty($reshook)) {
$result = -1;
}*/
$remise_percent = price2num(GETPOST('remise_percent'), '', 2);
// Check minimum price
$productid = GETPOST('productid', 'int');
if (!empty($productid)) {
@ -797,7 +799,7 @@ if (empty($reshook)) {
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
// Check price is not lower than minimum (check is done only for standard or replacement invoices)
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent', 2)) / 100) < price2num($price_min)))) {
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - $remise_percent / 100) < price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++;
}
@ -830,8 +832,8 @@ if (empty($reshook)) {
$vat_rate,
$localtax1_rate,
$localtax1_rate,
GETPOST('productid'),
price2num(GETPOST('remise_percent'), 2),
GETPOST('productid', 'int'),
$remise_percent,
'HT',
$info_bits,
0,
@ -1226,6 +1228,8 @@ if ($action == 'create') {
}
$morehtmlref .= '</div>';
$morehtmlright = '';
dol_banner_tab($object, 'ref', $linkback, 1, 'title', 'none', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';

View File

@ -172,8 +172,23 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT.'/compta/facture/list.php';
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist;
} else {
$backtopage = DOL_URL_ROOT.'/compta/facture/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
}
}
}
if ($cancel) {
if (!empty($backtopage)) {
if (!empty($backtopageforcancel)) {
header("Location: ".$backtopageforcancel);
exit;
} elseif (!empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
@ -506,7 +521,7 @@ if (empty($reshook)) {
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
} elseif ($action == 'setremisepercent' && $usercancreate) {
$object->fetch($id);
$result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), 2));
$result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), '', 2));
} elseif ($action == "setabsolutediscount" && $usercancreate) {
// POST[remise_id] or POST[remise_id_for_payment]
@ -834,7 +849,7 @@ if (empty($reshook)) {
}
// If some payments were already done, we change the amount to pay using same prorate
if (!empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED)) {
if (!empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) && $object->type == Facture::TYPE_CREDIT_NOTE) {
$alreadypaid = $object->getSommePaiement(); // This can be not 0 if we allow to create credit to reuse from credit notes partially refunded.
if ($alreadypaid && abs($alreadypaid) < abs($object->total_ttc)) {
$ratio = abs(($object->total_ttc - $alreadypaid) / $object->total_ttc);
@ -1022,8 +1037,8 @@ if (empty($reshook)) {
$object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->fk_account = GETPOST('fk_account', 'int');
$object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU', 2);
$object->remise_percent = price2num(GETPOST('remise_percent'), '', 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@ -1079,7 +1094,7 @@ if (empty($reshook)) {
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->fk_account = GETPOST('fk_account', 'int');
$object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->remise_percent = price2num(GETPOST('remise_percent'), '', 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@ -1294,7 +1309,7 @@ if (empty($reshook)) {
$object->fk_account = GETPOST('fk_account', 'int');
$object->amount = price2num(GETPOST('amount'));
$object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->remise_percent = price2num(GETPOST('remise_percent'), '', 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@ -1375,7 +1390,7 @@ if (empty($reshook)) {
$object->fk_account = GETPOST('fk_account', 'int');
$object->amount = price2num(GETPOST('amount'));
$object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->remise_percent = price2num(GETPOST('remise_percent'), '', 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@ -1798,7 +1813,7 @@ if (empty($reshook)) {
$product->fetch(GETPOST('idprod'.$i, 'int'));
$startday = dol_mktime(12, 0, 0, GETPOST('date_start'.$i.'month'), GETPOST('date_start'.$i.'day'), GETPOST('date_start'.$i.'year'));
$endday = dol_mktime(12, 0, 0, GETPOST('date_end'.$i.'month'), GETPOST('date_end'.$i.'day'), GETPOST('date_end'.$i.'year'));
$result = $object->addline($product->description, $product->price, price2num(GETPOST('qty'.$i), 'MS'), $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, GETPOST('idprod'.$i, 'int'), price2num(GETPOST('remise_percent'.$i)), $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', $product->fk_unit);
$result = $object->addline($product->description, $product->price, price2num(GETPOST('qty'.$i), 'MS'), $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, GETPOST('idprod'.$i, 'int'), price2num(GETPOST('remise_percent'.$i), '', 2), $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', $product->fk_unit);
}
}
}
@ -1899,8 +1914,8 @@ if (empty($reshook)) {
$object->fk_project = GETPOST('projectid', 'int');
$object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->remise_absolue =price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->remise_absolue =price2num(GETPOST('remise_absolue'), 'MU', 2);
$object->remise_percent = price2num(GETPOST('remise_percent'), '', 2);
// Proprietes particulieres a facture de remplacement
@ -1986,8 +2001,8 @@ if (empty($reshook)) {
$tva_tx = '';
}
$qty = price2num(GETPOST('qty'.$predef), 'MS');
$remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
$qty = price2num(GETPOST('qty'.$predef), 'MS', 2);
$remise_percent = price2num(GETPOST('remise_percent'.$predef), '', 2);
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@ -2389,6 +2404,8 @@ if (empty($reshook)) {
}
}
$remise_percent = price2num(GETPOST('remise_percent'), '', 2);
// Check minimum price
$productid = GETPOST('productid', 'int');
if (!empty($productid)) {
@ -2405,7 +2422,7 @@ if (empty($reshook)) {
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
// Check price is not lower than minimum (check is done only for standard or replacement invoices)
if ($usercanproductignorepricemin && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) {
if ($usercanproductignorepricemin && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - $remise_percent / 100) < price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++;
}
@ -2458,7 +2475,7 @@ if (empty($reshook)) {
$description,
$pu_ht,
$qty,
price2num(GETPOST('remise_percent'), 2),
$remise_percent,
$date_start,
$date_end,
$vat_rate,

View File

@ -300,32 +300,32 @@ class FactureRec extends CommonInvoice
$sql .= ", suspended";
$sql .= ") VALUES (";
$sql .= "'".$this->db->escape($this->titre ? $this->titre : $this->title)."'";
$sql .= ", ".$facsrc->socid;
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $facsrc->socid);
$sql .= ", ".((int) $conf->entity);
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".(!empty($facsrc->amount) ? $facsrc->amount : '0');
$sql .= ", ".(!empty($facsrc->remise) ? $this->remise : '0');
$sql .= ", ".(!empty($facsrc->amount) ? ((float) $facsrc->amount) : '0');
$sql .= ", ".(!empty($facsrc->remise) ? ((float) $this->remise) : '0');
$sql .= ", ".(!empty($this->note_private) ? ("'".$this->db->escape($this->note_private)."'") : "NULL");
$sql .= ", ".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL");
$sql .= ", ".(!empty($this->model_pdf) ? ("'".$this->db->escape($this->model_pdf)."'") : "NULL");
$sql .= ", '".$this->db->escape($user->id)."'";
$sql .= ", ".(!empty($facsrc->fk_project) ? "'".$this->db->escape($facsrc->fk_project)."'" : "null");
$sql .= ", ".(!empty($facsrc->fk_account) ? "'".$this->db->escape($facsrc->fk_account)."'" : "null");
$sql .= ", ".($facsrc->cond_reglement_id > 0 ? $this->db->escape($facsrc->cond_reglement_id) : "null");
$sql .= ", ".($facsrc->mode_reglement_id > 0 ? $this->db->escape($facsrc->mode_reglement_id) : "null");
$sql .= ", ".$this->usenewprice;
$sql .= ", ".$this->frequency;
$sql .= ", ".((int) $user->id);
$sql .= ", ".(!empty($facsrc->fk_project) ? ((int) $facsrc->fk_project) : "null");
$sql .= ", ".(!empty($facsrc->fk_account) ? ((int) $facsrc->fk_account) : "null");
$sql .= ", ".($facsrc->cond_reglement_id > 0 ? ((int) $facsrc->cond_reglement_id) : "null");
$sql .= ", ".($facsrc->mode_reglement_id > 0 ? ((int) $facsrc->mode_reglement_id) : "null");
$sql .= ", ".((int) $this->usenewprice);
$sql .= ", ".((int) $this->frequency);
$sql .= ", '".$this->db->escape($this->unit_frequency)."'";
$sql .= ", ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL');
$sql .= ", ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL');
$sql .= ", ".$this->db->escape($this->nb_gen_done);
$sql .= ", ".$this->db->escape($this->nb_gen_max);
$sql .= ", ".$this->db->escape($this->auto_validate);
$sql .= ", ".$this->db->escape($this->generate_pdf);
$sql .= ", ".$this->db->escape($facsrc->fk_multicurrency);
$sql .= ", ".((int) $this->nb_gen_done);
$sql .= ", ".((int) $this->nb_gen_max);
$sql .= ", ".((int) $this->auto_validate);
$sql .= ", ".((int) $this->generate_pdf);
$sql .= ", ".((int) $facsrc->fk_multicurrency);
$sql .= ", '".$this->db->escape($facsrc->multicurrency_code)."'";
$sql .= ", ".$this->db->escape($facsrc->multicurrency_tx);
$sql .= ", ".$this->db->escape($this->suspended);
$sql .= ", ".((float) $facsrc->multicurrency_tx);
$sql .= ", ".((int) $this->suspended);
$sql .= ")";
if ($this->db->query($sql)) {
@ -963,7 +963,7 @@ class FactureRec extends CommonInvoice
$sql .= ", ".price2num($txlocaltax2);
$sql .= ", '".$this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '')."'";
$sql .= ", ".(!empty($fk_product) ? "'".$this->db->escape($fk_product)."'" : "null");
$sql .= ", ".$product_type;
$sql .= ", ".((int) $product_type);
$sql .= ", ".price2num($remise_percent);
$sql .= ", ".price2num($pu_ht);
$sql .= ", null";
@ -976,16 +976,16 @@ class FactureRec extends CommonInvoice
$sql .= ", ".(int) $date_end_fill;
$sql .= ", ".($fk_fournprice > 0 ? $fk_fournprice : 'null');
$sql .= ", ".($pa_ht ? price2num($pa_ht) : 0);
$sql .= ", ".$info_bits;
$sql .= ", ".$rang;
$sql .= ", ".$special_code;
$sql .= ", ".($fk_unit ? "'".$this->db->escape($fk_unit)."'" : "null");
$sql .= ", ".((int) $info_bits);
$sql .= ", ".((int) $rang);
$sql .= ", ".((int) $special_code);
$sql .= ", ".($fk_unit ? ((int) $fk_unit) : "null");
$sql .= ", ".(int) $this->fk_multicurrency;
$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
$sql .= ", ".price2num($pu_ht_devise);
$sql .= ", ".price2num($multicurrency_total_ht);
$sql .= ", ".price2num($multicurrency_total_tva);
$sql .= ", ".price2num($multicurrency_total_ttc);
$sql .= ", ".price2num($pu_ht_devise, 'CU');
$sql .= ", ".price2num($multicurrency_total_ht, 'CT');
$sql .= ", ".price2num($multicurrency_total_tva, 'CT');
$sql .= ", ".price2num($multicurrency_total_ttc, 'CT');
$sql .= ")";
dol_syslog(get_class($this)."::addline", LOG_DEBUG);

View File

@ -678,8 +678,8 @@ class Facture extends CommonInvoice
$sql .= ", ".($this->fk_facture_source ? "'".$this->db->escape($this->fk_facture_source)."'" : "null");
$sql .= ", ".($user->id > 0 ? (int) $user->id : "null");
$sql .= ", ".($this->fk_project ? $this->fk_project : "null");
$sql .= ", ".$this->cond_reglement_id;
$sql .= ", ".$this->mode_reglement_id;
$sql .= ", ".((int) $this->cond_reglement_id);
$sql .= ", ".((int) $this->mode_reglement_id);
$sql .= ", '".$this->db->idate($this->date_lim_reglement)."'";
$sql .= ", ".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null");
$sql .= ", ".($this->situation_cycle_ref ? "'".$this->db->escape($this->situation_cycle_ref)."'" : "null");
@ -1737,7 +1737,7 @@ class Facture extends CommonInvoice
} else {
$this->error = 'Invoice with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found';
dol_syslog(__METHOD__ . $this->error, LOG_WARNING);
dol_syslog(__METHOD__.$this->error, LOG_WARNING);
return 0;
}
} else {

View File

@ -106,7 +106,7 @@ $search_pos_source = GETPOST('search_pos_source', 'alpha');
$search_town = GETPOST('search_town', 'alpha');
$search_zip = GETPOST('search_zip', 'alpha');
$search_state = GETPOST("search_state");
$search_country = GETPOST("search_country", 'int');
$search_country = GETPOST("search_country", 'alpha');
$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
$search_user = GETPOST('search_user', 'int');
$search_sale = GETPOST('search_sale', 'int');
@ -253,7 +253,7 @@ $arrayfields = array(
'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
);
if ($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_RETAINED_WARRANTY) {
if (getDolGlobalString("INVOICE_USE_SITUATION") && $conf->global->INVOICE_USE_RETAINED_WARRANTY) {
$arrayfields['f.retained_warranty'] = array('label'=>$langs->trans("RetainedWarranty"), 'checked'=>0, 'position'=>86);
}
// Overwrite $arrayfields from columns into ->fields (transition before removal of $arrayoffields)
@ -652,8 +652,26 @@ if ($search_zip) {
if ($search_state) {
$sql .= natural_search("state.nom", $search_state);
}
if ($search_country) {
$sql .= " AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).')';
if (strlen(trim($search_country))) {
$arrayofcode = getCountriesInEEC();
$country_code_in_EEC = $country_code_in_EEC_without_me = '';
foreach ($arrayofcode as $key => $value) {
$country_code_in_EEC .= ($country_code_in_EEC ? "," : "")."'".$value."'";
if ($value != $mysoc->country_code) {
$country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ? "," : "")."'".$value."'";
}
}
if ($search_country == 'special_allnotme') {
$sql .= " AND country.code <> '".$db->escape($mysoc->country_code)."'";
} elseif ($search_country == 'special_eec') {
$sql .= " AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).")";
} elseif ($search_country == 'special_eecnotme') {
$sql .= " AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).")";
} elseif ($search_country == 'special_noteec') {
$sql .= " AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).")";
} else {
$sql .= natural_search("country.code", $search_country);
}
}
if ($search_type_thirdparty != '' && $search_type_thirdparty != '-1') {
$sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')';
@ -941,6 +959,9 @@ if ($resql) {
if ($search_zip) {
$param .= '&search_zip='.urlencode($search_zip);
}
if ($search_country) {
$param .= "&search_country=".urlencode($search_country);
}
if ($search_sale > 0) {
$param .= '&search_sale='.urlencode($search_sale);
}
@ -1259,7 +1280,7 @@ if ($resql) {
// Country
if (!empty($arrayfields['country.code_iso']['checked'])) {
print '<td class="liste_titre" align="center">';
print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
print $form->select_country($search_country, 'search_country', '', 0, 'minwidth150imp maxwidth150', 'code2', 1, 0, 1, null, 1);
print '</td>';
}
// Company type

View File

@ -170,12 +170,12 @@ class RemiseCheque extends CommonObject
$sql .= ") VALUES (";
$sql .= "'".$this->db->idate($now)."'";
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".$user->id;
$sql .= ", ".((int) $user->id);
$sql .= ", ".((int) $account_id);
$sql .= ", 0";
$sql .= ", 0";
$sql .= ", 0";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ", 0";
$sql .= ", ''";
$sql .= ")";

View File

@ -155,8 +155,8 @@ class BonPrelevement extends CommonObject
}
$sql .= ",fk_prelevement_lignes";
$sql .= ") VALUES (";
$sql .= $invoice_id;
$sql .= ", ".$line_id;
$sql .= ((int) $invoice_id);
$sql .= ", ".((int) $line_id);
$sql .= ")";
if ($this->db->query($sql)) {

View File

@ -114,12 +114,12 @@ class RejetPrelevement
$sql .= ", date_creation";
$sql .= ", afacturer";
$sql .= ") VALUES (";
$sql .= $id;
$sql .= ((int) $id);
$sql .= ", '".$this->db->idate($date_rejet)."'";
$sql .= ", ".$motif;
$sql .= ", ".$user->id;
$sql .= ", ".((int) $motif);
$sql .= ", ".((int) $user->id);
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".$facturation;
$sql .= ", ".((int) $facturation);
$sql .= ")";
$result = $this->db->query($sql);

View File

@ -95,7 +95,9 @@ if (empty($reshook)) {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$bank = new Account($db);
$bank->fetch($conf->global->{$default_account});
if (empty($bank->ics) || empty($bank->ics_transfer)) {
if ((empty($bank->ics) && $type !== 'bank-transfer')
|| (empty($bank->ics_transfer) && $type === 'bank-transfer')
) {
$errormessage = str_replace('{url}', $bank->getNomUrl(1, '', '', -1, 1), $langs->trans("ErrorICSmissing", '{url}'));
setEventMessages($errormessage, null, 'errors');
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/create.php');

View File

@ -429,7 +429,7 @@ if ($id > 0) {
if (!empty($conf->global->TAX_ADD_CLONE_FOR_NEXT_MONTH_CHECKBOX)) {
$formquestion[] = array('type' => 'checkbox', 'name' => 'clone_for_next_month', 'label' => $langs->trans("CloneTaxForNextMonth"), 'value' => 1);
} else {
$formquestion[] = array('type' => 'date', 'name' => 'clone_date_ech', 'label' => $langs->trans("Date"), 'value' => -1);
$formquestion[] = array('type' => 'date', 'datenow'=>1, 'name' => 'clone_date_ech', 'label' => $langs->trans("Date"), 'value' => -1);
$formquestion[] = array('type' => 'date', 'name' => 'clone_period', 'label' => $langs->trans("PeriodEndDate"), 'value' => -1);
}
@ -546,7 +546,7 @@ if ($id > 0) {
// Date
if ($action == 'edit') {
print '<tr><td>'.$langs->trans("Date")."</td><td>";
print $form->selectDate($object->date_ech, 'ech', 0, 0, 0, 'charge', 1);
print $form->selectDate($object->date_ech, 'ech', 0, 0, 0, 'charge', 1, 1);
print "</td></tr>";
} else {
print "<tr><td>".$langs->trans("Date")."</td><td>".dol_print_date($object->date_ech, 'day')."</td></tr>";

View File

@ -230,17 +230,17 @@ class ChargeSociales extends CommonObject
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, fk_user, date_creation)";
$sql .= " VALUES (".$this->type;
$sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL');
$sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : "NULL");
$sql .= " VALUES (".((int) $this->type);
$sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL');
$sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "NULL");
$sql .= ", '".$this->db->escape($this->label ? $this->label : $this->lib)."'";
$sql .= ", '".$this->db->idate($this->date_ech)."'";
$sql .= ", '".$this->db->idate($this->periode)."'";
$sql .= ", '".price2num($newamount)."'";
$sql .= ", ".($this->fk_project > 0 ? $this->fk_project : 'NULL');
$sql .= ", ".$conf->entity;
$sql .= ", ".$user->id;
$sql .= ", ".($this->fk_user > 0 ? $this->db->escape($this->fk_user) : 'NULL');
$sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 'NULL');
$sql .= ", ".((int) $conf->entity);
$sql .= ", ".((int) $user->id);
$sql .= ", ".($this->fk_user > 0 ? ((int) $this->fk_user) : 'NULL');
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ")";

View File

@ -192,7 +192,7 @@ if (!empty($conf->projet->enabled)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON (cs.fk_user = u.rowid)";
$sql .= " WHERE cs.fk_type = c.id";
$sql .= " AND cs.entity = ".$conf->entity;
$sql .= " AND cs.entity = ".((int) $conf->entity);
// Search criteria
if ($search_ref) {
$sql .= " AND cs.ref = '".$db->escape($search_ref)."'";
@ -452,13 +452,13 @@ if (!empty($arrayfields['cs.rowid']['checked'])) {
print_liste_field_titre($arrayfields['cs.rowid']['label'], $_SERVER["PHP_SELF"], "cs.rowid", '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['cs.libelle']['checked'])) {
print_liste_field_titre($arrayfields['cs.libelle']['label'], $_SERVER["PHP_SELF"], "cs.libelle", '', $param, '', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['cs.libelle']['label'], $_SERVER["PHP_SELF"], "cs.libelle,cs.periode", '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['cs.fk_type']['checked'])) {
print_liste_field_titre($arrayfields['cs.fk_type']['label'], $_SERVER["PHP_SELF"], "cs.fk_type", '', $param, '', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['cs.fk_type']['label'], $_SERVER["PHP_SELF"], "cs.fk_type,cs.periode", '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['cs.date_ech']['checked'])) {
print_liste_field_titre($arrayfields['cs.date_ech']['label'], $_SERVER["PHP_SELF"], "cs.date_ech", '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre($arrayfields['cs.date_ech']['label'], $_SERVER["PHP_SELF"], "cs.date_ech,cs.periode", '', $param, '', $sortfield, $sortorder, 'center ');
}
if (!empty($arrayfields['cs.periode']['checked'])) {
print_liste_field_titre($arrayfields['cs.periode']['label'], $_SERVER["PHP_SELF"], "cs.periode", '', $param, '', $sortfield, $sortorder, 'center ');
@ -467,19 +467,19 @@ if (!empty($arrayfields['p.ref']['checked'])) {
print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['cs.fk_user']['checked'])) {
print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.lastname", "", $param, 'class="left"', $sortfield, $sortorder);
print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.lastname,cs.periode", "", $param, 'class="left"', $sortfield, $sortorder);
}
if (!empty($arrayfields['cs.fk_mode_reglement']['checked'])) {
print_liste_field_titre($arrayfields['cs.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "cs.fk_mode_reglement", '', $param, '', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['cs.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "cs.fk_mode_reglement,cs.periode", '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['cs.fk_account']['checked'])) {
print_liste_field_titre($arrayfields['cs.fk_account']['label'], $_SERVER["PHP_SELF"], "cs.fk_account", '', $param, '', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['cs.fk_account']['label'], $_SERVER["PHP_SELF"], "cs.fk_account,cs.periode", '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['cs.amount']['checked'])) {
print_liste_field_titre($arrayfields['cs.amount']['label'], $_SERVER["PHP_SELF"], "cs.amount", '', $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['cs.amount']['label'], $_SERVER["PHP_SELF"], "cs.amount,cs.periode", '', $param, 'class="right"', $sortfield, $sortorder);
}
if (!empty($arrayfields['cs.paye']['checked'])) {
print_liste_field_titre($arrayfields['cs.paye']['label'], $_SERVER["PHP_SELF"], "cs.paye", '', $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['cs.paye']['label'], $_SERVER["PHP_SELF"], "cs.paye,cs.periode", '', $param, 'class="right"', $sortfield, $sortorder);
}
// Hook fields

View File

@ -437,7 +437,7 @@ if ($action == 'create') {
print '<tr><td colspan="2"><hr></td></tr>';
// Auto create payment
print '<tr><td>'.$langs->trans('AutomaticCreationPayment').'</td>';
print '<tr><td><label for="auto_create_paiement">'.$langs->trans('AutomaticCreationPayment').'</label></td>';
print '<td><input id="auto_create_paiement" name="auto_create_paiement" type="checkbox" ' . (empty($auto_create_payment) ? '' : 'checked="checked"') . ' value="1"></td></tr>'."\n";
print '<tr class="hide_if_no_auto_create_payment">';

View File

@ -596,7 +596,7 @@ class Tva extends CommonObject
}
$sql .= ", '".$this->db->escape($user->id)."'";
$sql .= ", NULL";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ")";
dol_syslog(get_class($this)."::addPayment", LOG_DEBUG);

View File

@ -111,10 +111,27 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
// Cancel
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
header("Location: ".$backtopage);
exit;
$backurlforlist = DOL_URL_ROOT.'/contact/list.php';
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist;
} else {
$backtopage = DOL_URL_ROOT.'/contact/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
}
}
}
if ($cancel) {
if (!empty($backtopageforcancel)) {
header("Location: ".$backtopageforcancel);
exit;
} elseif (!empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
$action = '';
}
// Creation utilisateur depuis contact
@ -225,7 +242,7 @@ if (empty($reshook)) {
$action = 'create';
}
if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == -1 && $object->no_email == -1 && !empty($object->email)) {
if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && $object->no_email == -1 && !empty($object->email)) {
$error++;
$errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email"));
$action = 'create';
@ -317,7 +334,7 @@ if (empty($reshook)) {
$action = 'edit';
}
if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == -1 && GETPOST("no_email", "int") == -1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && GETPOST("no_email", "int") == -1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
$error++;
$errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email"));
$action = 'edit';
@ -678,7 +695,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Address
if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->address)) == 0) {
if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->address)) == 0) {
$object->address = $objsoc->address; // Predefined with third party
}
print '<tr><td><label for="address">'.$langs->trans("Address").'</label></td>';
@ -697,10 +714,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</tr>';
// Zip / Town
if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->zip)) == 0) {
if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->zip)) == 0) {
$object->zip = $objsoc->zip; // Predefined with third party
}
if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->town)) == 0) {
if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->town)) == 0) {
$object->town = $objsoc->town; // Predefined with third party
}
print '<tr><td><label for="zipcode">'.$langs->trans("Zip").'</label> / <label for="town">'.$langs->trans("Town").'</label></td><td colspan="'.$colspan.'" class="maxwidthonsmartphone">';
@ -734,10 +751,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</td></tr>';
}
if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->phone_pro)) == 0) {
if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->phone_pro)) == 0) {
$object->phone_pro = $objsoc->phone; // Predefined with third party
}
if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->fax)) == 0) {
if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->fax)) == 0) {
$object->fax = $objsoc->fax; // Predefined with third party
}
@ -767,7 +784,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<input type="text" name="fax" id="fax" class="maxwidth200" value="'.(GETPOSTISSET('fax') ? GETPOST('fax', 'alpha') : $object->fax).'"></td>';
print '</tr>';
if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->email)) == 0) {
if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->email)) == 0) {
$object->email = $objsoc->email; // Predefined with third party
}
@ -780,7 +797,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Unsubscribe
if (!empty($conf->mailing->enabled)) {
if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == -1) {
if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2) {
print "\n".'<script type="text/javascript" language="javascript">'."\n";
print '$(document).ready(function () {
$("#email").keyup(function() {
@ -801,7 +818,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
print '<tr>';
print '<td class="noemail"><label for="no_email">'.$langs->trans("No_Email").'</label></td>';
print '<td>'.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS), 1, false, ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == -1)).'</td>';
print '<td>'.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS), 1, false, ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2)).'</td>';
print '</tr>';
}
@ -871,7 +888,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</td>';
print '<td><label for="birthday_alert">'.$langs->trans("Alert").'</label>: ';
if ($object->birthday_alert) {
if (!empty($object->birthday_alert)) {
print '<input type="checkbox" name="birthday_alert" id="birthday_alert" checked>';
} else {
print '<input type="checkbox" name="birthday_alert" id="birthday_alert">';
@ -1051,7 +1068,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Unsubscribe
if (!empty($conf->mailing->enabled)) {
if ($conf->use_javascript_ajax && isset($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == -1) {
if ($conf->use_javascript_ajax && isset($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2) {
print "\n".'<script type="text/javascript" language="javascript">'."\n";
print '
@ -1078,7 +1095,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
print '<tr>';
print '<td class="noemail"><label for="no_email">'.$langs->trans("No_Email").'</label></td>';
$useempty = (isset($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == -1));
$useempty = (isset($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2));
print '<td>'.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $object->no_email), 1, false, $useempty).'</td>';
print '</tr>';
}
@ -1155,25 +1172,25 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (!empty($conf->commande->enabled)) {
print '<tr><td>'.$langs->trans("ContactForOrders").'</td><td colspan="3">';
print $object->ref_commande ? $object->ref_commande : $langs->trans("NoContactForAnyOrder");
print $object->ref_commande ? $object->ref_commande : ('<span class="opacitymedium">'.$langs->trans("NoContactForAnyOrder").'</span>');
print '</td></tr>';
}
if (!empty($conf->propal->enabled)) {
print '<tr><td>'.$langs->trans("ContactForProposals").'</td><td colspan="3">';
print $object->ref_propal ? $object->ref_propal : $langs->trans("NoContactForAnyProposal");
print $object->ref_propal ? $object->ref_propal : ('<span class="opacitymedium">'.$langs->trans("NoContactForAnyProposal").'</span>');
print '</td></tr>';
}
if (!empty($conf->contrat->enabled)) {
print '<tr><td>'.$langs->trans("ContactForContracts").'</td><td colspan="3">';
print $object->ref_contrat ? $object->ref_contrat : $langs->trans("NoContactForAnyContract");
print $object->ref_contrat ? $object->ref_contrat : ('<span class="opacitymedium">'.$langs->trans("NoContactForAnyContract").'</span>');
print '</td></tr>';
}
if (!empty($conf->facture->enabled)) {
print '<tr><td>'.$langs->trans("ContactForInvoices").'</td><td colspan="3">';
print $object->ref_facturation ? $object->ref_facturation : $langs->trans("NoContactForAnyInvoice");
print $object->ref_facturation ? $object->ref_facturation : ('<span class="opacitymedium">'.$langs->trans("NoContactForAnyInvoice").'</span>');
print '</td></tr>';
}
@ -1184,7 +1201,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$result = $dolibarr_user->fetch($object->user_id);
print $dolibarr_user->getLoginUrl(1);
} else {
print $langs->trans("NoDolibarrAccess");
print '<span class="opacitymedium">'.$langs->trans("NoDolibarrAccess").'</span>';
}
print '</td></tr>';

View File

@ -90,21 +90,19 @@ class Contact extends CommonObject
*/
public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>15),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
'fk_soc' =>array('type'=>'integer', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>1, 'position'=>25, 'searchall'=>1),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>3, 'notnull'=>1, 'position'=>30, 'index'=>1),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>3, 'position'=>35),
'civility' =>array('type'=>'varchar(6)', 'label'=>'Civility', 'enabled'=>1, 'visible'=>3, 'position'=>40),
'lastname' =>array('type'=>'varchar(50)', 'label'=>'Lastname', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'showoncombobox'=>1, 'searchall'=>1),
'firstname' =>array('type'=>'varchar(50)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'showoncombobox'=>1, 'searchall'=>1),
'poste' =>array('type'=>'varchar(80)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>-1, 'position'=>52),
'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>1, 'position'=>60),
'town' =>array('type'=>'text', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
'fk_departement' =>array('type'=>'integer', 'label'=>'Fk departement', 'enabled'=>1, 'visible'=>3, 'position'=>70),
'fk_pays' =>array('type'=>'integer', 'label'=>'Fk pays', 'enabled'=>1, 'visible'=>3, 'position'=>75),
'fk_soc' =>array('type'=>'integer', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>1, 'position'=>77, 'searchall'=>1),
'birthday' =>array('type'=>'date', 'label'=>'Birthday', 'enabled'=>1, 'visible'=>3, 'position'=>80),
'poste' =>array('type'=>'varchar(80)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'phone' =>array('type'=>'varchar(30)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>1, 'position'=>90, 'searchall'=>1),
'phone_perso' =>array('type'=>'varchar(30)', 'label'=>'PhonePerso', 'enabled'=>1, 'visible'=>-1, 'position'=>95, 'searchall'=>1),
'phone_mobile' =>array('type'=>'varchar(30)', 'label'=>'PhoneMobile', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'searchall'=>1),
@ -113,15 +111,17 @@ class Contact extends CommonObject
'socialnetworks' =>array('type'=>'text', 'label'=>'SocialNetworks', 'enabled'=>1, 'visible'=>3, 'position'=>115),
'photo' =>array('type'=>'varchar(255)', 'label'=>'Photo', 'enabled'=>1, 'visible'=>3, 'position'=>170),
'priv' =>array('type'=>'smallint(6)', 'label'=>'ContactVisibility', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>175),
'fk_stcommcontact' =>array('type'=>'integer', 'label'=>'Fk stcommcontact', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220),
'fk_stcommcontact' =>array('type'=>'integer', 'label'=>'ProspectStatus', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220),
'fk_prospectlevel' =>array('type'=>'varchar(12)', 'label'=>'ProspectLevel', 'enabled'=>1, 'visible'=>-1, 'position'=>255),
'no_email' =>array('type'=>'smallint(6)', 'label'=>'No_Email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180),
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>3, 'position'=>185),
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>3, 'position'=>190),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>3, 'position'=>195, 'searchall'=>1),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>3, 'position'=>200, 'searchall'=>1),
'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>3, 'position'=>205),
'canvas' =>array('type'=>'varchar(32)', 'label'=>'Canvas', 'enabled'=>1, 'visible'=>3, 'position'=>210),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>300),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>305),
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>3, 'position'=>310),
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>3, 'position'=>315),
'statut' =>array('type'=>'tinyint(4)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>500),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'position'=>1000),
);

View File

@ -371,7 +371,7 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = p.fk_pays";

View File

@ -110,6 +110,29 @@ if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT.'/contrat/list.php';
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist;
} else {
$backtopage = DOL_URL_ROOT.'/contrat/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
}
}
}
if ($cancel) {
if (!empty($backtopageforcancel)) {
header("Location: ".$backtopageforcancel);
exit;
} elseif (!empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
$action = '';
}
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
@ -204,7 +227,7 @@ if (empty($reshook)) {
$object->note_private = GETPOST('note_private', 'alpha');
$object->note_public = GETPOST('note_public', 'alpha');
$object->fk_project = GETPOST('projectid', 'int');
$object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->remise_percent = price2num(GETPOST('remise_percent'), '', 2);
$object->ref = GETPOST('ref', 'alpha');
$object->ref_customer = GETPOST('ref_customer', 'alpha');
$object->ref_supplier = GETPOST('ref_supplier', 'alpha');
@ -806,8 +829,7 @@ if (empty($reshook)) {
$action = 'edit_extras';
}
} elseif ($action == 'setref_supplier') {
$cancelbutton = GETPOST('cancel', 'alpha');
if (!$cancelbutton) {
if (!$cancel) {
$object->oldcopy = dol_clone($object);
$result = $object->setValueFrom('ref_supplier', GETPOST('ref_supplier', 'alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY');
@ -823,9 +845,7 @@ if (empty($reshook)) {
exit;
}
} elseif ($action == 'setref_customer') {
$cancelbutton = GETPOST('cancel', 'alpha');
if (!$cancelbutton) {
if (!$cancel) {
$object->oldcopy = dol_clone($object);
$result = $object->setValueFrom('ref_customer', GETPOST('ref_customer', 'alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY');
@ -841,9 +861,7 @@ if (empty($reshook)) {
exit;
}
} elseif ($action == 'setref') {
$cancelbutton = GETPOST('cancel', 'alpha');
if (!$cancelbutton) {
if (!$cancel) {
$result = $object->fetch($id);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
@ -878,9 +896,7 @@ if (empty($reshook)) {
exit;
}
} elseif ($action == 'setdate_contrat') {
$cancelbutton = GETPOST('cancel', 'alpha');
if (!$cancelbutton) {
if (!$cancel) {
$result = $object->fetch($id);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
@ -1186,12 +1202,8 @@ if ($action == 'create') {
}
print "</form>\n";
} else /* *************************************************************************** */
/* */
/* Mode vue et edition */
/* */
/* *************************************************************************** */
{
} else {
// View and edit mode
$now = dol_now();
if ($object->id > 0) {

View File

@ -127,8 +127,23 @@ if ($action == 'remove_file' && $permissiontoadd) {
$langs->load("other");
$filetodelete = GETPOST('file', 'alpha');
$file = $upload_dir.'/'.$filetodelete;
$dirthumb = dirname($file).'/thumbs/'; // Chemin du dossier contenant la vignette (if file is an image)
$ret = dol_delete_file($file, 0, 0, 0, $object);
if ($ret) {
// If it exists, remove thumb.
$regs = array();
if (preg_match('/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff)$/i', $file, $regs)) {
$photo_vignette = basename(preg_replace('/'.$regs[0].'/i', '', $file).'_small'.$regs[0]);
if (file_exists(dol_osencode($dirthumb.$photo_vignette))) {
dol_delete_file($dirthumb.$photo_vignette);
}
$photo_vignette = basename(preg_replace('/'.$regs[0].'/i', '', $file).'_mini'.$regs[0]);
if (file_exists(dol_osencode($dirthumb.$photo_vignette))) {
dol_delete_file($dirthumb.$photo_vignette);
}
}
setEventMessages($langs->trans("FileWasRemoved", $filetodelete), null, 'mesgs');
} else {
setEventMessages($langs->trans("ErrorFailToDeleteFile", $filetodelete), null, 'errors');

View File

@ -112,21 +112,20 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes' && (!isset($permissiont
dol_delete_file($fileold, 0, 0, 0, (is_object($object) ? $object : null)); // Delete file using old path
}
// If it exists, remove thumb.
$regs = array();
if (preg_match('/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff)$/i', $file, $regs)) {
$photo_vignette = basename(preg_replace('/'.$regs[0].'/i', '', $file).'_small'.$regs[0]);
if (file_exists(dol_osencode($dirthumb.$photo_vignette))) {
dol_delete_file($dirthumb.$photo_vignette);
}
$photo_vignette = basename(preg_replace('/'.$regs[0].'/i', '', $file).'_mini'.$regs[0]);
if (file_exists(dol_osencode($dirthumb.$photo_vignette))) {
dol_delete_file($dirthumb.$photo_vignette);
}
}
if ($ret) {
// If it exists, remove thumb.
$regs = array();
if (preg_match('/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff)$/i', $file, $regs)) {
$photo_vignette = basename(preg_replace('/'.$regs[0].'/i', '', $file).'_small'.$regs[0]);
if (file_exists(dol_osencode($dirthumb.$photo_vignette))) {
dol_delete_file($dirthumb.$photo_vignette);
}
$photo_vignette = basename(preg_replace('/'.$regs[0].'/i', '', $file).'_mini'.$regs[0]);
if (file_exists(dol_osencode($dirthumb.$photo_vignette))) {
dol_delete_file($dirthumb.$photo_vignette);
}
}
setEventMessages($langs->trans("FileWasRemoved", $urlfile), null, 'mesgs');
} else {
setEventMessages($langs->trans("ErrorFailToDeleteFile", $urlfile), null, 'errors');

View File

@ -1287,6 +1287,7 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
$objecttmp = new $objectclass($db);
$nbok = 0;
$TMsg = array();
foreach ($toselect as $toselectid) {
$result = $objecttmp->fetch($toselectid);
if ($result > 0) {
@ -1314,7 +1315,9 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
$result = $objecttmp->delete($user);
}
if ($result <= 0) {
if (empty($result)) { // if delete returns 0, there is at least one object linked
$TMsg = array_merge($objecttmp->errors, $TMsg);
} elseif ($result < 0) { // if delete returns is < 0, there is an error, we break and rollback later
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
@ -1328,16 +1331,25 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
}
}
if (!$error) {
if (empty($error)) {
// Message for elements well deleted
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
} else {
} elseif ($nbok == 1) {
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
}
// Message for elements which can't be deleted
if (!empty($TMsg)) {
sort($TMsg);
setEventMessages('', array_unique($TMsg), 'warnings');
}
$db->commit();
} else {
$db->rollback();
}
//var_dump($listofobjectthirdparties);exit;
}

View File

@ -0,0 +1,110 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Henry Guo <henrynopo@homtail.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/ajax/locationincoterms.php
* \ingroup core
* \brief File to return Ajax response on location_incoterms request
*/
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', 1); // Disables token renewal
}
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
if (!defined('NOREQUIRESOC')) {
define('NOREQUIRESOC', '1');
}
if (!defined('NOCSRFCHECK')) {
define('NOCSRFCHECK', '1');
}
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
/*
* View
*/
// Ajout directives pour resoudre bug IE
//header('Cache-Control: Public, must-revalidate');
//header('Pragma: public');
//top_htmlhead("", "", 1); // Replaced with top_httphead. An ajax page does not need html header.
top_httphead();
//print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
dol_syslog('location_incoterms call with MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY='.(empty($conf->global->MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY) ? '' : $conf->global->MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY));
//var_dump($_GET);
// Generation of list of zip-town
if (GETPOST('location_incoterms')) {
$return_arr = array();
// Define filter on text typed
$location_incoterms = GETPOST('location_incoterms');
if (!empty($conf->global->MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY)) { // Use location_incoterms
$sql = "SELECT z.location as location_incoterms, z.label as label";
$sql .= " FROM ".MAIN_DB_PREFIX."c_location_incoterms as z";
$sql .= " WHERE z.active = 1 AND UPPER(z.location) LIKE UPPER('%".$db->escape($location_incoterms)."%')";
$sql .= " ORDER BY z.location";
$sql .= $db->plimit(100); // Avoid pb with bad criteria
} else // Use table of commande
{
$sql = "SELECT DISTINCT s.location_incoterms FROM ".MAIN_DB_PREFIX.'commande as s';
$sql .= " WHERE UPPER(s.location_incoterms) LIKE UPPER('%".$db->escape($location_incoterms)."%')";
//Todo: merge with data from table of supplier order
/* $sql .=" UNION";
$sql .= " SELECT DISTINCT p.location_incoterms FROM ".MAIN_DB_PREFIX.'commande_fournisseur as p';
$sql .= " WHERE UPPER(p.location_incoterms) LIKE UPPER('%".$db->escape($location_incoterms)."%')";
*/
$sql .= " ORDER BY s.location_incoterms";
$sql .= $db->plimit(100); // Avoid pb with bad criteria
}
//print $sql;
$resql = $db->query($sql);
//var_dump($db);
if ($resql) {
while ($row = $db->fetch_array($resql)) {
$row_array['label'] = $row['location_incoterms'].($row['label']?' - '.$row['label'] : '');
if ($location_incoterms) {
$row_array['value'] = $row['location_incoterms'];
}
// TODO Use a cache here to avoid to make select_state in each pass (this make a SQL and lot of logs)
array_push($return_arr, $row_array);
}
}
echo json_encode($return_arr);
}
$db->close();

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010-2015 Regis Houssin <regis.houssin@inodbox.com>
/* Copyright (C) 2010-2021 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
@ -79,7 +79,7 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
$perm = 1;
} elseif ($table_element_line == 'facturedet' && $user->rights->facture->creer) {
$perm = 1;
} elseif ($table_element_line == 'facturerecdet' && $user->rights->facture->creer) {
} elseif ($table_element_line == 'facturedet_rec' && $user->rights->facture->creer) {
$perm = 1;
} elseif ($table_element_line == 'ecm_files' && $user->rights->ecm->creer) {
$perm = 1;
@ -89,7 +89,7 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
$perm = 1;
} elseif ($table_element_line == 'mrp_production' && $user->rights->mrp->write) {
$perm = 1;
} elseif ($table_element_line == 'supplier_proposaldet' && $user->rights->supplier_proposal->write) {
} elseif ($table_element_line == 'supplier_proposaldet' && $user->rights->supplier_proposal->creer) {
$perm = 1;
} elseif ($table_element_line == 'commande_fournisseurdet' && $user->rights->fournisseur->commande->creer) {
$perm = 1;

View File

@ -133,7 +133,8 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes
$thirdpartystatic->entity = $objp->entity;
$thirdpartystatic->outstanding_limit = $objp->outstanding_limit;
$outstandingtotal = $thirdpartystatic->getOutstandingBills()['opened'];
$tmp = $thirdpartystatic->getOutstandingBills();
$outstandingtotal = $tmp['opened'];
$outstandinglimit = $thirdpartystatic->outstanding_limit;
if ($outstandingtotal >= $outstandinglimit) {

View File

@ -128,7 +128,7 @@ class Comment extends CommonObject
$sql .= ", '".(isset($this->fk_element) ? $this->fk_element : "null")."'";
$sql .= ", '".$this->db->escape($this->element_type)."'";
$sql .= ", '".(isset($this->fk_user_author) ? $this->fk_user_author : "null")."'";
$sql .= ", ".$user->id."";
$sql .= ", ".((int) $user->id);
$sql .= ", ".(!empty($this->entity) ? $this->entity : '1');
$sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null");
$sql .= ")";

View File

@ -1941,9 +1941,9 @@ abstract class CommonObject
if ($fk_user_field) {
if (!empty($fuser) && is_object($fuser)) {
$sql .= ", ".$fk_user_field." = ".$fuser->id;
$sql .= ", ".$fk_user_field." = ".((int) $fuser->id);
} elseif (empty($fuser) || $fuser != 'none') {
$sql .= ", ".$fk_user_field." = ".$user->id;
$sql .= ", ".$fk_user_field." = ".((int) $user->id);
}
}
@ -2010,6 +2010,11 @@ abstract class CommonObject
return 1;
}
// For backward compatibility
if ($this->table_element == 'facture_rec' && $fieldid == 'title') {
$fieldid = 'titre';
}
// Security on socid
$socid = 0;
if ($user->socid > 0) {
@ -4292,10 +4297,10 @@ abstract class CommonObject
//print 'Found into table '.$table.', type '.$langs->transnoentitiesnoconv($elementname).', haschild='.$haschild;
$haschild += $obj->nb;
if (is_numeric($elementname)) { // old usage
$this->errors[] = $langs->trans("ErrorRecordHasAtLeastOneChildOfType", $table);
$this->errors[] = $langs->transnoentities("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table);
} else // new usage: $elementname=Translation key
{
$this->errors[] = $langs->trans("ErrorRecordHasAtLeastOneChildOfType", $langs->transnoentitiesnoconv($elementname));
$this->errors[] = $langs->transnoentities("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($elementname));
}
break; // We found at least one, we stop here
}
@ -6721,9 +6726,9 @@ abstract class CommonObject
foreach ($fields_label as $field_toshow) {
$translabel = $langs->trans($obj->$field_toshow);
if ($translabel != $obj->$field_toshow) {
$labeltoshow = dol_trunc($translabel, 18).' ';
$labeltoshow = dol_trunc($translabel).' ';
} else {
$labeltoshow = dol_trunc($obj->$field_toshow, 18).' ';
$labeltoshow = dol_trunc($obj->$field_toshow).' ';
}
}
$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
@ -6733,7 +6738,7 @@ abstract class CommonObject
if ($translabel != $obj->{$InfoFieldList[1]}) {
$labeltoshow = dol_trunc($translabel, 18);
} else {
$labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}, 18);
$labeltoshow = dol_trunc($obj->{$InfoFieldList[1]});
}
}
if (empty($labeltoshow)) {
@ -6916,7 +6921,7 @@ abstract class CommonObject
}
}
} elseif ($type == 'link') {
$param_list = array_keys($param['options']); // $param_list='ObjectName:classPath[:AddCreateButtonOrNot[:Filter]]'
$param_list = array_keys($param['options']); // $param_list='ObjectName:classPath[:AddCreateButtonOrNot[:Filter[:Sortfield]]]'
$param_list_array = explode(':', $param_list[0]);
$showempty = (($required && $default != '') ? 0 : 1);
@ -8961,7 +8966,7 @@ abstract class CommonObject
* @param User $user User that deletes
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @param int $forcechilddeletion 0=no, 1=Force deletion of children
* @return int <=0 if KO, >0 if OK
* @return int <=0 if KO, 0=Nothing done because object has child, >0 if OK
*/
public function deleteCommon(User $user, $notrigger = false, $forcechilddeletion = 0)
{

View File

@ -71,7 +71,7 @@ abstract class CommonObjectLine extends CommonObject
{
global $langs;
if (!$this->fk_unit) {
if (empty($this->fk_unit)) {
return '';
}
@ -87,6 +87,7 @@ abstract class CommonObjectLine extends CommonObject
}
$sql = "SELECT ".$label_type.", code from ".MAIN_DB_PREFIX."c_units where rowid = ".((int) $this->fk_unit);
$resql = $this->db->query($sql);
if ($resql && $this->db->num_rows($resql) > 0) {
$res = $this->db->fetch_array($resql);

View File

@ -215,26 +215,33 @@ class Conf
// modules_parts['login'], modules_parts['menus'], modules_parts['substitutions'], modules_parts['triggers'], modules_parts['tpl'],
// modules_parts['models'], modules_parts['theme']
// modules_parts['sms'],
// modules_parts['css'], ...
// modules_parts['css'], modules_parts['js'],...
$modulename = strtolower($reg[1]);
$partname = strtolower($reg[2]);
if (!isset($this->modules_parts[$partname]) || !is_array($this->modules_parts[$partname])) {
$this->modules_parts[$partname] = array();
}
$arrValue = json_decode($value, true);
if (is_array($arrValue) && !empty($arrValue)) {
$value = $arrValue;
if (is_array($arrValue)) {
$newvalue = $arrValue;
} elseif (in_array($partname, array('login', 'menus', 'substitutions', 'triggers', 'tpl'))) {
$value = '/'.$modulename.'/core/'.$partname.'/';
$newvalue = '/'.$modulename.'/core/'.$partname.'/';
} elseif (in_array($partname, array('models', 'theme'))) {
$value = '/'.$modulename.'/';
$newvalue = '/'.$modulename.'/';
} elseif (in_array($partname, array('sms'))) {
$value = '/'.$modulename.'/';
$newvalue = '/'.$modulename.'/';
} elseif ($value == 1) {
$value = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe
$newvalue = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe
} else {
$newvalue = $value;
}
if (!empty($newvalue)) {
$this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $newvalue)); // $value may be a string or an array
}
$this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value)); // $value may be a string or an array
} elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)$/i', $key, $reg)) {
// If this is a module constant (must be at end)
$modulename = strtolower($reg[1]);

View File

@ -219,7 +219,7 @@ class CProductNature // extends CommonObject
}
}
if (count($sqlwhere) > 0) {
$sql .= ' WHERE ('.implode(' '.$filtermode.' ', $sqlwhere).')';
$sql .= ' WHERE ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')';
}
if (!empty($sortfield)) {

View File

@ -239,12 +239,12 @@ class Ctyperesource
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
$sqlwhere [] = $key." LIKE '%".$this->db->escape($value)."%'";
$sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
}
}
if (count($sqlwhere) > 0) {
$sql .= ' WHERE '.implode(' '.$filtermode.' ', $sqlwhere);
$sql .= ' WHERE '.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere);
}
if (!empty($sortfield)) {
$sql .= $this->db->order($sortfield, $sortorder);

View File

@ -262,7 +262,7 @@ class CUnits // extends CommonObject
}
}
if (count($sqlwhere) > 0) {
$sql .= ' WHERE ('.implode(' '.$filtermode.' ', $sqlwhere).')';
$sql .= ' WHERE ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')';
}
if (!empty($sortfield)) {

View File

@ -279,7 +279,7 @@ class DefaultValues extends CommonObject
}
}
if (count($sqlwhere) > 0) {
$sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')';
$sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')';
}
if (!empty($sortfield)) {

View File

@ -388,9 +388,9 @@ class dolReceiptPrinter extends Printer
{
global $conf;
$error = 0;
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'printer_receipt';
$sql .= ' (name, fk_type, fk_profile, parameter, entity)';
$sql .= ' VALUES ("'.$this->db->escape($name).'", '.((int) $type).', '.((int) $profile).', "'.$this->db->escape($parameter).'", '.$conf->entity.')';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."printer_receipt";
$sql .= " (name, fk_type, fk_profile, parameter, entity)";
$sql .= " VALUES ('".$this->db->escape($name)."', ".((int) $type).", ".((int) $profile).", '".$this->db->escape($parameter)."', ".((int) $conf->entity).")";
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
@ -413,12 +413,14 @@ class dolReceiptPrinter extends Printer
{
global $conf;
$error = 0;
$sql = 'UPDATE '.MAIN_DB_PREFIX.'printer_receipt';
$sql .= ' SET name="'.$this->db->escape($name).'"';
$sql .= ', fk_type='.((int) $type);
$sql .= ', fk_profile='.((int) $profile);
$sql .= ', parameter="'.$this->db->escape($parameter).'"';
$sql .= ' WHERE rowid='.((int) $printerid);
$sql = "UPDATE ".MAIN_DB_PREFIX."printer_receipt";
$sql .= " SET name='".$this->db->escape($name)."'";
$sql .= ", fk_type=".((int) $type);
$sql .= ", fk_profile=".((int) $profile);
$sql .= ", parameter='".$this->db->escape($parameter)."'";
$sql .= " WHERE rowid=".((int) $printerid);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
@ -458,9 +460,9 @@ class dolReceiptPrinter extends Printer
{
global $conf;
$error = 0;
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'printer_receipt_template';
$sql .= ' (name, template, entity) VALUES ("'.$this->db->escape($name).'"';
$sql .= ', "'.$this->db->escape($template).'", '.$conf->entity.')';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."printer_receipt_template";
$sql .= " (name, template, entity) VALUES ('".$this->db->escape($name)."'";
$sql .= ", '".$this->db->escape($template)."', ".$conf->entity.")";
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
@ -502,10 +504,11 @@ class dolReceiptPrinter extends Printer
{
global $conf;
$error = 0;
$sql = 'UPDATE '.MAIN_DB_PREFIX.'printer_receipt_template';
$sql .= ' SET name="'.$this->db->escape($name).'"';
$sql .= ', template="'.$this->db->escape($template).'"';
$sql .= ' WHERE rowid='.((int) $templateid);
$sql = "UPDATE ".MAIN_DB_PREFIX."printer_receipt_template";
$sql .= " SET name='".$this->db->escape($name)."'";
$sql .= ", template='".$this->db->escape($template)."'";
$sql .= " WHERE rowid=".((int) $templateid);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;

View File

@ -147,9 +147,9 @@ class Fiscalyear extends CommonObject
$sql .= ", '".$this->db->idate($this->date_start)."'";
$sql .= ", ".($this->date_end ? "'".$this->db->idate($this->date_end)."'" : "null");
$sql .= ", 0";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".$user->id;
$sql .= ", ".((int) $user->id);
$sql .= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);

Some files were not shown because too many files have changed in this diff Show More