Merge branch 'Dolibarr:develop' into develop

This commit is contained in:
Erik van Berkum 2021-09-03 10:42:32 +09:00 committed by GitHub
commit bb475328e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
163 changed files with 2336 additions and 1091 deletions

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;
}
@ -1813,7 +1828,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Show link to invoices
$tmparray = $company->getOutstandingBills('customer');
if (!empty($tmparray['refs'])) {
print ' - '.img_picto($langs->trans("Invoices"), 'bill', 'class="paddingright"').'<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->socid.'">'.$langs->trans("Invoices").': '.count($tmparray['refs']);
print ' - '.img_picto($langs->trans("Invoices"), 'bill', 'class="paddingright"').'<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->socid.'">'.$langs->trans("Invoices").' ('.count($tmparray['refs']).')';
// TODO Add alert if warning on at least one invoice late
print '</a>';
}
@ -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

@ -2185,6 +2185,9 @@ class Adherent extends CommonObject
if (!empty($this->ref)) {
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
}
if (!empty($this->login)) {
$label .= '<br><b>'.$langs->trans('Login').':</b> '.$this->login;
}
if (!empty($this->firstname) || !empty($this->lastname)) {
$label .= '<br><b>'.$langs->trans('Name').':</b> '.$this->getFullName($langs);
}

View File

@ -318,6 +318,7 @@ $sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.p
$sql .= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
$sql .= " d.note_private, d.note_public,";
$sql .= " s.nom,";
$sql .= " ".$db->ifsql("d.societe IS NULL", "s.nom", "d.societe")." as companyname,";
$sql .= " t.libelle as type, t.subscription,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
// Add fields from extrafields
@ -492,7 +493,7 @@ if (GETPOSTISSET("search_status")) {
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'outofdate') {
$titre = $langs->trans("MembersListNotUpToDate");
}
if ($search_status == Adherent::STATUS_RESILIATED) {
if ((string) $search_status == (string) Adherent::STATUS_RESILIATED) { // The cast to string is required to have test false when search_status is ''
$titre = $langs->trans("MembersListResiliated");
}
if ($search_status == Adherent::STATUS_EXCLUDED) {
@ -601,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);
@ -833,7 +834,7 @@ if (!empty($arrayfields['d.gender']['checked'])) {
print_liste_field_titre($arrayfields['d.gender']['label'], $_SERVER['PHP_SELF'], 'd.gender', $param, "", "", $sortfield, $sortorder);
}
if (!empty($arrayfields['d.company']['checked'])) {
print_liste_field_titre($arrayfields['d.company']['label'], $_SERVER["PHP_SELF"], 'd.societe', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['d.company']['label'], $_SERVER["PHP_SELF"], 'companyname', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.login']['checked'])) {
print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], 'd.login', '', $param, '', $sortfield, $sortorder);
@ -906,6 +907,7 @@ while ($i < min($num, $limit)) {
$memberstatic->id = $obj->rowid;
$memberstatic->ref = $obj->ref;
$memberstatic->civility_id = $obj->civility;
$memberstatic->login = $obj->login;
$memberstatic->lastname = $obj->lastname;
$memberstatic->firstname = $obj->firstname;
$memberstatic->gender = $obj->gender;
@ -920,9 +922,13 @@ while ($i < min($num, $limit)) {
if (!empty($obj->fk_soc)) {
$memberstatic->fetch_thirdparty();
$companyname = $memberstatic->thirdparty->name;
if ($memberstatic->thirdparty->id > 0) {
$companyname = $memberstatic->thirdparty->name;
$companynametoshow = $memberstatic->thirdparty->getNomUrl(1);
}
} else {
$companyname = $obj->company;
$companynametoshow = $obj->company;
}
$memberstatic->company = $companyname;
@ -956,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']++;
@ -965,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']++;
@ -985,7 +993,7 @@ while ($i < min($num, $limit)) {
// Company
if (!empty($arrayfields['d.company']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companyname).'">';
print $companyname;
print $companynametoshow;
print "</td>\n";
}
// Login
@ -1095,7 +1103,9 @@ while ($i < min($num, $limit)) {
}
// EMail
if (!empty($arrayfields['d.email']['checked'])) {
print "<td>".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

@ -308,7 +308,7 @@ if ($mode) {
print '</tr>';
foreach ($data as $val) {
$year = isset($val['year']) ? $val['year'] : '';;
$year = isset($val['year']) ? $val['year'] : '';
print '<tr class="oddeven">';
print '<td>'.$val['label'].'</td>';
if (isset($label2)) {

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"));
}
@ -612,7 +612,7 @@ if ($rowid > 0) {
// Show link to invoices
$tmparray = $company->getOutstandingBills('customer');
if (!empty($tmparray['refs'])) {
print ' - '.img_picto($langs->trans("Invoices"), 'bill', 'class="paddingright"').'<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->socid.'">'.$langs->trans("Invoices").': '.count($tmparray['refs']);
print ' - '.img_picto($langs->trans("Invoices"), 'bill', 'class="paddingright"').'<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->socid.'">'.$langs->trans("Invoices").' ('.count($tmparray['refs']).')';
// TODO Add alert if warning on at least one invoice late
print '</a>';
}

View File

@ -172,7 +172,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
$object->morphy = trim($morphy);
$object->status = (int) $status;
$object->subscription = (int) $subscription;
$object->amount = ($amount == '' ? '' : price2num($amount, 'MT'));;
$object->amount = ($amount == '' ? '' : price2num($amount, 'MT'));
$object->duration_value = $duration_value;
$object->duration_unit = $duration_unit;
$object->note = trim($comment);

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

@ -265,7 +265,7 @@ if ($action == 'update') {
$_SESSION["mainmenu"] = ""; // The menu manager may have changed
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".'&mode='.$mode.(GETPOSTISSET('page_y', 'int') ? '&page_y='.GETPOST('page_y', 'int') : ''));
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".'&mode='.$mode.(GETPOSTISSET('page_y') ? '&page_y='.GETPOST('page_y', 'int') : ''));
exit;
}

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

@ -588,6 +588,11 @@ if ($mode == 'common' || $mode == 'commonkanban') {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
$disabled_modules = array();
if (!empty($_SESSION["disablemodules"])) {
$disabled_modules = explode(',', $_SESSION["disablemodules"]);
}
// Show list of modules
$oldfamily = '';
$foundoneexternalmodulewithupdate = 0;
@ -613,6 +618,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
continue;
}
$modulenameshort = strtolower(preg_replace('/^mod/i', '', get_class($objMod)));
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
// Check filters
@ -754,6 +760,11 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$codeenabledisable = '';
$codetoconfig = '';
// Force disable of module disabled into session (for demo for example)
if (in_array($modulenameshort, $disabled_modules)) {
$objMod->disabled = true;
}
// Activate/Disable and Setup (2 columns)
if (!empty($conf->global->$const_name)) { // If module is already activated
// Set $codeenabledisable
@ -761,6 +772,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
if (!empty($arrayofwarnings[$modName])) {
$codeenabledisable .= '<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n";
}
if (!empty($objMod->disabled)) {
$codeenabledisable .= $langs->trans("Disabled");
} elseif (!empty($objMod->always_enabled) || ((!empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {

View File

@ -52,27 +52,57 @@ 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_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,22 +117,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);
}
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
@ -463,6 +521,16 @@ print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td
print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0));
print '</td></tr>';
// Show online payment link on invoices
print '<tr class="oddeven"><td>'.$langs->trans("PDF_SHOW_LINK_TO_ONLINE_PAYMENT").'</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('PDF_SHOW_LINK_TO_ONLINE_PAYMENT');
} else {
print $form->selectyesno('PDF_SHOW_LINK_TO_ONLINE_PAYMENT', (!empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)) ? $conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT : 0, 1);
}
print '</td></tr>';
print '</table>';
print '</div>';

View File

@ -310,14 +310,23 @@ class DolibarrApi
}
if ($tmp[$i] == ')') {
$counter--;
// TODO: After a closing ), only a " or " or " and " or end of string is allowed.
}
if ($counter < 0) {
$error = "Bad sqlfilters=".$sqlfilters;
$error = "Bad sqlfilters (too many closing parenthesis) = ".$sqlfilters;
dol_syslog($error, LOG_WARNING);
return false;
}
$i++;
}
if ($counter > 0) {
$error = "Bad sqlfilters (too many opening parenthesis) = ".$sqlfilters;
dol_syslog($error, LOG_WARNING);
return false;
}
return true;
}
@ -327,7 +336,8 @@ class DolibarrApi
* Function to forge a SQL criteria
*
* @param array $matches Array of found string by regex search.
* Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.date_creation:<:'2016-01-01 12:30:00'" or "t.nature:is:NULL" or "t.nature:isnot:NULL"
* Each entry is 1 and only 1 criteria.
* Example: "t.ref:like:'SO-%'", "t.date_creation:<:'20160101'", "t.date_creation:<:'2016-01-01 12:30:00'", "t.nature:is:NULL", "t.field2:isnot:NULL"
* @return string Forged criteria. Example: "t.field like 'abc%'"
*/
protected static function _forge_criteria_callback($matches)

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 = '';
@ -150,6 +150,9 @@ class DolibarrApiAccess implements iAuthenticate
$fuser->getrights();
static::$user = $fuser;
// Set 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

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

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

@ -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>';
@ -1378,10 +1384,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 +1396,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 +1405,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 +1419,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;
}

View File

@ -346,7 +346,7 @@ if ($action == "sign" && $permissiontoclose) {
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;;
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
} else {

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

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

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

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

View File

@ -1625,10 +1625,10 @@ class Facture extends CommonInvoice
}
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
$resql = $this->db->query($sql);
if ($resql) {
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->entity = $obj->entity;
@ -1730,14 +1730,18 @@ class Facture extends CommonInvoice
$this->error = $this->db->error();
return -3;
}
$this->db->free($resql);
return 1;
} else {
$this->error = 'Invoice with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found';
dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR);
dol_syslog(__METHOD__.$this->error, LOG_WARNING);
return 0;
}
} else {
$this->error = $this->db->error();
$this->error = $this->db->lasterror();
return -1;
}
}

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

@ -100,7 +100,7 @@ class RejetPrelevement
$facs = $this->getListInvoices(1);
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
$lipre = new LignePrelevement($this->db, $user);
$lipre = new LignePrelevement($this->db);
$lipre->fetch($id);
$this->db->begin();

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

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

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

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

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

@ -1157,7 +1157,7 @@ class ExtraFields
} else {
$checked = ' value="1" ';
}
$out = '<input type="checkbox" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.$checked.' '.($moreparam ? $moreparam : '').'>';
$out = '<input type="checkbox" class="flat valignmiddle'.($morecss ? ' '.$morecss : '').' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.$checked.' '.($moreparam ? $moreparam : '').'>';
} else {
$out .= $form->selectyesno($keyprefix.$key.$keysuffix, $value, 1, false, 1);
}

View File

@ -1056,7 +1056,11 @@ class Form
}
$out .= '</select>';
$out .= '<input id="location_incoterms" class="maxwidth100onsmartphone nomargintop nomarginbottom" name="location_incoterms" value="'.$location_incoterms.'">';
if ($conf->use_javascript_ajax && empty($disableautocomplete)) {
$out .= ajax_multiautocompleter('location_incoterms', '', DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n";
$moreattrib .= ' autocomplete="off"';
}
$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n";
if (!empty($page)) {
$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>';
@ -1397,7 +1401,7 @@ class Form
if ($resql) {
if (!$forcecombo) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
$out .= ajax_combobox($htmlname, $events, getDolGlobalString("COMPANY_USE_SEARCH_TO_SELECT"));
}
// Construct $out and $outarray
@ -1414,7 +1418,7 @@ class Form
}
}
if ($showempty) {
$out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.$textifempty.'</span>').'">'.$textifempty.'</option>'."\n";
$out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : '&nbsp;').'</span>').'">'.$textifempty.'</option>'."\n";
}
$num = $this->db->num_rows($resql);
@ -1678,7 +1682,7 @@ class Form
if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
$out .= ajax_combobox($htmlid, $events, getDolGlobalString("CONTACT_USE_SEARCH_TO_SELECT"));
}
if ($htmlname != 'none' && !$options_only) {
@ -4799,7 +4803,8 @@ class Form
} elseif ($input['type'] == 'date') {
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>';
$more .= '<div class="tagtd">';
$more .= $this->selectDate($input['value'], $input['name'], 0, 0, 0, '', 1, 0);
$addnowlink = (empty($input['datenow']) ? 0 : 1);
$more .= $this->selectDate($input['value'], $input['name'], 0, 0, 0, '', 1, $addnowlink);
$more .= '</div></div>'."\n";
$formquestion[] = array('name'=>$input['name'].'day');
$formquestion[] = array('name'=>$input['name'].'month');
@ -6664,7 +6669,7 @@ class Form
* @param string $htmlname Name of select html
* @param string $filtertype Filter on ticket type
* @param int $limit Limit on number of returned lines
* @param string $filterkey Filter on product
* @param string $filterkey Filter on ticket ref or subject
* @param int $status Ticket status
* @param int $outputmode 0=HTML select string, 1=Array
* @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
@ -6696,7 +6701,7 @@ class Form
if (count($scrit) > 1) $sql .= "(";
foreach ($scrit as $crit) {
if ($i > 0) $sql .= " AND ";
$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";
$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'";
$sql .= ")";
$i++;
}
@ -9298,7 +9303,8 @@ class Form
$retstring = $withoutdiv ? '': '<div class="center">';
foreach ($buttons as $button) {
$retstring .= '<input type="submit" class="button button-'.$button['name'].' '.$button['addclass'].'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';
$addclass = empty($button['addclass']) ? '' : $button['addclass'];
$retstring .= '<input type="submit" class="button button-'.$button['name'].' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';
}
$retstring .= $withoutdiv ? '': '</div>';

View File

@ -263,7 +263,7 @@ class FormTicket
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
print '<tr><td class="titlefield"><label for="email"><span class="fieldrequired">'.$langs->trans("SecurityCode").'</span></label></td><td>';
print '<span class="span-icon-security inline-block">';
print '<input id="securitycode" placeholder="'.$langs->trans("SecurityCode").'" class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" />';
print '<input id="securitycode" placeholder="'.$langs->trans("SecurityCode").'" class="flat input-icon-security width125" type="text" maxlength="5" name="code" tabindex="3" />';
print '</span>';
print '<span class="nowrap inline-block">';
print '<img class="inline-block valignmiddle" src="'.DOL_URL_ROOT.'/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />';
@ -274,11 +274,15 @@ class FormTicket
// Categories
if ($conf->categorie->enabled) {
// Categories
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_TICKET, '', 'parent', 64, 0, 1);
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print "</td></tr>";
if (count($cate_arbo)) {
// Categories
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print "</td></tr>";
}
}
// Attached files
@ -467,13 +471,19 @@ class FormTicket
print dol_get_fiche_end();
}
print '<br><div class="center">';
print '<br>';
print $form->buttonsSaveCancel((($this->withthreadid > 0) ? "SendResponse" : "CreateTicket"), ($this->withcancel ? "Cancel" : ""));
/*
print '<div class="center">';
print '<input type="submit" class="button" name="add" value="'.$langs->trans(($this->withthreadid > 0 ? "SendResponse" : "CreateTicket")).'" />';
if ($this->withcancel) {
print " &nbsp; &nbsp; &nbsp;";
print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
}
print '</div>';
*/
print '<input type="hidden" name="page_y">'."\n";

