diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index f9b10c3ce3b..5a589756feb 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -205,16 +205,16 @@ print ''.$langs->trans("Description").''; print ''.$langs->trans("Value").''; print "\n"; -// Login/Pass required for members -print ''.$langs->trans("AdherentLoginRequired").''; -print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (!empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED) ? 0 : 1), 1); -print "\n"; - // Mail required for members print ''.$langs->trans("AdherentMailRequired").''; print $form->selectyesno('ADHERENT_MAIL_REQUIRED', (!empty($conf->global->ADHERENT_MAIL_REQUIRED) ? $conf->global->ADHERENT_MAIL_REQUIRED : 0), 1); print "\n"; +// Login/Pass required for members +print ''.$langs->trans("AdherentLoginRequired").''; +print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (!empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED) ? 0 : 1), 1); +print "\n"; + // Send mail information is on by default print ''.$langs->trans("MemberSendInformationByMailByDefault").''; print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? $conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL : 0), 1); diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 9c04463cfc2..f6a512eaa11 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -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"').''.$langs->trans("Invoices").': '.count($tmparray['refs']); + print ' - '.img_picto($langs->trans("Invoices"), 'bill', 'class="paddingright"').''.$langs->trans("Invoices").' ('.count($tmparray['refs']).')'; // TODO Add alert if warning on at least one invoice late print ''; } @@ -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 ''.$langs->trans("CreateDolibarrThirdParty").''."\n";; + print ''.$langs->trans("CreateDolibarrThirdParty").''."\n"; } else { print ''.$langs->trans("CreateDolibarrThirdParty").''."\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 ''.$langs->trans("CreateDolibarrLogin").''."\n"; + print ''.$langs->trans("CreateDolibarrLogin").''."\n"; } else { print ''.$langs->trans("CreateDolibarrLogin").''."\n"; } diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 78deca61028..bdb77982733 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2185,6 +2185,9 @@ class Adherent extends CommonObject if (!empty($this->ref)) { $label .= '
'.$langs->trans('Ref').': '.$this->ref; } + if (!empty($this->login)) { + $label .= '
'.$langs->trans('Login').': '.$this->login; + } if (!empty($this->firstname) || !empty($this->lastname)) { $label .= '
'.$langs->trans('Name').': '.$this->getFullName($langs); } diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index fd667ad6a2f..d55845b40c1 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -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 ''; - print $obj->firstname; + print $memberstatic->getNomUrl(0, 0, 'card', 'fistname'); + //print $obj->firstname; print "\n"; if (!$i) { $totalarray['nbfield']++; @@ -965,7 +972,8 @@ while ($i < min($num, $limit)) { // Lastname if (!empty($arrayfields['d.lastname']['checked'])) { print ''; - print $obj->lastname; + print $memberstatic->getNomUrl(0, 0, 'card', 'lastname'); + //print $obj->lastname; print "\n"; if (!$i) { $totalarray['nbfield']++; @@ -985,7 +993,7 @@ while ($i < min($num, $limit)) { // Company if (!empty($arrayfields['d.company']['checked'])) { print ''; - print $companyname; + print $companynametoshow; print "\n"; } // Login @@ -1095,7 +1103,9 @@ while ($i < min($num, $limit)) { } // EMail if (!empty($arrayfields['d.email']['checked'])) { - print "".dol_print_email($obj->email, 0, 0, 1)."\n"; + print ''; + print dol_print_email($obj->email, 0, 0, 1, 64, 1, 1); + print "\n"; } // End of subscription date $datefin = $db->jdate($obj->datefin); diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 16dfc3ccff6..e751a7b5c65 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -308,7 +308,7 @@ if ($mode) { print ''; foreach ($data as $val) { - $year = isset($val['year']) ? $val['year'] : '';; + $year = isset($val['year']) ? $val['year'] : ''; print ''; print ''.$val['label'].''; if (isset($label2)) { diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 384b00af25e..f7a8060d9a5 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -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"').''.$langs->trans("Invoices").': '.count($tmparray['refs']); + print ' - '.img_picto($langs->trans("Invoices"), 'bill', 'class="paddingright"').''.$langs->trans("Invoices").' ('.count($tmparray['refs']).')'; // TODO Add alert if warning on at least one invoice late print ''; } diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index af65f32b510..839e0c8ba47 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -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); diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 272da835741..d689b2df8af 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -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 ''.$langs->trans("AgendaExtSitesDesc")."
\n"; print "
\n"; + +$selectedvalue=$conf->global->AGENDA_DISABLE_EXT; +if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1; + print ""; print ""; @@ -203,31 +249,44 @@ print ""; print "'; print "'; print ''; +print ''; print ""; $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 ''; // Nb - print '"; + print '"; // Name - print ''; + print ''; // URL - print ''; + print ''; // Offset TZ - print ''; + print ''; // Color (Possible colors are limited by Google) print ''; + // Calendar active by default + print ''; print ""; $i++; diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index fb937dc1dbe..a9463be9937 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -499,7 +499,7 @@ print "\n"; print '
".$langs->trans("Name")."".$langs->trans("ExtSiteUrlAgenda")." (".$langs->trans("Example").': http://yoursite/agenda/agenda.ics)".$form->textwithpicto($langs->trans("FixTZ"), $langs->trans("FillFixTZOnlyIfRequired"), 1).''.$langs->trans("Color").''.$langs->trans("ActiveByDefault").'
'.$langs->trans("AgendaExtNb", $key)."' . $langs->trans("AgendaExtNb", $key) . "'; //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 ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('AGENDA_EXT_ACTIVEBYDEFAULT' . $key); + } else { + if (empty($conf->global->{$default})) { + print '' . img_picto($langs->trans("Enabled"), 'on') . ''; + } else { + print '' . img_picto($langs->trans("Disabled"), 'off') . ''; + } + } print '
'; print dol_get_fiche_end(); -$form->buttonsSaveCancel("Save", ''); +print $form->buttonsSaveCancel("Save", ''); print "\n"; diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 5b9a11dcf5f..9d8f655a608 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -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; } diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index b1a9efc8648..37735a43ed3 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -132,6 +132,7 @@ print ''; print ''; print ''; print ''; +print ''; print "\n"; print ''; +print ''; +print ''; print ''; +print ''; +print ''; print ''; +print ''; +print ''; // Constant to add salt into the unsubscribe and check read tag. @@ -165,15 +169,17 @@ print ''; +print ''; +print ''; // default blacklist from mailing print ''; -print ''; +print ''; print ''; +print ''; print ''; @@ -181,7 +187,8 @@ if (!empty($conf->use_javascript_ajax) && $conf->global->MAIN_FEATURES_LEVEL >= print ''; + print ''; + print ''; } print '
'.$langs->trans("Parameter").''.$langs->trans("Value").''.$langs->trans("Example").'
'; @@ -140,7 +141,8 @@ print '
'.dol_escape_htmltag(($mysoc->name ? $mysoc->name : 'MyName').' ').'
'; print $langs->trans("MailingEMailError").''; @@ -148,12 +150,14 @@ print '
webmaster@example.com>
'; print $langs->trans("MailingDelay").''; print ''; -print '
' . $langs->trans("DefaultBlacklistMailingStatus") . '' . $langs->trans("DefaultBlacklistMailingStatus", $langs->transnoentitiesnoconv("No_Email")) . ''; -$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 '
'; print $langs->trans("MailAdvTargetRecipients").''; print ajax_constantonoff('EMAILING_USE_ADVANCED_SELECTOR'); - print '
'; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index e3448d19702..658be446765 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -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 .= ''."\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))) { diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 5030c487537..b192f1636cd 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -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 ''.$langs->trans("ShowDetailsInPDFPageFoot").'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 ''; +// Show online payment link on invoices + +print ''.$langs->trans("PDF_SHOW_LINK_TO_ONLINE_PAYMENT").''; +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 ''; + print ''; print ''; diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index ab65576811a..b4e1abdbadb 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -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) diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index 99582b62047..ce8e3e06932 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -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'; } diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index 4a2e98fc666..ceaf6aa2ecc 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -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'; diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php index 6f743172617..65175a86c5e 100644 --- a/htdocs/asset/type.php +++ b/htdocs/asset/type.php @@ -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 "\n"; } @@ -502,12 +503,12 @@ if ($rowid > 0) { // Edit if ($user->rights->asset->write) { - print '
'.$langs->trans("Modify").'
'; + print '
'.$langs->trans("Modify").'
'; } // Delete if ($user->rights->asset->write) { - print '
'.$langs->trans("DeleteType").'
'; + print '
'.$langs->trans("DeleteType").'
'; } print ""; diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 385101c7468..2a15aa0965b 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -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); diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index ea4b306ac12..e6ae5c78ae5 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -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)) { diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 158627e274c..84300e76d98 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -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); } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index a7dba92085a..e4ceccdb3fc 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -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 ''.$langs->trans("Status").' / '.$langs->trans("Percentage").''; print ''; - $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 ''.$langs->trans("Status").' / '.$langs->trans("Percentage").''; - $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 ''; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 19aff1699c8..e79edcf8e23 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -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 .= ''."\n"; + // Formulaire de demande - print '
'."\n"; + print ''."\n"; print ''."\n"; print ''."\n"; @@ -1084,11 +1103,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { print dol_get_fiche_end(); - print '
'; - print ''; - print '    '; - print ''; - print '
'; + print $form->buttonsSaveCancel("SendRequestCP"); print ''."\n"; } diff --git a/htdocs/install/mysql/data/llx_const.sql b/htdocs/install/mysql/data/llx_const.sql index ed5449c0bd3..2f2975a158c 100644 --- a/htdocs/install/mysql/data/llx_const.sql +++ b/htdocs/install/mysql/data/llx_const.sql @@ -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); + diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 032504dfa61..d50b6991261 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -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, diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 1d9dd28f9d7..5584ccc40f6 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -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'; diff --git a/htdocs/install/mysql/tables/llx_mrp_mo.sql b/htdocs/install/mysql/tables/llx_mrp_mo.sql index de1933ccfed..185ea1583c9 100644 --- a/htdocs/install/mysql/tables/llx_mrp_mo.sql +++ b/htdocs/install/mysql/tables/llx_mrp_mo.sql @@ -17,8 +17,9 @@ CREATE TABLE llx_mrp_mo( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - ref varchar(128) DEFAULT '(PROV)' NOT NULL, entity integer DEFAULT 1 NOT NULL, + ref varchar(128) DEFAULT '(PROV)' NOT NULL, + mrptype integer DEFAULT 0, -- 0 for a manufacture MO, 1 for a dismantle MO label varchar(255), qty real NOT NULL, fk_warehouse integer, diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index b434612afcd..f9424f51a32 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -234,7 +234,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) { // Insert MAIN_VERSION_FIRST_INSTALL in a dedicated transaction. So if it fails (when first install was already done), we can do other following requests. $db->begin(); dolibarr_install_syslog('step5: set MAIN_VERSION_FIRST_INSTALL const to '.$targetversion, LOG_DEBUG); - $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name, value, type, visible, note, entity) values('".$db->escape($db->encrypt('MAIN_VERSION_FIRST_INSTALL'))."', '".$db->escape($db->encrypt($targetversion))."', 'chaine', 0, 'Dolibarr version when first install', 0)"); + $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name, value, type, visible, note, entity) values(".$db->encrypt('MAIN_VERSION_FIRST_INSTALL').", ".$db->encrypt($targetversion).", 'chaine', 0, 'Dolibarr version when first install', 0)"); if ($resql) { $conf->global->MAIN_VERSION_FIRST_INSTALL = $targetversion; $db->commit(); @@ -250,7 +250,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) { if (!$resql) { dol_print_error($db, 'Error in setup program'); } - $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values('".$db->escape($db->encrypt('MAIN_VERSION_LAST_INSTALL'))."', '".$db->escape($db->encrypt($targetversion))."', 'chaine', 0, 'Dolibarr version when last install', 0)"); + $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_LAST_INSTALL').", ".$db->encrypt($targetversion).", 'chaine', 0, 'Dolibarr version when last install', 0)"); if (!$resql) { dol_print_error($db, 'Error in setup program'); } @@ -262,7 +262,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) { if (!$resql) { dol_print_error($db, 'Error in setup program'); } - $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values('".$db->escape($db->encrypt('MAIN_REMOVE_INSTALL_WARNING'))."', '".$db->escape($db->encrypt(1))."', 'chaine', 1, 'Disable install warnings', 0)"); + $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_REMOVE_INSTALL_WARNING').", ".$db->encrypt(1).", 'chaine', 1, 'Disable install warnings', 0)"); if (!$resql) { dol_print_error($db, 'Error in setup program'); } @@ -330,7 +330,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) { if (!$resql) { dol_print_error($db, 'Error in setup program'); } - $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name, value, type, visible, note, entity) VALUES ('".$db->escape($db->encrypt('MAIN_VERSION_LAST_UPGRADE'))."', '".$db->escape($db->encrypt($targetversion))."', 'chaine', 0, 'Dolibarr version for last upgrade', 0)"); + $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name, value, type, visible, note, entity) VALUES (".$db->encrypt('MAIN_VERSION_LAST_UPGRADE').", ".$db->encrypt($targetversion).", 'chaine', 0, 'Dolibarr version for last upgrade', 0)"); if (!$resql) { dol_print_error($db, 'Error in setup program'); } @@ -346,7 +346,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) { } // May fail if parameter already defined - $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) VALUES ('".$db->escape($db->encrypt('MAIN_LANG_DEFAULT'))."', '".$db->escape($db->encrypt($setuplang))."', 'chaine', 0, 'Default language', 1)"); + $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) VALUES (".$db->encrypt('MAIN_LANG_DEFAULT').", ".$db->encrypt($setuplang).", 'chaine', 0, 'Default language', 1)"); //if (! $resql) dol_print_error($db,'Error in setup program'); $db->close(); diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 559e6f21cf0..8182a962b50 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -400,7 +400,7 @@ class KnowledgeRecord extends CommonObject } } if (count($sqlwhere) > 0) { - $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; + $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')'; } if (!empty($sortfield)) { diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index 68ab9fe98f4..08092696cab 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -120,7 +120,7 @@ if (empty($reshook)) { // Upadate / add for lang if (($action == 'update' || $action == 'add') && !empty($permissiontoadd)) { - $object->lang = GETPOSTISSET('langkm', 'aZ09')?GETPOST('langkm', 'aZ09'):$object->lang; + $object->lang = (GETPOSTISSET('langkm') ? GETPOST('langkm', 'aZ09') : $object->lang); } // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 454df4ed28e..76dd117dbd8 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2163,3 +2163,4 @@ APIsAreNotEnabled=APIs modules are not enabled YouShouldSetThisToOff=You should set this to 0 or off InstallAndUpgradeLockedBy=Install and upgrades are locked by the file %s OldImplementation=Old implementation +PDF_SHOW_LINK_TO_ONLINE_PAYMENT=If some online payment modules are enabled (Paypal, Stripe, ...), add a link on the PDF to make the online payment \ No newline at end of file diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index bab409dd036..cbe238ad2a4 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -169,4 +169,5 @@ TimeType=Duration type ReminderType=Callback type AddReminder=Create an automatic reminder notification for this event ErrorReminderActionCommCreation=Error creating the reminder notification for this event -BrowserPush=Browser Popup Notification \ No newline at end of file +BrowserPush=Browser Popup Notification +ActiveByDefault=Enabled by default diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index a8953bf64a3..8e2940272af 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -100,16 +100,17 @@ EvntOrgCancelled = Cancelled # Public page # SuggestForm = Suggestion page -RegisterPage = Page for conferences or booth +SuggestOrVoteForConfOrBooth = Page for suggestion or vote EvntOrgRegistrationHelpMessage = Here, you can vote for an event, or suggest a new conference or booth for the project EvntOrgRegistrationConfHelpMessage = Here, you can suggest a new conference for the project EvntOrgRegistrationBoothHelpMessage = Here, you can suggest a new booth for the project ListOfSuggestedConferences = List of suggested conferences ListOfSuggestedBooths = List of suggested booths +ListOfConferencesOrBooths=List of conferences or booths SuggestConference = Suggest a new conference SuggestBooth = Suggest a booth ViewAndVote = View and vote for suggested events -PublicAttendeeSubscriptionPage = Public link of registration to a conference +PublicAttendeeSubscriptionPage = Public link for registration to the event MissingOrBadSecureKey = The security key is invalid or missing EvntOrgWelcomeMessage = This form allows you to register as a new participant to the conference : '%s' EvntOrgDuration = This conference starts on %s and ends on %s. diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 1c0dd638eeb..033f86b63aa 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -175,5 +175,5 @@ Answered=Answered IsNotAnAnswer=Is not answer (initial email) IsAnAnswer=Is an answer of an initial email RecordCreatedByEmailCollector=Record created by the Email Collector %s from email %s -DefaultBlacklistMailingStatus=Default contact status for refuse bulk emailing +DefaultBlacklistMailingStatus=Default value for field '%s' when creating a new contact DefaultStatusEmptyMandatory=Empty but mandatory diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 2c4409caa88..5b81bbd69b0 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -7,7 +7,7 @@ Members=Members ShowMember=Show member card UserNotLinkedToMember=User not linked to a member ThirdpartyNotLinkedToMember=Third party not linked to a member -MembersTickets=Members Tickets +MembersTickets=Membership address sheet FundationMembers=Foundation members ListOfValidatedPublicMembers=List of validated public members ErrorThisMemberIsNotPublic=This member is not public @@ -19,8 +19,8 @@ MembersCards=Business cards for members MembersList=List of members MembersListToValid=List of draft members (to be validated) MembersListValid=List of valid members -MembersListUpToDate=List of valid members with up-to-date subscription -MembersListNotUpToDate=List of valid members with out-of-date subscription +MembersListUpToDate=List of valid members with up-to-date contribution +MembersListNotUpToDate=List of valid members with out-of-date contribution MembersListExcluded=List of excluded members MembersListResiliated=List of terminated members MembersListQualified=List of qualified members @@ -28,13 +28,13 @@ MenuMembersToValidate=Draft members MenuMembersValidated=Validated members MenuMembersExcluded=Excluded members MenuMembersResiliated=Terminated members -MembersWithSubscriptionToReceive=Members with subscription to receive -MembersWithSubscriptionToReceiveShort=Subscription to receive -DateSubscription=Subscription date -DateEndSubscription=Subscription end date -EndSubscription=Subscription Ends -SubscriptionId=Subscription id -WithoutSubscription=Without subscription +MembersWithSubscriptionToReceive=Members with contribution to receive +MembersWithSubscriptionToReceiveShort=Contributions to receive +DateSubscription=Date of membership +DateEndSubscription=End date of membership +EndSubscription=End of membership +SubscriptionId=Contribution ID +WithoutSubscription=Without contribution MemberId=Member id NewMember=New member MemberType=Member type @@ -43,9 +43,9 @@ MemberTypeLabel=Member type label MembersTypes=Members types MemberStatusDraft=Draft (needs to be validated) MemberStatusDraftShort=Draft -MemberStatusActive=Validated (waiting subscription) +MemberStatusActive=Validated (waiting contribution) MemberStatusActiveShort=Validated -MemberStatusActiveLate=Subscription expired +MemberStatusActiveLate=Contribution expired MemberStatusActiveLateShort=Expired MemberStatusPaid=Subscription up to date MemberStatusPaidShort=Up to date @@ -56,9 +56,9 @@ MemberStatusResiliatedShort=Terminated MembersStatusToValid=Draft members MembersStatusExcluded=Excluded members MembersStatusResiliated=Terminated members -MemberStatusNoSubscription=Validated (no subscription needed) +MemberStatusNoSubscription=Validated (no contribution required) MemberStatusNoSubscriptionShort=Validated -SubscriptionNotNeeded=No subscription needed +SubscriptionNotNeeded=No contribution required NewCotisation=New contribution PaymentSubscription=New contribution payment SubscriptionEndDate=Subscription's end date @@ -68,19 +68,19 @@ DeleteAMemberType=Delete a member type ConfirmDeleteMemberType=Are you sure you want to delete this member type? MemberTypeDeleted=Member type deleted MemberTypeCanNotBeDeleted=Member type can not be deleted -NewSubscription=New subscription +NewSubscription=New contribution NewSubscriptionDesc=This form allows you to record your subscription as a new member of the foundation. If you want to renew your subscription (if already a member), please contact foundation board instead by email %s. -Subscription=Subscription -Subscriptions=Subscriptions +Subscription=Contribution +Subscriptions=Contributions SubscriptionLate=Late -SubscriptionNotReceived=Subscription never received -ListOfSubscriptions=List of subscriptions +SubscriptionNotReceived=Contribution never received +ListOfSubscriptions=List of contributions SendCardByMail=Send card by email AddMember=Create member NoTypeDefinedGoToSetup=No member types defined. Go to menu "Members types" NewMemberType=New member type WelcomeEMail=Welcome email -SubscriptionRequired=Subscription required +SubscriptionRequired=Contribution required DeleteType=Delete VoteAllowed=Vote allowed Physical=Individual @@ -88,47 +88,48 @@ Moral=Corporation MorAndPhy=Corporation and Individual Reenable=Re-Enable ExcludeMember=Exclude a member +Exclude=Exclude ConfirmExcludeMember=Are you sure you want to exclude this member ? ResiliateMember=Terminate a member ConfirmResiliateMember=Are you sure you want to terminate this member? DeleteMember=Delete a member -ConfirmDeleteMember=Are you sure you want to delete this member (Deleting a member will delete all his subscriptions)? +ConfirmDeleteMember=Are you sure you want to delete this member (Deleting a member will delete all his contributions)? DeleteSubscription=Delete a subscription -ConfirmDeleteSubscription=Are you sure you want to delete this subscription? +ConfirmDeleteSubscription=Are you sure you want to delete this contribution? Filehtpasswd=htpasswd file ValidateMember=Validate a member ConfirmValidateMember=Are you sure you want to validate this member? FollowingLinksArePublic=The following links are open pages not protected by any Dolibarr permission. They are not formatted pages, provided as example to show how to list members database. PublicMemberList=Public member list -BlankSubscriptionForm=Public self-subscription form +BlankSubscriptionForm=Public self-registration form BlankSubscriptionFormDesc=Dolibarr can provide you a public URL/website to allow external visitors to ask to subscribe to the foundation. If an online payment module is enabled, a payment form may also be automatically provided. EnablePublicSubscriptionForm=Enable the public website with self-subscription form ForceMemberType=Force the member type -ExportDataset_member_1=Members and subscriptions +ExportDataset_member_1=Members and contributions ImportDataset_member_1=Members LastMembersModified=Latest %s modified members -LastSubscriptionsModified=Latest %s modified subscriptions +LastSubscriptionsModified=Latest %s modified contributions String=String Text=Text Int=Int DateAndTime=Date and time PublicMemberCard=Member public card -SubscriptionNotRecorded=Subscription not recorded -AddSubscription=Create subscription -ShowSubscription=Show subscription +SubscriptionNotRecorded=Contribution not recorded +AddSubscription=Create contribution +ShowSubscription=Show contribution # Label of email templates SendingAnEMailToMember=Sending information email to member SendingEmailOnAutoSubscription=Sending email on auto registration SendingEmailOnMemberValidation=Sending email on new member validation -SendingEmailOnNewSubscription=Sending email on new subscription -SendingReminderForExpiredSubscription=Sending reminder for expired subscriptions +SendingEmailOnNewSubscription=Sending email on new contribution +SendingReminderForExpiredSubscription=Sending reminder for expired contributions SendingEmailOnCancelation=Sending email on cancelation SendingReminderActionComm=Sending reminder for agenda event # Topic of email templates YourMembershipRequestWasReceived=Your membership was received. YourMembershipWasValidated=Your membership was validated -YourSubscriptionWasRecorded=Your new subscription was recorded -SubscriptionReminderEmail=Subscription reminder +YourSubscriptionWasRecorded=Your new contribution was recorded +SubscriptionReminderEmail=contribution reminder YourMembershipWasCanceled=Your membership was canceled CardContent=Content of your member card # Text of email templates @@ -139,10 +140,10 @@ ThisIsContentOfSubscriptionReminderEmail=We want to let you know that your subsc ThisIsContentOfYourCard=This is a summary of the information we have about you. Please contact us if anything is incorrect.

DescADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT=Subject of the notification email received in case of auto-inscription of a guest DescADHERENT_AUTOREGISTER_NOTIF_MAIL=Content of the notification email received in case of auto-inscription of a guest -DescADHERENT_EMAIL_TEMPLATE_AUTOREGISTER=Email template to use to send email to a member on member autosubscription +DescADHERENT_EMAIL_TEMPLATE_AUTOREGISTER=Email template to use to send email to a member on member auto-registration DescADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION=Email template to use to send email to a member on member validation -DescADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION=Email template to use to send email to a member on new subscription recording -DescADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION=Email template to use to send email reminder when subscription is about to expire +DescADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION=Email template to use to send email to a member on new contribution recording +DescADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION=Email template to use to send email reminder when contribution is about to expire DescADHERENT_EMAIL_TEMPLATE_CANCELATION=Email template to use to send email to a member on member cancelation DescADHERENT_EMAIL_TEMPLATE_EXCLUSION=Email template to use to send email to a member on member exclusion DescADHERENT_MAIL_FROM=Sender Email for automatic emails @@ -155,10 +156,10 @@ DescADHERENT_CARD_TEXT_RIGHT=Text printed on member cards (align on right) DescADHERENT_CARD_FOOTER_TEXT=Text printed on bottom of member cards ShowTypeCard=Show type '%s' HTPasswordExport=htpassword file generation -NoThirdPartyAssociatedToMember=No third party associated to this member -MembersAndSubscriptions= Members and Subscriptions +NoThirdPartyAssociatedToMember=No third party associated with this member +MembersAndSubscriptions=Members and Contributions MoreActions=Complementary action on recording -MoreActionsOnSubscription=Complementary action, suggested by default when recording a subscription +MoreActionsOnSubscription=Complementary action, suggested by default when recording a contribution MoreActionBankDirect=Create a direct entry on bank account MoreActionBankViaInvoice=Create an invoice, and a payment on bank account MoreActionInvoiceOnly=Create an invoice with no payment @@ -167,9 +168,9 @@ LinkToGeneratedPagesDesc=This screen allows you to generate PDF files with busin DocForAllMembersCards=Generate business cards for all members DocForOneMemberCards=Generate business cards for a particular member DocForLabels=Generate address sheets -SubscriptionPayment=Subscription payment -LastSubscriptionDate=Date of latest subscription payment -LastSubscriptionAmount=Amount of latest subscription +SubscriptionPayment=Contribution payment +LastSubscriptionDate=Date of latest contribution payment +LastSubscriptionAmount=Amount of latest contribution LastMemberType=Last Member type MembersStatisticsByCountries=Members statistics by country MembersStatisticsByState=Members statistics by state/province @@ -186,32 +187,34 @@ MembersByRegion=This screen show you statistics of members by region. MembersStatisticsDesc=Choose statistics you want to read... MenuMembersStats=Statistics LastMemberDate=Latest membership date -LatestSubscriptionDate=Latest subscription date +LatestSubscriptionDate=Latest contribution date MemberNature=Nature of the member MembersNature=Nature of the members Public=Information is public NewMemberbyWeb=New member added. Awaiting approval NewMemberForm=New member form -SubscriptionsStatistics=Subscriptions statistics -NbOfSubscriptions=Number of subscriptions -AmountOfSubscriptions=Amount collected from subscriptions +SubscriptionsStatistics=Contributions statistics +NbOfSubscriptions=Number of contributions +AmountOfSubscriptions=Amount collected from contributions TurnoverOrBudget=Turnover (for a company) or Budget (for a foundation) -DefaultAmount=Default amount of subscription -CanEditAmount=Visitor can choose/edit amount of its subscription +DefaultAmount=Default amount of contribution +CanEditAmount=Visitor can choose/edit amount of its contribution MEMBER_NEWFORM_PAYONLINE=Jump on integrated online payment page ByProperties=By nature MembersStatisticsByProperties=Members statistics by nature -VATToUseForSubscriptions=VAT rate to use for subscriptions -NoVatOnSubscription=No VAT for subscriptions -ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS=Product used for subscription line into invoice: %s +VATToUseForSubscriptions=VAT rate to use for contributionss +NoVatOnSubscription=No VAT for contributions +ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS=Product used for contribution line into invoice: %s NameOrCompany=Name or company SubscriptionRecorded=Subscription recorded NoEmailSentToMember=No email sent to member EmailSentToMember=Email sent to member at %s -SendReminderForExpiredSubscriptionTitle=Send reminder by email for expired subscription -SendReminderForExpiredSubscription=Send reminder by email to members when subscription is about to expire (parameter is number of days before end of subscription to send the remind. It can be a list of days separated by a semicolon, for example '10;5;0;-5') +SendReminderForExpiredSubscriptionTitle=Send reminder by email for expired contributions +SendReminderForExpiredSubscription=Send reminder by email to members when contribution is about to expire (parameter is number of days before end of membership to send the remind. It can be a list of days separated by a semicolon, for example '10;5;0;-5') MembershipPaid=Membership paid for current period (until %s) YouMayFindYourInvoiceInThisEmail=You may find your invoice attached to this email XMembersClosed=%s member(s) closed XExternalUserCreated=%s external user(s) created ForceMemberNature=Force member nature (Individual or Corporation) +CreateDolibarrLoginDesc=The creation of a user login for members allows them to connect to the application. Depending on the authorizations granted, they will be able, for example, to consult or modify their file themselves. +CreateDolibarrThirdPartyDesc=A thirdparty is the legal entity that will be used on the invoice if you decide to generate invoice for each contribution. You will be able to create it later during the process of recording the contribution. diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 2414a92cefb..0b779d55fbd 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -9,6 +9,7 @@ LatestBOMModified=Latest %s Bills of materials modified LatestMOModified=Latest %s Manufacturing Orders modified Bom=Bills of Material BillOfMaterials=Bill of Materials +BillOfMaterialsLines=Bill of Materials lines BOMsSetup=Setup of module BOM ListOfBOMs=List of bills of material - BOM ListOfManufacturingOrders=List of Manufacturing Orders @@ -55,6 +56,7 @@ WarehouseForProduction=Warehouse for production CreateMO=Create MO ToConsume=To consume ToProduce=To produce +ToObtain=To obtain QtyAlreadyConsumed=Qty already consumed QtyAlreadyProduced=Qty already produced QtyRequiredIfNoLoss=Qty required if there is no loss (Manufacturing efficiency is 100%%) @@ -101,3 +103,4 @@ HumanMachine=Human / Machine WorkstationArea=Workstation area Machines=Machines THMEstimatedHelp=This rate makes it possible to define a forecast cost of the item +MOAndLines=Manufacturing Orders and lines \ No newline at end of file diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index e6a84ad9736..6709a1de200 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -274,6 +274,7 @@ NewInter=New intervention OneLinePerTask=One line per task OneLinePerPeriod=One line per period OneLinePerTimeSpentLine=One line for each time spent declaration +AddDetailDateAndDuration=With date and duration into line description RefTaskParent=Ref. Parent Task ProfitIsCalculatedWith=Profit is calculated using AddPersonToTask=Add also to tasks diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 78b095d9f11..638221460a6 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -12,7 +12,7 @@ AddWarehouse=Create warehouse AddOne=Add one DefaultWarehouse=Default warehouse WarehouseTarget=Target warehouse -ValidateSending=Delete sending +ValidateSending=Confirm sending CancelSending=Cancel sending DeleteSending=Delete sending Stock=Stock @@ -261,3 +261,5 @@ ProductDoesNotExist=Product does not exist ErrorSameBatchNumber=Same batch number found in inventory list ProductBatchDoesNotExist=Product with batch/serial does not exist ProductBarcodeDoesNotExist=Product with barcode does not exist +WarehouseId=Warehouse ID +WarehouseRef=Warehouse Ref \ No newline at end of file diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 841ee0f3daf..888c9f52161 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -62,8 +62,8 @@ ListOfUsersInGroup=List of users in this group ListOfGroupsForUser=List of groups for this user LinkToCompanyContact=Link to third party / contact LinkedToDolibarrMember=Link to member -LinkedToDolibarrUser=Link to Dolibarr user -LinkedToDolibarrThirdParty=Link to Dolibarr third party +LinkedToDolibarrUser=Link to user +LinkedToDolibarrThirdParty=Link to third party CreateDolibarrLogin=Create a user CreateDolibarrThirdParty=Create a third party LoginAccountDisableInDolibarr=Account disabled in Dolibarr. diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang index 977681356d5..33faad30cdf 100644 --- a/htdocs/langs/fr_FR/agenda.lang +++ b/htdocs/langs/fr_FR/agenda.lang @@ -170,3 +170,4 @@ ReminderType=Type de rappel AddReminder=Créer une notification de rappel automatique pour cet événement ErrorReminderActionCommCreation=Erreur lors de la création de la notification de rappel pour cet événement BrowserPush=Notification par Popup navigateur +ActiveByDefault=Activation par défaut diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php index ed17db03db6..a59a7247338 100644 --- a/htdocs/mrp/class/api_mos.class.php +++ b/htdocs/mrp/class/api_mos.class.php @@ -370,12 +370,12 @@ class Mos extends DolibarrApi $qtytoprocess = $value["qty"]; if (isset($value["fk_warehouse"])) { // If there is a warehouse to set if (!($value["fk_warehouse"] > 0)) { // If there is no warehouse set. - throw new RestException(500, "Field fk_warehouse must be > 0 in ".$arrayname); $error++; + throw new RestException(500, "Field fk_warehouse must be > 0 in ".$arrayname); } if ($tmpproduct->status_batch) { - throw new RestException(500, "Product ".$tmpproduct->ref."must be in batch"); $error++; + throw new RestException(500, "Product ".$tmpproduct->ref."must be in batch"); } } $idstockmove = 0; diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index c88f0f44b48..fcf54eb364e 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -101,6 +101,7 @@ class Mo extends CommonObject 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'position'=>5, 'notnull'=>1, 'default'=>'1', 'index'=>1), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>'1', 'noteditable'=>1), 'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM", 'css'=>'minwidth100 maxwidth300', 'csslist'=>'nowraponall'), + 'mrptype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>34, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150 center'), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:0', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce", 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax100', 'picto'=>'product'), 'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce", 'css'=>'width75', 'default'=>1, 'isameasure'=>1), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'2', 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200'), @@ -121,8 +122,9 @@ class Mo extends CommonObject 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '2'=>'InProgress', '3'=>'StatusMOProduced', '9'=>'Canceled')), ); public $rowid; - public $ref; public $entity; + public $ref; + public $mrptype; public $label; public $qty; public $fk_warehouse; @@ -253,7 +255,7 @@ class Mo extends CommonObject $this->db->begin(); // Check that product is not a kit/virtual product - if (empty($conf->global->ALLOW_USE_KITS_INTO_BOM_AND_MO) and $this->fk_product > 0) { + if (empty($conf->global->ALLOW_USE_KITS_INTO_BOM_AND_MO) && $this->fk_product > 0) { include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $tmpproduct = new Product($this->db); $tmpproduct->fetch($this->fk_product); @@ -265,6 +267,14 @@ class Mo extends CommonObject } } + if ($this->fk_bom > 0) { + // If there is a nown BOM, we force the type of MO to the type of BOM + $tmpbom = new BOM($this->db); + $tmpbom->fetch($this->fk_bom); + + $this->mrptype = $tmpbom->bomtype; + } + if (!$error) { $idcreated = $this->createCommon($user, $notrigger); if ($idcreated <= 0) { @@ -273,7 +283,7 @@ class Mo extends CommonObject } if (!$error) { - $result = $this->updateProduction($user, $notrigger); + $result = $this->updateProduction($user, $notrigger); // Insert lines from BOM if ($result <= 0) { $error++; } @@ -448,7 +458,7 @@ class Mo extends CommonObject } } if (count($sqlwhere) > 0) { - $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; + $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')'; } if (!empty($sortfield)) { @@ -638,7 +648,7 @@ class Mo extends CommonObject $moline->fk_product = $this->fk_product; $moline->position = 1; - if ($this->fk_bom > 0) { // If a BOM is defined, we know what to consume. + if ($this->fk_bom > 0) { // If a BOM is defined, we know what to produce. include_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; $bom = new Bom($this->db); $bom->fetch($this->fk_bom); @@ -1557,7 +1567,7 @@ class MoLine extends CommonObjectLine } } if (count($sqlwhere) > 0) { - $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; + $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')'; } if (!empty($sortfield)) { diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 6eaf42ed833..fc8cab806c7 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -49,6 +49,7 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // Initialize technical objects $object = new Mo($db); $objectbom = new BOM($db); + $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->mrp->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('mocard', 'globalcard')); // Note that conf->hooks_modules contains array @@ -74,13 +75,14 @@ if (empty($action) && empty($id) && empty($ref)) { // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. -if (GETPOST('fk_bom', 'int')) { +if (GETPOST('fk_bom', 'int') > 0) { $objectbom->fetch(GETPOST('fk_bom', 'int')); if ($action != 'add') { // We force calling parameters if we are not in the submit of creation of MO $_POST['fk_product'] = $objectbom->fk_product; $_POST['qty'] = $objectbom->qty; + $_POST['mrptype'] = $objectbom->bomtype; $_POST['fk_warehouse'] = $objectbom->fk_warehouse; $_POST['note_private'] = $objectbom->note_private; } @@ -205,6 +207,13 @@ llxHeader('', $title, ''); // Part to create if ($action == 'create') { + if (GETPOST('fk_bom', 'int') > 0) { + $titlelist = $langs->trans("ToConsume"); + if ($objectbom->bomtype == 1) { + $titlelist = $langs->trans("ToObtain"); + } + } + print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Mo")), '', 'mrp'); print ''; @@ -245,7 +254,10 @@ if ($action == 'create') { console.log(data); if (typeof data.rowid != "undefined") { console.log("New BOM loaded, we set values in form"); + console.log(data); $('#qty').val(data.qty); + $("#mrptype").val(data.bomtype); // We set bomtype into mrptype + $('#mrptype').trigger('change'); // Notify any JS components that the value changed $("#fk_product").val(data.fk_product); $('#fk_product').trigger('change'); // Notify any JS components that the value changed $('#note_private').val(data.description); @@ -268,7 +280,7 @@ if ($action == 'create') { else if (jQuery('#fk_bom').val() < 0) { // Redirect to page with all fields defined except fk_bom set console.log(jQuery('#fk_product').val()); - window.location.href = '?action=create&qty='+jQuery('#qty').val()+'&fk_product='+jQuery('#fk_product').val()+'&label='+jQuery('#label').val()+'&fk_project='+jQuery('#fk_project').val()+'&fk_warehouse='+jQuery('#fk_warehouse').val(); + window.location.href = '?action=create&qty='+jQuery('#qty').val()+'&mrptype='+jQuery('#mrptype').val()+'&fk_product='+jQuery('#fk_product').val()+'&label='+jQuery('#label').val()+'&fk_project='+jQuery('#fk_project').val()+'&fk_warehouse='+jQuery('#fk_warehouse').val(); /* $('#qty').val(''); $("#fk_product").val(''); @@ -288,13 +300,14 @@ if ($action == 'create') { print $form->buttonsSaveCancel("Create"); - if (GETPOST('fk_bom', 'int') > 0) { - print load_fiche_titre($langs->trans("ToConsume")); + if ($objectbom->id > 0) { + print load_fiche_titre($titlelist); print '
'; print ''; $object->lines = $objectbom->lines; + $object->mrptype = $objectbom->bomtype; $object->bom = $objectbom; $object->printOriginLinesList('', array()); diff --git a/htdocs/partnership/admin/setup.php b/htdocs/partnership/admin/setup.php index 25567b137db..100dc7027a3 100644 --- a/htdocs/partnership/admin/setup.php +++ b/htdocs/partnership/admin/setup.php @@ -65,8 +65,10 @@ if ($action == 'setting') { $error += $partnership->delete_menus(); $error += $partnership->insert_menus(); - if (GETPOST("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL", 'int')) + if (GETPOSTISSET("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL")) { dolibarr_set_const($db, "PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL", GETPOST("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL", 'int'), 'chaine', 0, '', $conf->entity); + } + dolibarr_set_const($db, "PARTNERSHIP_BACKLINKS_TO_CHECK", GETPOST("PARTNERSHIP_BACKLINKS_TO_CHECK"), 'chaine', 0, '', $conf->entity); } @@ -131,16 +133,16 @@ print ''; -if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') { - print ''; - print ''; - print ''; - print ''; -} +//if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') { +print ''; +print ''; +print ''; +print ''; +//} print '
'.$langs->trans("partnershipforthirdparty print '
'.$langs->trans("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL").''; - $dnbdays = '15'; - $backlinks = (!empty($conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL)) ? $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL : $dnbdays; - print ''; - print ''.$dnbdays.'
'.$langs->trans("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL").''; +$dnbdays = '30'; +$backlinks = (!empty($conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL)) ? $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL : $dnbdays; +print ''; +print ''.$dnbdays.'
'; print '
'; diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 121b53007df..82a5ee65171 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -496,7 +496,7 @@ class Partnership extends CommonObject } } if (count($sqlwhere) > 0) { - $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; + $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')'; } if (!empty($sortfield)) { diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 44c7fd9ca51..a8f7c5d4a7a 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -201,6 +201,29 @@ if ($reshook < 0) { } if (empty($reshook)) { + $backurlforlist = DOL_URL_ROOT.'/product/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.'/product/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 = ''; + } + // Type if ($action == 'setfk_product_type' && $usercancreate) { $result = $object->setValueFrom('fk_product_type', GETPOST('fk_product_type'), '', null, 'text', '', $user, 'PRODUCT_MODIFY'); @@ -1213,7 +1236,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Description (used in invoice, propal...) print ''.$langs->trans("Description").''; - $doleditor = new DolEditor('desc', GETPOST('desc', 'restricthtml'), '', 160, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_4, '90%'); + $doleditor = new DolEditor('desc', GETPOST('desc', 'restricthtml'), '', 160, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_4, '90%'); $doleditor->Create(); print ""; @@ -1268,8 +1291,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { // Nature print ''.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).''; - $statutarray = array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); - print $form->selectarray('finished', $statutarray, GETPOST('finished', 'alpha'), 1); + print $formproduct->selectProductNature('finished', $object->finished); print ''; } } @@ -1373,13 +1395,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("NoteNotVisibleOnBill").''; // We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF. - $doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 140, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_8, '90%'); + $doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 140, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_8, '90%'); $doleditor->Create(); print ""; //} - if ($conf->categorie->enabled) { + if (!empty($conf->categorie->enabled)) { // Categories print ''.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 2e0d21b0456..9804daf1bba 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -269,15 +269,15 @@ class Products extends DolibarrApi $total = $this->db->fetch_object($totalsResult)->total; $tmp = $obj_ret; - $obj_ret = []; + $obj_ret = array(); $obj_ret['data'] = $tmp; - $obj_ret['pagination'] = [ + $obj_ret['pagination'] = array( 'total' => (int) $total, 'page' => $page, //count starts from 0 'page_count' => ceil((int) $total/$limit), 'limit' => $limit - ]; + ); } return $obj_ret; @@ -462,8 +462,8 @@ class Products extends DolibarrApi $childsArbo = $this->product->getChildsArbo($id, 1); - $keys = ['rowid', 'qty', 'fk_product_type', 'label', 'incdec']; - $childs = []; + $keys = array('rowid', 'qty', 'fk_product_type', 'label', 'incdec'); + $childs = array(); foreach ($childsArbo as $values) { $childs[] = array_combine($keys, $values); } @@ -1023,7 +1023,7 @@ class Products extends DolibarrApi throw new RestException(503, 'Error when retrieve product attribute list : '.$this->db->lasterror()); } - $return = []; + $return = array(); while ($result = $this->db->fetch_object($query)) { $tmp = new ProductAttribute($this->db); $tmp->id = $result->rowid; @@ -1113,7 +1113,7 @@ class Products extends DolibarrApi $result = $this->db->fetch_object($query); - $attr = []; + $attr = array(); $attr['id'] = $result->rowid; $attr['ref'] = $result->ref; $attr['ref_ext'] = $result->ref_ext; @@ -1160,7 +1160,7 @@ class Products extends DolibarrApi $result = $this->db->fetch_object($query); - $attr = []; + $attr = array(); $attr['id'] = $result->rowid; $attr['ref'] = $result->ref; $attr['ref_ext'] = $result->ref_ext; @@ -1317,7 +1317,7 @@ class Products extends DolibarrApi $result = $this->db->fetch_object($query); - $attrval = []; + $attrval = array(); $attrval['id'] = $result->rowid; $attrval['fk_product_attribute'] = $result->fk_product_attribute; $attrval['ref'] = $result->ref; @@ -1361,7 +1361,7 @@ class Products extends DolibarrApi $result = $this->db->fetch_object($query); - $attrval = []; + $attrval = array(); $attrval['id'] = $result->rowid; $attrval['fk_product_attribute'] = $result->fk_product_attribute; $attrval['ref'] = $result->ref; @@ -2025,8 +2025,8 @@ class Products extends DolibarrApi if ($includesubproducts) { $childsArbo = $this->product->getChildsArbo($id, 1); - $keys = ['rowid', 'qty', 'fk_product_type', 'label', 'incdec']; - $childs = []; + $keys = array('rowid', 'qty', 'fk_product_type', 'label', 'incdec'); + $childs = array(); foreach ($childsArbo as $values) { $childs[] = array_combine($keys, $values); } diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php index 7597b32f21a..550b0e5db36 100644 --- a/htdocs/product/class/productfournisseurprice.class.php +++ b/htdocs/product/class/productfournisseurprice.class.php @@ -339,7 +339,7 @@ class ProductFournisseurPrice extends CommonObject } } if (count($sqlwhere) > 0) { - $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; + $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')'; } if (!empty($sortfield)) { diff --git a/htdocs/product/index.php b/htdocs/product/index.php index f08ddd217ab..e3be4b91415 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -34,10 +34,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; $type = GETPOST("type", 'int'); -if ($type == '' && !$user->rights->produit->lire) { +if ($type == '' && empty($user->rights->produit->lire)) { $type = '1'; // Force global page on service page only } -if ($type == '' && !$user->rights->service->lire) { +if ($type == '' && empty($user->rights->service->lire)) { $type = '0'; // Force global page on product page only } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 4d208133759..aaf9903aa85 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -950,7 +950,7 @@ if ($resql) { } // Multiprice - if ($conf->global->PRODUIT_MULTIPRICES) { + if (!empty($conf->global->PRODUIT_MULTIPRICES)) { foreach ($arraypricelevel as $key => $value) { if (!empty($arrayfields['p.sellprice'.$key]['checked'])) { print ''; @@ -1156,7 +1156,7 @@ if ($resql) { } // Multiprices - if ($conf->global->PRODUIT_MULTIPRICES) { + if (!empty($conf->global->PRODUIT_MULTIPRICES)) { foreach ($arraypricelevel as $key => $value) { if (!empty($arrayfields['p.sellprice'.$key]['checked'])) { print_liste_field_titre($arrayfields['p.sellprice'.$key]['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 7defecb7c62..2ffaf43ea90 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -51,6 +51,7 @@ $confirm = GETPOST('confirm'); $projectid = GETPOST('projectid', 'int'); $id = GETPOST('id', 'int'); +$socid = GETPOST('socid', 'int'); $ref = GETPOST('ref', 'alpha'); $sortfield = GETPOST("sortfield", 'alpha'); @@ -288,7 +289,7 @@ if ($action == 'create') { $langs->load('projects'); print ''.$langs->trans('Project').''; print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); - print ' id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'">'; + print ' '; print ''; } @@ -296,7 +297,7 @@ if ($action == 'create') { print ''.$langs->trans("Description").''; // Editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('desc', (!empty($object->description) ? $object->description : ''), '', 180, 'dolibarr_notes', 'In', false, true, $conf->fckeditor->enabled, ROWS_5, '90%'); + $doleditor = new DolEditor('desc', (!empty($object->description) ? $object->description : ''), '', 180, 'dolibarr_notes', 'In', false, true, empty($conf->fckeditor->enabled) ? '' : $conf->fckeditor->enabled, ROWS_5, '90%'); $doleditor->Create(); print ''; @@ -347,7 +348,7 @@ if ($action == 'create') { // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; - if ($conf->categorie->enabled) { + if (!empty($conf->categorie->enabled)) { // Categories print ''.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_WAREHOUSE, '', 'parent', 64, 0, 1); diff --git a/htdocs/product/stock/class/productstockentrepot.class.php b/htdocs/product/stock/class/productstockentrepot.class.php index 0a9636c0290..9b32fe1fe5e 100644 --- a/htdocs/product/stock/class/productstockentrepot.class.php +++ b/htdocs/product/stock/class/productstockentrepot.class.php @@ -277,7 +277,7 @@ class ProductStockEntrepot extends CommonObject } } if (count($sqlwhere) > 0) { - $sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere); + $sql .= ' AND '.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere); } if (!empty($fk_product) && $fk_product > 0) { diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 4299028d621..12b6d8f32df 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -103,6 +103,8 @@ if ($reshook < 0) { } if (empty($reshook)) { + $backurlforlist = DOL_URL_ROOT.'/projet/list.php'; + // Cancel if ($cancel) { if (GETPOST("comefromclone") == 1) { @@ -115,11 +117,26 @@ if (empty($reshook)) { setEventMessages($langs->trans("CantRemoveProject", $langs->transnoentitiesnoconv("ProjectOverview")), null, 'errors'); } } - if ($backtopage) { + } + + 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.'/projet/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 = ''; } @@ -451,9 +468,9 @@ $formfile = new FormFile($db); $formproject = new FormProjets($db); $userstatic = new User($db); -$title = $langs->trans("Project").' - '.$object->ref.($object->thirdparty->name ? ' - '.$object->thirdparty->name : '').($object->title ? ' - '.$object->title : ''); +$title = $langs->trans("Project").' - '.$object->ref.(!empty($object->thirdparty->name) ? ' - '.$object->thirdparty->name : '').(!empty($object->title) ? ' - '.$object->title : ''); if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE)) { - $title = $object->ref.($object->thirdparty->name ? ' - '.$object->thirdparty->name : '').($object->title ? ' - '.$object->title : ''); + $title = $object->ref.(!empty($object->thirdparty->name) ? ' - '.$object->thirdparty->name : '').(!empty($object->title) ? ' - '.$object->title : ''); } $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE:Modul_Projekte"; @@ -461,7 +478,7 @@ llxHeader("", $title, $help_url); $titleboth = $langs->trans("LeadsOrProjects"); $titlenew = $langs->trans("NewLeadOrProject"); // Leads and opportunities by default -if ($conf->global->PROJECT_USE_OPPORTUNITIES == 0) { +if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { $titleboth = $langs->trans("Projects"); $titlenew = $langs->trans("NewProject"); } @@ -564,9 +581,9 @@ if ($action == 'create' && $user->rights->projet->creer) { print '
'; } if (!empty($conf->eventorganization->enabled)) { - print ' '; + print ' '; $htmltext = $langs->trans("EventOrganizationDescriptionLong"); - print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext); + print ''; } print ''; print ''; @@ -665,11 +682,11 @@ if ($action == 'create' && $user->rights->projet->creer) { // Description print ''.$langs->trans("Description").''; print ''; - $doleditor = new DolEditor('description', GETPOST("description", 'restricthtml'), '', 90, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_3, '90%'); + $doleditor = new DolEditor('description', GETPOST("description", 'restricthtml'), '', 90, 'dolibarr_notes', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_SOCIETE'), ROWS_3, '90%'); $doleditor->Create(); print ''; - if ($conf->categorie->enabled) { + if (!empty($conf->categorie->enabled)) { // Categories print ''.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT, '', 'parent', 64, 0, 1); @@ -821,7 +838,7 @@ if ($action == 'create' && $user->rights->projet->creer) { if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print ''; print ''."\n"; + print ''; print ''; print ''; diff --git a/htdocs/public/cron/cron_run_jobs_by_url.php b/htdocs/public/cron/cron_run_jobs_by_url.php index 133c5d1b18a..9369a9d78a7 100644 --- a/htdocs/public/cron/cron_run_jobs_by_url.php +++ b/htdocs/public/cron/cron_run_jobs_by_url.php @@ -67,6 +67,10 @@ global $langs, $conf; // Language Management $langs->loadLangs(array("admin", "cron", "dict")); +// Security check +if (empty($conf->cron->enabled)) { + accessforbidden('', 0, 0, 1); +} diff --git a/htdocs/public/cron/index.html b/htdocs/public/cron/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/public/cron/index.php b/htdocs/public/cron/index.php new file mode 100644 index 00000000000..a62d2d1ba68 --- /dev/null +++ b/htdocs/public/cron/index.php @@ -0,0 +1,27 @@ + + * + * 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 . + */ + +/** + * \file htdocs/public/cron/index.php + * \ingroup core + * \brief A redirect page to an error + */ + +require '../../master.inc.php'; + +header("Location: ".DOL_URL_ROOT.'/public/error-404.php'); +exit; diff --git a/htdocs/public/eventorganization/attendee_subscription.php b/htdocs/public/eventorganization/attendee_subscription.php index afdfdb9f806..0387843cf94 100644 --- a/htdocs/public/eventorganization/attendee_subscription.php +++ b/htdocs/public/eventorganization/attendee_subscription.php @@ -16,9 +16,9 @@ */ /** - * \file htdocs/public/members/new.php - * \ingroup member - * \brief Example of form to add a new member + * \file htdocs/public/eventorganization/attendee_subscription.php + * \ingroup project + * \brief Example of form to subscribe to an event * * Note that you can add following constant to change behaviour of page * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form @@ -79,12 +79,13 @@ $email = GETPOST("email"); $societe = GETPOST("societe"); // Getting id from Post and decoding it -$id = GETPOST('id'); +$id = GETPOST('id', 'int'); $conference = new ConferenceOrBooth($db); $resultconf = $conference->fetch($id); if ($resultconf < 0) { - setEventMessages(null, $conference->errors, "errors"); + print 'Bad value for parameter id'; + exit; } $project = new Project($db); @@ -196,7 +197,7 @@ function llxFooterVierge() /* * Actions */ -global $mysoc; + $parameters = array(); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); @@ -205,7 +206,7 @@ if ($reshook < 0) { } // Action called when page is submitted -if (empty($reshook) && $action == 'add' && $conference->status==2) { +if (empty($reshook) && $action == 'add' && $conference->status == 2) { $error = 0; $urlback = ''; @@ -460,7 +461,7 @@ $formcompany = new FormCompany($db); llxHeaderVierge($langs->trans("NewSubscription")); - +print '
'; print load_fiche_titre($langs->trans("NewSubscription"), '', '', 0, 0, 'center'); @@ -473,6 +474,9 @@ print $langs->trans("EvntOrgWelcomeMessage", $conference->label); print '
'; print $langs->trans("EvntOrgDuration", dol_print_date($conference->datep), dol_print_date($conference->datef)); print ''; + +print '
'; + dol_htmloutput_errors($errmsg); if ($conference->status!=2) { diff --git a/htdocs/public/index.php b/htdocs/public/index.php index a9de01f35ca..6e80d99430f 100644 --- a/htdocs/public/index.php +++ b/htdocs/public/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2009-2021 Laurent Destailleur * * 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 @@ -18,7 +18,7 @@ /** * \file htdocs/public/index.php * \ingroup core - * \brief A redirect page to an error + * \brief A redirect page to an error page */ require '../master.inc.php'; diff --git a/htdocs/public/notice.php b/htdocs/public/notice.php index c41bf81bea4..d5ac4070ff0 100644 --- a/htdocs/public/notice.php +++ b/htdocs/public/notice.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2016-2021 Laurent Destailleur * * 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 @@ -17,10 +17,10 @@ /** * \file htdocs/public/notice.php - * \brief Dolibarr page to show a notice. - * Default notice is a message to say network connection is off or show another message. - * You can also call this page with URL: - * /public/notice.php?lang=xx_XX&transkey=translation_key (key must be inside file main.lang, error.lang or other.lang) + * \brief Dolibarr public page to show a notice. + * Default notice is a message to say network connection is off. Some parameters can be used to show another message. + * You can call this page with URL: + * /public/notice.php?lang=xx_XX&transkey=translation_key (key must be inside file main.lang, error.lang or other.lang) * /public/notice.php?transphrase=url_encoded_sentence_to_show */ diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 70e546cdbd9..bb0f9005057 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -195,8 +195,8 @@ if (!empty($conf->global->PROJECT_IMAGE_PUBLIC_ORGANIZEDEVENT)) { print ''."\n"; $text = ''."\n"; -$text .= ''."\n"; -$text .= ''."\n";; +$text .= ''."\n"; +$text .= ''."\n"; print $text; diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index c695ea9cec1..4598859b7b6 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -542,7 +542,7 @@ print '
'; // Welcome message $text = '

'; $text .= ''."\n"; -$text .= ''."\n";; +$text .= ''."\n"; print $text; print ''; diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 399969bc80d..dc79346b427 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -473,7 +473,7 @@ print '
'; // Welcome message $text = '

'; $text .= ''."\n"; -$text .= ''."\n";; +$text .= ''."\n"; print $text; print ''; diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index e78176a5f56..017dda834c6 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -271,7 +271,7 @@ if (!empty($conf->global->PROJECT_IMAGE_PUBLIC_SUGGEST_BOOTH)) { print '

'.$langs->trans("EvntOrgRegistrationWelcomeMessage").'
'.$langs->trans("EvntOrgRegistrationHelpMessage").' '.$id.'.

'.$project->note_public.'

'.$langs->trans("EvntOrgRegistrationHelpMessage").' '.$project->title.'.

'.$project->note_public.'

'.$langs->trans("EvntOrgRegistrationBoothWelcomeMessage").'
'.$langs->trans("EvntOrgRegistrationBoothHelpMessage").' '.$id.'.

'.$project->note_public.'
'.$project->note_public.'
'.$langs->trans("EvntOrgRegistrationConfWelcomeMessage").'
'.$langs->trans("EvntOrgRegistrationConfHelpMessage").' '.$id.'.

'.$project->note_public.'
'.$project->note_public.'
'."\n"; $text = ''."\n"; $text .= ''."\n"; -$text .= ''."\n";; +$text .= ''."\n"; print $text; print '

'.$langs->trans("EvntOrgRegistrationWelcomeMessage").'
'.$langs->trans("EvntOrgVoteHelpMessage").' : "'.$project->title.'".

'.$project->note_public.'
'.$project->note_public.'
'."\n"; diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index b911e7480d3..e621feb6653 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -75,6 +75,10 @@ $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($object->table_element); +if (empty($conf->ticket->enabled)) { + accessforbidden('', 0, 0, 1); +} + /* * Actions @@ -89,7 +93,7 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } // Add file in email form -if (empty($reshook) && GETPOST('addfile', 'alpha') && !GETPOST('add', 'alpha')) { +if (empty($reshook) && GETPOST('addfile', 'alpha') && !GETPOST('save', 'alpha')) { ////$res = $object->fetch('','',GETPOST('track_id')); ////if($res > 0) ////{ @@ -108,7 +112,7 @@ if (empty($reshook) && GETPOST('addfile', 'alpha') && !GETPOST('add', 'alpha')) } // Remove file -if (empty($reshook) && GETPOST('removedfile', 'alpha') && !GETPOST('add', 'alpha')) { +if (empty($reshook) && GETPOST('removedfile', 'alpha') && !GETPOST('save', 'alpha')) { include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; // Set tmp directory @@ -120,7 +124,7 @@ if (empty($reshook) && GETPOST('removedfile', 'alpha') && !GETPOST('add', 'alpha $action = 'create_ticket'; } -if (empty($reshook) && $action == 'create_ticket' && GETPOST('add', 'alpha')) { +if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) { $error = 0; $origin_email = GETPOST('email', 'alpha'); if (empty($origin_email)) { diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php index 31ee838f6f5..6abeb5f8b12 100644 --- a/htdocs/public/ticket/index.php +++ b/htdocs/public/ticket/index.php @@ -61,6 +61,10 @@ $langs->loadLangs(array('companies', 'other', 'ticket', 'errors')); $track_id = GETPOST('track_id', 'alpha'); $action = GETPOST('action', 'aZ09'); +if (empty($conf->ticket->enabled)) { + accessforbidden('', 0, 0, 1); +} + /* * View diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 3df9d33eb4a..db5f5d8d754 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -70,6 +70,9 @@ if (isset($_SESSION['email_customer'])) { $object = new Ticket($db); +if (empty($conf->ticket->enabled)) { + accessforbidden('', 0, 0, 1); +} diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 1270ad6c0fa..b914ed0631e 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -68,6 +68,10 @@ if (isset($_SESSION['email_customer'])) { $object = new ActionsTicket($db); +if (empty($conf->ticket->enabled)) { + accessforbidden('', 0, 0, 1); +} + /* * Actions diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index e0008d1a694..37635d27048 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -388,7 +388,7 @@ class RecruitmentCandidature extends CommonObject } } if (count($sqlwhere) > 0) { - $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; + $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')'; } if (!empty($sortfield)) { diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 94ce1f8683d..cbfd11fd431 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -397,7 +397,7 @@ class RecruitmentJobPosition extends CommonObject } } if (count($sqlwhere) > 0) { - $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; + $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')'; } if (!empty($sortfield)) { diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 8e8ab5c2d1f..ac134bd88b6 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -418,12 +418,12 @@ if (empty($reshook)) { $error++; } - if (!empty($conf->mailing->enabled) && !empty($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1 && GETPOST('contact_no_email', 'int')==-1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) { + if (!empty($conf->mailing->enabled) && !empty($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && GETPOST('contact_no_email', 'int')==-1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")), null, 'errors'); } - if (!empty($conf->mailing->enabled) && GETPOST("private", 'int') == 1 && !empty($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1 && GETPOST('contact_no_email', 'int')==-1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) { + if (!empty($conf->mailing->enabled) && GETPOST("private", 'int') == 1 && !empty($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && GETPOST('contact_no_email', 'int')==-1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")), null, 'errors'); } @@ -1206,7 +1206,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { document.formsoc.action.value="create"; document.formsoc.submit(); });'; - if ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1) { + if ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2) { print ' function init_check_no_email(input) { if (input.val()!="") { diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index fff3aa11592..ca4793c2c60 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -485,7 +485,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N $sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s.parent = s2.rowid"; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { +if (!empty($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 (s.rowid = ef.fk_object)"; } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; @@ -1508,10 +1508,10 @@ while ($i < min($num, $limit)) { // Type ent if (!empty($arrayfields['typent.code']['checked'])) { print ''; - if (!is_array($typenArray) || count($typenArray) == 0) { + if (!isset($typenArray) || !is_array($typenArray) || count($typenArray) == 0) { $typenArray = $formcompany->typent_array(1); } - print $typenArray[$obj->typent_code]; + print empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code]; print ''; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/societe/partnership.php b/htdocs/societe/partnership.php index b1f0f24fbe1..295fe8b2075 100644 --- a/htdocs/societe/partnership.php +++ b/htdocs/societe/partnership.php @@ -245,7 +245,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $socid = $object->id; - // TODO Replace this card with the list of all partnerships. + // TODO Replace this card with a table of list of all partnerships. $object = new Partnership($db); $partnershipid = $object->fetch(0, '', 0, $socid); @@ -257,10 +257,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''."\n"; // Common attributes - //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field - //unset($object->fields['fk_project']); // Hide field already shown in banner - //unset($object->fields['fk_member']); // Hide field already shown in banner + unset($object->fields['fk_soc']); // Hide field already shown in banner include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + $forcefieldid = 'socid'; + $forceobjectid = $object->fk_soc; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print '
'; print ''; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 8b2b473d2a1..52805d96c42 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -60,6 +60,7 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel'); $origin = GETPOST('origin', 'alpha'); $originid = GETPOST('originid', 'int'); $confirm = GETPOST('confirm', 'alpha'); @@ -132,8 +133,23 @@ if ($reshook < 0) { } if (empty($reshook)) { + $backurlforlist = DOL_URL_ROOT.'/supplier_proposal/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.'/supplier_proposal/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; } @@ -1804,7 +1820,7 @@ if ($action == 'create') { $form_close .= $object->note_private; $form_close .= ''; $form_close .= ''; - $form_close .= $form->buttonsSaveCancel();; + $form_close .= $form->buttonsSaveCancel(); $form_close .= ' '; $form_close .= ''; diff --git a/htdocs/takepos/css/phone.css b/htdocs/takepos/css/phone.css index bdfdf45e116..2b0cf62797f 100644 --- a/htdocs/takepos/css/phone.css +++ b/htdocs/takepos/css/phone.css @@ -151,7 +151,7 @@ button.publicphonebutton { float:left; width: 50%; text-align:center; - height:150px;; + height:150px; overflow:hidden; margin-bottom:5px; font-size:18px; diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index e2872004323..0e9015ec95f 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -144,17 +144,31 @@ if (empty($reshook)) { $search_agenda_label = ''; } + $backurlforlist = DOL_URL_ROOT.'/ticket/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.'/ticket/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; } - $action = 'view'; } // Action to add an action (not a message) - if (GETPOST('add', 'alpha') && !empty($user->rights->ticket->write)) { + if (GETPOST('save', 'alpha') && !empty($user->rights->ticket->write)) { $error = 0; if (!GETPOST("subject", 'alphanohtml')) { @@ -276,9 +290,13 @@ if (empty($reshook)) { $db->commit(); if (!empty($backtopage)) { - $url = $backtopage; + if (empty($id)) { + $url = $backtopage; + } else { + $url = 'card.php?track_id='.urlencode($object->track_id); + } } else { - $url = 'card.php?track_id='.$object->track_id; + $url = 'card.php?track_id='.urlencode($object->track_id); } header("Location: ".$url); @@ -342,9 +360,13 @@ if (empty($reshook)) { $action = 'edit'; } else { if (!empty($backtopage)) { - $url = $backtopage; + if (empty($id)) { + $url = $backtopage; + } else { + $url = 'card.php?track_id='.urlencode($object->track_id); + } } else { - $url = 'card.php?track_id='.$object->track_id; + $url = 'card.php?track_id='.urlencode($object->track_id); } header('Location: '.$url); @@ -427,9 +449,13 @@ if (empty($reshook)) { if ($ret > 0) { if (!empty($backtopage)) { - $url = $backtopage; + if (empty($id)) { + $url = $backtopage; + } else { + $url = 'card.php?track_id='.urlencode($object->track_id); + } } else { - $url = 'card.php?action=view&track_id='.$object->track_id; + $url = 'card.php?action=view&track_id='.urlencode($object->track_id); } header("Location: ".$url); @@ -707,6 +733,8 @@ if ($action == 'create' || $action == 'presend') { $formticket->withextrafields = 1; $formticket->param = array('origin' => GETPOST('origin'), 'originid' => GETPOST('originid')); + $formticket->withcancel = 1; + $formticket->showForm(1, 'create', 0); /*} elseif ($action == 'edit' && $user->rights->ticket->write && $object->fk_statut < Ticket::STATUS_CLOSED) { $formticket = new FormTicket($db); diff --git a/htdocs/ticket/class/cticketcategory.class.php b/htdocs/ticket/class/cticketcategory.class.php index 34321b5b898..efd9b84330b 100644 --- a/htdocs/ticket/class/cticketcategory.class.php +++ b/htdocs/ticket/class/cticketcategory.class.php @@ -408,7 +408,7 @@ class CTicketCategory extends CommonObject } } if (count($sqlwhere) > 0) { - $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; + $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')'; } if (!empty($sortfield)) { diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 625503538b5..4b048d54671 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -897,7 +897,7 @@ print ''."\n"; // Detect if we need a fetch on each output line $needToFetchEachLine = 0; -if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { +if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { if (preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object diff --git a/htdocs/user/card.php b/htdocs/user/card.php index be91f302b97..ee1ebf71493 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -138,6 +138,29 @@ if ($reshook < 0) { } if (empty($reshook)) { + $backurlforlist = DOL_URL_ROOT.'/user/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.'/user/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 = ''; + } + if ($action == 'confirm_disable' && $confirm == "yes" && $candisableuser) { if ($id != $user->id) { // A user can't disable itself $object->fetch($id); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index db2d4583177..f229cd80637 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3526,7 +3526,7 @@ class User extends CommonObject } } if (count($sqlwhere) > 0) { - $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; + $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')'; } $sql .= $this->db->order($sortfield, $sortorder); if ($limit) { diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 69e94e1cfdc..89f9191751b 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -858,7 +858,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $canreadhrmdata = 1; } $canreadsecretapi = 0; - if ($user->id = $obj->rowid || !empty($user->admin)) { // Current user or admin + if ($user->id == $obj->rowid || !empty($user->admin)) { // Current user or admin $canreadsecretapi = 1; } diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index f48fada2eb9..f80a705c3f2 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -419,7 +419,7 @@ class Website extends CommonObject } } if (count($sqlwhere) > 0) { - $sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere); + $sql .= ' AND '.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere); } if (!empty($sortfield)) { @@ -1091,8 +1091,8 @@ class Website extends CommonObject } } - $line .= "\n-- For Dolibarr v14+ --\n"; - $line .= "UPDATE llx_website SET fk_default_lang = '".$this->db->escape($this->fk_default_lang)."' WHERE rowid = __WEBSITE_ID__;\n"; + $line = "\n-- For Dolibarr v14+ --;\n"; + $line .= "UPDATE llx_website SET lang = '".$this->db->escape($this->fk_default_lang)."' WHERE rowid = __WEBSITE_ID__;\n"; $line .= "UPDATE llx_website SET otherlang = '".$this->db->escape($this->otherlang)."' WHERE rowid = __WEBSITE_ID__;\n"; $line .= "\n"; fputs($fp, $line); diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 275c3c94afe..19fa8b8d12d 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -441,7 +441,7 @@ class WebsitePage extends CommonObject } } if (count($sqlwhere) > 0) { - $sql .= " AND (".implode(' '.$filtermode.' ', $sqlwhere).')'; + $sql .= " AND (".implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')'; } if (!empty($sortfield)) { @@ -543,7 +543,7 @@ class WebsitePage extends CommonObject } } if (count($sqlwhere) > 0) { - $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; + $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')'; } $resql = $this->db->query($sql); diff --git a/htdocs/website/index.php b/htdocs/website/index.php index d8a479d5923..d4058ccdb47 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2602,7 +2602,7 @@ if (!GETPOST('hide_websitemenu')) { print $langs->trans("Website").' : '; print ''; - $urltocreatenewwebsite = $_SERVER["PHP_SEFL"].'?action=createsite'; + $urltocreatenewwebsite = $_SERVER["PHP_SELF"].'?action=createsite'; if (empty($conf->use_javascript_ajax)) { print ''; print ''; @@ -2652,7 +2652,7 @@ if (!GETPOST('hide_websitemenu')) { $out .= ' if (jQuery("#website option:selected").val() == \'-2\') {'; $out .= ' window.location.href = "'.dol_escape_js($urltocreatenewwebsite).'";'; $out .= ' } else {'; - $out .= ' window.location.href = "'.$_SERVER["PHP_SEFL"].'?website="+jQuery("#website option:selected").val();'; + $out .= ' window.location.href = "'.$_SERVER["PHP_SELF"].'?website="+jQuery("#website option:selected").val();'; $out .= ' }'; $out .= ' });'; $out .= '});'; @@ -2691,16 +2691,16 @@ if (!GETPOST('hide_websitemenu')) { print ''; // Regenerate all pages - print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'">'; + print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'">'; print '   '; // Generate site map - print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("GenerateSitemaps")).'">'; + print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("GenerateSitemaps")).'">'; print '   '; - print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'">'; + print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'">'; } print ''; @@ -2811,7 +2811,7 @@ if (!GETPOST('hide_websitemenu')) { print ''; print ''; - print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("AddPage")).'">'; + print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("AddPage")).'">'; print ''; //print ''; @@ -2826,7 +2826,7 @@ if (!GETPOST('hide_websitemenu')) { $out .= $s; $out .= ''; - $urltocreatenewpage = $_SERVER["PHP_SEFL"].'?action=createcontainer&website='.$website->ref; + $urltocreatenewpage = $_SERVER["PHP_SELF"].'?action=createcontainer&website='.$website->ref; if (!empty($conf->use_javascript_ajax)) { $out .= '