diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php
index 884de9dd232..55700fe8439 100644
--- a/htdocs/accountancy/customer/lines.php
+++ b/htdocs/accountancy/customer/lines.php
@@ -458,8 +458,8 @@ if ($result) {
$productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
$accountingaccountstatic->rowid = $objp->fk_compte;
- $accountingaccountstatic->label = $objp->label;
- $accountingaccountstatic->labelshort = $objp->labelshort;
+ $accountingaccountstatic->label = $objp->label_account;
+ $accountingaccountstatic->labelshort = $objp->labelshort_account;
$accountingaccountstatic->account_number = $objp->account_number;
print '
';
echo '| '.$langs->trans("CustomerOrder");
- if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {
+ if (!empty($showImportButton) && !empty($conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES)) {
print ' ';
diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php
index ab8451c9e59..ec7af37940c 100644
--- a/htdocs/compta/cashcontrol/cashcontrol_list.php
+++ b/htdocs/compta/cashcontrol/cashcontrol_list.php
@@ -343,21 +343,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
-// Example : Adding jquery code
-print '';
-
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 585cabc1be4..1f6a03ca351 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -112,7 +112,12 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
if ($id > 0 || !empty($ref)) {
if ($action != 'add') {
- $ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
+ if (empty($conf->global->INVOICE_USE_SITUATION)) {
+ $fetch_situation = false;
+ } else {
+ $fetch_situation = true;
+ }
+ $ret = $object->fetch($id, $ref, '', '', $fetch_situation);
}
}
@@ -607,7 +612,7 @@ if (empty($reshook)) {
}
// Check for mandatory fields in invoice
- $array_to_check = array('REF_CUSTOMER'=>'RefCustomer');
+ $array_to_check = array('REF_CLIENT'=>'RefCustomer');
foreach ($array_to_check as $key => $val) {
$keymin = strtolower($key);
$vallabel = $object->$keymin;
@@ -2362,25 +2367,26 @@ if (empty($reshook)) {
$line = new FactureLigne($db);
$line->fetch(GETPOST('lineid', 'int'));
$percent = $line->get_prev_progress($object->id);
+ $progress = price2num(GETPOST('progress', 'alpha'));
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref > 0) {
// in case of situation credit note
- if (GETPOST('progress') >= 0) {
+ if ($progress >= 0) {
$mesg = $langs->trans("CantBeNullOrPositive");
setEventMessages($mesg, null, 'warnings');
$error++;
$result = -1;
- } elseif (GETPOST('progress') < $line->situation_percent) { // TODO : use a modified $line->get_prev_progress($object->id) result
+ } elseif ($progress < $line->situation_percent) { // TODO : use a modified $line->get_prev_progress($object->id) result
$mesg = $langs->trans("CantBeLessThanMinPercent");
setEventMessages($mesg, null, 'warnings');
$error++;
$result = -1;
+ } elseif ($progress < $percent) {
+ $mesg = ' '.$langs->trans("CantBeLessThanMinPercent").' ';
+ setEventMessages($mesg, null, 'warnings');
+ $error++;
+ $result = -1;
}
- } elseif (GETPOST('progress') < $percent) {
- $mesg = ''.$langs->trans("CantBeLessThanMinPercent").' ';
- setEventMessages($mesg, null, 'warnings');
- $error++;
- $result = -1;
}
// Check minimum price
diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php
index 1e99cf8676f..ee847603954 100644
--- a/htdocs/compta/paiement/list.php
+++ b/htdocs/compta/paiement/list.php
@@ -5,7 +5,7 @@
* Copyright (C) 2013 Cédric Salvador
* Copyright (C) 2015 Jean-François Ferry
* Copyright (C) 2015 Juanjo Menent
- * Copyright (C) 2017 Alexandre Spangaro
+ * Copyright (C) 2017-2021 Alexandre Spangaro
* Copyright (C) 2018 Ferran Marcet
* Copyright (C) 2018 Charlene Benke
* Copyright (C) 2020 Tobias Sekan
@@ -56,16 +56,22 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'p
$facid = GETPOST('facid', 'int');
$socid = GETPOST('socid', 'int');
$userid = GETPOST('userid', 'int');
-$day = GETPOST('day', 'int');
-$month = GETPOST('month', 'int');
-$year = GETPOST('year', 'int');
$search_ref = GETPOST("search_ref", "alpha");
-$search_company = GETPOST("search_company", 'alpha');
-$search_paymenttype = GETPOST("search_paymenttype");
-$search_account = GETPOST("search_account", "int");
-$search_payment_num = GETPOST('search_payment_num', 'alpha');
+$search_date_startday = GETPOST('search_date_startday', 'int');
+$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
+$search_date_startyear = GETPOST('search_date_startyear', 'int');
+$search_date_endday = GETPOST('search_date_endday', 'int');
+$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
+$search_date_endyear = GETPOST('search_date_endyear', 'int');
+$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
+$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
+$search_company = GETPOST("search_company", 'alpha');
+$search_paymenttype = GETPOST("search_paymenttype");
+$search_account = GETPOST("search_account", "int");
+$search_payment_num = GETPOST('search_payment_num', 'alpha');
$search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x"
+$search_status = GETPOST('search_status', 'intcomma');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
@@ -130,14 +136,20 @@ if (empty($reshook)) {
// All tests are required to be compatible with all browsers
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
$search_ref = '';
+ $search_date_startday = '';
+ $search_date_startmonth = '';
+ $search_date_startyear = '';
+ $search_date_endday = '';
+ $search_date_endmonth = '';
+ $search_date_endyear = '';
+ $search_date_start = '';
+ $search_date_end = '';
$search_account = '';
$search_amount = '';
$search_paymenttype = '';
$search_payment_num = '';
$search_company = '';
- $day = '';
- $year = '';
- $month = '';
+ $search_status = '';
$option = '';
$toselect = '';
$search_array_options = array();
@@ -211,10 +223,15 @@ if (GETPOST("orphelins", "alpha")) {
}
// Search criteria
- $sql .= dolSqlDateFilter("p.datep", $day, $month, $year);
if ($search_ref) {
$sql .= natural_search('p.ref', $search_ref);
}
+ if ($search_date_start) {
+ $sql .= " AND p.datep >= '" . $db->idate($search_date_start) . "'";
+ }
+ if ($search_date_end) {
+ $sql .= " AND p.datep <= '" . $db->idate($search_date_end) . "'";
+ }
if ($search_account > 0) {
$sql .= " AND b.fk_account=".((int) $search_account);
}
@@ -273,11 +290,40 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
-$param .= (GETPOST("orphelins") ? "&orphelins=1" : '');
-$param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : '');
-$param .= ($search_company ? "&search_company=".urlencode($search_company) : '');
-$param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : '');
-$param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : '');
+
+if (GETPOST("orphelins")) {
+ $param .= '&orphelins=1';
+}
+if ($search_ref) {
+ $param .= '&search_ref='.urlencode($search_ref);
+}
+if ($search_date_startday) {
+ $param .= '&search_date_startday='.urlencode($search_date_startday);
+}
+if ($search_date_startmonth) {
+ $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
+}
+if ($search_date_startyear) {
+ $param .= '&search_date_startyear='.urlencode($search_date_startyear);
+}
+if ($search_date_endday) {
+ $param .= '&search_date_endday='.urlencode($search_date_endday);
+}
+if ($search_date_endmonth) {
+ $param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
+}
+if ($search_date_endyear) {
+ $param .= '&search_date_endyear='.urlencode($search_date_endyear);
+}
+if ($search_company) {
+ $param .= '&search_company='.urlencode($search_company);
+}
+if ($search_amount != '') {
+ $param .= '&search_amount='.urlencode($search_amount);
+}
+if ($search_payment_num) {
+ $param .= '&search_payment_num='.urlencode($search_payment_num);
+}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
@@ -305,10 +351,12 @@ if ($search_all) {
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+$massactionbutton = '';
if ($massactionbutton) {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
}
+$moreforfilter = '';
print '';
print ' ';
@@ -331,11 +379,12 @@ if (!empty($arrayfields['p.ref']['checked'])) {
// Filter: Date
if (!empty($arrayfields['p.datep']['checked'])) {
print '| ';
- if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
- print '';
- }
- print '';
- $formother->select_year($year ? $year : -1, 'year', 1, 20, 5);
+ print ' ';
+ print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
+ print ' ';
+ print '';
+ print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
+ print ' ';
print ' | ';
}
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index cc3688d03a0..a5f408f4299 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -885,30 +885,32 @@ class Contact extends CommonObject
$this->error = $this->db->lasterror();
}
- // Mis a jour alerte birthday
- if (!empty($this->birthday_alert)) {
- //check existing
- $sql_check = "SELECT rowid FROM ".MAIN_DB_PREFIX."user_alert WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id;
- $result_check = $this->db->query($sql_check);
- if (!$result_check || ($this->db->num_rows($result_check) < 1)) {
- //insert
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_alert(type,fk_contact,fk_user) ";
- $sql .= "VALUES (1,".$this->db->escape($id).",".$user->id.")";
+ if ($user) {
+ // Update birthday alert
+ if (!empty($this->birthday_alert)) {
+ //check existing
+ $sql_check = "SELECT rowid FROM " . MAIN_DB_PREFIX . "user_alert WHERE type = 1 AND fk_contact = " . ((int) $id) . " AND fk_user = " . ((int) $user->id);
+ $result_check = $this->db->query($sql_check);
+ if (!$result_check || ($this->db->num_rows($result_check) < 1)) {
+ //insert
+ $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user_alert(type, fk_contact, fk_user) ";
+ $sql .= "VALUES (1," . ((int) $id) . "," . ((int) $user->id) . ")";
+ $result = $this->db->query($sql);
+ if (!$result) {
+ $error++;
+ $this->error = $this->db->lasterror();
+ }
+ } else {
+ $result = true;
+ }
+ } else {
+ $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_alert ";
+ $sql .= "WHERE type=1 AND fk_contact=" . ((int) $id) . " AND fk_user=" . ((int) $user->id);
$result = $this->db->query($sql);
if (!$result) {
$error++;
$this->error = $this->db->lasterror();
}
- } else {
- $result = true;
- }
- } else {
- $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_alert ";
- $sql .= "WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id;
- $result = $this->db->query($sql);
- if (!$result) {
- $error++;
- $this->error = $this->db->lasterror();
}
}
diff --git a/htdocs/core/boxes/box_boms.php b/htdocs/core/boxes/box_boms.php
index ee248d0a083..d96fac8bc76 100644
--- a/htdocs/core/boxes/box_boms.php
+++ b/htdocs/core/boxes/box_boms.php
@@ -85,7 +85,11 @@ class box_boms extends ModeleBoxes
$this->info_box_head = array('text' => $langs->trans("BoxTitleLatestModifiedBoms", $max));
if ($user->rights->bom->read) {
- $sql = "SELECT p.ref as product_ref, p.tobuy, p.tosell";
+ $sql = "SELECT p.ref as product_ref";
+ $sql .= ", p.rowid as productid";
+ $sql .= ", p.tosell";
+ $sql .= ", p.tobuy";
+ $sql .= ", p.tobatch";
$sql .= ", c.rowid";
$sql .= ", c.date_creation";
$sql .= ", c.tms";
@@ -111,12 +115,13 @@ class box_boms extends ModeleBoxes
$bomstatic->id = $objp->rowid;
$bomstatic->ref = $objp->ref;
- $bomstatic->id = $objp->socid;
$bomstatic->status = $objp->status;
+ $productstatic->id = $objp->productid;
$productstatic->ref = $objp->product_ref;
- $productstatic->status = $objp->tobuy;
- $productstatic->status_buy = $objp->tosell;
+ $productstatic->status = $objp->tosell;
+ $productstatic->status_buy = $objp->tobuy;
+ $productstatic->status_batch = $objp->tobatch;
$this->info_box_contents[$line][] = array(
'td' => 'class="nowraponall"',
diff --git a/htdocs/core/boxes/box_mos.php b/htdocs/core/boxes/box_mos.php
index 18a19da93dc..6436fb8e34e 100644
--- a/htdocs/core/boxes/box_mos.php
+++ b/htdocs/core/boxes/box_mos.php
@@ -86,12 +86,15 @@ class box_mos extends ModeleBoxes
if ($user->rights->mrp->read) {
$sql = "SELECT p.ref as product_ref";
+ $sql .= ", p.rowid as productid";
+ $sql .= ", p.tosell";
+ $sql .= ", p.tobuy";
+ $sql .= ", p.tobatch";
$sql .= ", c.rowid";
$sql .= ", c.date_creation";
$sql .= ", c.tms";
$sql .= ", c.ref";
$sql .= ", c.status";
- //$sql.= ", c.fk_user_valid";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= ", ".MAIN_DB_PREFIX."mrp_mo as c";
$sql .= " WHERE c.fk_product = p.rowid";
@@ -110,9 +113,12 @@ class box_mos extends ModeleBoxes
$datem = $this->db->jdate($objp->tms);
$mostatic->id = $objp->rowid;
$mostatic->ref = $objp->ref;
- $mostatic->id = $objp->socid;
$mostatic->status = $objp->status;
+ $productstatic->id = $objp->productid;
$productstatic->ref = $objp->product_ref;
+ $productstatic->status = $objp->tosell;
+ $productstatic->status_buy = $objp->tobuy;
+ $productstatic->status_batch = $objp->tobatch;
$this->info_box_contents[$line][] = array(
'td' => 'class="nowraponall"',
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 789bfb4e8b2..ec9449eba8f 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -940,7 +940,7 @@ abstract class CommonObject
$ecmfile->fullpath_orig = '';
$ecmfile->gen_or_uploaded = 'generated';
$ecmfile->description = ''; // indexed content
- $ecmfile->keyword = ''; // keyword content
+ $ecmfile->keywords = ''; // keyword content
$ecmfile->share = getRandomPassword(true);
$result = $ecmfile->create($user);
if ($result < 0)
@@ -5261,7 +5261,7 @@ abstract class CommonObject
$ecmfile->fullpath_orig = '';
$ecmfile->gen_or_uploaded = 'generated';
$ecmfile->description = ''; // indexed content
- $ecmfile->keyword = ''; // keyword content
+ $ecmfile->keywords = ''; // keyword content
$result = $ecmfile->update($user);
if ($result < 0) {
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
@@ -5274,7 +5274,7 @@ abstract class CommonObject
$ecmfile->fullpath_orig = '';
$ecmfile->gen_or_uploaded = 'generated';
$ecmfile->description = ''; // indexed content
- $ecmfile->keyword = ''; // keyword content
+ $ecmfile->keywords = ''; // keyword content
$ecmfile->src_object_type = $this->table_element;
$ecmfile->src_object_id = $this->id;
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 49d69747c7b..8d0f1931763 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -5085,7 +5085,12 @@ class Form
} else {
if ($selected) {
$this->load_cache_conditions_paiements();
- print $this->cache_conditions_paiements[$selected]['label'];
+ if (isset($this->cache_conditions_paiements[$selected])) {
+ print $this->cache_conditions_paiements[$selected]['label'];
+ } else {
+ $langs->load('errors');
+ print $langs->trans('ErrorNotInDictionaryPaymentConditions');
+ }
} else {
print " ";
}
@@ -7778,7 +7783,7 @@ class Form
print '';
print '';
print ' | ';
- print ''.(!empty($objp->ref_client) ? $objp->ref_client : $objp->ref_supplier).' | ';
+ print ''.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).' | ';
print '';
if ($possiblelink['label'] == 'LinkToContract') {
$form = new Form($this->db);
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index f4e076640c4..daafa88333f 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -569,14 +569,14 @@ class FormTicket
* @param int $noadmininfo 0=Add admin info, 1=Disable admin info
* @param int $maxlength Max length of label
* @param string $morecss More CSS
- * @param int $use_multilevel if != 0 create a multilevel select ( Do not use any of the other params)
+ * @param int $use_multilevel if > 0 create a multilevel select which use $htmlname example: $use_multilevel = 1 permit to have 2 select boxes.
* @return void
*/
public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '', $use_multilevel = 0)
{
global $langs, $user;
- if ($use_multilevel == 0) {
+ if ($use_multilevel <= 0) {
$ticketstat = new Ticket($this->db);
dol_syslog(get_class($this)."::selectCategoryTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
@@ -655,12 +655,13 @@ class FormTicket
}
print ajax_combobox('select'.$htmlname);
- } else {
- $groupticket=GETPOST('groupticket', 'aZ09');
- $groupticketchild=GETPOST('groupticket_child', 'aZ09');
+ } elseif ($htmlname!='') {
+ $groupticket=GETPOST($htmlname, 'aZ09');
+ $groupticketchild=GETPOST($htmlname.'_child', 'aZ09');
$arraycodenotparent[] = "";
+ $arrayidused = array();
$stringtoprint = ''.$langs->trans("GroupOfTicket").' ';
- $stringtoprint .= ' | ';
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index bd25398776e..ac3da9eca68 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -1158,6 +1158,18 @@ class Task extends CommonObject
$this->timespent_datehour = $this->timespent_date;
}
+ if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) {
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
+ $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm');
+
+ if ($this->timespent_date < $restrictBefore) {
+ $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS);
+ $this->errors[] = $this->error;
+ return -1;
+ }
+ }
+
+
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_time (";
@@ -1519,6 +1531,17 @@ class Task extends CommonObject
$this->timespent_note = trim($this->timespent_note);
}
+ if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) {
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
+ $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm');
+
+ if ($this->timespent_date < $restrictBefore) {
+ $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS);
+ $this->errors[] = $this->error;
+ return -1;
+ }
+ }
+
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time SET";
@@ -1585,6 +1608,17 @@ class Task extends CommonObject
$error = 0;
+ if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) {
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
+ $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm');
+
+ if ($this->timespent_date < $restrictBefore) {
+ $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS);
+ $this->errors[] = $this->error;
+ return -1;
+ }
+ }
+
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time";
diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php
index 54a3d9e7ba9..4c6cb84783a 100644
--- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php
+++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php
@@ -253,12 +253,11 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
$objphoto->fetch($object->lines[$i]->fk_product);
//var_dump($objphoto->ref);exit;
- if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
- {
+ if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) {
$pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/";
$pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/';
} else {
- $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; // default
+ $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default
$pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative
}
diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php
index 4826dc735ef..a1e98ded601 100644
--- a/htdocs/recruitment/recruitmentcandidature_card.php
+++ b/htdocs/recruitment/recruitmentcandidature_card.php
@@ -305,21 +305,6 @@ $title = $langs->trans("RecruitmentCandidature");
$help_url = '';
llxHeader('', $title, $help_url);
-// Example : Adding jquery code
-print '';
-
// Part to create
if ($action == 'create') {
diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php
index 1caeb05095f..7a5a88bc6c4 100644
--- a/htdocs/recruitment/recruitmentcandidature_list.php
+++ b/htdocs/recruitment/recruitmentcandidature_list.php
@@ -348,21 +348,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
llxHeader('', $title, $help_url);
-// Example : Adding jquery code
-print '';
-
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';
diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php
index 6475a60a8ed..7ccad1de16a 100644
--- a/htdocs/recruitment/recruitmentjobposition_list.php
+++ b/htdocs/recruitment/recruitmentjobposition_list.php
@@ -349,21 +349,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
llxHeader('', $title, $help_url);
-// Example : Adding jquery code
-print '';
-
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index a2b229147fa..8e1d03411cd 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -1659,8 +1659,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, '');
print ' |
';
- } else // For external software
- {
+ } else { // For external software
// Accountancy_code_sell
print '