View File

@ -231,7 +231,7 @@ class SMTPs
/**
* An array of options for stream_context_create()
*/
private $_options = [];
private $_options = array();
/**
* Set delivery receipt
@ -239,7 +239,7 @@ class SMTPs
* @param array $_options An array of options for stream_context_create()
* @return void
*/
public function setOptions($_options = [])
public function setOptions($_options = array())
{
$this->_options = $_options;
}

View File

@ -46,13 +46,12 @@ class Validate
/**
* Constructor
* Constructor
*
* @param DoliDB $db Database handler
* @param Translate $outputLang output lang for error
* @return null
* @param DoliDB $db Database handler
* @param Translate $outputLang Output lang for error
*/
public function __construct($db, $outputLang = false)
public function __construct($db, $outputLang = null)
{
global $langs;

View File

@ -432,13 +432,13 @@ interface Database
/**
* Encrypt sensitive data in database
* Warning: This function includes the escape, so it must use direct value
* Warning: This function includes the escape and add the SQL simple quotes on strings.
*
* @param string $fieldorvalue Field name or value to encrypt
* @param int $withQuotes Return string with quotes
* @return string XXX(field) or XXX('value') or field or 'value'
* @param string $fieldorvalue Field name or value to encrypt
* @param int $withQuotes Return string including the SQL simple quotes. This param must always be 1 (Value 0 is bugged and deprecated).
* @return string XXX(field) or XXX('value') or field or 'value'
*/
public function encrypt($fieldorvalue, $withQuotes = 0);
public function encrypt($fieldorvalue, $withQuotes = 1);
/**
* Validate a database transaction

View File

@ -522,15 +522,14 @@ class DoliDBMysqli extends DoliDB
}
/**
* Encrypt sensitive data in database
* Warning: This function includes the escape, so it must use direct value
*
* @param string $fieldorvalue Field name or value to encrypt
* @param int $withQuotes Return string with quotes
* @return string XXX(field) or XXX('value') or field or 'value'
* Encrypt sensitive data in database
* Warning: This function includes the escape and add the SQL simple quotes on strings.
*
* @param string $fieldorvalue Field name or value to encrypt
* @param int $withQuotes Return string including the SQL simple quotes. This param must always be 1 (Value 0 is bugged and deprecated).
* @return string XXX(field) or XXX('value') or field or 'value'
*/
public function encrypt($fieldorvalue, $withQuotes = 0)
public function encrypt($fieldorvalue, $withQuotes = 1)
{
global $conf;
@ -540,17 +539,17 @@ class DoliDBMysqli extends DoliDB
//Encryption key
$cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey) ? $conf->db->dolibarr_main_db_cryptkey : '');
$return = ($withQuotes ? "'" : "").$this->escape($fieldorvalue).($withQuotes ? "'" : "");
$escapedstringwithquotes = ($withQuotes ? "'" : "").$this->escape($fieldorvalue).($withQuotes ? "'" : "");
if ($cryptType && !empty($cryptKey)) {
if ($cryptType == 2) {
$return = 'AES_ENCRYPT('.$return.',\''.$cryptKey.'\')';
$escapedstringwithquotes = "AES_ENCRYPT(".$escapedstringwithquotes.", '".$this->escape($cryptKey)."')";
} elseif ($cryptType == 1) {
$return = 'DES_ENCRYPT('.$return.',\''.$cryptKey.'\')';
$escapedstringwithquotes = "DES_ENCRYPT(".$escapedstringwithquotes.", '".$this->escape($cryptKey)."')";
}
}
return $return;
return $escapedstringwithquotes;
}
/**

View File

@ -823,22 +823,22 @@ class DoliDBPgsql extends DoliDB
}
/**
* Encrypt sensitive data in database
* Warning: This function includes the escape, so it must use direct value
* Encrypt sensitive data in database
* Warning: This function includes the escape and add the SQL simple quotes on strings.
*
* @param string $fieldorvalue Field name or value to encrypt
* @param int $withQuotes Return string with quotes
* @return string XXX(field) or XXX('value') or field or 'value'
* @param string $fieldorvalue Field name or value to encrypt
* @param int $withQuotes Return string including the SQL simple quotes. This param must always be 1 (Value 0 is bugged and deprecated).
* @return string XXX(field) or XXX('value') or field or 'value'
*/
public function encrypt($fieldorvalue, $withQuotes = 0)
public function encrypt($fieldorvalue, $withQuotes = 1)
{
global $conf;
// Type of encryption (2: AES (recommended), 1: DES , 0: no encryption)
$cryptType = ($conf->db->dolibarr_main_db_encryption ? $conf->db->dolibarr_main_db_encryption : 0);
//$cryptType = ($conf->db->dolibarr_main_db_encryption ? $conf->db->dolibarr_main_db_encryption : 0);
//Encryption key
$cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey) ? $conf->db->dolibarr_main_db_cryptkey : '');
//$cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey) ? $conf->db->dolibarr_main_db_cryptkey : '');
$return = $fieldorvalue;
return ($withQuotes ? "'" : "").$this->escape($return).($withQuotes ? "'" : "");

View File

@ -744,34 +744,34 @@ class DoliDBSqlite3 extends DoliDB
}
/**
* Encrypt sensitive data in database
* Warning: This function includes the escape, so it must use direct value
* Encrypt sensitive data in database
* Warning: This function includes the escape and add the SQL simple quotes on strings.
*
* @param string $fieldorvalue Field name or value to encrypt
* @param int $withQuotes Return string with quotes
* @return string XXX(field) or XXX('value') or field or 'value'
* @param string $fieldorvalue Field name or value to encrypt
* @param int $withQuotes Return string including the SQL simple quotes. This param must always be 1 (Value 0 is bugged and deprecated).
* @return string XXX(field) or XXX('value') or field or 'value'
*/
public function encrypt($fieldorvalue, $withQuotes = 0)
public function encrypt($fieldorvalue, $withQuotes = 1)
{
global $conf;
// Type of encryption (2: AES (recommended), 1: DES , 0: no encryption)
$cryptType = ($conf->db->dolibarr_main_db_encryption ? $conf->db->dolibarr_main_db_encryption : 0);
$cryptType = (!empty($conf->db->dolibarr_main_db_encryption) ? $conf->db->dolibarr_main_db_encryption : 0);
//Encryption key
$cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey) ? $conf->db->dolibarr_main_db_cryptkey : '');
$return = ($withQuotes ? "'" : "").$this->escape($fieldorvalue).($withQuotes ? "'" : "");
$escapedstringwithquotes = ($withQuotes ? "'" : "").$this->escape($fieldorvalue).($withQuotes ? "'" : "");
if ($cryptType && !empty($cryptKey)) {
if ($cryptType == 2) {
$return = 'AES_ENCRYPT('.$return.',\''.$cryptKey.'\')';
$escapedstringwithquotes = "AES_ENCRYPT(".$escapedstringwithquotes.", '".$this->escape($cryptKey)."')";
} elseif ($cryptType == 1) {
$return = 'DES_ENCRYPT('.$return.',\''.$cryptKey.'\')';
$escapedstringwithquotes = "DES_ENCRYPT(".$escapedstringwithquotes.", '".$this->escape($cryptKey)."')";
}
}
return $return;
return $escapedstringwithquotes;
}
/**

View File

@ -345,7 +345,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
for ($j = 0; $j < $num; $j++) {
$from = $reg[0][$j];
$to = $db->encrypt($reg[1][$j], 1);
$to = $db->encrypt($reg[1][$j]);
$newsql = str_replace($from, $to, $newsql);
}
$sqlmodified++;
@ -481,10 +481,10 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
/**
* Effacement d'une constante dans la base de donnees
* Delete a constant
*
* @param DoliDB $db Database handler
* @param string $name Name of constant or rowid of line
* @param string|int $name Name of constant or rowid of line
* @param int $entity Multi company id, -1 for all entities
* @return int <0 if KO, >0 if OK
*
@ -502,7 +502,7 @@ function dolibarr_del_const($db, $name, $entity = 1)
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const";
$sql .= " WHERE (".$db->decrypt('name')." = '".$db->escape($name)."'";
if (is_numeric($name)) {
$sql .= " OR rowid = '".$db->escape($name)."'";
$sql .= " OR rowid = ".((int) $name);
}
$sql .= ")";
if ($entity >= 0) {
@ -536,7 +536,7 @@ function dolibarr_get_const($db, $name, $entity = 1)
$sql = "SELECT ".$db->decrypt('value')." as value";
$sql .= " FROM ".MAIN_DB_PREFIX."const";
$sql .= " WHERE name = '".$db->escape($db->encrypt($name))."'";
$sql .= " WHERE name = ".$db->encrypt($name);
$sql .= " AND entity = ".((int) $entity);
dol_syslog("admin.lib::dolibarr_get_const", LOG_DEBUG);
@ -583,7 +583,7 @@ function dolibarr_set_const($db, $name, $value, $type = 'chaine', $visible = 0,
$db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const";
$sql .= " WHERE name = '".$db->escape($db->encrypt($name))."'";
$sql .= " WHERE name = ".$db->encrypt($name);
if ($entity >= 0) {
$sql .= " AND entity = ".((int) $entity);
}
@ -594,8 +594,8 @@ function dolibarr_set_const($db, $name, $value, $type = 'chaine', $visible = 0,
if (strcmp($value, '')) { // true if different. Must work for $value='0' or $value=0
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity)";
$sql .= " VALUES (";
$sql .= $db->encrypt($name, 1);
$sql .= ", ".$db->encrypt($value, 1);
$sql .= $db->encrypt($name);
$sql .= ", ".$db->encrypt($value);
$sql .= ",'".$db->escape($type)."',".((int) $visible).",'".$db->escape($note)."',".((int) $entity).")";
//print "sql".$value."-".pg_escape_string($value)."-".$sql;exit;
@ -753,7 +753,7 @@ function security_prepare_head()
$sql = "SELECT COUNT(r.id) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
$sql .= " AND entity = ".$conf->entity;
$sql .= " AND entity = ".((int) $conf->entity);
$sql .= " AND bydefault = 1";
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
@ -1839,7 +1839,7 @@ function delDocumentModel($name, $type)
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql .= " WHERE nom = '".$db->escape($name)."'";
$sql .= " AND type = '".$db->escape($type)."'";
$sql .= " AND entity = ".$conf->entity;
$sql .= " AND entity = ".((int) $conf->entity);
dol_syslog("admin.lib::delDocumentModel", LOG_DEBUG);
$resql = $db->query($sql);

View File

@ -692,14 +692,11 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
*
* @param string $paramname Name of parameter to found
* @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get)
* @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails)
* @param mixed $options Options to pass to filter_var when $check is set to 'custom'
* @param string $noreplace Force disable of replacement of __xxx__ strings.
* @return int Value found (int)
*/
function GETPOSTINT($paramname, $method = 0, $filter = null, $options = null, $noreplace = 0)
function GETPOSTINT($paramname, $method = 0)
{
return (int) GETPOST($paramname, 'int', $method, $filter, $options, $noreplace);
return (int) GETPOST($paramname, 'int', $method, null, null, 0);
}
/**

View File

@ -256,7 +256,7 @@ function getCustomerInvoicePieChart($socid = 0)
$i = 0;
$total = 0;
$vals = [];
$vals = array();
while ($i < $num) {
$row = $db->fetch_row($resql);
@ -279,14 +279,14 @@ function getCustomerInvoicePieChart($socid = 0)
$result .= '</tr>';
$objectstatic = new Facture($db);
$array = [Facture::STATUS_DRAFT, Facture::STATUS_VALIDATED, Facture::STATUS_CLOSED, Facture::STATUS_ABANDONED];
$dataseries = [];
$array = array(Facture::STATUS_DRAFT, Facture::STATUS_VALIDATED, Facture::STATUS_CLOSED, Facture::STATUS_ABANDONED);
$dataseries = array();
foreach ($array as $status) {
$objectstatic->statut = $status;
$objectstatic->paye = $status == Facture::STATUS_CLOSED ? -1 : 0;
$dataseries[] = [$objectstatic->getLibStatut(1), (isset($vals[$status]) ? (int) $vals[$status] : 0)];
$dataseries[] = array($objectstatic->getLibStatut(1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
if ($status == Facture::STATUS_DRAFT) {
$colorseries[$status] = '-'.$badgeStatus0;
}
@ -376,7 +376,7 @@ function getPurchaseInvoicePieChart($socid = 0)
$i = 0;
$total = 0;
$vals = [];
$vals = array();
while ($i < $num) {
$row = $db->fetch_row($resql);
@ -400,14 +400,14 @@ function getPurchaseInvoicePieChart($socid = 0)
$result .= '</tr>';
$objectstatic = new FactureFournisseur($db);
$array = [FactureFournisseur::STATUS_DRAFT, FactureFournisseur::STATUS_VALIDATED, FactureFournisseur::STATUS_CLOSED, FactureFournisseur::STATUS_ABANDONED];
$dataseries = [];
$array = array(FactureFournisseur::STATUS_DRAFT, FactureFournisseur::STATUS_VALIDATED, FactureFournisseur::STATUS_CLOSED, FactureFournisseur::STATUS_ABANDONED);
$dataseries = array();
foreach ($array as $status) {
$objectstatic->statut = $status;
$objectstatic->paye = $status == FactureFournisseur::STATUS_CLOSED ? -1 : 0;
$dataseries[] = [$objectstatic->getLibStatut(1), (isset($vals[$status]) ? (int) $vals[$status] : 0)];
$dataseries[] = array($objectstatic->getLibStatut(1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
if ($status == FactureFournisseur::STATUS_DRAFT) {
$colorseries[$status] = '-'.$badgeStatus0;
}

View File

@ -751,7 +751,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
$sql .= " pf.".$fk_payment." as payment_id, pf.amount as payment_amount,";
$sql .= " pa.datep as datep, pa.ref as payment_ref";
$sql .= " FROM ".MAIN_DB_PREFIX.$invoicetable." as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX.$paymentfacturetable." as pf ON pf.".$fk_facture2." = f.rowid";;
$sql .= " INNER JOIN ".MAIN_DB_PREFIX.$paymentfacturetable." as pf ON pf.".$fk_facture2." = f.rowid";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX.$paymenttable." as pa ON pa.rowid = pf.".$fk_payment;
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX.$invoicedettable." as d ON d.".$fk_facture." = f.rowid";

View File

@ -85,9 +85,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
'position' => 10,
'id' => $id,
'idsel' => 'home',
'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "home") ? 'class="tmenusel"' : 'class="tmenu"',
'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "home") ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '<span class="fa fa-home fa-fw paddingright"></span>',
'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "home") ? 0 : 1),
'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "home") ? 0 : 1),
'loadLangs' => array(),
'submenus' => array(),
);
@ -110,9 +110,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
'position' => 18,
'id' => $id,
'idsel' => 'members',
'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members") ? 'class="tmenusel"' : 'class="tmenu"',
'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "members") ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => img_picto('', 'member', 'class="fa-fw paddingright"'),
'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members") ? 0 : 1),
'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "members") ? 0 : 1),
'loadLangs' => array(),
'submenus' => array(),
);
@ -139,9 +139,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
'position' => 20,
'id' => $id,
'idsel' => 'companies',
'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "companies") ? 'class="tmenusel"' : 'class="tmenu"',
'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "companies") ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => img_picto('', 'company', 'class="fa-fw paddingright"'),
'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "companies") ? 0 : 1),
'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "companies") ? 0 : 1),
'loadLangs' => array("companies", "suppliers"),
'submenus' => array(),
);
@ -166,9 +166,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
'position' => 30,
'id' => $id,
'idsel' => 'products',
'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "products") ? 'class="tmenusel"' : 'class="tmenu"',
'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "products") ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => img_picto('', 'product', 'class="fa-fw paddingright"'),
'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "products") ? 0 : 1),
'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "products") ? 0 : 1),
'loadLangs' => array("products"),
'submenus' => array(),
);
@ -191,9 +191,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
'position' => 31,
'id' => $id,
'idsel' => 'mrp',
'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "mrp") ? 'class="tmenusel"' : 'class="tmenu"',
'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "mrp") ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => img_picto('', 'mrp', 'class="fa-fw paddingright"'),
'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "mrp") ? 0 : 1),
'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "mrp") ? 0 : 1),
'loadLangs' => array("mrp"),
'submenus' => array(),
);
@ -216,9 +216,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
'position' => 35,
'id' => $id,
'idsel' => 'project',
'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project") ? 'class="tmenusel"' : 'class="tmenu"',
'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "project") ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => img_picto('', 'project', 'class="fa-fw paddingright"'),
'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project") ? 0 : 1),
'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "project") ? 0 : 1),
'loadLangs' => array("projects"),
'submenus' => array(),
);
@ -265,9 +265,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
'position' => 40,
'id' => $id,
'idsel' => 'commercial',
'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "commercial") ? 'class="tmenusel"' : 'class="tmenu"',
'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "commercial") ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => img_picto('', 'contract', 'class="fa-fw paddingright"'),
'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "commercial") ? 0 : 1),
'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "commercial") ? 0 : 1),
'loadLangs' => array("commercial"),
'submenus' => array(),
);
@ -299,9 +299,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
'position' => 50,
'id' => $id,
'idsel' => 'billing',
'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "billing") ? 'class="tmenusel"' : 'class="tmenu"',
'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "billing") ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => img_picto('', 'bill', 'class="fa-fw paddingright"'),
'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "billing") ? 0 : 1),
'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "billing") ? 0 : 1),
'loadLangs' => array("compta"),
'submenus' => array(),
);
@ -324,9 +324,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
'position' => 52,
'id' => $id,
'idsel' => 'bank',
'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "bank") ? 'class="tmenusel"' : 'class="tmenu"',
'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "bank") ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => img_picto('', 'bank_account', 'class="fa-fw paddingright"'),
'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "bank") ? 0 : 1),
'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "bank") ? 0 : 1),
'loadLangs' => array("compta", "banks"),
'submenus' => array(),
);
@ -349,9 +349,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
'position' => 54,
'id' => $id,
'idsel' => 'accountancy',
'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy") ? 'class="tmenusel"' : 'class="tmenu"',
'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "accountancy") ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => img_picto('', 'accountancy', 'class="fa-fw paddingright"'),
'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy") ? 0 : 1),
'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "accountancy") ? 0 : 1),
'loadLangs' => array("compta", "accountancy", "assets", "intracommreport"),
'submenus' => array(),
);
@ -375,9 +375,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
'position' => 80,
'id' => $id,
'idsel' => 'hrm',
'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "hrm") ? 'class="tmenusel"' : 'class="tmenu"',
'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "hrm") ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => img_picto('', 'hrm', 'class="fa-fw paddingright"'),
'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "hrm") ? 0 : 1),
'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "hrm") ? 0 : 1),
'loadLangs' => array("holiday"),
'submenus' => array(),
);
@ -400,9 +400,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
'position' => 88,
'id' => $id,
'idsel' => 'ticket',
'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "ticket") ? 'class="tmenusel"' : 'class="tmenu"',
'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "ticket") ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => img_picto('', 'ticket', 'class="fa-fw paddingright"'),
'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "ticket") ? 0 : 1),
'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "ticket") ? 0 : 1),
'loadLangs' => array("other"),
'submenus' => array(),
);
@ -425,9 +425,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
'position' => 90,
'id' => $id,
'idsel' => 'tools',
'classname' => $classname = ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "tools") ? 'class="tmenusel"' : 'class="tmenu"',
'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "tools") ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => img_picto('', 'tools', 'class="fa-fw paddingright"'),
'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "tools") ? 0 : 1),
'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "tools") ? 0 : 1),
'loadLangs' => array("other"),
'submenus' => array(),
);
@ -1567,7 +1567,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Cash Control
if (!empty($conf->takepos->enabled) || !empty($conf->cashdesk->enabled)) {
$permtomakecashfence = ($user->rights->cashdesk->run || $user->rights->takepos->run);
$permtomakecashfence = ($user->hasRight('cashdesk', 'run')|| $user->hasRight('takepos', 'run'));
$newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("POS"), 0, $permtomakecashfence, '', $mainmenu, 'cashcontrol', 0, '', '', '', img_picto('', 'pos', 'class="pictofixedwidth"'));
$newmenu->add("/compta/cashcontrol/cashcontrol_card.php?action=create", $langs->trans("NewCashFence"), 1, $permtomakecashfence);
$newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("List"), 1, $permtomakecashfence);
@ -1733,7 +1733,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$titleboth = $langs->trans("LeadsOrProjects");
$titlenew = $langs->trans("NewLeadOrProject"); // Leads and opportunities by default
if (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 0) {
if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
$titleboth = $langs->trans("Projects");
$titlenew = $langs->trans("NewProject");
}
@ -1746,7 +1746,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/projet/index.php?leftmenu=projects".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titleboth, 0, $user->rights->projet->lire, '', $mainmenu, 'projects', 0, '', '', '', img_picto('', 'project', 'class="pictofixedwidth"'));
$newmenu->add("/projet/card.php?leftmenu=projects&action=create".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titlenew, 1, $user->rights->projet->creer);
if (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 0) {
if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
$newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : '').'&search_status=99', $langs->trans("List"), 1, $showmode, '', 'project', 'list');
} elseif (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 1) {
$newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $showmode, '', 'project', 'list');

View File

@ -994,9 +994,9 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$note = json_encode(array('authorid'=>(is_object($user) ? $user->id : 0), 'ip'=>(empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR'])));
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name, value, visible, entity, note) VALUES";
$sql .= " (".$this->db->encrypt($this->const_name, 1);
$sql .= ", ".$this->db->encrypt('1', 1);
$sql .= ", 0, ".$entity;
$sql .= " (".$this->db->encrypt($this->const_name);
$sql .= ", ".$this->db->encrypt('1');
$sql .= ", 0, ".((int) $entity);
$sql .= ", '".$this->db->escape($note)."')";
dol_syslog(get_class($this)."::_active insert activation constant", LOG_DEBUG);
@ -1555,9 +1555,9 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$sql .= ", entity";
$sql .= ")";
$sql .= " VALUES (";
$sql .= $this->db->encrypt($this->const_name."_TABS_".$i, 1);
$sql .= $this->db->encrypt($this->const_name."_TABS_".$i);
$sql .= ", 'chaine'";
$sql .= ", ".$this->db->encrypt($newvalue, 1);
$sql .= ", ".$this->db->encrypt($newvalue);
$sql .= ", null";
$sql .= ", '0'";
$sql .= ", ".$entity;
@ -1627,9 +1627,9 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
if ($row[0] == 0) { // If not found
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,type,value,note,visible,entity)";
$sql .= " VALUES (";
$sql .= $this->db->encrypt($name, 1);
$sql .= $this->db->encrypt($name);
$sql .= ",'".$this->db->escape($type)."'";
$sql .= ",".(($val != '') ? $this->db->encrypt($val, 1) : "''");
$sql .= ",".(($val != '') ? $this->db->encrypt($val) : "''");
$sql .= ",".($note ? "'".$this->db->escape($note)."'" : "null");
$sql .= ",'".$this->db->escape($visible)."'";
$sql .= ",".$entity;
@ -2064,8 +2064,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$row = $this->db->fetch_row($result);
if ($row[0] == 0) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,type,value,note,visible,entity)";
$sql .= " VALUES ('".$this->db->escape($this->db->encrypt($name))."', 'chaine', '".$this->db->escape($this->db->encrypt($dir))."', 'Directory for module ".$this->name."', '0', ".((int) $conf->entity).")";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name, type, value, note, visible, entity)";
$sql .= " VALUES (".$this->db->encrypt($name).", 'chaine', ".$this->db->encrypt($dir).", '".$this->db->escape("Directory for module ".$this->name)."', '0', ".((int) $conf->entity).")";
dol_syslog(get_class($this)."::insert_dirs", LOG_DEBUG);
$this->db->query($sql);
@ -2126,7 +2126,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$entity = $conf->entity; // Reset the current entity
$newvalue = $value;
var_dump($newvalue);
// Serialize array parameters
if (is_array($value)) {
// Can defined other parameters
@ -2141,11 +2141,12 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
if (isset($value['entity'])) {
$entity = $value['entity'];
}
} else // when hook is declared with syntax 'hook'=>array('hookcontext1','hookcontext2',...)
{
} else { // when hook is declared with syntax 'hook'=>array('hookcontext1','hookcontext2',...)
$newvalue = json_encode($value);
}
}
var_dump($newvalue);
var_dump($this->db->escape($newvalue));
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (";
$sql .= "name";
@ -2156,14 +2157,14 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$sql .= ", entity";
$sql .= ")";
$sql .= " VALUES (";
$sql .= "'".$this->db->escape($this->db->encrypt($this->const_name."_".strtoupper($key)))."'";
$sql .= " ".$this->db->encrypt($this->const_name."_".strtoupper($key));
$sql .= ", 'chaine'";
$sql .= ", '".$this->db->escape($this->db->encrypt($newvalue))."'";
$sql .= ", ".$this->db->encrypt($newvalue);
$sql .= ", null";
$sql .= ", '0'";
$sql .= ", ".((int) $entity);
$sql .= ")";
print $sql;
dol_syslog(get_class($this)."::insert_module_parts for key=".$this->const_name."_".strtoupper($key), LOG_DEBUG);
$resql = $this->db->query($sql, 1);

View File

@ -248,6 +248,14 @@ class pdf_crabe extends ModelePDFFactures
// Load translation files required by the page
$outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies"));
global $outputlangsbis;
$outputlangsbis = null;
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
$outputlangsbis = new Translate('', $conf);
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
$outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies"));
}
$nblines = count($object->lines);
// Loop on each lines to detect if there is at least one image to show
@ -761,10 +769,10 @@ class pdf_crabe extends ModelePDFFactures
}
// Display info area
$posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
$posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs, $outputlangsbis);
// Display total area
$posy = $this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
$posy = $this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs, $outputlangsbis);
// Display Payments area
if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS)) {
@ -1014,9 +1022,10 @@ class pdf_crabe extends ModelePDFFactures
* @param Facture $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
* @return void
* @param Translate $outputlangsbis Object lang for output bis
* @return int Pos y
*/
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs, $outputlangsbis)
{
// phpcs:enable
global $conf, $mysoc;
@ -1053,7 +1062,7 @@ class pdf_crabe extends ModelePDFFactures
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
$pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L');
$posy = $pdf->GetY() + 3;
$posy = $pdf->GetY() + 3; // We need spaces for 2 lines payment conditions
}
if ($object->type != 2) {
@ -1078,7 +1087,7 @@ class pdf_crabe extends ModelePDFFactures
}
// Show payment mode
if ($object->mode_reglement_code
if (!empty($object->mode_reglement_code)
&& $object->mode_reglement_code != 'CHQ'
&& $object->mode_reglement_code != 'VIR') {
$pdf->SetFont('', 'B', $default_font_size - 2);
@ -1091,9 +1100,25 @@ class pdf_crabe extends ModelePDFFactures
$lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement);
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
// Show online payment link
$useonlinepayment = ((!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled)) && !empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT));
if (($object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') && $object->statut != Facture::STATUS_DRAFT && $useonlinepayment) {
$posy = $pdf->GetY();
}
// Show online payment link
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') {
$useonlinepayment = 0;
if (!empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)) {
if (!empty($conf->paypal->enabled)) {
$useonlinepayment++;
}
if (!empty($conf->stripe->enabled)) {
$useonlinepayment++;
}
if (!empty($conf->paybox->enabled)) {
$useonlinepayment++;
}
}
if ($object->statut != Facture::STATUS_DRAFT && $useonlinepayment) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
global $langs;
@ -1102,11 +1127,11 @@ class pdf_crabe extends ModelePDFFactures
$paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', '');
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';
$pdf->writeHTMLCell(80, 10, '', '', dol_htmlentitiesbr($linktopay), 0, 1);
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->writeHTMLCell(80, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1);
}
$posy = $pdf->GetY() + 2;
$posy = $pdf->GetY() + 1;
}
// Show payment mode CHQ
@ -1181,12 +1206,13 @@ class pdf_crabe extends ModelePDFFactures
* @param int $deja_regle Amount already paid (in the currency of invoice)
* @param int $posy Position depart
* @param Translate $outputlangs Objet langs
* @param Translate $outputlangsbis Object lang for output bis
* @return int Position pour suite
*/
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis)
{
// phpcs:enable
global $conf, $mysoc;
global $conf, $mysoc, $hookmanager;
$sign = 1;
if ($object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) {
@ -1253,7 +1279,8 @@ class pdf_crabe extends ModelePDFFactures
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : '');
$totalvat .= ' ';
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
@ -1285,7 +1312,8 @@ class pdf_crabe extends ModelePDFFactures
$tvakey = str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : '');
$totalvat .= ' ';
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);

View File

@ -906,10 +906,10 @@ class pdf_sponge extends ModelePDFFactures
}
// Display infos area
$posy = $this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs);
$posy = $this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs, $outputlangsbis);
// Display total zone
$posy = $this->drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
$posy = $this->drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs, $outputlangsbis);
// Display payment area
if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS)) {
@ -1104,9 +1104,10 @@ class pdf_sponge extends ModelePDFFactures
* @param Facture $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
* @param Translate $outputlangsbis Object lang for output bis
* @return int Pos y
*/
protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs)
protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs, $outputlangsbis)
{
global $conf, $mysoc;
@ -1118,7 +1119,11 @@ class pdf_sponge extends ModelePDFFactures
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) {
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
if ($mysoc->forme_juridique_code == 92) {
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0);
} else {
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
}
$posy = $pdf->GetY() + 4;
}
@ -1138,7 +1143,7 @@ class pdf_sponge extends ModelePDFFactures
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
$pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L');
$posy = $pdf->GetY() + 3;
$posy = $pdf->GetY() + 3; // We need spaces for 2 lines payment conditions
}
if ($object->type != 2) {
@ -1163,7 +1168,7 @@ class pdf_sponge extends ModelePDFFactures
}
// Show payment mode
if ($object->mode_reglement_code
if (!empty($object->mode_reglement_code)
&& $object->mode_reglement_code != 'CHQ'
&& $object->mode_reglement_code != 'VIR') {
$pdf->SetFont('', 'B', $default_font_size - 2);
@ -1176,9 +1181,25 @@ class pdf_sponge extends ModelePDFFactures
$lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement);
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
// Show online payment link
$useonlinepayment = ((!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled)) && !empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT));
if (($object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') && $object->statut != Facture::STATUS_DRAFT && $useonlinepayment) {
$posy = $pdf->GetY();
}
// Show online payment link
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') {
$useonlinepayment = 0;
if (!empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)) {
if (!empty($conf->paypal->enabled)) {
$useonlinepayment++;
}
if (!empty($conf->stripe->enabled)) {
$useonlinepayment++;
}
if (!empty($conf->paybox->enabled)) {
$useonlinepayment++;
}
}
if ($object->statut != Facture::STATUS_DRAFT && $useonlinepayment) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
global $langs;
@ -1187,10 +1208,11 @@ class pdf_sponge extends ModelePDFFactures
$paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', '');
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';
$pdf->writeHTMLCell(80, 10, '', '', dol_htmlentitiesbr($linktopay), 0, 1);
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->writeHTMLCell(80, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1);
}
$posy = $pdf->GetY() + 2;
$posy = $pdf->GetY() + 1;
}
// Show payment mode CHQ
@ -1263,9 +1285,10 @@ class pdf_sponge extends ModelePDFFactures
* @param int $deja_regle Amount already paid (in the currency of invoice)
* @param int $posy Position depart
* @param Translate $outputlangs Objet langs
* @param Translate $outputlangsbis Object lang for output bis
* @return int Position pour suite
*/
protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs)
protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis)
{
global $conf, $mysoc, $hookmanager;
@ -1276,14 +1299,6 @@ class pdf_sponge extends ModelePDFFactures
$default_font_size = pdf_getPDFFontSize($outputlangs);
$outputlangsbis = null;
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
$outputlangsbis = new Translate('', $conf);
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
$outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));
$default_font_size--;
}
$tab2_top = $posy;
$tab2_hl = 4;
$pdf->SetFont('', '', $default_font_size - 1);
@ -2136,7 +2151,7 @@ class pdf_sponge extends ModelePDFFactures
$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
$mode = 'target';
$mode = 'target';
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, $mode, $object);
// Show recipient

View File

@ -245,8 +245,8 @@ class modApi extends DolibarrModules
{
// Remove old constants with entity fields different of 0
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$this->db->escape($this->db->encrypt('MAIN_MODULE_API'))."'",
"DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$this->db->escape($this->db->encrypt('API_PRODUCTION_MODE'))."'"
"DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = ".$this->db->encrypt('MAIN_MODULE_API'), // API can't be enabled per environment. Why ?
"DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = ".$this->db->encrypt('API_PRODUCTION_MODE') // Not in production mode by default at activation
);
return $this->_remove($sql, $options);

View File

@ -326,12 +326,12 @@ class modBom extends DolibarrModules
$this->import_code[$r] = 'bom_'.$r;
$this->import_label[$r] = 'BillOfMaterials';
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = [];
$this->import_tables_array[$r] = ['b' => MAIN_DB_PREFIX.'bom_bom', 'extra' => MAIN_DB_PREFIX.'bom_bom_extrafields'];
$this->import_tables_creator_array[$r] = ['b' => 'fk_user_creat']; // Fields to store import user id
$this->import_fields_array[$r] = [
'b.ref' => 'Document Ref*',
'b.label' => 'BomLabel*',
$this->import_entities_array[$r] = array();
$this->import_tables_array[$r] = array('b' => MAIN_DB_PREFIX.'bom_bom', 'extra' => MAIN_DB_PREFIX.'bom_bom_extrafields');
$this->import_tables_creator_array[$r] = array('b' => 'fk_user_creat'); // Fields to store import user id
$this->import_fields_array[$r] = array(
'b.ref' => 'Ref*',
'b.label' => 'Label*',
'b.fk_product' => 'ProductRef*',
'b.description' => 'Description',
'b.note_public' => 'Note',
@ -346,12 +346,12 @@ class modBom extends DolibarrModules
'b.fk_user_valid' => 'ValidatedById',
'b.model_pdf' => 'Model',
'b.status' => 'Status*',
'b.bomtype' => 'BomType*'
];
'b.bomtype' => 'Type*'
);
$import_sample = array();
// Add extra fields
$import_extrafield_sample = [];
$import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'bom_bom' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
@ -365,61 +365,62 @@ class modBom extends DolibarrModules
}
// End add extra fields
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'bom_bom'];
$this->import_regex_array[$r] = [
'b.ref' => '(CPV\d{4}-\d{4}|BOM\d{4}-\d{4}|PROV.{1,32}$)'
];
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'bom_bom');
$this->import_regex_array[$r] = array(
'b.ref' => ''
);
$this->import_updatekeys_array[$r] = ['b.ref' => 'Ref'];
$this->import_convertvalue_array[$r] = [
'b.fk_product' => [
$this->import_updatekeys_array[$r] = array('b.ref' => 'Ref');
$this->import_convertvalue_array[$r] = array(
'b.fk_product' => array(
'rule' => 'fetchidfromref',
'file' => '/product/class/product.class.php',
'class' => 'Product',
'method' => 'fetch',
'element' => 'Product'
],
'b.fk_warehouse' => [
),
'b.fk_warehouse' => array(
'rule' => 'fetchidfromref',
'file' => '/product/stock/class/entrepot.class.php',
'class' => 'Entrepot',
'method' => 'fetch',
'element' => 'Warehouse'
],
'b.fk_user_valid' => [
),
'b.fk_user_valid' => array(
'rule' => 'fetchidfromref',
'file' => '/user/class/user.class.php',
'class' => 'User',
'method' => 'fetch',
'element' => 'user'
],
'b.fk_user_modif' => [
),
'b.fk_user_modif' => array(
'rule' => 'fetchidfromref',
'file' => '/user/class/user.class.php',
'class' => 'User',
'method' => 'fetch',
'element' => 'user'
],
];
),
);
//Import BOM Lines
$r++;
$this->import_code[$r] = 'bom_lines_'.$r;
$this->import_label[$r] = 'BillOfMaterialsLine';
$this->import_label[$r] = 'BillOfMaterialsLines';
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = [];
$this->import_tables_array[$r] = ['bd' => MAIN_DB_PREFIX.'bom_bomline', 'extra' => MAIN_DB_PREFIX.'bom_bomline_extrafields'];
$this->import_fields_array[$r] = [
'bd.fk_bom' => 'Document Ref*',
$this->import_entities_array[$r] = array();
$this->import_tables_array[$r] = array('bd' => MAIN_DB_PREFIX.'bom_bomline', 'extra' => MAIN_DB_PREFIX.'bom_bomline_extrafields');
$this->import_fields_array[$r] = array(
'bd.fk_bom' => 'BOM*',
'bd.fk_product' => 'ProductRef',
'bd.fk_bom_child' => 'BOMChild',
'bd.description' => 'Description',
'bd.qty' => 'LineQty',
'bd.qty_frozen' => 'LineIsFrozen',
'bd.qty_frozen' => 'LineIsFrozen',
'bd.disable_stock_change' => 'Disable Stock Change',
'bd.efficiency' => 'Efficiency',
'bd.position' => 'LinePosition'
];
);
// Add extra fields
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'bom_bomline' AND entity IN (0, ".$conf->entity.")";
@ -433,25 +434,25 @@ class modBom extends DolibarrModules
}
// End add extra fields
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'bom_bomline'];
$this->import_regex_array[$r] = [];
$this->import_updatekeys_array[$r] = ['bd.fk_bom' => 'BOM Id'];
$this->import_convertvalue_array[$r] = [
'bd.fk_bom' => [
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'bom_bomline');
$this->import_regex_array[$r] = array();
$this->import_updatekeys_array[$r] = array('bd.fk_bom' => 'BOM Id');
$this->import_convertvalue_array[$r] = array(
'bd.fk_bom' => array(
'rule' => 'fetchidfromref',
'file' => '/bom/class/bom.class.php',
'class' => 'BOM',
'method' => 'fetch',
'element' => 'bom'
],
'bd.fk_product' => [
),
'bd.fk_product' => array(
'rule' => 'fetchidfromref',
'file' => '/product/class/product.class.php',
'class' => 'Product',
'method' => 'fetch',
'element' => 'Product'
],
];
),
);
}
/**

View File

@ -285,11 +285,11 @@ class modCommande extends DolibarrModules
$this->import_code[$r] = 'commande_'.$r;
$this->import_label[$r] = 'CustomersOrders';
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = [];
$this->import_tables_array[$r] = ['c' => MAIN_DB_PREFIX.'commande', 'extra' => MAIN_DB_PREFIX.'commande_extrafields'];
$this->import_tables_creator_array[$r] = ['c' => 'fk_user_author']; // Fields to store import user id
$this->import_fields_array[$r] = [
'c.ref' => 'Document Ref*',
$this->import_entities_array[$r] = array();
$this->import_tables_array[$r] = array('c' => MAIN_DB_PREFIX.'commande', 'extra' => MAIN_DB_PREFIX.'commande_extrafields');
$this->import_tables_creator_array[$r] = array('c' => 'fk_user_author'); // Fields to store import user id
$this->import_fields_array[$r] = array(
'c.ref' => 'Ref*',
'c.ref_client' => 'RefCustomer',
'c.fk_soc' => 'ThirdPartyName*',
'c.fk_projet' => 'ProjectId',
@ -310,7 +310,7 @@ class modCommande extends DolibarrModules
'c.fk_cond_reglement' => 'Payment Condition',
'c.fk_mode_reglement' => 'Payment Mode',
'c.model_pdf' => 'Model'
];
);
if (!empty($conf->multicurrency->enabled)) {
$this->import_fields_array[$r]['c.multicurrency_code'] = 'Currency';
@ -321,7 +321,7 @@ class modCommande extends DolibarrModules
}
// Add extra fields
$import_extrafield_sample = [];
$import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
@ -337,7 +337,6 @@ class modCommande extends DolibarrModules
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commande'];
$this->import_regex_array[$r] = [
'c.ref' => '(CPV\d{4}-\d{4}|CO\d{4}-\d{4}|PROV.{1,32}$)',
'c.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'
];
@ -371,10 +370,10 @@ class modCommande extends DolibarrModules
$this->import_code[$r] = 'commande_lines_'.$r;
$this->import_label[$r] = 'SaleOrderLines';
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = [];
$this->import_tables_array[$r] = ['cd' => MAIN_DB_PREFIX.'commandedet', 'extra' => MAIN_DB_PREFIX.'commandedet_extrafields'];
$this->import_fields_array[$r] = [
'cd.fk_commande' => 'Document Ref*',
$this->import_entities_array[$r] = array();
$this->import_tables_array[$r] = array('cd' => MAIN_DB_PREFIX.'commandedet', 'extra' => MAIN_DB_PREFIX.'commandedet_extrafields');
$this->import_fields_array[$r] = array(
'cd.fk_commande' => 'SalesOrder*',
'cd.fk_parent_line' => 'PrParentLine',
'cd.fk_product' => 'IdProduct',
'cd.label' => 'Label',
@ -393,7 +392,7 @@ class modCommande extends DolibarrModules
'cd.date_end' => 'End Date',
'cd.buy_price_ht' => 'LineBuyPriceHT',
'cd.rang' => 'LinePosition'
];
);
if (!empty($conf->multicurrency->enabled)) {
$this->import_fields_array[$r]['cd.multicurrency_code'] = 'Currency';

View File

@ -63,7 +63,7 @@ class modFckeditor extends DolibarrModules
$this->config_page_url = array("fckeditor.php");
// Dependencies
$this->disabled = (in_array(constant('JS_CKEDITOR'), array('disabled', 'disabled/')) ? 1 : 0); // A condition to disable module (used for native debian packages)
$this->disabled = in_array(constant('JS_CKEDITOR'), array('disabled', 'disabled/'));
$this->depends = array();
$this->requiredby = array('modWebsites');

View File

@ -504,10 +504,10 @@ class modFournisseur extends DolibarrModules
$this->import_code[$r] = $this->rights_class.'_'.$r;
$this->import_label[$r] = "SupplierInvoices"; // Translation key
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = ['f' => MAIN_DB_PREFIX.'facture_fourn', 'extra' => MAIN_DB_PREFIX.'facture_fourn_extrafields'];
$this->import_tables_creator_array[$r] = ['f' => 'fk_user_author']; // Fields to store import user id
$this->import_fields_array[$r] = [
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = array('f' => MAIN_DB_PREFIX.'facture_fourn', 'extra' => MAIN_DB_PREFIX.'facture_fourn_extrafields');
$this->import_tables_creator_array[$r] = array('f' => 'fk_user_author'); // Fields to store import user id
$this->import_fields_array[$r] = array(
'f.ref' => 'InvoiceRef*',
'f.ref_supplier' => 'RefSupplier',
'f.type' => 'Type*',
@ -531,7 +531,7 @@ class modFournisseur extends DolibarrModules
'f.fk_mode_reglement' => 'Payment Mode',
'f.model_pdf' => 'Model',
'f.date_valid' => 'Validation Date'
];
);
if (!empty($conf->multicurrency->enabled)) {
$this->import_fields_array[$r]['f.multicurrency_code'] = 'Currency';
$this->import_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate';
@ -540,7 +540,7 @@ class modFournisseur extends DolibarrModules
$this->import_fields_array[$r]['f.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
}
// Add extra fields
$import_extrafield_sample = [];
$import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
if ($resql) {
@ -552,9 +552,9 @@ class modFournisseur extends DolibarrModules
}
}
// End add extra fields
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'facture_fourn'];
$this->import_regex_array[$r] = ['f.ref' => '(SI\d{4}-\d{4}|PROV.{1,32}$)', 'f.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'];
$import_sample = [
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'facture_fourn');
$this->import_regex_array[$r] = array('f.ref' => '(SI\d{4}-\d{4}|PROV.{1,32}$)', 'f.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency');
$import_sample = array(
'f.ref' => '(PROV001)',
'f.ref_supplier' => 'Supplier1',
'f.type' => '0',
@ -583,23 +583,23 @@ class modFournisseur extends DolibarrModules
'f.multicurrency_total_ht' => '1000',
'f.multicurrency_total_tva' => '0',
'f.multicurrency_total_ttc' => '1000'
];
);
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
$this->import_updatekeys_array[$r] = ['f.ref' => 'Ref'];
$this->import_convertvalue_array[$r] = [
$this->import_updatekeys_array[$r] = array('f.ref' => 'Ref');
$this->import_convertvalue_array[$r] = array(
//'c.ref'=>array('rule'=>'getrefifauto'),
'f.fk_soc' => ['rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'],
'f.fk_account' => ['rule' => 'fetchidfromref', 'file' => '/compta/bank/class/account.class.php', 'class' => 'Account', 'method' => 'fetch', 'element' => 'bank_account'],
];
'f.fk_soc' => array('rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'),
'f.fk_account' => array('rule' => 'fetchidfromref', 'file' => '/compta/bank/class/account.class.php', 'class' => 'Account', 'method' => 'fetch', 'element' => 'bank_account'),
);
//Import Supplier Invoice Lines
$r++;
$this->import_code[$r] = $this->rights_class.'_'.$r;
$this->import_label[$r] = "SupplierInvoiceLines"; // Translation key
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = ['fd' => MAIN_DB_PREFIX.'facture_fourn_det', 'extra' => MAIN_DB_PREFIX.'facture_fourn_det_extrafields'];
$this->import_fields_array[$r] = [
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = array('fd' => MAIN_DB_PREFIX.'facture_fourn_det', 'extra' => MAIN_DB_PREFIX.'facture_fourn_det_extrafields');
$this->import_fields_array[$r] = array(
'fd.fk_facture_fourn' => 'InvoiceRef*',
'fd.fk_parent_line' => 'FacParentLine',
'fd.fk_product' => 'IdProduct',
@ -618,7 +618,7 @@ class modFournisseur extends DolibarrModules
'fd.date_start' => 'Start Date',
'fd.date_end' => 'End Date',
'fd.fk_unit' => 'Unit'
];
);
if (!empty($conf->multicurrency->enabled)) {
$this->import_fields_array[$r]['fd.multicurrency_code'] = 'Currency';
$this->import_fields_array[$r]['fd.multicurrency_subprice'] = 'CurrencyRate';
@ -627,7 +627,7 @@ class modFournisseur extends DolibarrModules
$this->import_fields_array[$r]['fd.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
}
// Add extra fields
$import_extrafield_sample = [];
$import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn_det' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
if ($resql) {
@ -639,9 +639,9 @@ class modFournisseur extends DolibarrModules
}
}
// End add extra fields
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'facture_fourn_det'];
$this->import_regex_array[$r] = ['fd.product_type' => '[0|1]$', 'fd.fk_product' => 'rowid@'.MAIN_DB_PREFIX.'product', 'fd.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'];
$import_sample = [
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'facture_fourn_det');
$this->import_regex_array[$r] = array('fd.product_type' => '[0|1]$', 'fd.fk_product' => 'rowid@'.MAIN_DB_PREFIX.'product', 'fd.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency');
$import_sample = array(
'fd.fk_facture_fourn' => '(PROV001)',
'fd.fk_parent_line' => '',
'fd.fk_product' => '',
@ -665,23 +665,23 @@ class modFournisseur extends DolibarrModules
'fd.multicurrency_total_ht' => '50000',
'fd.multicurrency_total_tva' => '0',
'fd.multicurrency_total_ttc' => '50000'
];
);
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
$this->import_updatekeys_array[$r] = ['fd.rowid' => 'Row Id', 'fd.fk_facture_fourn' => 'Invoice Id', 'fd.fk_product' => 'Product Id'];
$this->import_convertvalue_array[$r] = [
'fd.fk_facture_fourn' => ['rule' => 'fetchidfromref', 'file' => '/fourn/class/fournisseur.facture.class.php', 'class' => 'FactureFournisseur', 'method' => 'fetch'],
];
$this->import_updatekeys_array[$r] = array('fd.rowid' => 'Row Id', 'fd.fk_facture_fourn' => 'Invoice Id', 'fd.fk_product' => 'Product Id');
$this->import_convertvalue_array[$r] = array(
'fd.fk_facture_fourn' => array('rule' => 'fetchidfromref', 'file' => '/fourn/class/fournisseur.facture.class.php', 'class' => 'FactureFournisseur', 'method' => 'fetch'),
);
//Import Purchase Orders
$r++;
$this->import_code[$r] = 'commande_fournisseur_'.$r;
$this->import_label[$r] = 'SuppliersOrders';
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = [];
$this->import_tables_array[$r] = ['c' => MAIN_DB_PREFIX.'commande_fournisseur', 'extra' => MAIN_DB_PREFIX.'commande_fournisseur_extrafields'];
$this->import_tables_creator_array[$r] = ['c' => 'fk_user_author']; // Fields to store import user id
$this->import_fields_array[$r] = [
'c.ref' => 'Document Ref*',
$this->import_entities_array[$r] = array();
$this->import_tables_array[$r] = array('c' => MAIN_DB_PREFIX.'commande_fournisseur', 'extra' => MAIN_DB_PREFIX.'commande_fournisseur_extrafields');
$this->import_tables_creator_array[$r] = array('c' => 'fk_user_author'); // Fields to store import user id
$this->import_fields_array[$r] = array(
'c.ref' => 'Ref*',
'c.ref_supplier' => 'RefSupplier',
'c.fk_soc' => 'ThirdPartyName*',
'c.fk_projet' => 'ProjectId',
@ -705,7 +705,7 @@ class modFournisseur extends DolibarrModules
'c.fk_cond_reglement' => 'Payment Condition',
'c.fk_mode_reglement' => 'Payment Mode',
'c.model_pdf' => 'Model'
];
);
if (!empty($conf->multicurrency->enabled)) {
$this->import_fields_array[$r]['c.multicurrency_code'] = 'Currency';
@ -716,7 +716,7 @@ class modFournisseur extends DolibarrModules
}
// Add extra fields
$import_extrafield_sample = [];
$import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseur' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
@ -730,40 +730,39 @@ class modFournisseur extends DolibarrModules
}
// End add extra fields
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commande_fournisseur'];
$this->import_regex_array[$r] = [
'c.ref' => '(PO\d{4}-\d{4}|PORDER.{1,32}$|PROV.{1,32}$)',
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commande_fournisseur');
$this->import_regex_array[$r] = array(
'c.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'
];
);
$this->import_updatekeys_array[$r] = ['c.ref' => 'Ref'];
$this->import_convertvalue_array[$r] = [
'c.fk_soc' => [
$this->import_updatekeys_array[$r] = array('c.ref' => 'Ref');
$this->import_convertvalue_array[$r] = array(
'c.fk_soc' => array(
'rule' => 'fetchidfromref',
'file' => '/societe/class/societe.class.php',
'class' => 'Societe',
'method' => 'fetch',
'element' => 'ThirdParty'
],
'c.fk_mode_reglement' => [
),
'c.fk_mode_reglement' => array(
'rule' => 'fetchidfromcodeorlabel',
'file' => '/compta/paiement/class/cpaiement.class.php',
'class' => 'Cpaiement',
'method' => 'fetch',
'element' => 'cpayment'
],
'c.source' => ['rule' => 'zeroifnull'],
];
),
'c.source' => array('rule' => 'zeroifnull'),
);
//Import PO Lines
// Import PO Lines
$r++;
$this->import_code[$r] = 'commande_fournisseurdet_'.$r;
$this->import_label[$r] = 'PurchaseOrderLines';
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = [];
$this->import_tables_array[$r] = ['cd' => MAIN_DB_PREFIX.'commande_fournisseurdet', 'extra' => MAIN_DB_PREFIX.'commande_fournisseurdet_extrafields'];
$this->import_fields_array[$r] = [
'cd.fk_commande' => 'Document Ref*',
$this->import_entities_array[$r] = array();
$this->import_tables_array[$r] = array('cd' => MAIN_DB_PREFIX.'commande_fournisseurdet', 'extra' => MAIN_DB_PREFIX.'commande_fournisseurdet_extrafields');
$this->import_fields_array[$r] = array(
'cd.fk_commande' => 'PurchaseOrder*',
'cd.fk_parent_line' => 'PrParentLine',
'cd.fk_product' => 'IdProduct',
'cd.label' => 'Label',
@ -783,7 +782,7 @@ class modFournisseur extends DolibarrModules
'cd.special_code' => 'Special Code',
'cd.rang' => 'LinePosition',
'cd.fk_unit' => 'Unit'
];
);
if (!empty($conf->multicurrency->enabled)) {
$this->import_fields_array[$r]['cd.multicurrency_code'] = 'Currency';
@ -805,24 +804,24 @@ class modFournisseur extends DolibarrModules
}
// End add extra fields
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commande_fournisseurdet'];
$this->import_regex_array[$r] = [
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commande_fournisseurdet');
$this->import_regex_array[$r] = array(
'cd.product_type' => '[0|1]$',
'cd.fk_product' => 'rowid@'.MAIN_DB_PREFIX.'product',
'cd.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'
];
$this->import_updatekeys_array[$r] = ['cd.fk_commande' => 'Purchase Order Id'];
$this->import_convertvalue_array[$r] = [
'cd.fk_commande' => [
);
$this->import_updatekeys_array[$r] = array('cd.fk_commande' => 'Purchase Order Id');
$this->import_convertvalue_array[$r] = array(
'cd.fk_commande' => array(
'rule' => 'fetchidfromref',
'file' => '/fourn/class/fournisseur.commande.class.php',
'class' => 'CommandeFournisseur',
'method' => 'fetch',
'element' => 'order_supplier'
],
'cd.info_bits' => ['rule' => 'zeroifnull'],
'cd.special_code' => ['rule' => 'zeroifnull'],
];
),
'cd.info_bits' => array('rule' => 'zeroifnull'),
'cd.special_code' => array('rule' => 'zeroifnull'),
);
}

View File

@ -317,7 +317,7 @@ class modKnowledgeManagement extends DolibarrModules
// Define condition to show or hide menu entry. Use '$conf->knowledgemanagement->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'enabled'=>'$conf->knowledgemanagement->enabled',
// Use 'perms'=>'$user->rights->knowledgemanagement->level1->level2' if you want your menu with a permission rules
'perms'=>'1',
'perms'=>'$user->rights->knowledgemanagement->knowledgerecord->read',
'target'=>'',
// 0=Menu for internal users, 1=external users, 2=both
'user'=>2,
@ -337,7 +337,7 @@ class modKnowledgeManagement extends DolibarrModules
// Define condition to show or hide menu entry. Use '$conf->knowledgemanagement->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'enabled'=>'$conf->knowledgemanagement->enabled',
// Use 'perms'=>'$user->rights->knowledgemanagement->level1->level2' if you want your menu with a permission rules
'perms'=>'1',
'perms'=>'$user->rights->knowledgemanagement->knowledgerecord->read',
'target'=>'',
// 0=Menu for internal users, 1=external users, 2=both
'user'=>2,
@ -357,7 +357,7 @@ class modKnowledgeManagement extends DolibarrModules
// Define condition to show or hide menu entry. Use '$conf->knowledgemanagement->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'enabled'=>'$conf->knowledgemanagement->enabled',
// Use 'perms'=>'$user->rights->knowledgemanagement->level1->level2' if you want your menu with a permission rules
'perms'=>'1',
'perms'=>'$user->rights->knowledgemanagement->knowledgerecord->write',
'target'=>'',
// 0=Menu for internal users, 1=external users, 2=both
'user'=>2

View File

@ -79,7 +79,7 @@ class modMailing extends DolibarrModules
$this->const[$r][0] = "MAILING_CONTACT_DEFAULT_BULK_STATUS";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "0";
$this->const[$r][3] = 'Default black list mailing';
$this->const[$r][3] = 'Default value for field "Refuse bulk email" when creating a contact';
$this->const[$r][4] = 0;
$r++;

View File

@ -263,31 +263,78 @@ class modMrp extends DolibarrModules
/* BEGIN MODULEBUILDER TOPMENU */
/* END MODULEBUILDER LEFTMENU MO */
$langs->loadLangs(array("mrp", "stocks"));
// Exports profiles provided by this module
$r = 1;
/* BEGIN MODULEBUILDER EXPORT MO */
/*
$langs->load("mrp");
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='MoLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r]='mo@mrp';
$keyforclass = 'Mo'; $keyforclassfile='/mymobule/class/mo.class.php'; $keyforelement='mo';
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
$keyforselect='mo'; $keyforaliasextra='extra'; $keyforelement='mo';
$this->export_label[$r]='MOs'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r]='mrp';
$this->export_fields_array[$r] = array(
'm.rowid'=>"Id",
'm.ref'=>"Ref",
'm.label'=>"Label",
'm.fk_project'=>'Project',
'm.fk_bom'=>"Bom",
'm.date_start_planned'=>"DateStartPlanned",
'm.date_end_planned'=>"DateEndPlanned",
'm.fk_product'=>"Product",
'm.status'=>'Status',
'm.model_pdf'=>'Model',
'm.fk_user_valid'=>'ValidatedById',
'm.fk_user_modif'=>'ModifiedById',
'm.fk_user_creat'=>'CreatedById',
'm.date_valid'=>'DateValidation',
'm.note_private'=>'NotePrivate',
'm.note_public'=>'Note',
'm.fk_soc'=>'Tiers',
'e.rowid'=>'WarehouseId',
'e.ref'=>'WarehouseRef',
'm.qty'=>'Qty',
'm.date_creation'=>'DateCreation',
'm.tms'=>'DateModification'
);
$keyforselect = 'mrp_mo';
$keyforelement = 'mrp_mo';
$keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
//$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'mo as t';
$this->export_sql_end[$r] .=' WHERE 1 = 1';
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('mo').')';
$r++; */
/* END MODULEBUILDER EXPORT MO */
$this->export_TypeFields_array[$r] = array(
'm.ref'=>"Text",
'm.label'=>"Text",
'm.fk_project'=>'Numeric',
'm.fk_bom'=>"Numeric",
'm.date_end_planned'=>"Date",
'm.date_start_planned'=>"Date",
'm.fk_product'=>"Numeric",
'm.status'=>'Numeric',
'm.model_pdf'=>'Text',
'm.fk_user_valid'=>'Numeric',
'm.fk_user_modif'=>'Numeric',
'm.fk_user_creat'=>'Numeric',
'm.date_valid'=>'Date',
'm.note_private'=>'Text',
'm.note_public'=>'Text',
'm.fk_soc'=>'Numeric',
'e.fk_warehouse'=>'Numeric',
'e.ref'=>'Text',
'm.qty'=>'Numeric',
'm.date_creation'=>'Date',
'm.tms'=>'Date'
);
$this->export_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'mrp_mo as m';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'mrp_mo_extrafields as extra ON m.rowid = extra.fk_object';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e ON e.rowid = m.fk_warehouse';
$this->export_sql_end[$r] .= ' WHERE m.entity IN ('.getEntity('mrp_mo').')'; // For product and service profile
// Imports profiles provided by this module
$r = 1;
$r = 0;
$langs->load("mrp");
/* BEGIN MODULEBUILDER IMPORT MO */
/*
$langs->load("mrp");
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='MoLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r]='mo@mrp';
@ -302,6 +349,89 @@ class modMrp extends DolibarrModules
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('mo').')';
$r++; */
/* END MODULEBUILDER IMPORT MO */
$r++;
$this->import_code[$r]=$this->rights_class.'_'.$r;
$this->import_label[$r]='MOs'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->import_icon[$r]='mrp';
$this->import_entities_array[$r] = array(); // We define here only fields that use a different icon from the one defined in import_icon
$this->import_tables_array[$r] = array('m'=>MAIN_DB_PREFIX.'mrp_mo', 'extra'=>MAIN_DB_PREFIX.'mrp_mo_extrafields');
$this->import_tables_creator_array[$r] = array('m'=>'fk_user_creat'); // Fields to store import user id
$this->import_fields_array[$r] = array(
'm.ref' => "Ref*",
'm.label' => "Label*",
'm.fk_project'=>'Project',
'm.fk_bom'=>"Bom",
'm.date_start_planned'=>"DateStartPlanned",
'm.date_end_planned'=>"DateEndPlanned",
'm.fk_product'=>"Product*",
'm.status'=>'Status',
'm.model_pdf'=>'Model',
'm.fk_user_valid'=>'ValidatedById',
'm.fk_user_modif'=>'ModifiedById',
'm.fk_user_creat'=>'CreatedById',
'm.date_valid'=>'DateValid',
'm.note_private'=>'NotePrivate',
'm.note_public'=>'Note',
'm.fk_soc'=>'Tiers',
'm.fk_warehouse'=>'Warehouse',
'm.qty'=>'Qty*',
'm.date_creation'=>'DateCreation',
'm.tms'=>'DateModification',
);
$import_sample = array();
// Add extra fields
$import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'mrp_mo' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
$fieldname = 'extra.'.$obj->name;
$fieldlabel = ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
$import_extrafield_sample[$fieldname] = $fieldlabel;
}
}
// End add extra fields
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'mrp_mo');
/*$this->import_regex_array[$r] = array(
'm.ref' => ''
);*/
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
$this->import_updatekeys_array[$r] = array('m.ref' => 'Ref');
$this->import_convertvalue_array[$r] = array(
'm.fk_product' => array(
'rule' => 'fetchidfromref',
'file' => '/product/class/product.class.php',
'class' => 'Product',
'method' => 'fetch',
'element' => 'Product'
),
'm.fk_warehouse' => array(
'rule' => 'fetchidfromref',
'file' => '/product/stock/class/entrepot.class.php',
'class' => 'Entrepot',
'method' => 'fetch',
'element' => 'Warehouse'
),
'm.fk_user_valid' => array(
'rule' => 'fetchidfromref',
'file' => '/user/class/user.class.php',
'class' => 'User',
'method' => 'fetch',
'element' => 'user'
),
'm.fk_user_modif' => array(
'rule' => 'fetchidfromref',
'file' => '/user/class/user.class.php',
'class' => 'User',
'method' => 'fetch',
'element' => 'user'
),
);
}
/**

View File

@ -66,7 +66,7 @@ class modProjet extends DolibarrModules
// Dependencies
$this->hidden = false; // A condition to hide module
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
$this->requiredby = array(); // List of module ids to disable if this one is disabled
$this->requiredby = array('modEventOrganization'); // List of module ids to disable if this one is disabled
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
$this->phpmin = array(5, 6); // Minimum version of PHP required by module
$this->langfiles = array('projects');

View File

@ -276,11 +276,11 @@ class modPropale extends DolibarrModules
$this->import_code[$r] = $this->rights_class.'_'.$r;
$this->import_label[$r] = 'Proposals'; // Translation key
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = ['c' => MAIN_DB_PREFIX.'propal', 'extra' => MAIN_DB_PREFIX.'propal_extrafields'];
$this->import_tables_creator_array[$r] = ['c'=>'fk_user_author']; // Fields to store import user id
$this->import_fields_array[$r] = [
'c.ref' => 'Document Ref*',
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = array('c' => MAIN_DB_PREFIX.'propal', 'extra' => MAIN_DB_PREFIX.'propal_extrafields');
$this->import_tables_creator_array[$r] = array('c'=>'fk_user_author'); // Fields to store import user id
$this->import_fields_array[$r] = array(
'c.ref' => 'Ref*',
'c.ref_client' => 'RefCustomer',
'c.fk_soc' => 'ThirdPartyName*',
'c.datec' => 'DateCreation',
@ -293,7 +293,7 @@ class modPropale extends DolibarrModules
'c.note_public' => 'Note',
'c.date_livraison' => 'DeliveryDate',
'c.fk_user_valid' => 'ValidatedById'
];
);
if (!empty($conf->multicurrency->enabled)) {
$this->import_fields_array[$r]['c.multicurrency_code'] = 'Currency';
$this->import_fields_array[$r]['c.multicurrency_tx'] = 'CurrencyRate';
@ -302,7 +302,7 @@ class modPropale extends DolibarrModules
$this->import_fields_array[$r]['c.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
}
// Add extra fields
$import_extrafield_sample = [];
$import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'propal' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
if ($resql) {
@ -353,13 +353,13 @@ class modPropale extends DolibarrModules
$this->import_code[$r] = $this->rights_class.'line_'.$r;
$this->import_label[$r] = "ProposalLines"; // Translation key
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = [
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = array(
'cd' => MAIN_DB_PREFIX.'propaldet',
'extra' => MAIN_DB_PREFIX.'propaldet_extrafields'
];
$this->import_fields_array[$r] = [
'cd.fk_propal' => 'Document Ref*',
);
$this->import_fields_array[$r] = array(
'cd.fk_propal' => 'Proposal*',
'cd.fk_parent_line' => 'PrParentLine',
'cd.fk_product' => 'IdProduct',
'cd.label' => 'Label',
@ -377,7 +377,7 @@ class modPropale extends DolibarrModules
'cd.date_start' => 'Start Date',
'cd.date_end' => 'End Date',
'cd.buy_price_ht' => 'LineBuyPriceHT'
];
);
if (!empty($conf->multicurrency->enabled)) {
$this->import_fields_array[$r]['cd.multicurrency_code'] = 'Currency';
$this->import_fields_array[$r]['cd.multicurrency_subprice'] = 'CurrencyRate';
@ -386,7 +386,7 @@ class modPropale extends DolibarrModules
$this->import_fields_array[$r]['cd.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
}
// Add extra fields
$import_extrafield_sample = [];
$import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'propaldet' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
if ($resql) {
@ -398,9 +398,9 @@ class modPropale extends DolibarrModules
}
}
// End add extra fields
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'propaldet'];
$this->import_regex_array[$r] = ['cd.product_type' => '[0|1]$'];
$import_sample = [
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'propaldet');
$this->import_regex_array[$r] = array('cd.product_type' => '[0|1]$');
$import_sample = array(
'cd.fk_propal' => 'PROV(0001)',
'cd.fk_parent_line' => '',
'cd.fk_product' => '',
@ -424,17 +424,17 @@ class modPropale extends DolibarrModules
'cd.multicurrency_total_ht' => '10000',
'cd.multicurrency_total_tva' => '0',
'cd.multicurrency_total_ttc' => '10100'
];
);
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
$this->import_updatekeys_array[$r] = ['cd.fk_propal' => 'Quotation Id', 'cd.fk_product' => 'Product Id'];
$this->import_convertvalue_array[$r] = [
'cd.fk_propal' => [
$this->import_updatekeys_array[$r] = array('cd.fk_propal' => 'Quotation Id', 'cd.fk_product' => 'Product Id');
$this->import_convertvalue_array[$r] = array(
'cd.fk_propal' => array(
'rule'=>'fetchidfromref',
'file'=>'/comm/propal/class/propal.class.php',
'class'=>'Propal',
'method'=>'fetch'
]
];
)
);
}

View File

@ -212,6 +212,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
if (!is_object($object->thirdparty)) {
$object->thirdparty = $mysoc; // If fetch_thirdparty fails, object has no socid (specimen)
}
$this->emetteur = $object->thirdparty;
if (!$this->emetteur->country_code) {
$this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
@ -231,8 +232,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$nblines = count($object->lines);
if ($conf->fournisseur->facture->dir_output) {
$object->fetch_thirdparty();
$deja_regle = $object->getSommePaiement((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0);
$amount_credit_notes_included = $object->getSumCreditNotesUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0);
$amount_deposits_included = $object->getSumDepositsUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0);

View File

@ -81,7 +81,7 @@ foreach ($object->fields as $key => $val) {
} elseif ($val['type'] == 'price') {
$value = GETPOSTISSET($key) ? price2num(GETPOST($key)) : price2num($object->$key);
} elseif ($key == 'lang') {
$value = GETPOSTISSET($key, 'aZ09') ? GETPOST($key, 'aZ09') : $object->lang;
$value = GETPOSTISSET($key) ? GETPOST($key, 'aZ09') : $object->lang;
} else {
$value = GETPOSTISSET($key) ? GETPOST($key, 'alpha') : $object->$key;
}

View File

@ -199,11 +199,13 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l
if (($isdraft || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$tmpkeyextra]))
&& $permok && $enabled != 5 && ($action != 'edit_extras' || GETPOST('attribute') != $tmpkeyextra)
&& empty($extrafields->attributes[$object->table_element]['computed'][$tmpkeyextra])) {
$fieldid = 'id';
$fieldid = empty($forcefieldid) ? 'id' : $forcefieldid;
$valueid = empty($forceobjectid) ? $object->id : $forceobjectid;
if ($object->table_element == 'societe') {
$fieldid = 'socid';
}
print '<td class="right"><a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?'.$fieldid.'='.$object->id.'&action=edit_extras&attribute='.$tmpkeyextra.'&ignorecollapsesetup=1">'.img_edit().'</a></td>';
print '<td class="right"><a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?'.$fieldid.'='.$valueid.'&action=edit_extras&attribute='.$tmpkeyextra.'&ignorecollapsesetup=1">'.img_edit().'</a></td>';
}
print '</tr></table>';
print '</td>';

View File

@ -212,7 +212,7 @@ if ($captcha) {
<span class="fa fa-unlock"></span>
<span class="span-icon-security inline-block">
<input id="securitycode" placeholder="<?php echo $langs->trans("SecurityCode"); ?>" class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" autocomplete="off" />
<input id="securitycode" placeholder="<?php echo $langs->trans("SecurityCode"); ?>" class="flat input-icon-security width125" type="text" maxlength="5" name="code" tabindex="3" autocomplete="off" />
</span>
<span class="nowrap inline-block">
<img class="inline-block valignmiddle" src="<?php echo DOL_URL_ROOT ?>/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />

View File

@ -30,6 +30,14 @@ $objclassname = get_class($object);
$isInvoice = in_array($object->element, array('facture', 'invoice', 'facture_fourn', 'invoice_supplier'));
$isNewObject = empty($object->id) && empty($object->rowid);
// Clean variables not defined
if (!isset($absolute_discount)) {
$absolute_discount = 0;
}
if (!isset($absolute_creditnote)) {
$absolute_creditnote = 0;
}
// Relative and absolute discounts
$addrelativediscount = '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$thirdparty->id.'&backtopage='.$backtopage.'">'.$langs->trans("EditRelativeDiscount").'</a>';
$addabsolutediscount = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$thirdparty->id.'&backtopage='.$backtopage.'">'.$langs->trans("EditGlobalDiscounts").'</a>';

View File

@ -79,6 +79,7 @@ if (!empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE_SCREEN) && in_array($obje
$sign = -1;
}
$coldisplay = 0;
?>
<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->
@ -163,32 +164,33 @@ if (($line->info_bits & 2) == 2) {
// Show date range
if ($line->element == 'facturedetrec') {
if ($line->date_start_fill || $line->date_end_fill) {
print '<br><div class="clearboth nowraponall">';
print '<div class="clearboth nowraponall"><br>';
}
if ($line->date_start_fill) {
print $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill);
print '<span class="opacitymedium">'.$langs->trans('AutoFillDateFromShort').':</span> '.yn($line->date_start_fill);
}
if ($line->date_start_fill && $line->date_end_fill) {
print ' - ';
}
if ($line->date_end_fill) {
print $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill);
print '<span class="opacitymedium">'.$langs->trans('AutoFillDateToShort').':</span> '.yn($line->date_end_fill);
}
if ($line->date_start_fill || $line->date_end_fill) {
print '</div>';
}
} else {
if ($line->date_start || $line->date_end) {
print '<br><div class="clearboth nowraponall opacitymedium">'.get_date_range($line->date_start, $line->date_end, $format).'</div>';
print '<div class="clearboth nowraponall opacitymedium">'.get_date_range($line->date_start, $line->date_end, $format).'</div>';
}
//print get_date_range($line->date_start, $line->date_end, $format);
}
// Add description in form
if ($line->fk_product > 0 && !empty($conf->global->PRODUIT_DESC_IN_FORM)) {
print (!empty($line->description) && $line->description != $line->product_label) ? '<br>'.dol_htmlentitiesbr($line->description) : '';
print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start || $line->date_end) ? '' : '<br>').'<br>'.dol_htmlentitiesbr($line->description) : '';
}
//Line extrafield
// Line extrafield
if (!empty($extrafields)) {
$temps = $line->showOptionals($extrafields, 'view', array(), '', '', 1, 'line');
if (!empty($temps)) {

View File

@ -150,7 +150,7 @@ if (!empty($captcha)) {
<span class="fa fa-unlock"></span>
<span class="nofa inline-block">
<input id="securitycode" placeholder="<?php echo $langs->trans("SecurityCode"); ?>" class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" autocomplete="off" />
<input id="securitycode" placeholder="<?php echo $langs->trans("SecurityCode"); ?>" class="flat input-icon-security width125" type="text" maxlength="5" name="code" tabindex="3" autocomplete="off" />
</span>
<span class="nowrap inline-block">
<img class="inline-block valignmiddle" src="<?php echo DOL_URL_ROOT ?>/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />

View File

@ -192,7 +192,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($action == 'BILL_SUPPLIER_VALIDATE') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
// First classify billed the order to allow the proposal classify process
// Firstly, we set to purchase order to "Billed" if WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER is set.
// After we will set proposals
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER)) {
$object->fetchObjectLinked('', 'order_supplier', $object->id, $object->element);
if (!empty($object->linkedObjects)) {
@ -206,13 +207,15 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
foreach ($object->linkedObjects['order_supplier'] as $element) {
$ret = $element->classifyBilled($user);
if ($ret < 0) {
return $ret;
}
}
}
}
return $ret;
}
// Second classify billed the proposal.
// Secondly, we set to linked Proposal to "Billed" if WORKFLOW_INVOICE_CLASSIFY_BILLED_SUPPLIER_PROPOSAL is set.
if (!empty($conf->supplier_proposal->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_SUPPLIER_PROPOSAL)) {
$object->fetchObjectLinked('', 'supplier_proposal', $object->id, $object->element);
if (!empty($object->linkedObjects)) {
@ -226,11 +229,37 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
foreach ($object->linkedObjects['supplier_proposal'] as $element) {
$ret = $element->classifyBilled($user);
if ($ret < 0) {
return $ret;
}
}
}
}
return $ret;
}
// Then set reception to "Billed" if WORKFLOW_BILL_ON_RECEPTION is set
if (!empty($conf->reception->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) {
$object->fetchObjectLinked('', 'reception', $object->id, $object->element);
if (!empty($object->linkedObjects)) {
$totalonlinkedelements = 0;
foreach ($object->linkedObjects['reception'] as $element) {
if ($element->statut == Reception::STATUS_VALIDATED) {
$totalonlinkedelements += $element->total_ht;
}
}
dol_syslog("Amount of linked reception = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
if ($totalonlinkedelements == $object->total_ht) {
foreach ($object->linkedObjects['reception'] as $element) {
$ret = $element->setBilled();
if ($ret < 0) {
return $ret;
}
}
}
}
}
return $ret;
}
// Invoice classify billed order
@ -325,30 +354,6 @@ class InterfaceWorkflowManager extends DolibarrTriggers
}
}
// classify billed reception
if ($action == 'BILL_SUPPLIER_VALIDATE') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id, LOG_DEBUG);
if (!empty($conf->reception->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) {
$object->fetchObjectLinked('', 'reception', $object->id, $object->element);
if (!empty($object->linkedObjects)) {
$totalonlinkedelements = 0;
foreach ($object->linkedObjects['reception'] as $element) {
if ($element->statut == Reception::STATUS_VALIDATED) {
$totalonlinkedelements += $element->total_ht;
}
}
dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
if ($totalonlinkedelements == $object->total_ht) {
foreach ($object->linkedObjects['reception'] as $element) {
$ret = $element->setBilled();
}
}
}
return $ret;
}
}
return 0;
}

View File

@ -596,13 +596,13 @@ class TraceableDB extends DoliDB
/**
* Encrypt sensitive data in database
* Warning: This function includes the escape, so it must use direct value
* Warning: This function includes the escape and add the SQL simple quotes on strings.
*
* @param string $fieldorvalue Field name or value to encrypt
* @param int $withQuotes Return string with quotes
* @return string XXX(field) or XXX('value') or field or 'value'
* @param string $fieldorvalue Field name or value to encrypt
* @param int $withQuotes Return string including the SQL simple quotes. This param must always be 1 (Value 0 is bugged and deprecated).
* @return string XXX(field) or XXX('value') or field or 'value'
*/
public function encrypt($fieldorvalue, $withQuotes = 0)
public function encrypt($fieldorvalue, $withQuotes = 1)
{
return $this->db->encrypt($fieldorvalue, $withQuotes);
}

View File

@ -84,259 +84,284 @@ if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
// Action reopen object
if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) {
$object->fetch($id);
if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT.'/don/list.php';
$result = $object->reopen($user);
if ($result >= 0) {
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
if (method_exists($object, 'generateDocument')) {
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model = $object->model_pdf;
$ret = $object->fetch($id); // Reload to get new records
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
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.'/don/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
}
}
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
// Action update object
if ($action == 'update') {
if (!empty($cancel)) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".urlencode($id));
exit;
}
$error = 0;
if (empty($donation_date)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = "create";
$error++;
}
if (empty($amount)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
$action = "create";
$error++;
}
if (!$error) {
$object->fetch($id);
$object->firstname = (string) GETPOST("firstname", 'alpha');
$object->lastname = (string) GETPOST("lastname", 'alpha');
$object->societe = (string) GETPOST("societe", 'alpha');
$object->address = (string) GETPOST("address", 'alpha');
$object->amount = price2num(GETPOST("amount", 'alpha'));
$object->town = (string) GETPOST("town", 'alpha');
$object->zip = (string) GETPOST("zipcode", 'alpha');
$object->country_id = (int) GETPOST('country_id', 'int');
$object->email = (string) GETPOST("email", 'alpha');
$object->date = $donation_date;
$object->public = $public_donation;
$object->fk_project = (int) GETPOST("fk_project", 'int');
$object->note_private = (string) GETPOST("note_private", 'restricthtml');
$object->note_public = (string) GETPOST("note_public", 'restricthtml');
$object->modepaymentid = (int) GETPOST('modepayment', 'int');
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) {
$error++;
}
if ($object->update($user) > 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
if ($cancel) {
if (!empty($backtopageforcancel)) {
header("Location: ".$backtopageforcancel);
exit;
} elseif (!empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
}
}
// Action add/create object
if ($action == 'add') {
if (!empty($cancel)) {
header("Location: index.php");
exit;
$action = '';
}
$error = 0;
// Action reopen object
if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) {
$object->fetch($id);
if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES) && !(GETPOST("socid", 'int') > 0)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")), null, 'errors');
$action = "create";
$error++;
}
if (empty($donation_date)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = "create";
$error++;
}
$result = $object->reopen($user);
if ($result >= 0) {
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
if (method_exists($object, 'generateDocument')) {
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model = $object->model_pdf;
$ret = $object->fetch($id); // Reload to get new records
if (empty($amount)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
$action = "create";
$error++;
}
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
if (!$error) {
$object->socid = (int) GETPOST("socid", 'int');
$object->firstname = (string) GETPOST("firstname", 'alpha');
$object->lastname = (string) GETPOST("lastname", 'alpha');
$object->societe = (string) GETPOST("societe", 'alpha');
$object->address = (string) GETPOST("address", 'alpha');
$object->amount = price2num(GETPOST("amount", 'alpha'));
$object->zip = (string) GETPOST("zipcode", 'alpha');
$object->town = (string) GETPOST("town", 'alpha');
$object->country_id = (int) GETPOST('country_id', 'int');
$object->email = (string) GETPOST('email', 'alpha');
$object->date = $donation_date;
$object->note_private = (string) GETPOST("note_private", 'restricthtml');
$object->note_public = (string) GETPOST("note_public", 'restricthtml');
$object->public = $public_donation;
$object->fk_project = (int) GETPOST("fk_project", 'int');
$object->modepaymentid = (int) GETPOST('modepayment', 'int');
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) {
$error++;
}
$res = $object->create($user);
if ($res > 0) {
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$res);
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
// Action delete object
if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->don->supprimer) {
$object->fetch($id);
$result = $object->delete($user);
if ($result > 0) {
header("Location: index.php");
exit;
} else {
dol_syslog($object->error, LOG_DEBUG);
setEventMessages($object->error, $object->errors, 'errors');
// Action update object
if ($action == 'update') {
if (!empty($cancel)) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".urlencode($id));
exit;
}
$error = 0;
if (empty($donation_date)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = "create";
$error++;
}
if (empty($amount)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
$action = "create";
$error++;
}
if (!$error) {
$object->fetch($id);
$object->firstname = (string) GETPOST("firstname", 'alpha');
$object->lastname = (string) GETPOST("lastname", 'alpha');
$object->societe = (string) GETPOST("societe", 'alpha');
$object->address = (string) GETPOST("address", 'alpha');
$object->amount = price2num(GETPOST("amount", 'alpha'));
$object->town = (string) GETPOST("town", 'alpha');
$object->zip = (string) GETPOST("zipcode", 'alpha');
$object->country_id = (int) GETPOST('country_id', 'int');
$object->email = (string) GETPOST("email", 'alpha');
$object->date = $donation_date;
$object->public = $public_donation;
$object->fk_project = (int) GETPOST("fk_project", 'int');
$object->note_private = (string) GETPOST("note_private", 'restricthtml');
$object->note_public = (string) GETPOST("note_public", 'restricthtml');
$object->modepaymentid = (int) GETPOST('modepayment', 'int');
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) {
$error++;
}
if ($object->update($user) > 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
}
}
}
// Action validation
if ($action == 'valid_promesse') {
$object->fetch($id);
if ($object->valid_promesse($id, $user->id) >= 0) {
setEventMessages($langs->trans("DonationValidated", $object->ref), null);
$action = '';
} else {
setEventMessages($object->error, $object->errors, 'errors');
// Action add/create object
if ($action == 'add') {
if (!empty($cancel)) {
header("Location: index.php");
exit;
}
$error = 0;
if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES) && !(GETPOST("socid", 'int') > 0)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")), null, 'errors');
$action = "create";
$error++;
}
if (empty($donation_date)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = "create";
$error++;
}
if (empty($amount)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
$action = "create";
$error++;
}
if (!$error) {
$object->socid = (int) GETPOST("socid", 'int');
$object->firstname = (string) GETPOST("firstname", 'alpha');
$object->lastname = (string) GETPOST("lastname", 'alpha');
$object->societe = (string) GETPOST("societe", 'alpha');
$object->address = (string) GETPOST("address", 'alpha');
$object->amount = price2num(GETPOST("amount", 'alpha'));
$object->zip = (string) GETPOST("zipcode", 'alpha');
$object->town = (string) GETPOST("town", 'alpha');
$object->country_id = (int) GETPOST('country_id', 'int');
$object->email = (string) GETPOST('email', 'alpha');
$object->date = $donation_date;
$object->note_private = (string) GETPOST("note_private", 'restricthtml');
$object->note_public = (string) GETPOST("note_public", 'restricthtml');
$object->public = $public_donation;
$object->fk_project = (int) GETPOST("fk_project", 'int');
$object->modepaymentid = (int) GETPOST('modepayment', 'int');
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) {
$error++;
}
$res = $object->create($user);
if ($res > 0) {
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$res);
exit;
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
}
// Action cancel
if ($action == 'set_cancel') {
$object->fetch($id);
if ($object->set_cancel($id) >= 0) {
$action = '';
} else {
setEventMessages($object->error, $object->errors, 'errors');
// Action delete object
if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->don->supprimer) {
$object->fetch($id);
$result = $object->delete($user);
if ($result > 0) {
header("Location: index.php");
exit;
} else {
dol_syslog($object->error, LOG_DEBUG);
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
// Action set paid
if ($action == 'set_paid') {
$object->fetch($id);
if ($object->setPaid($id, $modepayment) >= 0) {
$action = '';
} else {
setEventMessages($object->error, $object->errors, 'errors');
// Action validation
if ($action == 'valid_promesse') {
$object->fetch($id);
if ($object->valid_promesse($id, $user->id) >= 0) {
setEventMessages($langs->trans("DonationValidated", $object->ref), null);
$action = '';
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
// Action cancel
if ($action == 'set_cancel') {
$object->fetch($id);
if ($object->set_cancel($id) >= 0) {
$action = '';
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
// Action set paid
if ($action == 'set_paid') {
$object->fetch($id);
if ($object->setPaid($id, $modepayment) >= 0) {
$action = '';
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'classin' && $user->rights->don->creer) {
$object->fetch($id);
$object->setProject($projectid);
}
} elseif ($action == 'classin' && $user->rights->don->creer) {
$object->fetch($id);
$object->setProject($projectid);
}
// Actions to build doc
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
// Actions to build doc
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
// Remove file in doc form
/*if ($action == 'remove_file')
{
$object = new Don($db, 0, GETPOST('id', 'int'));
if ($object->fetch($id))
// Remove file in doc form
/*if ($action == 'remove_file')
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$object = new Don($db, 0, GETPOST('id', 'int'));
if ($object->fetch($id))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$object->fetch_thirdparty();
$object->fetch_thirdparty();
$langs->load("other");
$upload_dir = $conf->don->dir_output;
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
$action='';
$langs->load("other");
$upload_dir = $conf->don->dir_output;
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
$action='';
}
}
}
*/
*/
/*
* Build doc
*/
/*
if ($action == 'builddoc')
{
$object = new Don($db);
$result=$object->fetch($id);
// Save last template used to generate document
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
if (! empty($newlang))
/*
* Build doc
*/
/*
if ($action == 'builddoc')
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$result=don_create($db, $object->id, '', $object->model_pdf, $outputlangs);
if ($result <= 0)
{
dol_print_error($db,$result);
exit;
$object = new Don($db);
$result=$object->fetch($id);
// Save last template used to generate document
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$result=don_create($db, $object->id, '', $object->model_pdf, $outputlangs);
if ($result <= 0)
{
dol_print_error($db,$result);
exit;
}
}
*/
}
*/
/*

View File

@ -542,7 +542,7 @@ class EcmFiles extends CommonObject
$sql .= " AND entity IN (" . getEntity('ecmfiles') . ")";
}*/
if (count($sqlwhere) > 0) {
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
$sql .= ' AND '.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere);
}
if (!empty($sortfield)) {
$sql .= $this->db->order($sortfield, $sortorder);

View File

@ -120,7 +120,8 @@ if (GETPOST("sendit", 'alphanohtml') && !empty($conf->global->MAIN_UPLOAD_DOC))
if (!$error) {
$generatethumbs = 0;
$res = dol_add_file_process($upload_dir, 0, 1, 'userfile', '', null, '', $generatethumbs);
$overwritefile = GETPOST('overwritefile', 'int')?GETPOST('overwritefile', 'int'):0;
$res = dol_add_file_process($upload_dir, $overwritefile, 1, 'userfile', '', null, '', $generatethumbs);
if ($res > 0) {
$result = $ecmdir->changeNbOfFiles('+');
}

View File

@ -242,11 +242,11 @@ class ConferenceOrBooth extends ActionComm
*/
public function fetch($id, $ref = null, $ref_ext = '', $email_msgid = '')
{
global $dolibarr_main_url_root, $dolibarr_main_instance_unique_id, $conf, $langs;
global $dolibarr_main_url_root, $conf, $langs;
$result = parent::fetch($id, $ref, $ref_ext, $email_msgid);
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$id;
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.urlencode($id);
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
@ -306,7 +306,7 @@ class ConferenceOrBooth extends ActionComm
}
}
if (count($sqlwhere) > 0) {
$sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')';
$sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')';
}
if (!empty($sortfield)) {

View File

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

View File

@ -33,13 +33,13 @@ if ($conf->categorie->enabled) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
}
global $dolibarr_main_url_root;
// for other modules
//dol_include_once('/othermodule/class/otherobject.class.php');
// Load translation files required by the page
$langs->loadLangs(array("eventorganization", "other"));
global $dolibarr_main_url_root, $dolibarr_main_instance_unique_id;
$langs->loadLangs(array("eventorganization", "other", "projects"));
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
@ -228,7 +228,7 @@ $now = dol_now();
//$help_url="EN:Module_ConferenceOrBooth|FR:Module_ConferenceOrBooth_FR|ES:Módulo_ConferenceOrBooth";
$help_url = '';
$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("ConferenceOrBooths"));
$title = $langs->trans('ListOfConferencesOrBooths');
if ($projectid > 0) {
$project = new Project($db);
@ -246,9 +246,9 @@ if ($projectid > 0) {
}
$help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
$title = $langs->trans("Project") . ' - ' . $langs->trans("ConferenceOrBooths") . ' - ' . $project->ref . ' ' . $project->name;
$title = $langs->trans("Project") . ' - ' . $langs->trans("ListOfConferencesOrBooths") . ' - ' . $project->ref . ' ' . $project->name;
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $project->name) {
$title = $project->ref . ' ' . $project->name . ' - ' . $langs->trans("ConferenceOrBooths");
$title = $project->ref . ' ' . $project->name . ' - ' . $langs->trans("ListOfConferencesOrBooths");
}
}
@ -352,14 +352,6 @@ if ($projectid > 0) {
}
print '</td></tr>';
// Link to the vote/register page
print '<tr><td>'.$langs->trans("RegisterPage").'</td><td>';
$linkregister = $dolibarr_main_url_root.'/public/project/index.php?id='.$project->id;
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 2);
$linkregister .= '&securekey='.urlencode($encodedsecurekey);
print '<a target="_blank" href="'.$linkregister.'">'.$linkregister.'</a>';
print '</td></tr>';
// Other attributes
$cols = 2;
$objectconf=$object;
@ -422,12 +414,45 @@ if ($projectid > 0) {
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
// Show message
$message = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
$message = '<a target="blank" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
$message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
$message .= "&project=".$projectid.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').'</a>';
$message .= "&project=".$projectid.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
print $message;
print "</td></tr>";
// Link to the submit vote/register page
print '<tr><td>';
//print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage"));
//print '</span>';
print '</td><td>';
$linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$project->id;
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 2);
$linksuggest .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$linksuggest.'" class="quatrevingtpercent">'.$linksuggest.'</a></div>';
print '<a target="_blank" href="'.$linksuggest.'">'.img_picto('', 'globe').'</a>';
//print '</div>';
//print ajax_autoselect("linkregister");
print '</td></tr>';
// Link to the subscribe
print '<tr><td>';
//print '<span class="opacitymedium">';
print $langs->trans("PublicAttendeeSubscriptionPage");
//print '</span>';
print '</td><td>';
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$project->id;
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 2);
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.'" class="quatrevingtpercent">'.$link_subscription.'</a></div>';
print '<a target="_blank" href="'.$link_subscription.'">'.img_picto('', 'globe').'</a>';
//print '</div>';
//print ajax_autoselect("linkregister");
print '</td></tr>';
print '</table>';
@ -437,7 +462,6 @@ if ($projectid > 0) {
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
}
@ -612,7 +636,7 @@ $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle'
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
// Add code for pre mass action (confirmation or email presend form)
$topicmail = "SendConferenceOrBoothRef";
$topicmail = $object->ref;
$modelmail = "conferenceorbooth";
$objecttmp = new ConferenceOrBooth($db);
$trackid = 'conferenceorbooth_'.$object->id;
@ -665,7 +689,7 @@ foreach ($object->fields as $key => $val) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref')) && $val['label'] != 'TechnicalID') {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
if (!empty($arrayfields['t.'.$key]['checked'])) {
@ -713,7 +737,7 @@ foreach ($object->fields as $key => $val) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref')) && $val['label'] != 'TechnicalID') {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
if (!empty($arrayfields['t.'.$key]['checked'])) {
@ -768,10 +792,10 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif ($key == 'ref') {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap left';
}
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status'))) {
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref', 'status'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
*
* This program is free software; you can redistribute it and/or modify
@ -624,6 +624,7 @@ if ($id > 0 || !empty($ref)) {
$sql .= ' p.rowid as prodid, p.label as product_label, p.entity, p.ref, p.fk_product_type as product_type, p.description as product_desc,';
$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,';
$sql .= ' p.surface, p.surface_units, p.volume, p.volume_units';
$sql .= ', p.tobatch, p.tosell, p.tobuy, p.barcode';
$sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
$sql .= " WHERE cd.fk_commande = ".((int) $object->id);
@ -711,6 +712,10 @@ if ($id > 0 || !empty($ref)) {
$product_static->id = $objp->fk_product;
$product_static->ref = $objp->ref;
$product_static->entity = $objp->entity;
$product_static->status = $objp->tosell;
$product_static->status_buy = $objp->tobuy;
$product_static->status_batch = $objp->tobatch;
$product_static->barcode = $objp->barcode;
$product_static->weight = $objp->weight;
$product_static->weight_units = $objp->weight_units;

View File

@ -138,8 +138,23 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT.'/expensereport/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.'/expensereport/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;
}

View File

@ -113,8 +113,23 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT.'/fichinter/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.'/fichinter/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;
}
@ -995,6 +1010,7 @@ if ($action == 'create') {
} else {
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="create">'; // We go back to create action
print dol_get_fiche_head('');

View File

@ -54,7 +54,7 @@ $langs->loadLangs(array(
));
$action = GETPOST('action', 'aZ09');
$cancelbutton = GETPOST('cancel', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
// Security check
$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
@ -73,7 +73,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
$hookmanager->initHooks(array('suppliercard', 'globalcard'));
// Security check
$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0);
$result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0);
if ($object->id > 0) {
if (!($object->fournisseur > 0) || empty($user->rights->fournisseur->lire)) {
@ -93,7 +93,7 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
if ($cancelbutton) {
if ($cancel) {
$action = "";
}
@ -385,7 +385,7 @@ if ($object->id > 0) {
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop" width="100%">';
$boxstat .= '<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
if ($conf->supplier_proposal->enabled) {
if (!empty($conf->supplier_proposal->enabled)) {
// Box proposals
$tmp = $object->getOutstandingProposals('supplier');
$outstandingOpened = $tmp['opened'];
@ -428,6 +428,7 @@ if ($object->id > 0) {
}
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) {
$warn = '';
$tmp = $object->getOutstandingBills('supplier');
$outstandingOpened = $tmp['opened'];
$outstandingTotal = $tmp['total_ht'];
@ -584,7 +585,7 @@ if ($object->id > 0) {
*/
$proposalstatic = new SupplierProposal($db);
if ($user->rights->supplier_proposal->lire) {
if (!empty($user->rights->supplier_proposal->lire)) {
$langs->loadLangs(array("supplier_proposal"));
$sql = "SELECT p.rowid, p.ref, p.date_valid as dc, p.fk_statut, p.total_ht, p.total_tva, p.total_ttc";
@ -831,7 +832,7 @@ if ($object->id > 0) {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("ThirdPartyIsClosed").'</a></div>';
}
if ($conf->supplier_proposal->enabled && $user->rights->supplier_proposal->creer) {
if (!empty($conf->supplier_proposal->enabled) && !empty($user->rights->supplier_proposal->creer)) {
$langs->load("supplier_proposal");
if ($object->status == 1) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddSupplierProposal").'</a>';

View File

@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT."/reception/class/reception.class.php";
/**
* Class to manage table commandefournisseurdispatch
*/
class CommandeFournisseurDispatch extends CommonObject
class CommandeFournisseurDispatch extends CommonObjectLine
{
/**
* @var DoliDB Database handler.
@ -677,7 +677,7 @@ class CommandeFournisseurDispatch extends CommonObject
}
}
if (count($sqlwhere) > 0) {
$sql .= ' WHERE '.implode(' '.$filtermode.' ', $sqlwhere);
$sql .= ' WHERE '.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere);
}
if (!empty($sortfield)) {

View File

@ -3387,20 +3387,11 @@ class SupplierInvoiceLine extends CommonObjectLine
$this->multicurrency_total_ttc = 0;
}
$fk_product = (int) $this->fk_product;
$fk_unit = (int) $this->fk_unit;
$this->db->begin();
if (empty($this->fk_product)) {
$fk_product = "null";
} else {
$fk_product = (int) $this->fk_product;
}
if (empty($this->fk_unit)) {
$fk_unit = "null";
} else {
$fk_unit = (int) $this->fk_unit;
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET";
$sql .= " description ='".$this->db->escape($this->description)."'";
$sql .= ", ref ='".$this->db->escape($this->ref_supplier ? $this->ref_supplier : $this->ref)."'";

View File

@ -168,6 +168,17 @@ if (empty($reshook)) {
}
}
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 include_once
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
@ -1591,7 +1602,7 @@ if ($action == 'create') {
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="remise_percent" value="'.$soc->remise_supplier_percent.'">';
print '<input type="hidden" name="remise_percent" value="'.(empty($soc->remise_supplier_percent) ? '' : $soc->remise_supplier_percent).'">';
print '<input type="hidden" name="origin" value="'.$origin.'">';
print '<input type="hidden" name="originid" value="'.$originid.'">';
if ($backtopage) {
@ -1693,7 +1704,7 @@ if ($action == 'create') {
$langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td>';
print img_picto('', 'project').$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$societe->id).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$societe->id).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
print '</td></tr>';
}

View File

@ -140,8 +140,23 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT.'/fourn/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.'/fourn/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;
}
@ -538,7 +553,7 @@ if (empty($reshook)) {
}
// If some payments were already done, we change the amount to pay using same prorate
if (!empty($conf->global->SUPPLIER_INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED)) {
if (!empty($conf->global->SUPPLIER_INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) && $object->type == FactureFournisseur::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);

View File

@ -124,8 +124,23 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT.'/holiday/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.'/holiday/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;
}
@ -915,37 +930,41 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
$nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd');
print '<script type="text/javascript">
function valider()
{
if(document.demandeCP.date_debut_.value != "")
{
if(document.demandeCP.date_fin_.value != "")
{
if(document.demandeCP.valideur.value != "-1") {
return true;
}
else {
alert("'.dol_escape_js($langs->transnoentities('InvalidValidatorCP')).'");
return false;
}
}
else
{
alert("'.dol_escape_js($langs->transnoentities('NoDateFin')).'");
return false;
}
}
else
{
alert("'.dol_escape_js($langs->transnoentities('NoDateDebut')).'");
return false;
}
}
$( document ).ready(function() {
$("input.button-save").click("submit", function(e) {
console.log("Call valider()");
if (document.demandeCP.date_debut_.value != "")
{
if(document.demandeCP.date_fin_.value != "")
{
if(document.demandeCP.valideur.value != "-1") {
return true;
}
else {
alert("'.dol_escape_js($langs->transnoentities('InvalidValidatorCP')).'");
return false;
}
}
else
{
alert("'.dol_escape_js($langs->transnoentities('NoDateFin')).'");
return false;
}
}
else
{
alert("'.dol_escape_js($langs->transnoentities('NoDateDebut')).'");
return false;
}
});
});
</script>'."\n";
// Formulaire de demande
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" onsubmit="return valider()" name="demandeCP">'."\n";
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" name="demandeCP">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'" />'."\n";
print '<input type="hidden" name="action" value="add" />'."\n";
@ -1084,11 +1103,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
print dol_get_fiche_end();
print '<div class="center">';
print '<input type="submit" value="'.$langs->trans("SendRequestCP").'" name="bouton" class="button">';
print '&nbsp; &nbsp; ';
print '<input type="button" value="'.$langs->trans("Cancel").'" class="button button-cancel" onclick="history.go(-1)">';
print '</div>';
print $form->buttonsSaveCancel("SendRequestCP");
print '</from>'."\n";
}

View File

@ -86,7 +86,7 @@ insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_EXP
-- Mail Mailing
--
insert into llx_const (name, value, type, note, visible) values ('MAIN_FIX_FOR_BUGGED_MTA','1','chaine','Set constant to fix email ending from PHP with some linux ike system',1);
insert into llx_const (name, value, type, note, visible) values ('MAILING_EMAIL_FROM','dolibarr@domain.com','chaine','EMail emmetteur pour les envois d emailings',0);
insert into llx_const (name, value, type, note, visible) values ('MAILING_EMAIL_FROM','no-reply@mydomain.com','chaine','EMail emmetteur pour les envois d emailings',0);
--
@ -103,3 +103,9 @@ insert into llx_const (name, value, type, visible, entity) VALUES ('USER_ADDON_P
--
INSERT INTO llx_const (name, entity, value, type, visible) VALUES ('PRODUCT_PRICE_BASE_TYPE', 0, 'HT', 'string', 0);
--
-- Membership
--
INSERT INTO llx_const (name, entity, value, type, visible) VALUES ('ADHERENT_LOGIN_NOT_REQUIRED', 0, '1', 'string', 0);

View File

@ -459,7 +459,7 @@ CREATE TABLE llx_partnership(
fk_soc integer,
fk_member integer,
date_partnership_start date NOT NULL,
date_partnership_end date NOT NULL,
date_partnership_end date NULL,
entity integer DEFAULT 1 NOT NULL, -- multi company id, 0 = all
reason_decline_or_cancel text NULL,
date_creation datetime NOT NULL,

View File

@ -63,6 +63,7 @@ INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUE
ALTER TABLE llx_product ADD COLUMN fk_default_bom integer DEFAULT NULL;
ALTER TABLE llx_mrp_mo ADD COLUMN mrptype integer DEFAULT 0;
DELETE FROM llx_menu WHERE type = 'top' AND module = 'cashdesk' AND mainmenu = 'cashdesk';

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