\n";
if ($action == '') {
if ($user->rights->produit->creer || $user->rights->service->creer) {
- print '
'.$langs->trans('Add').' ';
+ print '
'.$langs->trans('Add').' ';
if ($cnt_trans > 0) {
- print '
'.$langs->trans('Update').' ';
+ print '
'.$langs->trans('Update').' ';
}
}
}
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 8a10b39826f..e56a2e89fcf 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -1688,7 +1688,7 @@ if ($id > 0) {
print img_picto('', 'project', 'class="paddingrightonly"');
$numprojet = $formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth500');
if ($numprojet == 0) {
- print '
id.'&action=edit').'"> ';
+ print '
id.'&action=edit').'"> ';
}
print '';
}
@@ -2168,7 +2168,7 @@ if ($id > 0) {
if ($action != 'edit') {
if ($user->rights->agenda->allactions->create ||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) {
- print '
';
+ print '
';
} else {
print '
';
}
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 79fb13a8717..a4c06b65d1f 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -1245,7 +1245,6 @@ class ActionComm extends CommonObject
* Load all objects with filters.
* @todo WARNING: This make a fetch on all records instead of making one request with a join.
*
- * @param DoliDb $db Not used
* @param int $socid Filter by thirdparty
* @param int $fk_element Id of element action is linked to
* @param string $elementtype Type of element action is linked to
@@ -1255,7 +1254,7 @@ class ActionComm extends CommonObject
* @param string $limit Limit number of answers
* @return array|string Error string if KO, array with actions if OK
*/
- public static function getActions($db, $socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0)
+ public function getActions($socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0)
{
global $conf, $langs;
@@ -1277,33 +1276,33 @@ class ActionComm extends CommonObject
$sql .= " (SELECT fk_actioncomm FROM ".MAIN_DB_PREFIX."actioncomm_resources WHERE";
$sql .= " element_type = 'socpeople' AND fk_element = ".((int) $fk_element).')';
} else {
- $sql .= " AND a.fk_element = ".((int) $fk_element)." AND a.elementtype = '".$db->escape($elementtype)."'";
+ $sql .= " AND a.fk_element = ".((int) $fk_element)." AND a.elementtype = '".$this->db->escape($elementtype)."'";
}
}
if (!empty($filter)) {
$sql .= $filter;
}
if ($sortorder && $sortfield) {
- $sql .= $db->order($sortfield, $sortorder);
+ $sql .= $this->db->order($sortfield, $sortorder);
}
- $sql .= $db->plimit($limit, 0);
+ $sql .= $this->db->plimit($limit, 0);
- $resql = $db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql) {
- $num = $db->num_rows($resql);
+ $num = $this->db->num_rows($resql);
if ($num) {
for ($i = 0; $i < $num; $i++) {
- $obj = $db->fetch_object($resql);
- $actioncommstatic = new ActionComm($db);
+ $obj = $this->db->fetch_object($resql);
+ $actioncommstatic = new ActionComm($this->db);
$actioncommstatic->fetch($obj->id);
$resarray[$i] = $actioncommstatic;
}
}
- $db->free($resql);
+ $this->db->free($resql);
return $resarray;
} else {
- return $db->lasterror();
+ return $this->db->lasterror();
}
}
diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index f891bf722cc..c9f422d78c8 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -406,7 +406,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentConditions');
print '
';
if (($action != 'editconditions') && $user->rights->societe->creer) {
- print ' id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
}
print '';
print '
';
@@ -424,7 +424,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentMode');
print ' ';
if (($action != 'editmode') && $user->rights->societe->creer) {
- print ' id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '';
print '
';
@@ -443,7 +443,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentBankAccount');
print ' ';
if (($action != 'editbankaccount') && $user->rights->societe->creer) {
- print ' id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '';
print '
';
@@ -569,7 +569,7 @@ if ($object->id > 0) {
print $langs->trans('SendingMethod');
print ' ';
if (($action != 'editshipping') && $user->rights->societe->creer) {
- print ' id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '';
print '
';
@@ -589,7 +589,7 @@ if ($object->id > 0) {
print $langs->trans('IntracommReportTransportMode');
print ' ';
if (($action != 'edittransportmode') && $user->rights->societe->creer) {
- print ' id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '';
print '
';
@@ -652,7 +652,7 @@ if ($object->id > 0) {
print $langs->trans('ProspectLevel');
print ' ';
if ($action != 'editlevel' && $user->rights->societe->creer) {
- print ' id.'">'.img_edit($langs->trans('Modify'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('Modify'), 1).' ';
}
print '';
print '
';
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index b5f05e72795..cff5c5d0e35 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -2093,7 +2093,7 @@ if ($action == 'create') {
print $langs->trans('DatePropal');
print ' ';
if ($action != 'editdate' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
- print '
id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
}
print '';
print '
';
@@ -2120,7 +2120,7 @@ if ($action == 'create') {
print $langs->trans('DateEndPropal');
print ' ';
if ($action != 'editecheance' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
- print '
id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
}
print '';
print '
';
@@ -2150,7 +2150,7 @@ if ($action == 'create') {
print $langs->trans('PaymentConditionsShort');
print ' ';
if ($action != 'editconditions' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
- print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).' ';
+ print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).' ';
}
print '';
print '
';
@@ -2169,7 +2169,7 @@ if ($action == 'create') {
print $langs->trans('PaymentMode');
print ' ';
if ($action != 'editmode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
- print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).' ';
+ print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).' ';
}
print '';
print '
';
@@ -2198,7 +2198,7 @@ if ($action == 'create') {
}
print ' ';
if ($action != 'editavailability' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
- print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1).' ';
+ print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1).' ';
}
print '';
print '
';
@@ -2218,7 +2218,7 @@ if ($action == 'create') {
print $langs->trans('SendingMethod');
print ' ';
if ($action != 'editshippingmethod' && $usercancreate) {
- print '
id.'">'.img_edit($langs->trans('SetShippingMode'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetShippingMode'), 1).' ';
}
print '';
print '
';
@@ -2255,7 +2255,7 @@ if ($action == 'create') {
print $langs->trans('Source');
print ' ';
if ($action != 'editdemandreason' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
- print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1).' ';
+ print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1).' ';
}
print '';
print '
';
@@ -2276,7 +2276,7 @@ if ($action == 'create') {
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print ' ';
if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT && $usercancreate) {
- print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '
';
@@ -2296,7 +2296,7 @@ if ($action == 'create') {
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print ' ';
if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $usercancreate) {
- print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '
';
@@ -2337,7 +2337,7 @@ if ($action == 'create') {
print $langs->trans('BankAccount');
print ' ';
if ($action != 'editbankaccount' && $usercancreate) {
- print '
id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '';
print '
';
@@ -2373,7 +2373,7 @@ if ($action == 'create') {
print $langs->trans('IncotermLabel');
print ' ';
if ($usercancreate) {
- print ''.img_edit().' ';
+ print ''.img_edit().' ';
} else {
print ' ';
}
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index bff848c78e2..269cf9cfd91 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -13,9 +13,9 @@
* Copyright (C) 2016-2021 Ferran Marcet
* Copyright (C) 2017-2018 Charlene Benke
* Copyright (C) 2018 Nicolas ZABOURI
- * Copyright (C) 2019 Alexandre Spangaro
+ * Copyright (C) 2019-2021 Alexandre Spangaro
* Copyright (C) 2021 Anthony Berton
- * Copyright (C) 2021 Frédéric France
+ * Copyright (C) 2021 Frédéric France
*
* 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
@@ -88,12 +88,30 @@ $search_zip = GETPOST('search_zip', 'alpha');
$search_state = GETPOST("search_state");
$search_country = GETPOST("search_country", 'int');
$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
-$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
-$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
-$search_dateend_start = dol_mktime(0, 0, 0, GETPOST('search_dateend_startmonth', 'int'), GETPOST('search_dateend_startday', 'int'), GETPOST('search_dateend_startyear', 'int'));
-$search_dateend_end = dol_mktime(23, 59, 59, GETPOST('search_dateend_endmonth', 'int'), GETPOST('search_dateend_endday', 'int'), GETPOST('search_dateend_endyear', 'int'));
-$search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int'));
-$search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int'));
+$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_date_end_startday = GETPOST('search_date_end_startday', 'int');
+$search_date_end_startmonth = GETPOST('search_date_end_startmonth', 'int');
+$search_date_end_startyear = GETPOST('search_date_end_startyear', 'int');
+$search_date_end_endday = GETPOST('search_date_end_endday', 'int');
+$search_date_end_endmonth = GETPOST('search_date_end_endmonth', 'int');
+$search_date_end_endyear = GETPOST('search_date_end_endyear', 'int');
+$search_date_end_start = dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear); // Use tzserver
+$search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear);
+$search_date_delivery_startday = GETPOST('search_date_delivery_startday', 'int');
+$search_date_delivery_startmonth = GETPOST('search_date_delivery_startmonth', 'int');
+$search_date_delivery_startyear = GETPOST('search_date_delivery_startyear', 'int');
+$search_date_delivery_endday = GETPOST('search_date_delivery_endday', 'int');
+$search_date_delivery_endmonth = GETPOST('search_date_delivery_endmonth', 'int');
+$search_date_delivery_endyear = GETPOST('search_date_delivery_endyear', 'int');
+$search_date_delivery_start = dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear);
+$search_date_delivery_end = dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
$search_availability = GETPOST('search_availability', 'int');
$search_categ_cus = GETPOST("search_categ_cus", 'int');
$search_fk_cond_reglement = GETPOST("search_fk_cond_reglement", 'int');
@@ -278,12 +296,30 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_type = '';
$search_country = '';
$search_type_thirdparty = '';
+ $search_date_startday = '';
+ $search_date_startmonth = '';
+ $search_date_startyear = '';
+ $search_date_endday = '';
+ $search_date_endmonth = '';
+ $search_date_endyear = '';
$search_date_start = '';
$search_date_end = '';
- $search_dateend_start = '';
- $search_dateend_end = '';
- $search_datedelivery_start = '';
- $search_datedelivery_end = '';
+ $search_date_end_startday = '';
+ $search_date_end_startmonth = '';
+ $search_date_end_startyear = '';
+ $search_date_end_endday = '';
+ $search_date_end_endmonth = '';
+ $search_date_end_endyear = '';
+ $search_date_end_start = '';
+ $search_date_end_end = '';
+ $search_date_delivery_startday = '';
+ $search_date_delivery_startmonth = '';
+ $search_date_delivery_startyear = '';
+ $search_date_delivery_endday = '';
+ $search_date_delivery_endmonth = '';
+ $search_date_delivery_endyear = '';
+ $search_date_delivery_start = '';
+ $search_date_delivery_end = '';
$search_availability = '';
$search_status = '';
$object_statut = '';
@@ -472,11 +508,11 @@ $sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date
$sql .= ' p.note_public, p.note_private,';
$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
-$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity as user_entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
+$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity as user_entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", sc.fk_soc, sc.fk_user";
}
-if ($search_categ_cus) {
+if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
$sql .= ", cc.fk_categorie, cc.fk_soc";
}
// Add fields from extrafields
@@ -494,7 +530,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
-if (!empty($search_categ_cus)) {
+if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
}
$sql .= ', '.MAIN_DB_PREFIX.'propal as p';
@@ -599,6 +635,7 @@ if ($search_multicurrency_montant_ttc != '') {
if ($sall) {
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
}
+
if ($search_categ_cus > 0) {
$sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus);
}
@@ -634,17 +671,17 @@ if ($search_date_start) {
if ($search_date_end) {
$sql .= " AND p.datep <= '".$db->idate($search_date_end)."'";
}
-if ($search_dateend_start) {
- $sql .= " AND p.fin_validite >= '".$db->idate($search_dateend_start)."'";
+if ($search_date_end_start) {
+ $sql .= " AND p.fin_validite >= '".$db->idate($search_date_end_start)."'";
}
-if ($search_dateend_end) {
- $sql .= " AND p.fin_validite <= '".$db->idate($search_dateend_end)."'";
+if ($search_date_end_end) {
+ $sql .= " AND p.fin_validite <= '".$db->idate($search_date_end_end)."'";
}
-if ($search_datedelivery_start) {
- $sql .= " AND p.date_livraison >= '".$db->idate($search_datedelivery_start)."'";
+if ($search_date_delivery_start) {
+ $sql .= " AND p.date_livraison >= '".$db->idate($search_date_delivery_start)."'";
}
-if ($search_datedelivery_end) {
- $sql .= " AND p.date_livraison <= '".$db->idate($search_datedelivery_end)."'";
+if ($search_date_delivery_end) {
+ $sql .= " AND p.date_livraison <= '".$db->idate($search_date_delivery_end)."'";
}
if ($search_sale > 0) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
@@ -719,12 +756,60 @@ if ($resql) {
if ($sall) {
$param .= '&sall='.urlencode($sall);
}
- if ($search_date_start) $param .= '&search_date_startday='.urlencode(dol_print_date($search_date_start, '%d')).'&search_date_startmonth='.urlencode(dol_print_date($search_date_start, '%m')).'&search_date_startyear='.urlencode(dol_print_date($search_date_start, '%Y'));
- if ($search_date_end) $param .= '&search_date_endday='.urlencode(dol_print_date($search_date_end, '%d')).'&search_date_endmonth='.urlencode(dol_print_date($search_date_end, '%m')).'&search_date_endyear='.urlencode(dol_print_date($search_date_end, '%Y'));
- if ($search_dateend_start) $param .= '&search_dateend_startday='.urlencode(dol_print_date($search_dateend_start, '%d')).'&search_dateend_startmonth='.urlencode(dol_print_date($search_dateend_start, '%m')).'&search_dateend_startyear='.urlencode(dol_print_date($search_dateend_start, '%Y'));
- if ($search_dateend_end) $param .= '&search_dateend_endday='.urlencode(dol_print_date($search_dateend_end, '%d')).'&search_dateend_endmonth='.urlencode(dol_print_date($search_dateend_end, '%m')).'&search_dateend_endyear='.urlencode(dol_print_date($search_dateend_end, '%Y'));
- if ($search_datedelivery_start) $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start, '%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start, '%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start, '%Y'));
- if ($search_datedelivery_end) $param .= '&search_datedelivery_endday='.urlencode(dol_print_date($search_datedelivery_end, '%d')).'&search_datedelivery_endmonth='.urlencode(dol_print_date($search_datedelivery_end, '%m')).'&search_datedelivery_endyear='.urlencode(dol_print_date($search_datedelivery_end, '%Y'));
+ 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_date_end_startday) {
+ $param .= '&search_date_end_startday='.urlencode($search_date_end_startday);
+ }
+ if ($search_date_end_startmonth) {
+ $param .= '&search_date_end_startmonth='.urlencode($search_date_end_startmonth);
+ }
+ if ($search_date_end_startyear) {
+ $param .= '&search_date_end_startyear='.urlencode($search_date_end_startyear);
+ }
+ if ($search_date_end_endday) {
+ $param .= '&search_date_end_endday='.urlencode($search_date_end_endday);
+ }
+ if ($search_date_end_endmonth) {
+ $param .= '&search_date_end_endmonth='.urlencode($search_date_end_endmonth);
+ }
+ if ($search_date_end_endyear) {
+ $param .= '&search_date_end_endyear='.urlencode($search_date_end_endyear);
+ }
+ if ($search_date_delivery_startday) {
+ $param .= '&search_date_delivery_startday='.urlencode($search_date_delivery_startday);
+ }
+ if ($search_date_delivery_startmonth) {
+ $param .= '&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth);
+ }
+ if ($search_date_delivery_startyear) {
+ $param .= '&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear);
+ }
+ if ($search_date_delivery_endday) {
+ $param .= '&search_date_delivery_endday='.urlencode($search_date_delivery_endday);
+ }
+ if ($search_date_delivery_endmonth) {
+ $param .= '&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth);
+ }
+ if ($search_date_delivery_endyear) {
+ $param .= '&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear);
+ }
if ($search_ref) {
$param .= '&search_ref='.urlencode($search_ref);
}
@@ -1024,10 +1109,10 @@ if ($resql) {
if (!empty($arrayfields['p.fin_validite']['checked'])) {
print '';
print '';
- print $form->selectDate($search_dateend_start ? $search_dateend_start : -1, 'search_dateend_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
+ print $form->selectDate($search_date_end_start ? $search_date_end_start : -1, 'search_date_end_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '
';
print '';
- print $form->selectDate($search_dateend_end ? $search_dateend_end : -1, 'search_dateend_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
+ print $form->selectDate($search_date_end_end ? $search_date_end_end : -1, 'search_date_end_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '
';
print ' ';
}
@@ -1035,10 +1120,10 @@ if ($resql) {
if (!empty($arrayfields['p.date_livraison']['checked'])) {
print '';
print '';
- print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
+ print $form->selectDate($search_date_delivery_start ? $search_date_delivery_start : -1, 'search_date_delivery_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '
';
print '';
- print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
+ print $form->selectDate($search_date_delivery_end ? $search_date_delivery_end : -1, 'search_date_delivery_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '
';
print ' ';
}
@@ -1715,8 +1800,8 @@ if ($resql) {
$userstatic->login = $obj->login;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
- $userstatic->email = $obj->email;
- $userstatic->statut = $obj->statut;
+ $userstatic->email = $obj->user_email;
+ $userstatic->statut = $obj->user_statut;
$userstatic->entity = $obj->user_entity;
$userstatic->photo = $obj->photo;
$userstatic->office_phone = $obj->office_phone;
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 5fce8a81a30..e3675129198 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -299,13 +299,9 @@ class Commande extends CommonOrder
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
- 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
- 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>56),
- 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
+ 'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60),
+ 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62),
'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
- 'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>70),
- 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
- 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>80),
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'source' =>array('type'=>'smallint(6)', 'label'=>'Source', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
@@ -344,6 +340,10 @@ class Commande extends CommonOrder
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>270),
'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>275),
'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>280),
+ 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>300),
+ 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>302),
+ 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>304),
+ 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>306),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>400),
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
);
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 22b24c048a2..4e8a18821ff 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -428,7 +428,7 @@ $sql .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multic
$sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
$sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
-$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
+$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
$sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method,';
$sql .= ' c.fk_input_reason';
if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
@@ -553,7 +553,7 @@ if ($search_state) {
if ($search_country) {
$sql .= " AND s.fk_pays IN (".$db->sanitize($search_country).')';
}
-if ($search_type_thirdparty) {
+if ($search_type_thirdparty && $search_type_thirdparty != '-1') {
$sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')';
}
if ($search_company) {
@@ -795,7 +795,7 @@ if ($resql) {
if ($search_country != '') {
$param .= '&search_country='.urlencode($search_country);
}
- if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
+ if ($search_type_thirdparty && $search_type_thirdparty != '-1') {
$param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
}
if ($search_product_category != '') {
@@ -1697,8 +1697,8 @@ if ($resql) {
$userstatic->login = $obj->login;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
- $userstatic->email = $obj->email;
- $userstatic->statut = $obj->statut;
+ $userstatic->email = $obj->user_email;
+ $userstatic->statut = $obj->user_statut;
$userstatic->entity = $obj->entity;
$userstatic->photo = $obj->photo;
$userstatic->office_phone = $obj->office_phone;
diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php
index 9fd88f44d4f..8396979e247 100644
--- a/htdocs/compta/bank/class/account.class.php
+++ b/htdocs/compta/bank/class/account.class.php
@@ -1503,7 +1503,7 @@ class Account extends CommonObject
{
$country_code = $this->getCountryCode();
- if (in_array($country_code, array('FR', 'ES', 'GA', 'IT', 'NC'))) {
+ if (in_array($country_code, array('AD', 'FR', 'ES', 'GA', 'IT', 'NC'))) {
return 1; // France, Spain, Gabon, ... - Not valid for CH
}
if (in_array($country_code, array('AU', 'BE', 'CA', 'DE', 'DK', 'GR', 'GB', 'ID', 'IE', 'IR', 'KR', 'NL', 'NZ', 'UK', 'US'))) {
@@ -1696,21 +1696,21 @@ class Account extends CommonObject
/**
* Function used to replace a thirdparty id with another one.
*
- * @param DoliDB $db Database handler
+ * @param DoliDB $dbs Database handler
* @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id
- * @return bool
+ * @return bool True=SQL success, False=SQL error
*/
- public static function replaceThirdparty($db, $origin_id, $dest_id)
+ public static function replaceThirdparty($dbs, $origin_id, $dest_id)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_url SET url_id = ".((int) $dest_id)." WHERE url_id = ".((int) $origin_id)." AND type='company'";
- if (!$db->query($sql)) {
- //if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B.
- //$this->errors = $db->lasterror();
- return false;
- } else {
+ if ($dbs->query($sql)) {
return true;
+ } else {
+ //if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B.
+ //$this->errors = $dbs->lasterror();
+ return false;
}
}
}
diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php
index 97184c1b8eb..af0b388cb7a 100644
--- a/htdocs/compta/bank/releve.php
+++ b/htdocs/compta/bank/releve.php
@@ -364,7 +364,7 @@ if (empty($numref)) {
print '';
if ($user->rights->banque->consolidate && $action != 'editbankreceipt') {
- print 'id.($page > 0 ? '&page='.$page : '').'&action=editbankreceipt&brref='.$objp->numr.'">'.img_edit().' ';
+ print 'id.($page > 0 ? '&page='.$page : '').'&action=editbankreceipt&token='.newToken().'&brref='.urlencode($objp->numr).'">'.img_edit().' ';
}
print ' ';
diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php
index 77db777c077..33b453cd0b4 100644
--- a/htdocs/compta/deplacement/card.php
+++ b/htdocs/compta/deplacement/card.php
@@ -469,7 +469,7 @@ if ($action == 'create') {
if ($object->statut < Deplacement::STATUS_REFUNDED) { // if not refunded
if ($user->rights->deplacement->creer) {
- print ''.$langs->trans('Modify').' ';
+ print ''.$langs->trans('Modify').' ';
} else {
print ''.$langs->trans('Modify').' ';
}
diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php
index 153bd58114d..28143d0340a 100644
--- a/htdocs/compta/facture/card-rec.php
+++ b/htdocs/compta/facture/card-rec.php
@@ -1269,7 +1269,7 @@ if ($action == 'create') {
print $langs->trans('PaymentConditionsShort');
print ' ';
if ($action != 'editconditions' && $user->rights->facture->creer) {
- print '
id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
}
print '';
print '
';
@@ -1290,7 +1290,7 @@ if ($action == 'create') {
print $langs->trans('PaymentMode');
print ' ';
if ($action != 'editmode' && $user->rights->facture->creer) {
- print '
id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '';
print '
';
@@ -1310,7 +1310,7 @@ if ($action == 'create') {
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print ' ';
if ($usercancreate && $action != 'editmulticurrencycode' && !empty($object->brouillon)) {
- print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '
';
@@ -1326,7 +1326,7 @@ if ($action == 'create') {
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print ' ';
if ($usercancreate && $action != 'editmulticurrencyrate' && !empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
- print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '
';
@@ -1398,7 +1398,7 @@ if ($action == 'create') {
print $langs->trans('BankAccount');
print ' ';
if (($action != 'editbankaccount') && $user->rights->facture->creer && $object->statut == FactureRec::STATUS_DRAFT) {
- print ' id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '';
print '
';
@@ -1416,7 +1416,7 @@ if ($action == 'create') {
print $langs->trans('Model');
print ' ';
if (($action != 'editmodelpdf') && $user->rights->facture->creer && $object->statut == FactureRec::STATUS_DRAFT) {
- print ' id.'">'.img_edit($langs->trans('SetModel'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetModel'), 1).' ';
}
print '';
print '
';
@@ -1463,7 +1463,7 @@ if ($action == 'create') {
print $langs->trans('Frequency');
print ' ';
if ($action != 'editfrequency' && $user->rights->facture->creer) {
- print '
id.'">'.img_edit($langs->trans('Edit'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('Edit'), 1).' ';
}
print '';
print '
';
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 7ddb90cd4da..764af7a232a 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -4336,7 +4336,7 @@ if ($action == 'create') {
print $langs->trans('DateInvoice');
print ' ';
if ($action != 'editinvoicedate' && !empty($object->brouillon) && $usercancreate && empty($conf->global->FAC_FORCE_DATE_VALIDATION)) {
- print '
id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
}
print '';
print '
';
@@ -4356,7 +4356,7 @@ if ($action == 'create') {
print '';
print ' ';
if ($action == 'editdate_pointoftax') {
@@ -4373,7 +4373,7 @@ if ($action == 'create') {
print $langs->trans('PaymentConditionsShort');
print ' ';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && $usercancreate) {
- print '
id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
}
print '';
print '
';
@@ -4394,7 +4394,7 @@ if ($action == 'create') {
print $langs->trans('DateMaxPayment');
print ' ';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && $usercancreate) {
- print '
id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
}
print '';
print '
';
@@ -4418,7 +4418,7 @@ if ($action == 'create') {
print $langs->trans('PaymentMode');
print ' ';
if ($action != 'editmode' && $usercancreate) {
- print '
id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '';
print '
';
@@ -4438,7 +4438,7 @@ if ($action == 'create') {
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print ' ';
if ($usercancreate && $action != 'editmulticurrencycode' && !empty($object->brouillon)) {
- print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '
';
@@ -4454,7 +4454,7 @@ if ($action == 'create') {
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print ' ';
if ($usercancreate && $action != 'editmulticurrencyrate' && !empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
- print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '
';
@@ -4482,7 +4482,7 @@ if ($action == 'create') {
print $langs->trans('BankAccount');
print ' ';
if (($action != 'editbankaccount') && $usercancreate) {
- print ' id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '';
print '
';
@@ -4502,7 +4502,7 @@ if ($action == 'create') {
print $langs->trans('IncotermLabel');
print ' ';
if ($usercancreate) {
- print ''.img_edit().' ';
+ print ''.img_edit().' ';
} else {
print ' ';
}
@@ -4532,7 +4532,7 @@ if ($action == 'create') {
print $langs->trans('RetainedWarranty');
print ' ';
if ($action != 'editretainedwarranty' && $user->rights->facture->creer) {
- print '
id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).' ';
}
print '';
@@ -4555,7 +4555,7 @@ if ($action == 'create') {
print $langs->trans('PaymentConditionsShortRetainedWarranty');
print '';
if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer) {
- print '
id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).' ';
}
print '';
@@ -4590,7 +4590,7 @@ if ($action == 'create') {
print $langs->trans('RetainedWarrantyDateLimit');
print '';
if ($action != 'editretainedwarrantydatelimit' && $user->rights->facture->creer) {
- print '
id.'">'.img_edit($langs->trans('setretainedwarrantyDateLimit'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('setretainedwarrantyDateLimit'), 1).' ';
}
print '';
@@ -4676,7 +4676,7 @@ if ($action == 'create') {
print $langs->trans('RevenueStamp');
print '';
if ($action != 'editrevenuestamp' && !empty($object->brouillon) && $usercancreate) {
- print '
id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).' ';
}
print '';
print '
';
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index e6a49cf6077..b2074224412 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -549,7 +549,7 @@ $sql .= ' typent.code as typent_code,';
$sql .= ' state.code_departement as state_code, state.nom as state_name,';
$sql .= ' country.code as country_code,';
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
-$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
+$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
if (!$sall) {
@@ -572,7 +572,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
-if (!empty($search_categ_cus) && $search_categ_cus!=-1) {
+if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
}
@@ -2013,8 +2013,8 @@ if ($resql) {
$userstatic->login = $obj->login;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
- $userstatic->email = $obj->email;
- $userstatic->statut = $obj->statut;
+ $userstatic->email = $obj->user_email;
+ $userstatic->statut = $obj->user_statut;
$userstatic->entity = $obj->entity;
$userstatic->photo = $obj->photo;
$userstatic->office_phone = $obj->office_phone;
diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php
index e94fd6f5e1b..7e5a7047060 100644
--- a/htdocs/compta/facture/prelevement.php
+++ b/htdocs/compta/facture/prelevement.php
@@ -363,7 +363,7 @@ if ($object->id > 0) {
print $langs->trans('DateInvoice');
print ' ';
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) {
- print '
id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
}
print '';
print '
';
@@ -386,7 +386,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentConditionsShort');
print ' ';
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) {
- print '
id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
}
print '';
print '
';
@@ -407,7 +407,7 @@ if ($object->id > 0) {
print $langs->trans('DateMaxPayment');
print ' ';
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) {
- print '
id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
}
print '';
print '
';
@@ -436,7 +436,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentMode');
print ' ';
if ($action != 'editmode' && !empty($object->brouillon) && $user->rights->facture->creer) {
- print '
id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '';
print '
';
@@ -453,7 +453,7 @@ if ($object->id > 0) {
print $langs->trans('BankAccount');
print ' ';
if (($action != 'editbankaccount') && $user->rights->commande->creer && !empty($object->brouillon)) {
- print ' id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '';
print '
';
@@ -537,7 +537,7 @@ if ($object->id > 0) {
print $langs->trans('RevenueStamp');
print ' ';
if ($action != 'editrevenuestamp' && !empty($object->brouillon) && $user->rights->facture->creer) {
- print '
id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).' ';
}
print '';
print '
';
diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php
index 61d295a29b0..9b235926421 100644
--- a/htdocs/compta/paiement/cheque/card.php
+++ b/htdocs/compta/paiement/cheque/card.php
@@ -529,7 +529,7 @@ if ($action == 'new') {
print $langs->trans('Date');
print ' ';
if ($action != 'editdate') {
- print '
id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
}
print '';
print '
';
@@ -554,7 +554,7 @@ if ($action == 'new') {
print '';
print ' ';
if ($action == 'editrefext')
diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php
index 257e7617531..58cfe5be72d 100644
--- a/htdocs/compta/prelevement/card.php
+++ b/htdocs/compta/prelevement/card.php
@@ -198,8 +198,7 @@ if ($id > 0 || $ref) {
print '
';
print '';
- //print ''.$langs->trans("Ref").' '.$object->getNomUrl(1).' ';
- print ''.$langs->trans("Date").' '.dol_print_date($object->datec, 'day').' ';
+ print ''.$langs->trans("Date").' '.dol_print_date($object->datec, 'day').' ';
print ''.$langs->trans("Amount").' '.price($object->amount).' ';
@@ -237,7 +236,7 @@ if ($id > 0 || $ref) {
$acc = new Account($db);
$result = $acc->fetch(($object->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT));
- print '';
+ print ' ';
$labelofbankfield = "BankToReceiveWithdraw";
if ($object->type == 'bank-transfer') {
$labelofbankfield = 'BankToPayCreditTransfer';
@@ -251,7 +250,7 @@ if ($id > 0 || $ref) {
print ' ';
print ' ';
- print '';
+ print ' ';
$labelfororderfield = 'WithdrawalFile';
if ($object->type == 'bank-transfer') {
$labelfororderfield = 'CreditTransferFile';
@@ -412,10 +411,9 @@ if ($id > 0 || $ref) {
// Status of line
print " ";
+ print '';
print $ligne->LibStatut($obj->statut, 2);
- print " ";
- print ' ';
- print sprintf("%06s", $obj->rowid);
+ print ''.$obj->rowid.' ';
print ' ';
$thirdparty = new Societe($db);
diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php
index 1c57feca37e..dfd8a920f93 100644
--- a/htdocs/compta/prelevement/class/ligneprelevement.class.php
+++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php
@@ -137,29 +137,31 @@ class LignePrelevement
return $langs->trans($this->statuts[$status]);
} elseif ($mode == 1) {
if ($status == 0) {
- return img_picto($langs->trans($this->statuts[$status]), 'statut1').' '.$langs->trans($this->statuts[$status]); // Waiting
+ return img_picto($langs->trans($this->statuts[$status]), 'statut1', 'class="valignmiddle"').' '.$langs->trans($this->statuts[$status]); // Waiting
} elseif ($status == 2) {
- return img_picto($langs->trans($this->statuts[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); // Credited
+ return img_picto($langs->trans($this->statuts[$status]), 'statut6', 'class="valignmiddle"').' '.$langs->trans($this->statuts[$status]); // Credited
} elseif ($status == 3) {
- return img_picto($langs->trans($this->statuts[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]); // Refused
+ return img_picto($langs->trans($this->statuts[$status]), 'statut8', 'class="valignmiddle"').' '.$langs->trans($this->statuts[$status]); // Refused
}
} elseif ($mode == 2) {
if ($status == 0) {
- return img_picto($langs->trans($this->statuts[$status]), 'statut1');
+ return img_picto($langs->trans($this->statuts[$status]), 'statut1', 'class="valignmiddle"');
} elseif ($status == 2) {
- return img_picto($langs->trans($this->statuts[$status]), 'statut6');
+ return img_picto($langs->trans($this->statuts[$status]), 'statut6', 'class="valignmiddle"');
} elseif ($status == 3) {
- return img_picto($langs->trans($this->statuts[$status]), 'statut8');
+ return img_picto($langs->trans($this->statuts[$status]), 'statut8', 'class="valignmiddle"');
}
} elseif ($mode == 3) {
if ($status == 0) {
- return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut1');
+ return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut1', 'class="valignmiddle"');
} elseif ($status == 2) {
- return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut6');
+ return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut6', 'class="valignmiddle"');
} elseif ($status == 3) {
- return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut8');
+ return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut8', 'class="valignmiddle"');
}
}
+
+ //return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
/**
diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php
index c00c29e1c39..a100cd9156f 100644
--- a/htdocs/compta/prelevement/factures.php
+++ b/htdocs/compta/prelevement/factures.php
@@ -100,8 +100,8 @@ if ($id > 0 || $ref) {
print '
';
print ''."\n";
- //print ''.$langs->trans("Ref").' '.$object->getNomUrl(1).' ';
- print ''.$langs->trans("Date").' '.dol_print_date($object->datec, 'day').' ';
+ //print ''.$langs->trans("Ref").' '.$object->getNomUrl(1).' ';
+ print ''.$langs->trans("Date").' '.dol_print_date($object->datec, 'day').' ';
print ''.$langs->trans("Amount").' '.price($object->amount).' ';
if ($object->date_trans <> 0) {
@@ -131,7 +131,7 @@ if ($id > 0 || $ref) {
$acc = new Account($db);
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
- print '';
+ print ' ';
$labelofbankfield = "BankToReceiveWithdraw";
if ($object->type == 'bank-transfer') {
$labelofbankfield = 'BankToPayCreditTransfer';
@@ -145,7 +145,7 @@ if ($id > 0 || $ref) {
print ' ';
print ' ';
- print '';
+ print ' ';
$labelfororderfield = 'WithdrawalFile';
if ($object->type == 'bank-transfer') {
$labelfororderfield = 'CreditTransferFile';
diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php
index 8711f663d55..9ff5970e656 100644
--- a/htdocs/compta/prelevement/fiche-rejet.php
+++ b/htdocs/compta/prelevement/fiche-rejet.php
@@ -90,8 +90,8 @@ if ($prev_id > 0 || $ref) {
print '
';
print ''."\n";
- //print ''.$langs->trans("Ref").' '.$object->getNomUrl(1).' ';
- print ''.$langs->trans("Date").' '.dol_print_date($object->datec, 'day').' ';
+ //print ''.$langs->trans("Ref").' '.$object->getNomUrl(1).' ';
+ print ''.$langs->trans("Date").' '.dol_print_date($object->datec, 'day').' ';
print ''.$langs->trans("Amount").' '.price($object->amount).' ';
if ($object->date_trans <> 0) {
@@ -121,7 +121,7 @@ if ($prev_id > 0 || $ref) {
$acc = new Account($db);
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
- print '';
+ print ' ';
$labelofbankfield = "BankToReceiveWithdraw";
if ($object->type == 'bank-transfer') {
$labelofbankfield = 'BankToPayCreditTransfer';
@@ -135,7 +135,7 @@ if ($prev_id > 0 || $ref) {
print ' ';
print ' ';
- print '';
+ print ' ';
$labelfororderfield = 'WithdrawalFile';
if ($object->type == 'bank-transfer') {
$labelfororderfield = 'CreditTransferFile';
diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php
index 4a9bfbf6345..5833f417ddd 100644
--- a/htdocs/compta/prelevement/fiche-stat.php
+++ b/htdocs/compta/prelevement/fiche-stat.php
@@ -89,8 +89,8 @@ if ($prev_id > 0 || $ref) {
print '
';
print ''."\n";
- //print ''.$langs->trans("Ref").' '.$object->getNomUrl(1).' ';
- print ''.$langs->trans("Date").' '.dol_print_date($object->datec, 'day').' ';
+ //print ''.$langs->trans("Ref").' '.$object->getNomUrl(1).' ';
+ print ''.$langs->trans("Date").' '.dol_print_date($object->datec, 'day').' ';
print ''.$langs->trans("Amount").' '.price($object->amount).' ';
if ($object->date_trans <> 0) {
@@ -120,7 +120,7 @@ if ($prev_id > 0 || $ref) {
$acc = new Account($db);
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
- print '';
+ print ' ';
$labelofbankfield = "BankToReceiveWithdraw";
if ($object->type == 'bank-transfer') {
$labelofbankfield = 'BankToPayCreditTransfer';
diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php
index bea351ac46c..a82da74ab48 100644
--- a/htdocs/compta/prelevement/line.php
+++ b/htdocs/compta/prelevement/line.php
@@ -151,7 +151,9 @@ if ($id) {
print $bon->getNomUrl(1).' ';
print ''.$langs->trans("Date").' '.dol_print_date($bon->datec, 'day').' ';
- print ''.$langs->trans("Amount").' '.price($lipre->amount).' ';
+
+ print ''.$langs->trans("Amount").' '.price($lipre->amount).' ';
+
print ''.$langs->trans("Status").' '.$lipre->LibStatut($lipre->statut, 1).' ';
if ($lipre->statut == 3) {
@@ -159,6 +161,7 @@ if ($id) {
$resf = $rej->fetch($lipre->id);
if ($resf == 0) {
print ''.$langs->trans("RefusedReason").' '.$rej->motif.' ';
+
print ''.$langs->trans("RefusedData").' ';
if ($rej->date_rejet == 0) {
/* Historique pour certaines install */
@@ -167,6 +170,7 @@ if ($id) {
print dol_print_date($rej->date_rejet, 'day');
}
print ' ';
+
print ''.$langs->trans("RefusedInvoicing").' '.$rej->invoicing.' ';
} else {
print ''.$resf.' ';
@@ -229,7 +233,7 @@ if ($id) {
/*
* Action bar
*/
- print "";
+ print '
';
if ($action == '') {
if ($bon->statut == BonPrelevement::STATUS_CREDITED) {
@@ -245,7 +249,7 @@ if ($id) {
}
}
- print "
";
+ print '
';
/*
* List of invoices
@@ -267,7 +271,7 @@ if ($id) {
if ($socid) {
$sql .= " AND s.rowid = ".((int) $socid);
}
- $sql .= " ORDER BY $sortfield $sortorder ";
+ $sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($conf->liste_limit + 1, $offset);
$result = $db->query($sql);
diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php
index f436c47b10e..1223ad3ec36 100644
--- a/htdocs/compta/sociales/card.php
+++ b/htdocs/compta/sociales/card.php
@@ -577,7 +577,7 @@ if ($id > 0) {
print $langs->trans('DefaultPaymentMode');
print '';
if ($action != 'editmode') {
- print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '
';
print ' ';
@@ -595,7 +595,7 @@ if ($id > 0) {
print $langs->trans('DefaultBankAccount');
print ' ';
if ($action != 'editbankaccount' && $user->rights->tax->charges->creer) {
- print ' id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '
';
print ' ';
diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php
index 363af314113..83740385f2b 100755
--- a/htdocs/compta/tva/card.php
+++ b/htdocs/compta/tva/card.php
@@ -573,7 +573,7 @@ if ($id) {
print $langs->trans('PaymentMode');
print ' ';
if ($action != 'editmode') {
- print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '
';
print '';
@@ -591,7 +591,7 @@ if ($id) {
print $langs->trans('BankAccount');
print ' ';
if ($action != 'editbankaccount' && $user->rights->tax->charges->creer) {
- print ' id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '
';
print ' ';
diff --git a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php
index e458cdf3016..adf5bb722d3 100644
--- a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php
+++ b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php
@@ -139,11 +139,11 @@ if (!empty($this->control->tpl['action_delete'])) {
if (empty($user->socid)) {
print ' ';
@@ -1486,11 +1486,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
if ($user->rights->societe->contact->creer) {
- print ''.$langs->trans('Modify').' ';
+ print ''.$langs->trans('Modify').' ';
}
if (!$object->user_id && $user->rights->user->user->creer) {
- print ''.$langs->trans("CreateDolibarrLogin").' ';
+ print ''.$langs->trans("CreateDolibarrLogin").' ';
}
// Activer
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index bae32e8b3b1..71e888540b2 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -575,13 +575,13 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
}
$param .= '&begin='.urlencode($begin).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
$param .= '&type='.urlencode($type).'&view='.urlencode($view);
-if (!empty($search_categ)) {
+if (!empty($search_categ) && $search_categ != '-1') {
$param .= '&search_categ='.urlencode($search_categ);
}
-if (!empty($search_categ_thirdparty)) {
+if (!empty($search_categ_thirdparty) && $search_categ_thirdparty != '-1') {
$param .= '&search_categ_thirdparty='.urlencode($search_categ_thirdparty);
}
-if (!empty($search_categ_supplier)) {
+if (!empty($search_categ_supplier) && $search_categ_supplier != '-1') {
$param .= '&search_categ_supplier='.urlencode($search_categ_supplier);
}
if ($sall != '') {
diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php
index a5b64e37998..285f71cae48 100644
--- a/htdocs/contact/perso.php
+++ b/htdocs/contact/perso.php
@@ -311,7 +311,7 @@ if ($action != 'edit') {
print '";
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index bf9208ccb2b..9d8cdb78912 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -1541,12 +1541,12 @@ if ($action == 'create') {
print ' ';
if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0)) {
print '';
- print '';
+ print ' ';
print img_picto($langs->trans("MoveToAnotherContract"), 'uparrow');
print ' ';
}
if ($user->rights->contrat->creer && ($object->statut >= 0)) {
- print '';
+ print ' ';
print img_edit();
print ' ';
}
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index 66d84874d76..7e19ec13e22 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -431,40 +431,40 @@ if ($search_ref_supplier != '') {
if ($search_op2df != '') {
$param .= '&search_op2df='.urlencode($search_op2df);
}
-if ($search_date_startday) {
+if ($search_date_startday > 0) {
$param .= '&search_date_startday='.urlencode($search_date_startday);
}
-if ($search_date_startmonth) {
+if ($search_date_startmonth > 0) {
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
}
-if ($search_date_startyear) {
+if ($search_date_startyear > 0) {
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
}
-if ($search_date_endday) {
+if ($search_date_endday > 0) {
$param .= '&search_date_endday='.urlencode($search_date_endday);
}
-if ($search_date_endmonth) {
+if ($search_date_endmonth > 0) {
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
}
-if ($search_date_endyear) {
+if ($search_date_endyear > 0) {
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
}
-if ($search_dfyear != '') {
+if ($search_dfyear > 0) {
$param .= '&search_dfyear='.urlencode($search_dfyear);
}
-if ($search_dfmonth != '') {
+if ($search_dfmonth > 0) {
$param .= '&search_dfmonth='.urlencode($search_dfmonth);
}
-if ($search_sale != '') {
+if ($search_sale > 0) {
$param .= '&search_sale='.urlencode($search_sale);
}
-if ($search_user != '') {
+if ($search_user > 0) {
$param .= '&search_user='.urlencode($search_user);
}
-if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
+if ($search_type_thirdparty > 0) {
$param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
}
-if ($search_product_category != '') {
+if ($search_product_category > 0) {
$param .= '&search_product_category='.urlencode($search_product_category);
}
if ($show_files) {
diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php
index 2cc477520ea..a6157d2a26b 100644
--- a/htdocs/core/actions_addupdatedelete.inc.php
+++ b/htdocs/core/actions_addupdatedelete.inc.php
@@ -129,6 +129,7 @@ if ($action == 'add' && !empty($permissiontoadd)) {
if (!$error) {
$result = $object->create($user);
+ var_dump($object);exit;
if ($result > 0) {
// Creation OK
if ($conf->categorie->enabled && method_exists($object, 'setCategories')) {
diff --git a/htdocs/core/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php
index 5b95b58d29d..0a5e4548e3f 100644
--- a/htdocs/core/boxes/box_members_by_type.php
+++ b/htdocs/core/boxes/box_members_by_type.php
@@ -68,7 +68,7 @@ class box_members_by_type extends ModeleBoxes
$this->enabled = 0; // disabled for external users
}
- $this->hidden = !($user->rights->adherent->lire);
+ $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire);
}
/**
diff --git a/htdocs/core/boxes/box_members_last_modified.php b/htdocs/core/boxes/box_members_last_modified.php
index 9de6a3af12f..cf70bcafcb1 100644
--- a/htdocs/core/boxes/box_members_last_modified.php
+++ b/htdocs/core/boxes/box_members_last_modified.php
@@ -67,7 +67,7 @@ class box_members_last_modified extends ModeleBoxes
$this->enabled = 0; // disabled for external users
}
- $this->hidden = !($user->rights->adherent->lire);
+ $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire);
}
/**
diff --git a/htdocs/core/boxes/box_members_last_subscriptions.php b/htdocs/core/boxes/box_members_last_subscriptions.php
index 3cea44c2dc3..949edd567f3 100644
--- a/htdocs/core/boxes/box_members_last_subscriptions.php
+++ b/htdocs/core/boxes/box_members_last_subscriptions.php
@@ -67,7 +67,7 @@ class box_members_last_subscriptions extends ModeleBoxes
$this->enabled = 0; // disabled for external users
}
- $this->hidden = !($user->rights->adherent->lire);
+ $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire);
}
/**
diff --git a/htdocs/core/boxes/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php
index be835511c6b..fe64f37c805 100644
--- a/htdocs/core/boxes/box_members_subscriptions_by_year.php
+++ b/htdocs/core/boxes/box_members_subscriptions_by_year.php
@@ -67,7 +67,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes
$this->enabled = 0; // disabled for external users
}
- $this->hidden = !($user->rights->adherent->lire);
+ $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire);
}
/**
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index ec145f89f43..8e43a70c3fe 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -826,9 +826,10 @@ class Conf
$this->global->MAIN_MODULE_DOLISTORE_API_KEY = 'dolistorecatalogpublickey1234567';
}
- // If we are in develop mode, we activate the option MAIN_SECURITY_CSRF_WITH_TOKEN to 1 if not already defined.
- if (!isset($this->global->MAIN_SECURITY_CSRF_WITH_TOKEN) && $this->global->MAIN_FEATURES_LEVEL >= 2) {
- $this->global->MAIN_SECURITY_CSRF_WITH_TOKEN = 1;
+ // Enable by default the CSRF protection by token.
+ if (!isset($this->global->MAIN_SECURITY_CSRF_WITH_TOKEN)) {
+ $this->global->MAIN_SECURITY_CSRF_WITH_TOKEN = 1; // Value 2 uses also CSRF check for all GET requests
+ // Note: Set MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL=1 to have a renewal of token at each page call instead of each session (not recommended)
}
if (defined('MAIN_ANTIVIRUS_COMMAND')) {
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 9eb84c39c89..5710d47644b 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -2047,9 +2047,9 @@ class ExtraFields
*
* @param array $extralabels Deprecated (old $array of extrafields, now set this to null)
* @param object $object Object
- * @param string $onlykey Only some keys are filled:$this
+ * @param string $onlykey Only some keys are filled:
* 'string' => When we make update of only one extrafield ($action = 'update_extras'), calling page can set this to avoid to have other extrafields being reset.
- * '@GETPOSTISSET' => When we make update of extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset.
+ * '@GETPOSTISSET' => When we make update of several extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset.
* @return int 1 if array_options set, 0 if no value, -1 if error (field required missing for example)
*/
public function setOptionalsFromPost($extralabels, &$object, $onlykey = '')
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 01bd1a13141..8deda2ecd09 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -165,7 +165,7 @@ class Form
$ret .= ' ';
}
if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) {
- $ret .= 'id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).' ';
+ $ret .= 'id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).' ';
}
if (!empty($notabletag) && $notabletag == 1) {
$ret .= ' : ';
diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php
index 0048031d0e7..0590566582d 100644
--- a/htdocs/core/class/html.formactions.class.php
+++ b/htdocs/core/class/html.formactions.class.php
@@ -178,7 +178,8 @@ class FormActions
$sortfield = 'a.datep,a.id';
$sortorder = 'DESC,DESC';
- $listofactions = ActionComm::getActions($this->db, $socid, $object->id, $typeelement, '', $sortfield, $sortorder, ($max ? ($max + 1) : 0));
+ $actioncomm = new ActionComm($this->db);
+ $listofactions = $actioncomm->getActions($socid, $object->id, $typeelement, '', $sortfield, $sortorder, ($max ? ($max + 1) : 0));
if (!is_array($listofactions)) {
dol_print_error($this->db, 'FailedToGetActions');
}
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index ca7e939fb6f..f25a6e0933c 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -136,6 +136,7 @@ class FormFile
$out .= ' '."\n";
$out .= ' '."\n";
$out .= ' '."\n";
+ $out .= ' '."\n";
}
$out .= '';
@@ -215,13 +216,13 @@ class FormFile
$langs->load('link');
$out .= ''.$langs->trans("OverwriteIfExists").' ';
}
- $out .= ' trans("Upload").'"';
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : '');
$out .= '>';
if ($addcancel) {
$out .= ' ';
- $out .= ' ';
+ $out .= ' ';
}
if (!empty($conf->global->MAIN_UPLOAD_DOC)) {
@@ -275,6 +276,7 @@ class FormFile
$out .= ' '."\n";
$out .= ' '."\n";
$out .= ' '."\n";
+ $out .= ' '."\n";
}
$out .= '';
@@ -293,7 +295,7 @@ class FormFile
$out .= ' ';
$out .= '
';
$out .= '';
- $out .= ' trans("ToLink").'"';
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : '');
$out .= '>';
$out .= '
';
@@ -1454,7 +1456,7 @@ class FormFile
if ($permtoeditline) {
$paramsectiondir = (in_array($modulepart, array('medias', 'ecm')) ? '§ion_dir='.urlencode($relativepath) : '');
- print ''.img_edit('default', 0, 'class="paddingrightonly"').' ';
+ print ''.img_edit('default', 0, 'class="paddingrightonly"').' ';
}
}
if ($permonobject) {
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index c37766b24df..a4b18470be4 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -762,7 +762,7 @@ class FormTicket
$arraycodenotparent[] = "";
$stringtoprint = ''.$langs->trans("GroupOfTicket").' ';
- $stringtoprint .= '';
+ $stringtoprint .= '';
$stringtoprint .= ' ';
$sql = "SELECT ctc.rowid, ctc.code, ctc.label, ctc.fk_parent, ctc.public, ";
diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php
index fb59e2b7c42..bdd0f79a0aa 100644
--- a/htdocs/core/class/infobox.class.php
+++ b/htdocs/core/class/infobox.class.php
@@ -83,7 +83,7 @@ class InfoBox
/**
* Return array of boxes qualified for area and user
*
- * @param DoliDB $db Database handler
+ * @param DoliDB $dbs Database handler
* @param string $mode 'available' or 'activated'
* @param int $zone Name or area (-1 for all, 0 for Homepage, 1 for Accountancy, 2 for xxx, ...)
* @param User|null $user Object user to filter
@@ -91,7 +91,7 @@ class InfoBox
* @param int $includehidden Include also hidden boxes
* @return array Array of boxes
*/
- public static function listBoxes($db, $mode, $zone, $user = null, $excludelist = array(), $includehidden = 1)
+ public static function listBoxes($dbs, $mode, $zone, $user = null, $excludelist = array(), $includehidden = 1)
{
global $conf;
@@ -119,12 +119,12 @@ class InfoBox
}
dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user) ? $user->id : '')."", LOG_DEBUG);
- $resql = $db->query($sql);
+ $resql = $dbs->query($sql);
if ($resql) {
- $num = $db->num_rows($resql);
+ $num = $dbs->num_rows($resql);
$j = 0;
while ($j < $num) {
- $obj = $db->fetch_object($resql);
+ $obj = $dbs->fetch_object($resql);
if (!in_array($obj->box_id, $excludelist)) {
$regs = array();
@@ -144,7 +144,7 @@ class InfoBox
// Goal is to avoid making a "new" done for each boxes returned by select.
dol_include_once($relsourcefile);
if (class_exists($boxname)) {
- $box = new $boxname($db, $obj->note); // Constructor may set properties like box->enabled. obj->note is note into box def, not user params.
+ $box = new $boxname($dbs, $obj->note); // Constructor may set properties like box->enabled. obj->note is note into box def, not user params.
//$box=new stdClass();
// box properties
@@ -204,8 +204,8 @@ class InfoBox
$j++;
}
} else {
- dol_syslog($db->lasterror(), LOG_ERR);
- return array('error'=>$db->lasterror());
+ dol_syslog($dbs->lasterror(), LOG_ERR);
+ return array('error'=>$dbs->lasterror());
}
return $boxes;
@@ -215,13 +215,13 @@ class InfoBox
/**
* Save order of boxes for area and user
*
- * @param DoliDB $db Database handler
+ * @param DoliDB $dbs Database handler
* @param int $zone Name of area (0 for Homepage, ...)
* @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...'
* @param int $userid Id of user
* @return int <0 if KO, 0=Nothing done, > 0 if OK
*/
- public static function saveboxorder($db, $zone, $boxorder, $userid = 0)
+ public static function saveboxorder($dbs, $zone, $boxorder, $userid = 0)
{
global $conf;
@@ -235,18 +235,18 @@ class InfoBox
return 0;
}
- $user = new User($db);
+ $user = new User($dbs);
$user->id = $userid;
- $db->begin();
+ $dbs->begin();
// Save parameters to say user has a dedicated setup
$tab = array();
$confuserzone = 'MAIN_BOXES_'.$zone;
$tab[$confuserzone] = 1;
- if (dol_set_user_param($db, $conf, $user, $tab) < 0) {
- $error = $db->lasterror();
- $db->rollback();
+ if (dol_set_user_param($dbs, $conf, $user, $tab) < 0) {
+ $error = $dbs->lasterror();
+ $dbs->rollback();
return -3;
}
@@ -257,7 +257,7 @@ class InfoBox
$sql .= " AND position = ".((int) $zone);
dol_syslog(get_class()."::saveboxorder", LOG_DEBUG);
- $result = $db->query($sql);
+ $result = $dbs->query($sql);
if ($result) {
$colonnes = explode('-', $boxorder);
foreach ($colonnes as $collist) {
@@ -279,12 +279,12 @@ class InfoBox
$sql .= " values (";
$sql .= " ".((int) $id).",";
$sql .= " ".((int) $zone).",";
- $sql .= " '".$db->escape($colonne.$ii)."',";
+ $sql .= " '".$dbs->escape($colonne.$ii)."',";
$sql .= " ".((int) $userid).",";
$sql .= " ".((int) $conf->entity);
$sql .= ")";
- $result = $db->query($sql);
+ $result = $dbs->query($sql);
if ($result < 0) {
$error++;
break;
@@ -297,10 +297,10 @@ class InfoBox
}
if ($error) {
- $db->rollback();
+ $dbs->rollback();
return -2;
} else {
- $db->commit();
+ $dbs->commit();
return 1;
}
}
diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php
index 2a5e0f99c64..eaf4804b213 100644
--- a/htdocs/core/class/link.class.php
+++ b/htdocs/core/class/link.class.php
@@ -274,24 +274,24 @@ class Link extends CommonObject
/**
* Return nb of links
*
- * @param DoliDb $db Database handler
+ * @param DoliDb $dbs Database handler
* @param string $objecttype Type of the associated object in dolibarr
* @param int $objectid Id of the associated object in dolibarr
* @return int Nb of links, -1 if error
**/
- public static function count($db, $objecttype, $objectid)
+ public static function count($dbs, $objecttype, $objectid)
{
global $conf;
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."links";
- $sql .= " WHERE objecttype = '".$db->escape($objecttype)."' AND objectid = ".((int) $objectid);
+ $sql .= " WHERE objecttype = '".$dbs->escape($objecttype)."' AND objectid = ".((int) $objectid);
if ($conf->entity != 0) {
$sql .= " AND entity = ".$conf->entity;
}
- $resql = $db->query($sql);
+ $resql = $dbs->query($sql);
if ($resql) {
- $obj = $db->fetch_object($resql);
+ $obj = $dbs->fetch_object($resql);
if ($obj) {
return $obj->nb;
}
diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php
index 9b812df8dc2..c6769ad0619 100644
--- a/htdocs/core/db/Database.interface.php
+++ b/htdocs/core/db/Database.interface.php
@@ -177,6 +177,14 @@ interface Database
*/
public function escape($stringtoencode);
+ /**
+ * Escape a string to insert data
+ *
+ * @param string $stringtoencode String to escape
+ * @return string String escaped
+ */
+ public function escapeunderscore($stringtoencode);
+
/**
* Sanitize a string for SQL forging
*
diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php
index 02a1e5d13d3..0db4e16a897 100644
--- a/htdocs/core/db/mysqli.class.php
+++ b/htdocs/core/db/mysqli.class.php
@@ -440,6 +440,17 @@ class DoliDBMysqli extends DoliDB
return $this->db->real_escape_string($stringtoencode);
}
+ /**
+ * Escape a string to insert data
+ *
+ * @param string $stringtoencode String to escape
+ * @return string String escaped
+ */
+ public function escapeunderscore($stringtoencode)
+ {
+ return str_replace('_', '\_', $stringtoencode);
+ }
+
/**
* Return generic error code of last operation.
*
diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php
index 9d17d4b9099..5997349d0c5 100644
--- a/htdocs/core/db/pgsql.class.php
+++ b/htdocs/core/db/pgsql.class.php
@@ -713,6 +713,17 @@ class DoliDBPgsql extends DoliDB
return pg_escape_string($stringtoencode);
}
+ /**
+ * Escape a string to insert data
+ *
+ * @param string $stringtoencode String to escape
+ * @return string String escaped
+ */
+ public function escapeunderscore($stringtoencode)
+ {
+ return str_replace('_', '\_', $stringtoencode);
+ }
+
/**
* Format a SQL IF
*
diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php
index e2a2c124737..c03d2a5ee04 100644
--- a/htdocs/core/db/sqlite3.class.php
+++ b/htdocs/core/db/sqlite3.class.php
@@ -645,6 +645,17 @@ class DoliDBSqlite3 extends DoliDB
return Sqlite3::escapeString($stringtoencode);
}
+ /**
+ * Escape a string to insert data
+ *
+ * @param string $stringtoencode String to escape
+ * @return string String escaped
+ */
+ public function escapeunderscore($stringtoencode)
+ {
+ return str_replace('_', '\_', $stringtoencode);
+ }
+
/**
* Renvoie le code erreur generique de l'operation precedente.
*
diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php
index 12022ed178c..702d6673527 100644
--- a/htdocs/core/lib/barcode.lib.php
+++ b/htdocs/core/lib/barcode.lib.php
@@ -59,7 +59,10 @@ if (empty($font_loc)) {
if (defined('PHP-BARCODE_PATH_COMMAND')) {
$genbarcode_loc = constant('PHP-BARCODE_PATH_COMMAND');
} else {
- $genbarcode_loc = $conf->global->GENBARCODE_LOCATION;
+ $genbarcode_loc = '';
+ if (!empty($conf->global->GENBARCODE_LOCATION)) {
+ $genbarcode_loc = $conf->global->GENBARCODE_LOCATION;
+ }
}
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index 1d8024cf40e..0adcb967991 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -1295,7 +1295,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
// Edit
if ($user->rights->societe->contact->creer) {
- print '';
+ print ' ';
print img_edit();
print ' ';
}
@@ -2003,7 +2003,7 @@ function show_subsidiaries($conf, $langs, $db, $object)
print ''.$obj->code_client.' ';
print '';
- print '';
+ print ' ';
print img_edit();
print ' ';
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 698bf4410da..ef7f320f049 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -4386,7 +4386,7 @@ function img_mime($file, $titlealt = '', $morecss = '')
}
//return img_picto_common($titlealt, 'mime/'.$mimeimg, 'class="'.$morecss.'"');
- return ' ';
+ return ' ';
}
@@ -6977,7 +6977,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = 'Security key for payment on a member subscription (one key per member)';
$substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = 'Security key for payment on an order';
$substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = 'Security key for payment on an invoice';
- $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = 'Security key for payment on a a service';
+ $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = 'Security key for payment on a service of a contract';
$substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = 'Direct download url of a proposal';
$substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = 'Direct download url of an order';
diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php
index ba18e415539..e2067240c45 100644
--- a/htdocs/core/lib/ticket.lib.php
+++ b/htdocs/core/lib/ticket.lib.php
@@ -699,7 +699,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
if ($user->rights->agenda->allactions->create ||
(($actionstatic->authorid == $user->id || $actionstatic->userownerid == $user->id) && $user->rights->agenda->myactions->create)) {
- $out .= ' ';
+ $out .= ' ';
}
$out .= '';
diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php
index fda21e28a21..05e6d51a78d 100644
--- a/htdocs/core/lib/treeview.lib.php
+++ b/htdocs/core/lib/treeview.lib.php
@@ -190,7 +190,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset
print "\n".'';
if ($showfk) {
print '';
- print ' ';
+ print ' ';
print $tab[$x]['title'];
print ' ';
print ' (mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' - fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].')';
diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php
index 29f208e5254..7a9bb12172b 100644
--- a/htdocs/core/lib/usergroups.lib.php
+++ b/htdocs/core/lib/usergroups.lib.php
@@ -400,7 +400,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
if (!file_exists($file)) {
$url = DOL_URL_ROOT.'/public/theme/common/nophoto.png';
}
- print ' id : '').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">';
+ print ' id : '').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">';
if ($subdir == $conf->global->MAIN_THEME) {
$title = $langs->trans("ThemeCurrentlyActive");
} else {
diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php
index 89fd777cd20..20380e02aab 100644
--- a/htdocs/core/lib/website.lib.php
+++ b/htdocs/core/lib/website.lib.php
@@ -866,11 +866,11 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so
$sql .= " AND (";
$searchalgo = '';
if (preg_match('/meta/', $algo)) {
- $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.title LIKE '%".$db->escape($searchstring)."%' OR wp.description LIKE '%".$db->escape($searchstring)."%'";
- $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.keywords LIKE '".$db->escape($searchstring).",%' OR wp.keywords LIKE '% ".$db->escape($searchstring)."%'"; // TODO Use a better way to scan keywords
+ $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.title LIKE '%".$db->escapeunderscore($db->escape($searchstring))."%' OR wp.description LIKE '%".$db->escapeunderscore($db->escape($searchstring))."%'";
+ $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.keywords LIKE '".$db->escapeunderscore($db->escape($searchstring)).",%' OR wp.keywords LIKE '% ".$db->escapeunderscore($db->escape($searchstring))."%'"; // TODO Use a better way to scan keywords
}
if (preg_match('/content/', $algo)) {
- $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.content LIKE '%".$db->escape($searchstring)."%'";
+ $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.content LIKE '%".$db->escapeunderscore($db->escape($searchstring))."%'";
}
$sql .= $searchalgo;
if (is_array($otherfilters) && !empty($otherfilters['category'])) {
@@ -879,6 +879,7 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so
$sql .= ")";
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($max);
+ //print $sql;
$resql = $db->query($sql);
if ($resql) {
diff --git a/htdocs/core/modules/modMultiCurrency.class.php b/htdocs/core/modules/modMultiCurrency.class.php
index 5bf91ec341e..e89a2a4fe3e 100644
--- a/htdocs/core/modules/modMultiCurrency.class.php
+++ b/htdocs/core/modules/modMultiCurrency.class.php
@@ -300,10 +300,11 @@ class modMultiCurrency extends DolibarrModules
{
global $conf, $user, $langs;
- if (!MultiCurrency::checkCodeAlreadyExists($conf->currency)) {
+ $multicurrency = new MultiCurrency($this->db);
+
+ if (! $multicurrency->checkCodeAlreadyExists($conf->currency)) {
$langs->loadCacheCurrencies('');
- $multicurrency = new MultiCurrency($this->db);
$multicurrency->code = $conf->currency;
$multicurrency->name = $langs->cache_currencies[$conf->currency]['label'].' ('.$langs->getCurrencySymbol($conf->currency).')';
$r = $multicurrency->create($user);
diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php
index eed6871c465..c3eba65673b 100644
--- a/htdocs/core/modules/modSociete.class.php
+++ b/htdocs/core/modules/modSociete.class.php
@@ -281,6 +281,9 @@ class modSociete extends DolibarrModules
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
$this->export_fields_array[$r]['s.price_level'] = 'PriceLevel';
}
+ if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
+ $this->export_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode');
+ }
// Add multicompany field
if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) {
$nbofallowedentities = count(explode(',', getEntity('societe'))); // If project are shared, nb will be > 1
@@ -317,7 +320,8 @@ class modSociete extends DolibarrModules
'payterm.libelle'=>'Text', 'paymode.libelle'=>'Text',
's.outstanding_limit'=>'Numeric', 'pbacc.ref'=>'Text', 'incoterm.code'=>'Text',
'u.login'=>'Text', 'u.firstname'=>'Text', 'u.lastname'=>'Text',
- 's.entity'=>'Numeric', 's.price_level'=>'Numeric'
+ 's.entity'=>'Numeric', 's.price_level'=>'Numeric',
+ 's.accountancy_code_sell'=>'Text', 's.accountancy_code_buy'=>'Text'
);
$this->export_entities_array[$r] = array('u.login'=>'user', 'u.firstname'=>'user', 'u.lastname'=>'user'); // We define here only fields that use another picto
@@ -488,6 +492,9 @@ class modSociete extends DolibarrModules
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
$this->import_fields_array[$r]['s.price_level'] = 'PriceLevel';
}
+ if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
+ $this->import_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode');
+ }
// Add extra fields
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
@@ -621,7 +628,9 @@ class modSociete extends DolibarrModules
's.canvas' => "empty / a custom canvas form layout url e.g. mycanvas@mymodule",
's.datec' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'),
's.fk_multicurrency' => '0 (use system default currency) / 1 (use local currency)',
- 's.multicurrency_code' => 'GBP/USD etc... matches field "code_iso" in table "'.MAIN_DB_PREFIX.'c_currencies"'
+ 's.multicurrency_code' => 'GBP/USD etc... matches field "code_iso" in table "'.MAIN_DB_PREFIX.'c_currencies"',
+ 's.accountancy_code_sell' => '707',
+ 's.accountancy_code_buy' => '607',
);
$this->import_updatekeys_array[$r] = array(
's.nom' => 'Name',
diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php
index 88c643c641d..acc5fad8125 100644
--- a/htdocs/core/tpl/ajaxrow.tpl.php
+++ b/htdocs/core/tpl/ajaxrow.tpl.php
@@ -66,7 +66,7 @@ $(document).ready(function(){
var fk_element = "";
var element_id = "";
var filepath = "";
- var token = ""; // We use old 'token' and not 'newtoken' for Ajax call because the ajax page has the NOTOKENRENEWAL constant set.
+ var token = ""; // We use old 'token' and not 'newtoken' for Ajax call because the ajax page has the NOTOKENRENEWAL constant set.
$.post("/core/ajax/row.php",
{
roworder: roworder,
diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php
index f50276821b1..cd58ae554f2 100644
--- a/htdocs/core/tpl/extrafields_view.tpl.php
+++ b/htdocs/core/tpl/extrafields_view.tpl.php
@@ -208,7 +208,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l
$fieldid = 'socid';
}
- print ' '.img_edit().' ';
+ print ''.img_edit().' ';
}
print '
';
print '';
diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php
index 8ebb767a4d8..6a7d48add5e 100644
--- a/htdocs/core/tpl/objectline_view.tpl.php
+++ b/htdocs/core/tpl/objectline_view.tpl.php
@@ -384,7 +384,7 @@ if ($this->statut == 0 && !empty($object_rights->creer) && $action != 'selectlin
$coldisplay++;
if (($line->info_bits & 2) == 2 || !empty($disableedit)) {
} else { ?>
- id.'&action=editline&lineid='.$line->id.'#line_'.$line->id; ?>">
+ id.'&action=editline&token='.newToken().'&lineid='.$line->id.'#line_'.$line->id; ?>">
';
}
print '';
@@ -392,7 +392,7 @@ if ($this->statut == 0 && !empty($object_rights->creer) && $action != 'selectlin
print ' ';
$coldisplay++;
if (!$situationinvoicelinewithparent && empty($disableremove)) { // For situation invoice, deletion is not possible if there is a parent company.
- print 'id.'&action=ask_deleteline&lineid='.$line->id.'">';
+ print ' id.'&action=ask_deleteline&token='.newToken().'&lineid='.$line->id.'">';
print img_delete();
print ' ';
}
@@ -402,12 +402,12 @@ if ($this->statut == 0 && !empty($object_rights->creer) && $action != 'selectlin
print ' ';
$coldisplay++;
if ($i > 0) { ?>
- id.'&action=up&rowid='.$line->id; ?>">
+ id.'&action=up&token='.newToken().'&rowid='.$line->id; ?>">
- id.'&action=down&rowid='.$line->id; ?>">
+ id.'&action=down&token='.newToken().'&rowid='.$line->id; ?>">
rights->cron->create) {
print ''.$langs->trans("Edit").' ';
} else {
- print ''.$langs->trans("Edit").' ';
+ print ''.$langs->trans("Edit").' ';
}
if ((empty($user->rights->cron->execute))) {
@@ -753,7 +753,7 @@ if (($action == "create") || ($action == "edit")) {
} elseif (empty($object->status)) {
print ''.$langs->trans("CronExecute").' ';
} else {
- print ''.$langs->trans("CronExecute").' ';
+ print ''.$langs->trans("CronExecute").' ';
}
if (!$user->rights->cron->create) {
diff --git a/htdocs/datapolicy/admin/setup.php b/htdocs/datapolicy/admin/setup.php
index dde8644571e..8f25461eb64 100644
--- a/htdocs/datapolicy/admin/setup.php
+++ b/htdocs/datapolicy/admin/setup.php
@@ -175,7 +175,7 @@ if ($action == 'edit') {
print '
';
print '';
}
diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php
index 267c79ab08e..2d9f70a1eb5 100644
--- a/htdocs/debugbar/class/TraceableDB.php
+++ b/htdocs/debugbar/class/TraceableDB.php
@@ -250,6 +250,17 @@ class TraceableDB extends DoliDB
return $this->db->escape($stringtoencode);
}
+ /**
+ * Escape a string to insert data
+ *
+ * @param string $stringtoencode String to escape
+ * @return string String escaped
+ */
+ public function escapeunderscore($stringtoencode)
+ {
+ return $this->db->escapeunderscore($stringtoencode);
+ }
+
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get last ID after an insert INSERT
diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php
index c72718ffce2..cca399f43af 100644
--- a/htdocs/delivery/card.php
+++ b/htdocs/delivery/card.php
@@ -427,7 +427,7 @@ if ($action == 'create') { // Create. Seems to no be used
print ' ';
if ($action != 'editdate_delivery') {
- print '
id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).' ';
}
print '';
print '
';
@@ -451,7 +451,7 @@ if ($action == 'create') { // Create. Seems to no be used
print $langs->trans('IncotermLabel');
print ' ';
if ($user->rights->expedition->delivery->creer) {
- print ''.img_edit().' ';
+ print ''.img_edit().' ';
} else {
print ' ';
}
diff --git a/htdocs/don/card.php b/htdocs/don/card.php
index 528a640b391..8ff0fa62e6c 100644
--- a/htdocs/don/card.php
+++ b/htdocs/don/card.php
@@ -855,7 +855,7 @@ if (!empty($id) && $action != 'edit') {
print ''.$langs->trans("ReOpen").' ';
}
- print '';
+ print '';
if ($object->statut == $object::STATUS_DRAFT) {
print '';
@@ -870,7 +870,7 @@ if (!empty($id) && $action != 'edit') {
if ($remaintopay == 0) {
print ''.$langs->trans('DoPayment').'
';
} else {
- print '';
+ print '';
}
}
diff --git a/htdocs/ecm/dir_card.php b/htdocs/ecm/dir_card.php
index b6aa59720ae..0b42fc17a02 100644
--- a/htdocs/ecm/dir_card.php
+++ b/htdocs/ecm/dir_card.php
@@ -454,11 +454,11 @@ if ($action != 'edit' && $action != 'delete') {
print '';
if ($permtoadd) {
- print '
'.$langs->trans('Edit').' ';
+ print '
'.$langs->trans('Edit').' ';
}
if ($permtoadd) {
- print '
'.$langs->trans('ECMAddSection').' ';
+ print '
'.$langs->trans('ECMAddSection').' ';
} else {
print '
'.$langs->trans('ECMAddSection').' ';
}
diff --git a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php
index 17c185426c0..197d995a808 100644
--- a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php
+++ b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php
@@ -16,6 +16,7 @@
* along with this program. If not, see
.
*
* Output javascript for interactions code of ecm module
+ * $conf, $module, $param, $preopened, $nameforformuserfile may be defined
*/
// Protection to avoid direct call of template
@@ -47,8 +48,8 @@ $(document).ready(function() {
$('#filetree').fileTree({
root: '',
// Ajax called if we click to expand a dir (not a file). Parameter 'dir' is provided as a POST parameter by fileTree code to this following URL.
- // We must use token=$_SESSION['token'] and not token=$_SESSION['newtoken'] here because ajaxdirtree has NOTOKENRENEWAL define so there is no rollup of token so we must compare with the one valid on main page
- script: '',
+ // We must use token=currentToken() and not newToken() here because ajaxdirtree has NOTOKENRENEWAL define so there is no rollup of token so we must compare with the one valid on main page
+ script: '',
folderEvent: 'click', // 'dblclick'
multiFolder: false },
// Called if we click on a file (not a dir)
diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php
index 1e76e3544e5..0826a53b772 100644
--- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php
+++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php
@@ -248,9 +248,9 @@ class ConferenceOrBoothAttendee extends CommonObject
}
$result = $this->createCommon($user, $notrigger);
- if ($result>0) {
- $result =$this->fetch($result);
- if ($result>0) {
+ if ($result > 0) {
+ $result = $this->fetch($result);
+ if ($result > 0) {
$this->ref = $this->id;
$result = $this->update($user);
}
@@ -293,7 +293,7 @@ class ConferenceOrBoothAttendee extends CommonObject
// Clear fields
if (property_exists($object, 'ref')) {
- $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default'];
+ $object->ref = empty($this->fields['ref']['default']) ? "(PROV)" : $this->fields['ref']['default'];
}
if (property_exists($object, 'label')) {
$object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
@@ -327,6 +327,9 @@ class ConferenceOrBoothAttendee extends CommonObject
$error++;
$this->error = $object->error;
$this->errors = $object->errors;
+ } else {
+ $object->ref = $object->id;
+ $result = $object->update($user);
}
if (!$error) {
diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php
index 7defb3dbf3c..780b3bebc55 100644
--- a/htdocs/eventorganization/conferenceorbooth_list.php
+++ b/htdocs/eventorganization/conferenceorbooth_list.php
@@ -41,7 +41,7 @@ global $dolibarr_main_url_root;
//dol_include_once('/othermodule/class/otherobject.class.php');
// Load translation files required by the page
-$langs->loadLangs(array("eventorganization", "other", "projects"));
+$langs->loadLangs(array("eventorganization", "other", "projects", "companies"));
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php
index c5562e39c37..03e309aa41d 100644
--- a/htdocs/eventorganization/conferenceorboothattendee_card.php
+++ b/htdocs/eventorganization/conferenceorboothattendee_card.php
@@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
// Load translation files required by the page
-$langs->loadLangs(array("eventorganization", "other"));
+$langs->loadLangs(array("eventorganization", "other", "projects", "companies"));
// Get parameters
$id = GETPOST('id', 'int');
@@ -110,6 +110,7 @@ $permissionnote = $user->rights->eventorganization->write; // Used by the includ
$permissiondellink = $user->rights->eventorganization->write; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1];
+
/*
* Actions
*/
@@ -134,7 +135,7 @@ if (empty($reshook)) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist;
} else {
- $backtopage = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?id='.($id > 0 ? $id : '__ID__');
+ $backtopage = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?fk_project='.((int) $fk_project).'&id='.($id > 0 ? $id : '__ID__');
}
}
}
@@ -650,9 +651,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (empty($reshook)) {
// Send
if (empty($user->socid)) {
- print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=presend&mode=init#formmailbeforetitle');
+ print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
}
- print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=edit', '', $permissiontoadd);
+ print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=edit&token='.newToken().'', '', $permissiontoadd);
// Clone
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken().'&object=scrumsprint', '', $permissiontoadd);
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index c36442915e6..c87d2fcc5ce 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -137,8 +137,15 @@ if ($reshook < 0) {
if (empty($reshook)) {
if ($cancel) {
- $action = '';
- $object->fetch($id); // show shipment also after canceling modification
+ if ($origin && $origin_id > 0) {
+ if ($origin == 'commande') {
+ header("Location: ".DOL_URL_ROOT.'/expedition/shipment.php?id='.((int) $origin_id));
+ exit;
+ }
+ } else {
+ $action = '';
+ $object->fetch($id); // show shipment also after canceling modification
+ }
}
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
@@ -1049,7 +1056,7 @@ if ($action == 'create') {
print '
'.$langs->trans("QtyShipped").' ';
print '
'.$langs->trans("QtyToShip");
if (empty($conf->productbatch->enabled)) {
- print ''.img_picto($langs->trans("Autofill"), 'autofill', 'class="paddingrightonly"').$langs->trans("Fill").' ';
+ print ''.img_picto($langs->trans("Autofill"), 'autofill', 'class="paddingrightonly"').' ';
print ' / ';
} else {
print ' ';
@@ -1760,7 +1767,7 @@ if ($action == 'create') {
print ' ';
if ($action != 'editdate_livraison') {
- print '
id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).' ';
}
print '';
print '
';
@@ -1892,7 +1899,7 @@ if ($action == 'create') {
print ' ';
if ($action != 'editshipping_method_id') {
- print '
id.'">'.img_edit($langs->trans('SetSendingMethod'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetSendingMethod'), 1).' ';
}
print '';
print '
';
@@ -1929,7 +1936,7 @@ if ($action == 'create') {
print $langs->trans('IncotermLabel');
print ' ';
if ($user->rights->expedition->creer) {
- print ''.img_edit().' ';
+ print ''.img_edit().' ';
} else {
print ' ';
}
@@ -2482,7 +2489,7 @@ if ($action == 'create') {
$label = "ClassifyBilled";
$paramaction = 'classifybilled';
}
- print 'id.'&action='.$paramaction.'">'.$langs->trans($label).' ';
+ print 'id.'&action='.$paramaction.'&token='.newToken().'">'.$langs->trans($label).' ';
}
}
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index a9372564280..623d3635ba5 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -43,9 +43,7 @@ if (!empty($conf->propal->enabled)) {
if (!empty($conf->commande->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
}
-if (!empty($conf->productbatch->enabled)) {
- require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
-}
+require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionlinebatch.class.php';
/**
@@ -1188,7 +1186,6 @@ class Expedition extends CommonObject
global $conf, $langs, $user;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
- require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
$error = 0;
$this->error = '';
@@ -1230,6 +1227,9 @@ class Expedition extends CommonObject
$resql = $this->db->query($sql);
if ($resql) {
$cpt = $this->db->num_rows($resql);
+
+ $shipmentlinebatch = new ExpeditionLineBatch($this->db);
+
for ($i = 0; $i < $cpt; $i++) {
dol_syslog(get_class($this)."::delete movement index ".$i);
$obj = $this->db->fetch_object($resql);
@@ -1240,11 +1240,12 @@ class Expedition extends CommonObject
// get lot/serial
$lotArray = null;
if ($conf->productbatch->enabled) {
- $lotArray = ExpeditionLineBatch::fetchAll($this->db, $obj->expeditiondet_id);
+ $lotArray = $shipmentlinebatch->fetchAll($obj->expeditiondet_id);
if (!is_array($lotArray)) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
}
}
+
if (empty($lotArray)) {
// no lot/serial
// We increment stock of product (and sub-products)
@@ -1276,7 +1277,8 @@ class Expedition extends CommonObject
// delete batch expedition line
if (!$error && $conf->productbatch->enabled) {
- if (ExpeditionLineBatch::deletefromexp($this->db, $this->id) < 0) {
+ $shipmentlinebatch = new ExpeditionLineBatch($this->db);
+ if ($shipmentlinebatch->deleteFromShipment($this->id) < 0) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
}
}
@@ -1372,7 +1374,6 @@ class Expedition extends CommonObject
global $conf, $langs, $user;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
- require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
$error = 0;
$this->error = '';
@@ -1460,15 +1461,16 @@ class Expedition extends CommonObject
// delete batch expedition line (we try deletion even if module not enabled in case of the module were enabled and disabled previously)
if (!$error) {
- if (ExpeditionLineBatch::deletefromexp($this->db, $this->id) < 0) {
+ $shipmentlinebatch = ExpeditionLineBatch($this->db);
+ if ($shipmentlinebatch->deleteFromShipment($this->id) < 0) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
}
}
if (!$error) {
- $main = MAIN_DB_PREFIX.'expeditiondet';
- $ef = $main."_extrafields";
- $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_expedition = ".((int) $this->id).")";
+ $main = MAIN_DB_PREFIX.'expeditiondet';
+ $ef = $main."_extrafields";
+ $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_expedition = ".((int) $this->id).")";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet";
$sql .= " WHERE fk_expedition = ".((int) $this->id);
@@ -1480,8 +1482,8 @@ class Expedition extends CommonObject
$error++;
}
- // delete extrafields
- $res = $this->deleteExtraFields();
+ // delete extrafields
+ $res = $this->deleteExtraFields();
if ($res < 0) {
$error++;
}
@@ -1597,6 +1599,7 @@ class Expedition extends CommonObject
$this->total_localtax2 = 0;
$line = new ExpeditionLigne($this->db);
+ $shipmentlinebatch = new ExpeditionLineBatch($this->db);
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
@@ -1695,9 +1698,8 @@ class Expedition extends CommonObject
// Detail of batch
if (!empty($conf->productbatch->enabled) && $obj->line_id > 0 && $obj->product_tobatch > 0) {
- require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
+ $newdetailbatch = $shipmentlinebatch->fetchAll($obj->line_id, $obj->fk_product);
- $newdetailbatch = ExpeditionLineBatch::fetchAll($this->db, $obj->line_id, $obj->fk_product);
if (is_array($newdetailbatch)) {
if ($originline != $obj->fk_origin_line) {
$line->detail_batch = $newdetailbatch;
@@ -2925,8 +2927,9 @@ class ExpeditionLigne extends CommonObjectLine
}
// fetch remaining lot qty
- require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
- if (!$error && ($lotArray = ExpeditionLineBatch::fetchAll($this->db, $this->id)) < 0) {
+ $shipmentlinebatch = new ExpeditionLineBatch($this->db);
+
+ if (!$error && ($lotArray = $shipmentlinebatch->fetchAll($this->id)) < 0) {
$this->errors[] = $this->db->lasterror()." - ExpeditionLineBatch::fetchAll";
$error++;
} else {
diff --git a/htdocs/expedition/class/expeditionbatch.class.php b/htdocs/expedition/class/expeditionlinebatch.class.php
similarity index 85%
rename from htdocs/expedition/class/expeditionbatch.class.php
rename to htdocs/expedition/class/expeditionlinebatch.class.php
index 03066869450..b2562734447 100644
--- a/htdocs/expedition/class/expeditionbatch.class.php
+++ b/htdocs/expedition/class/expeditionlinebatch.class.php
@@ -17,7 +17,7 @@
*/
/**
- * \file expedition/class/expeditionbatch.class.php
+ * \file htdocs/expedition/class/expeditionlinebatch.class.php
* \ingroup productbatch
* \brief This file implements CRUD method for managing shipment batch lines
* with batch record
@@ -33,7 +33,10 @@ class ExpeditionLineBatch extends CommonObject
*/
public $element = 'expeditionlignebatch';
- private static $_table_element = 'expeditiondet_batch'; //!< Name of table without prefix where object is stored
+ /**
+ * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management.
+ */
+ public $table_element = 'expeditiondet_batch';
public $sellby;
public $eatby;
@@ -44,6 +47,7 @@ class ExpeditionLineBatch extends CommonObject
public $fk_origin_stock;
public $fk_expeditiondet;
+
/**
* Constructor
*
@@ -74,6 +78,7 @@ class ExpeditionLineBatch extends CommonObject
$sql .= " WHERE pb.rowid = ".(int) $id_stockdluo;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
+
$resql = $this->db->query($sql);
if ($resql) {
if ($this->db->num_rows($resql)) {
@@ -106,7 +111,7 @@ class ExpeditionLineBatch extends CommonObject
$id_line_expdet = (int) $id_line_expdet;
- $sql = "INSERT INTO ".MAIN_DB_PREFIX.self::$_table_element." (";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." (";
$sql .= "fk_expeditiondet";
$sql .= ", sellby";
$sql .= ", eatby";
@@ -129,7 +134,8 @@ class ExpeditionLineBatch extends CommonObject
}
if (!$error) {
- $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.self::$_table_element);
+ $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
+
$this->fk_expeditiondet = $id_line_expdet;
return $this->id;
} else {
@@ -145,17 +151,16 @@ class ExpeditionLineBatch extends CommonObject
/**
* Delete batch record attach to a shipment
*
- * @param DoliDB $db Database object
* @param int $id_expedition rowid of shipment
* @return int -1 if KO, 1 if OK
*/
- public static function deletefromexp($db, $id_expedition)
+ public function deleteFromShipment($id_expedition)
{
- $sql = "DELETE FROM ".MAIN_DB_PREFIX.self::$_table_element;
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE fk_expeditiondet in (SELECT rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition=".((int) $id_expedition).")";
dol_syslog(__METHOD__, LOG_DEBUG);
- if ($db->query($sql)) {
+ if ($this->db->query($sql)) {
return 1;
} else {
return -1;
@@ -165,12 +170,11 @@ class ExpeditionLineBatch extends CommonObject
/**
* Retrieve all batch number detailed information of a shipment line
*
- * @param DoliDB $db Database object
* @param int $id_line_expdet id of shipment line
* @param int $fk_product If provided, load also detailed information of lot
* @return int|array -1 if KO, array of ExpeditionLineBatch if OK
*/
- public static function fetchAll($db, $id_line_expdet, $fk_product = 0)
+ public function fetchAll($id_line_expdet, $fk_product = 0)
{
$sql = "SELECT";
$sql .= " eb.rowid,";
@@ -184,25 +188,24 @@ class ExpeditionLineBatch extends CommonObject
$sql .= ", pl.sellby";
$sql .= ", pl.eatby";
}
- $sql .= " FROM ".MAIN_DB_PREFIX.self::$_table_element." as eb";
+ $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as eb";
if ($fk_product > 0) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lot as pl ON pl.batch = eb.batch AND pl.fk_product = ".((int) $fk_product);
}
$sql .= " WHERE fk_expeditiondet=".(int) $id_line_expdet;
dol_syslog(__METHOD__."", LOG_DEBUG);
- $resql = $db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql) {
- $num = $db->num_rows($resql);
+ $num = $this->db->num_rows($resql);
$i = 0;
$ret = array();
while ($i < $num) {
- $tmp = new self($db);
+ $obj = $this->db->fetch_object($resql);
- $obj = $db->fetch_object($resql);
-
- $tmp->sellby = $db->jdate($obj->sellby ? $obj->sellby : $obj->oldsellby);
- $tmp->eatby = $db->jdate($obj->eatby ? $obj->eatby : $obj->oldeatby);
+ $tmp = new self($this->db);
+ $tmp->sellby = $this->db->jdate($obj->sellby ? $obj->sellby : $obj->oldsellby);
+ $tmp->eatby = $this->db->jdate($obj->eatby ? $obj->eatby : $obj->oldeatby);
$tmp->batch = $obj->batch;
$tmp->id = $obj->rowid;
$tmp->fk_origin_stock = $obj->fk_origin_stock;
@@ -213,10 +216,12 @@ class ExpeditionLineBatch extends CommonObject
$ret[] = $tmp;
$i++;
}
- $db->free($resql);
+
+ $this->db->free($resql);
+
return $ret;
} else {
- dol_print_error($db);
+ dol_print_error($this->db);
return -1;
}
}
diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php
index f543b8baee4..a6ab016ef7b 100644
--- a/htdocs/expedition/shipment.php
+++ b/htdocs/expedition/shipment.php
@@ -370,7 +370,7 @@ if ($id > 0 || !empty($ref)) {
print ' ';
if ($action != 'editdate_livraison') {
- print '
id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).' ';
}
print '';
print '
';
@@ -400,7 +400,7 @@ if ($id > 0 || !empty($ref)) {
print $langs->trans('SendingMethod');
print ' ';
if ($action != 'editshippingmethod' && $user->rights->expedition->creer) {
- print '
id.'">'.img_edit($langs->trans('SetShippingMode'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetShippingMode'), 1).' ';
}
print '';
print '
';
@@ -421,7 +421,7 @@ if ($id > 0 || !empty($ref)) {
print $langs->trans('Warehouse');
print ' ';
if ($action != 'editwarehouse' && $user->rights->commande->creer) {
- print '
id.'">'.img_edit($langs->trans('SetWarehouse'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetWarehouse'), 1).' ';
}
print '';
print '
';
@@ -441,7 +441,7 @@ if ($id > 0 || !empty($ref)) {
print $langs->trans('PaymentConditionsShort');
print ' ';
- if ($action != 'editconditions' && $object->statut == Expedition::STATUS_VALIDATED) print '
id.'">'.img_edit($langs->trans('SetConditions'),1).' ';
+ if ($action != 'editconditions' && $object->statut == Expedition::STATUS_VALIDATED) print '
id.'">'.img_edit($langs->trans('SetConditions'),1).' ';
print '';
print '
';
if ($action == 'editconditions')
@@ -459,7 +459,7 @@ if ($id > 0 || !empty($ref)) {
print '';
print ' ';
if ($action == 'editmode')
@@ -478,7 +478,7 @@ if ($id > 0 || !empty($ref)) {
print $langs->trans('AvailabilityPeriod');
print ' ';
if ($action != 'editavailability') {
- print '
id.'">'.img_edit($langs->trans('SetAvailability'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetAvailability'), 1).' ';
}
print '';
print '
';
@@ -495,7 +495,7 @@ if ($id > 0 || !empty($ref)) {
print $langs->trans('Source');
print ' ';
if ($action != 'editdemandreason') {
- print '
id.'">'.img_edit($langs->trans('SetDemandReason'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetDemandReason'), 1).' ';
}
print '';
print '
';
@@ -528,7 +528,7 @@ if ($id > 0 || !empty($ref)) {
print $langs->trans('IncotermLabel');
print ' ';
if ($user->rights->commande->creer) {
- print ''.img_edit().' ';
+ print ''.img_edit().' ';
} else {
print ' ';
}
diff --git a/htdocs/expensereport/ajax/ajaxik.php b/htdocs/expensereport/ajax/ajaxik.php
index c2cc8345671..6cd8c05fe5b 100644
--- a/htdocs/expensereport/ajax/ajaxik.php
+++ b/htdocs/expensereport/ajax/ajaxik.php
@@ -76,7 +76,8 @@ if (empty($fk_expense) || $fk_expense < 0) {
if ($userauthor->fetch($expense->fk_user_author) <= 0) {
echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorRecordNotFound'), 'fk_user_author' => $expense->fk_user_author));
} else {
- $range = ExpenseReportIk::getRangeByUser($userauthor, $fk_c_exp_tax_cat);
+ $expenseik = new ExpenseReportIk($db);
+ $range = $expenseik->getRangeByUser($userauthor, $fk_c_exp_tax_cat);
if (empty($range)) {
echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorRecordNotFound'), 'range' => $range));
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index 7aa08d30c39..f982b046793 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -2554,11 +2554,11 @@ if ($action != 'create' && $action != 'edit') {
if ($user->rights->expensereport->creer && $object->status == ExpenseReport::STATUS_DRAFT) {
if (in_array($object->fk_user_author, $user->getAllChildIds(1)) || !empty($user->rights->expensereport->writeall_advance)) {
// Modify
- print '';
+ print '';
// Validate
if (count($object->lines) > 0) {
- print '';
+ print '';
}
}
}
@@ -2571,12 +2571,12 @@ if ($action != 'create' && $action != 'edit') {
if ($user->rights->expensereport->creer && $object->status == ExpenseReport::STATUS_REFUSED) {
if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) {
// Modify
- print '';
+ print '';
// setdraft (le statut refusée est identique à brouillon)
//print ''.$langs->trans('ReOpen').' ';
// Enregistrer depuis le statut "Refusée"
- print '';
+ print '';
}
}
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index df1c79c82dd..63303554c51 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -1887,7 +1887,8 @@ class ExpenseReport extends CommonObject
}
//$buyer = new Societe($this->db);
- $rulestocheck = ExpenseReportRule::getAllRule($this->line->fk_c_type_fees, $this->line->date, $this->fk_user_author);
+ $expensereportrule = new ExpenseReportRule($db);
+ $rulestocheck = $expensereportrule->getAllRule($this->line->fk_c_type_fees, $this->line->date, $this->fk_user_author);
$violation = 0;
$rule_warning_message_tab = array();
@@ -1974,7 +1975,8 @@ class ExpenseReport extends CommonObject
}
//$buyer = new Societe($this->db);
- $range = ExpenseReportIk::getRangeByUser($userauthor, $this->line->fk_c_exp_tax_cat);
+ $expenseik = new ExpenseReportIk($db);
+ $range = $expenseik->getRangeByUser($userauthor, $this->line->fk_c_exp_tax_cat);
if (empty($range)) {
$this->error = 'ErrorNoRangeAvailable';
diff --git a/htdocs/expensereport/class/expensereport_ik.class.php b/htdocs/expensereport/class/expensereport_ik.class.php
index 358a2fe06ca..da2312bdcb1 100644
--- a/htdocs/expensereport/class/expensereport_ik.class.php
+++ b/htdocs/expensereport/class/expensereport_ik.class.php
@@ -87,8 +87,6 @@ class ExpenseReportIk extends CoreObject
*/
public function __construct(DoliDB &$db)
{
- global $conf;
-
parent::__construct($db);
parent::init();
@@ -102,29 +100,28 @@ class ExpenseReportIk extends CoreObject
* @param int $mode 1=only active; 2=only inactive; other value return all
* @return array of category
*/
- public static function getTaxCategories($mode = 1)
+ public function getTaxCategories($mode = 1)
{
- global $db;
-
$categories = array();
$sql = 'SELECT rowid, label, entity, active';
$sql .= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat';
- $sql .= ' WHERE entity IN ('.getEntity('c_exp_tax_cat').')';
+ $sql .= ' WHERE entity IN (0, '.getEntity($this->element).')';
if ($mode == 1) {
$sql .= ' AND active = 1';
} elseif ($mode == 2) {
$sql .= 'AND active = 0';
}
- dol_syslog(get_called_class().'::getTaxCategories sql='.$sql, LOG_DEBUG);
- $resql = $db->query($sql);
+ dol_syslog(get_called_class().'::getTaxCategories', LOG_DEBUG);
+
+ $resql = $this->db->query($sql);
if ($resql) {
- while ($obj = $db->fetch_object($resql)) {
+ while ($obj = $this->db->fetch_object($resql)) {
$categories[$obj->rowid] = $obj;
}
} else {
- dol_print_error($db);
+ dol_print_error($this->db);
}
return $categories;
@@ -137,10 +134,10 @@ class ExpenseReportIk extends CoreObject
* @param int $fk_c_exp_tax_cat category
* @return boolean|array
*/
- public static function getRangeByUser(User $userauthor, int $fk_c_exp_tax_cat)
+ public function getRangeByUser(User $userauthor, int $fk_c_exp_tax_cat)
{
$default_range = (int) $userauthor->default_range; // if not defined, then 0
- $ranges = self::getRangesByCategory($fk_c_exp_tax_cat);
+ $ranges = $this->getRangesByCategory($fk_c_exp_tax_cat);
// substract 1 because array start from 0
if (empty($ranges) || !isset($ranges[$default_range - 1])) {
@@ -157,10 +154,8 @@ class ExpenseReportIk extends CoreObject
* @param int $active active
* @return array
*/
- public static function getRangesByCategory(int $fk_c_exp_tax_cat, $active = 1)
+ public function getRangesByCategory(int $fk_c_exp_tax_cat, $active = 1)
{
- global $db;
-
$ranges = array();
dol_syslog(get_called_class().'::getRangesByCategory for fk_c_exp_tax_cat='.$fk_c_exp_tax_cat, LOG_DEBUG);
@@ -170,24 +165,25 @@ class ExpenseReportIk extends CoreObject
$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)';
}
$sql .= ' WHERE r.fk_c_exp_tax_cat = '.((int) $fk_c_exp_tax_cat);
+ $sql .= " AND entity IN(0, ".getEntity($this->element).")";
if ($active) {
$sql .= ' AND r.active = 1 AND c.active = 1';
}
$sql .= ' ORDER BY r.range_ik';
- $resql = $db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql) {
- $num = $db->num_rows($resql);
+ $num = $this->db->num_rows($resql);
if ($num > 0) {
- while ($obj = $db->fetch_object($resql)) {
- $object = new ExpenseReportIk($db);
+ while ($obj = $this->db->fetch_object($resql)) {
+ $object = new ExpenseReportIk($this->db);
$object->fetch($obj->rowid);
$ranges[] = $object;
}
}
} else {
- dol_print_error($db);
+ dol_print_error($this->db);
}
return $ranges;
@@ -198,24 +194,23 @@ class ExpenseReportIk extends CoreObject
*
* @return array
*/
- public static function getAllRanges()
+ public function getAllRanges()
{
- global $db;
-
$ranges = array();
$sql = ' SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, c.label, i.rowid as fk_expense_ik, r.active as range_active, c.active as cat_active';
$sql .= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r';
$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'expensereport_ik i ON (r.rowid = i.fk_range)';
- $sql .= ' WHERE r.entity IN (0, '.getEntity('').')';
+ $sql .= ' WHERE r.entity IN (0, '.getEntity($this->element).')';
$sql .= ' ORDER BY r.fk_c_exp_tax_cat, r.range_ik';
- dol_syslog(get_called_class().'::getAllRanges sql='.$sql, LOG_DEBUG);
- $resql = $db->query($sql);
+ dol_syslog(get_called_class().'::getAllRanges', LOG_DEBUG);
+
+ $resql = $this->db->query($sql);
if ($resql) {
- while ($obj = $db->fetch_object($resql)) {
- $ik = new ExpenseReportIk($db);
+ while ($obj = $this->db->fetch_object($resql)) {
+ $ik = new ExpenseReportIk($this->db);
if ($obj->fk_expense_ik > 0) {
$ik->fetch($obj->fk_expense_ik);
}
@@ -227,7 +222,7 @@ class ExpenseReportIk extends CoreObject
$ranges[$obj->fk_c_exp_tax_cat]['ranges'][] = $obj;
}
} else {
- dol_print_error($db);
+ dol_print_error($this->db);
}
return $ranges;
@@ -236,30 +231,28 @@ class ExpenseReportIk extends CoreObject
/**
* Return the max number of range by a category
*
- * @param int $default_c_exp_tax_cat id
- * @return int
+ * @param int $default_c_exp_tax_cat id Default c_exp_tax_cat
+ * @return int Max nb
*/
- public static function getMaxRangeNumber($default_c_exp_tax_cat = 0)
+ public function getMaxRangeNumber($default_c_exp_tax_cat = 0)
{
- global $db, $conf;
-
$sql = 'SELECT MAX(counted) as nbRange FROM (';
$sql .= ' SELECT COUNT(*) as counted';
$sql .= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r';
- $sql .= ' WHERE r.entity IN (0, '.$conf->entity.')';
+ $sql .= ' WHERE r.entity IN (0, '.getEntity($this->element).')';
if ($default_c_exp_tax_cat > 0) {
$sql .= ' AND r.fk_c_exp_tax_cat = '.((int) $default_c_exp_tax_cat);
}
$sql .= ' GROUP BY r.fk_c_exp_tax_cat';
$sql .= ') as counts';
- dol_syslog(get_called_class().'::getMaxRangeNumber sql='.$sql, LOG_DEBUG);
- $resql = $db->query($sql);
+ dol_syslog(get_called_class().'::getMaxRangeNumber', LOG_DEBUG);
+ $resql = $this->db->query($sql);
if ($resql) {
- $obj = $db->fetch_object($resql);
+ $obj = $this->db->fetch_object($resql);
return $obj->nbRange;
} else {
- dol_print_error($db);
+ dol_print_error($this->db);
}
return 0;
diff --git a/htdocs/expensereport/class/expensereport_rule.class.php b/htdocs/expensereport/class/expensereport_rule.class.php
index 6299dd7c5bd..ae89b4b0f51 100644
--- a/htdocs/expensereport/class/expensereport_rule.class.php
+++ b/htdocs/expensereport/class/expensereport_rule.class.php
@@ -148,20 +148,19 @@ class ExpenseReportRule extends CoreObject
* @param int $fk_user user of expense
* @return array Array with ExpenseReportRule
*/
- public static function getAllRule($fk_c_type_fees = '', $date = '', $fk_user = '')
+ public function getAllRule($fk_c_type_fees = '', $date = '', $fk_user = '')
{
- global $db;
-
$rules = array();
+
$sql = 'SELECT er.rowid';
$sql .= ' FROM '.MAIN_DB_PREFIX.'expensereport_rules er';
- $sql .= ' WHERE er.entity IN (0,'.getEntity('').')';
+ $sql .= ' WHERE er.entity IN (0,'.getEntity($this->element).')';
if (!empty($fk_c_type_fees)) {
$sql .= ' AND er.fk_c_type_fees IN (-1, '.((int) $fk_c_type_fees).')';
}
if (!empty($date)) {
- $sql .= " AND er.dates <= '".dol_print_date($date, '%Y-%m-%d')."'";
- $sql .= " AND er.datee >= '".dol_print_date($date, '%Y-%m-%d')."'";
+ $sql .= " AND er.dates <= '".$this->db->idate($date)."'";
+ $sql .= " AND er.datee >= '".$this->db->idate($date)."'";
}
if ($fk_user > 0) {
$sql .= ' AND (er.is_for_all = 1';
@@ -172,18 +171,18 @@ class ExpenseReportRule extends CoreObject
dol_syslog("ExpenseReportRule::getAllRule");
- $resql = $db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql) {
- while ($obj = $db->fetch_object($resql)) {
- $rule = new ExpenseReportRule($db);
+ while ($obj = $this->db->fetch_object($resql)) {
+ $rule = new ExpenseReportRule($this->db);
if ($rule->fetch($obj->rowid) > 0) {
$rules[$rule->id] = $rule;
} else {
- dol_print_error($db);
+ dol_print_error($this->db);
}
}
} else {
- dol_print_error($db);
+ dol_print_error($this->db);
}
return $rules;
@@ -201,7 +200,7 @@ class ExpenseReportRule extends CoreObject
if ($this->fk_usergroup > 0) {
$group = new UserGroup($this->db);
if ($group->fetch($this->fk_usergroup) > 0) {
- return $group->nom;
+ return $group->name;
} else {
$this->error = $group->error;
$this->errors[] = $this->error;
diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php
index 44eb3734378..d74e0a5c5e8 100644
--- a/htdocs/fichinter/card-rec.php
+++ b/htdocs/fichinter/card-rec.php
@@ -587,7 +587,7 @@ if ($action == 'create') {
print $langs->trans('Frequency');
print ' ';
if ($action != 'editfrequency' && $user->rights->ficheinter->creer) {
- print '
';
+ print ' ';
print img_edit($langs->trans('Edit'), 1).' ';
}
print '';
diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php
index 31f42c9b0fa..6613ea0ed9d 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -1350,21 +1350,21 @@ if ($action == 'create') {
// Icon to edit and delete
if ($object->statut == 0 && $user->rights->ficheinter->creer) {
print '
';
- print 'id.'&action=editline&line_id='.$objp->rowid.'#'.$objp->rowid.'">';
+ print ' id.'&action=editline&token='.newToken().'&line_id='.$objp->rowid.'#'.$objp->rowid.'">';
print img_edit();
print ' ';
- print 'id.'&action=ask_deleteline&line_id='.$objp->rowid.'">';
+ print ' id.'&action=ask_deleteline&token='.newToken().'&line_id='.$objp->rowid.'">';
print img_delete();
print ' ';
print '
';
if ($num > 1) {
if ($i > 0) {
- print 'id.'&action=up&line_id='.$objp->rowid.'">';
+ print ' id.'&action=up&token='.newToken().'&line_id='.$objp->rowid.'">';
print img_up();
print ' ';
}
if ($i < $num - 1) {
- print 'id.'&action=down&line_id='.$objp->rowid.'">';
+ print ' id.'&action=down&token='.newToken().'&line_id='.$objp->rowid.'">';
print img_down();
print ' ';
}
diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php
index 12b7b09cf53..9cfb2fe475f 100644
--- a/htdocs/fourn/card.php
+++ b/htdocs/fourn/card.php
@@ -261,7 +261,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentConditions');
print ' ';
if (($action != 'editconditions') && $user->rights->societe->creer) {
- print ' id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
}
print '';
print '
';
@@ -279,7 +279,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentMode');
print ' ';
if (($action != 'editmode') && $user->rights->societe->creer) {
- print ' id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '';
print '
';
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 09a43fb95ab..99ef4e54e87 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -112,6 +112,7 @@ class CommandeFournisseur extends CommonOrder
public $socid;
public $fourn_id;
public $date;
+ public $date_creation;
public $date_valid;
public $date_approve;
public $date_approve2; // Used when SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set
@@ -375,11 +376,16 @@ class CommandeFournisseur extends CommonOrder
$this->total_localtax1 = $obj->localtax1;
$this->total_localtax2 = $obj->localtax2;
$this->total_ttc = $obj->total_ttc;
- $this->date = $this->db->jdate($obj->date_creation);
+ $this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_valid = $this->db->jdate($obj->date_valid);
$this->date_approve = $this->db->jdate($obj->date_approve);
$this->date_approve2 = $this->db->jdate($obj->date_approve2);
$this->date_commande = $this->db->jdate($obj->date_commande); // date we make the order to supplier
+ if (isset($obj->date_commande)) {
+ $this->date = $this->date_commande;
+ } else {
+ $this->date = $this->date_creation;
+ }
$this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated
$this->delivery_date = $this->db->jdate($obj->delivery_date);
$this->remise_percent = $obj->remise_percent;
@@ -3295,7 +3301,6 @@ class CommandeFournisseur extends CommonOrder
$keysinwishednotindelivered = array_diff(array_keys($qtywished), array_keys($qtydelivered)); // To check we also have same number of keys
$keysindeliverednotinwished = array_diff(array_keys($qtydelivered), array_keys($qtywished)); // To check we also have same number of keys
/*var_dump(array_keys($qtydelivered));
-
var_dump(array_keys($qtywished));
var_dump($diff_array);
var_dump($keysinwishednotindelivered);
diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php
index a83795996e4..a73be8ac43b 100644
--- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php
@@ -103,6 +103,7 @@ class CommandeFournisseurDispatch extends CommonObjectLine
public $batch;
public $eatby = '';
public $sellby = '';
+ public $cost_price = 0;
@@ -189,7 +190,8 @@ class CommandeFournisseurDispatch extends CommonObjectLine
$sql .= "batch,";
$sql .= "eatby,";
$sql .= "sellby,";
- $sql .= "fk_reception";
+ $sql .= "fk_reception,";
+ $sql .= "cost_price";
$sql .= ") VALUES (";
@@ -205,7 +207,8 @@ class CommandeFournisseurDispatch extends CommonObjectLine
$sql .= " ".(!isset($this->batch) ? 'NULL' : "'".$this->db->escape($this->batch)."'").",";
$sql .= " ".(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : "'".$this->db->idate($this->eatby)."'").",";
$sql .= " ".(!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : "'".$this->db->idate($this->sellby)."'").",";
- $sql .= " ".(!isset($this->fk_reception) ? 'NULL' : "'".$this->db->escape($this->fk_reception)."'")."";
+ $sql .= " ".(!isset($this->fk_reception) ? 'NULL' : "'".$this->db->escape($this->fk_reception)."'").",";
+ $sql .= " ".(!isset($this->cost_price) ? '0' : "'".$this->db->escape($this->cost_price)."'")."";
$sql .= ")";
$this->db->begin();
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index e579c07ac14..ae6c271fec8 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -1975,7 +1975,7 @@ if ($action == 'create') {
}
if (empty($conf->global->MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER) || $action != 'edit_thirdparty') {
if (!empty($conf->global->MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER) && $object->statut == CommandeFournisseur::STATUS_DRAFT) {
- $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty')).' ';
+ $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty')).' ';
}
$morehtmlref .= ' : '.$object->thirdparty->getNomUrl(1, 'supplier');
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
@@ -2075,7 +2075,7 @@ if ($action == 'create') {
print $langs->trans('PaymentConditions');
print ' ';
if ($action != 'editconditions') {
- print ' id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
}
print '';
print '
';
@@ -2094,7 +2094,7 @@ if ($action == 'create') {
print $langs->trans('PaymentMode');
print ' ';
if ($action != 'editmode') {
- print '
id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '';
print '
';
@@ -2114,7 +2114,7 @@ if ($action == 'create') {
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print ' ';
if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT) {
- print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '
';
@@ -2134,7 +2134,7 @@ if ($action == 'create') {
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print ' ';
if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
- print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '
';
@@ -2162,7 +2162,7 @@ if ($action == 'create') {
print $langs->trans('BankAccount');
print ' ';
if ($action != 'editbankaccount' && $usercancreate) {
- print ' id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '';
print '
';
@@ -2187,7 +2187,7 @@ if ($action == 'create') {
print $langs->trans('DateDeliveryPlanned');
print ' ';
if ($action != 'editdate_livraison') {
- print '
id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).' ';
}
print '';
print '
';
@@ -2221,7 +2221,7 @@ if ($action == 'create') {
print $langs->trans('IncotermLabel');
print ' ';
if ($usercancreate) {
- print ''.img_edit().' ';
+ print ''.img_edit().' ';
} else {
print ' ';
}
diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php
index afd99951aa4..16d4b1f25f3 100644
--- a/htdocs/fourn/commande/dispatch.php
+++ b/htdocs/fourn/commande/dispatch.php
@@ -1294,13 +1294,13 @@ if ($id > 0 || !empty($ref)) {
if ($action != 'editline' || $lineid != $objp->dispatchlineid) {
if (empty($reception->id) || ($reception->statut == Reception::STATUS_DRAFT)) { // only allow edit on draft reception
print ' ';
- print 'id.'&action=editline&lineid='.$objp->dispatchlineid.'#line_'.$objp->dispatchlineid.'">';
+ print ' id.'&action=editline&token='.newToken().'&lineid='.$objp->dispatchlineid.'#line_'.$objp->dispatchlineid.'">';
print img_edit();
print ' ';
print ' ';
print '
';
- print 'id.'&action=ask_deleteline&lineid='.$objp->dispatchlineid.'#dispatch_received_products">';
+ print ' id.'&action=ask_deleteline&token='.newToken().'&lineid='.$objp->dispatchlineid.'#dispatch_received_products">';
print img_delete();
print ' ';
print ' ';
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index 762436a3a0e..21d6e73eb39 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -2779,7 +2779,7 @@ if ($action == 'create') {
print $langs->trans('PaymentConditions');
print '
';
if ($action != 'editconditions' && $form_permission) {
- print ' id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
}
print '';
print '
';
@@ -2808,7 +2808,7 @@ if ($action == 'create') {
print $langs->trans('PaymentMode');
print ' ';
if ($action != 'editmode' && $form_permission2) {
- print '
id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '';
print '
';
@@ -2828,7 +2828,7 @@ if ($action == 'create') {
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print ' ';
if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT) {
- print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '
';
@@ -2847,7 +2847,7 @@ if ($action == 'create') {
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print ' ';
if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
- print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print '
id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '
';
@@ -2875,7 +2875,7 @@ if ($action == 'create') {
print $langs->trans('BankAccount');
print ' ';
if ($action != 'editbankaccount' && $usercancreate) {
- print ' id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
+ print '
id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '';
print '
';
@@ -2895,7 +2895,7 @@ if ($action == 'create') {
print $langs->trans('IncotermLabel');
print ' ';
if ($usercancreate) {
- print ''.img_edit().' ';
+ print ''.img_edit().' ';
} else {
print ' ';
}
@@ -2918,7 +2918,7 @@ if ($action == 'create') {
print $langs->trans('IntracommReportTransportMode');
print ' ';
if ($action != 'editmode' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) {
- print '
id.'">'.img_edit().' ';
+ print '
id.'">'.img_edit().' ';
}
print '';
print '';
@@ -3406,7 +3406,7 @@ if ($action == 'create') {
$ventilExportCompta = $object->getVentilExportCompta(); // Should be 0 since the sum of payments are zero. But we keep the protection.
if ($ventilExportCompta == 0) {
- print '
'.$langs->trans('Modify').' ';
+ print '
'.$langs->trans('Modify').' ';
} else {
print '
'.$langs->trans('Modify').' ';
}
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 6a23cdbdd91..56f98139052 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -441,7 +441,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
-if (!empty($search_categ_sup)) {
+if (!empty($search_categ_sup) && $search_categ_supplier != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc";
}
diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php
index 65c3521bf20..9948b64e460 100644
--- a/htdocs/holiday/card.php
+++ b/htdocs/holiday/card.php
@@ -338,25 +338,25 @@ if (empty($reshook)) {
// If no start date
if (empty($_POST['date_debut_'])) {
- header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=nodatedebut');
+ header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'&error=nodatedebut');
exit;
}
// If no end date
if (empty($_POST['date_fin_'])) {
- header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=nodatefin');
+ header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'&error=nodatefin');
exit;
}
// If start date after end date
if ($date_debut > $date_fin) {
- header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=datefin');
+ header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'&error=datefin');
exit;
}
// If no validator designated
if ($approverid < 1) {
- header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=Valideur');
+ header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'&error=Valideur');
exit;
}
@@ -1339,7 +1339,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
}
$include_users = $object->fetch_users_approver_holiday();
if (is_array($include_users) && in_array($user->id, $include_users) && $object->statut == Holiday::STATUS_VALIDATED) {
- print '
id.'&action=editvalidator">'.img_edit($langs->trans("Edit")).' ';
+ print '
id.'&action=editvalidator&token='.newToken().'">'.img_edit($langs->trans("Edit")).' ';
}
print '';
print '';
@@ -1451,11 +1451,11 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
print '
';
if ($cancreate && $object->statut == Holiday::STATUS_DRAFT) {
- print '
id.'&action=edit" class="butAction">'.$langs->trans("EditCP").' ';
+ print '
id.'&action=edit&token='.newToken().'" class="butAction">'.$langs->trans("EditCP").' ';
}
if ($cancreate && $object->statut == Holiday::STATUS_DRAFT) { // If draft
- print '
id.'&action=sendToValidate" class="butAction">'.$langs->trans("Validate").' ';
+ print '
id.'&action=sendToValidate&token='.newToken().'" class="butAction">'.$langs->trans("Validate").' ';
}
if ($object->statut == Holiday::STATUS_VALIDATED) { // If validated
diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php
index 9daf1d768b8..0ce7d793003 100644
--- a/htdocs/hrm/establishment/card.php
+++ b/htdocs/hrm/establishment/card.php
@@ -419,7 +419,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
* Action bar
*/
print '
';
}
diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php
index 68bcd78636b..ec7ba9b74e3 100644
--- a/htdocs/hrm/index.php
+++ b/htdocs/hrm/index.php
@@ -96,7 +96,7 @@ print load_fiche_titre($langs->trans("HRMArea"), '', 'hrm');
if (!empty($setupcompanynotcomplete)) {
$langs->load("errors");
$warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"));
- print '
';
+ print '
';
llxFooter();
exit;
diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql
index 07a09724ed2..7af5d28df8c 100644
--- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql
+++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql
@@ -356,3 +356,16 @@ insert into llx_c_forme_juridique (fk_pays, code, libelle) values (13, '1306','S
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (13, '1307','Société en participation');
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (13, '1308','Groupe de sociétés');
+-- Sweden (id country=20)
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2001', 'Aktiebolag');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2002', 'Publikt aktiebolag (AB publ)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2003', 'Ekonomisk förening (ek. för.)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2004', 'Bostadsrättsförening (BRF)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2005', 'Hyresrättsförening (HRF)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2006', 'Kooperativ');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2007', 'Enskild firma (EF)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2008', 'Handelsbolag (HB)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2009', 'Kommanditbolag (KB)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2010', 'Enkelt bolag');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2011', 'Ideell förening');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2012', 'Stiftelse');
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 63f20198658..db0e40790dc 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
@@ -425,14 +425,22 @@ CREATE TABLE llx_eventorganization_conferenceorboothattendee(
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_project integer NOT NULL;
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_invoice integer NULL;
+ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_soc;
+ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_actioncomm;
+ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_project;
+
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_rowid (rowid);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_ref (ref);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_soc (fk_soc);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_actioncomm (fk_actioncomm);
-ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm(id);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_email (email);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_status (status);
-ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_soc, fk_actioncomm, email);
+
+-- VMYSQL4.1 DROP INDEX uk_eventorganization_conferenceorboothattendee on llx_eventorganization_conferenceorboothattendee;
+-- VPGSQL8.2 DROP INDEX uk_eventorganization_conferenceorboothattendee;
+
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_project, email, fk_actioncomm);
+
create table llx_eventorganization_conferenceorboothattendee_extrafields
(
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 f4f6e9e349f..03bb7631dda 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
@@ -35,10 +35,31 @@
-- VMYSQL4.3 ALTER TABLE llx_partnership MODIFY COLUMN date_partnership_end date NULL;
-- VPGSQL8.2 ALTER TABLE llx_partnership ALTER COLUMN date_partnership_end DROP NOT NULL;
+
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_project integer NOT NULL;
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_invoice integer NULL;
+
+ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_soc;
+ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_actioncomm;
+ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_project;
+
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_rowid (rowid);
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_ref (ref);
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_soc (fk_soc);
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_actioncomm (fk_actioncomm);
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_email (email);
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_status (status);
+
+-- VMYSQL4.1 DROP INDEX uk_eventorganization_conferenceorboothattendee on llx_eventorganization_conferenceorboothattendee;
+-- VPGSQL8.2 DROP INDEX uk_eventorganization_conferenceorboothattendee;
+
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_project, email, fk_actioncomm);
+
+
-- VMYSQL4.3 ALTER TABLE llx_eventorganization_conferenceorboothattendee MODIFY COLUMN fk_actioncomm integer NULL;
-- VPGSQL8.2 ALTER TABLE llx_eventorganization_conferenceorboothattendee ALTER COLUMN fk_actioncomm DROP NOT NULL;
-ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_project integer NOT NULL;
+
UPDATE llx_extrafields SET elementtype = 'salary' WHERE elementtype = 'payment_salary';
ALTER TABLE llx_payment_salary_extrafields RENAME TO llx_salary_extrafields;
@@ -112,3 +133,19 @@ ALTER TABLE llx_product_lot ADD COLUMN barcode varchar(180) DEFAULT NULL;
ALTER TABLE llx_product_lot ADD COLUMN fk_barcode_type integer DEFAULT NULL;
ALTER TABLE llx_projet ADD COLUMN max_attendees integer DEFAULT 0;
+
+ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN cost_price double(24,8) DEFAULT 0;
+
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2001', 'Aktiebolag');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2002', 'Publikt aktiebolag (AB publ)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2003', 'Ekonomisk förening (ek. för.)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2004', 'Bostadsrättsförening (BRF)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2005', 'Hyresrättsförening (HRF)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2006', 'Kooperativ');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2007', 'Enskild firma (EF)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2008', 'Handelsbolag (HB)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2009', 'Kommanditbolag (KB)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2010', 'Enkelt bolag');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2011', 'Ideell förening');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2012', 'Stiftelse');
+
diff --git a/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql b/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql
index 9489cca9652..a693fb19c41 100644
--- a/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql
+++ b/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql
@@ -13,7 +13,7 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.
-create table llx_categorie_knowledgemanagement
+create table llx_categorie_knowledgemanagement(
fk_categorie integer NOT NULL,
fk_knowledgemanagement integer NOT NULL,
import_key varchar(14)
diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql
index b5f85fea250..974e10c09ff 100644
--- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql
+++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql
@@ -36,5 +36,6 @@ create table llx_commande_fournisseur_dispatch
sellby date DEFAULT NULL,
status integer,
datec datetime,
- tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ cost_price double(24,8) DEFAULT 0
)ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.key.sql b/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.key.sql
index 0633e3cc2a2..9e1bbcde191 100644
--- a/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.key.sql
+++ b/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.key.sql
@@ -18,15 +18,11 @@
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_rowid (rowid);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_ref (ref);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_soc (fk_soc);
-ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_actioncomm (fk_actioncomm);
-ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm(id);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_project (fk_project);
-ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_project FOREIGN KEY (fk_project) REFERENCES llx_projet(rowid);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_email (email);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_status (status);
-- END MODULEBUILDER INDEXES
-ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_soc, fk_project, fk_actioncomm, email);
-
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_project, email, fk_actioncomm);
diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql
index 78560c5a05e..80e3f90b828 100644
--- a/htdocs/install/mysql/tables/llx_product.sql
+++ b/htdocs/install/mysql/tables/llx_product.sql
@@ -104,8 +104,7 @@ create table llx_product
fk_unit integer DEFAULT NULL,
price_autogen tinyint DEFAULT 0,
fk_project integer DEFAULT NULL, -- Used when product was generated by a project or is specifif to a project
- mandatory_period tinyint DEFAULT 0 -- is used to signal to the user that the start and end dates are mandatory for this type of product the fk_product_type == 1 (service) (non-blocking action)
+ mandatory_period tinyint DEFAULT 0, -- is used to signal to the user that the start and end dates are mandatory for this type of product the fk_product_type == 1 (service) (non-blocking action)
- fk_default_bom integer DEFAULT NULL,
- fk_project integer DEFAULT NULL -- Used when the product was generated by a project or is specific to a project
+ fk_default_bom integer DEFAULT NULL
)ENGINE=innodb;
diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php
index 99aaabe7744..8af0431f361 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_card.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_card.php
@@ -404,12 +404,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes', '', $permissiontoadd);
}
if (($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) && $permissiontovalidate) {
- print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit', '', $permissiontoadd);
+ print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
}
// Validate
if ($object->status == $object::STATUS_DRAFT) {
if ((empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) && $permissiontovalidate) {
- print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', $permissiontoadd);
+ print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&token='.newToken().'&confirm=yes', '', $permissiontoadd);
} else {
$langs->load("errors");
//print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', 0);
@@ -418,7 +418,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// Clone
- print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=scrumsprint', '', $permissiontoadd);
+ print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken().'&object=scrumsprint', '', $permissiontoadd);
/*
if ($permissiontoadd) {
diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php
index e9fa70e53d2..75aa11cf771 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_list.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_list.php
@@ -371,13 +371,13 @@ $param .= $hookmanager->resPrint;
// List of mass actions available
$arrayofmassactions = array(
- 'validate'=>$langs->trans("Validate"),
- //'generate_doc'=>$langs->trans("ReGeneratePDF"),
- //'builddoc'=>$langs->trans("PDFMerge"),
- //'presend'=>$langs->trans("SendByMail"),
+ 'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
+ //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
+ //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
+ //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
);
if ($permissiontodelete) {
- $arrayofmassactions['predelete'] = '
'.$langs->trans("Delete");
+ $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
$arrayofmassactions = array();
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 53355dd15ce..48887552e7e 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1926,7 +1926,7 @@ SellTaxRate=Sales tax rate
RecuperableOnly=Yes for VAT "Not Perceived but Recoverable" dedicated for some state in France. Keep value to "No" in all other cases.
UrlTrackingDesc=If the provider or transport service offers a page or web site to check the status of your shipments, you may enter it here. You can use the key {TRACKID} in the URL parameters so the system will replace it with the tracking number the user entered into the shipment card.
OpportunityPercent=When you create a lead, you will define an estimated amount of project/lead. According to status of the lead, this amount may be multiplied by this rate to evaluate a total amount all your leads may generate. Value is a percentage (between 0 and 100).
-TemplateForElement=This template record is dedicated to which element
+TemplateForElement=This mail template is related to what type of object? An email template is available only when using the "Send Email" button from the related object.
TypeOfTemplate=Type of template
TemplateIsVisibleByOwnerOnly=Template is visible to owner only
VisibleEverywhere=Visible everywhere
diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang
index cbe238ad2a4..bc9c7dab537 100644
--- a/htdocs/langs/en_US/agenda.lang
+++ b/htdocs/langs/en_US/agenda.lang
@@ -64,6 +64,7 @@ ShipmentClassifyClosedInDolibarr=Shipment %s classified billed
ShipmentUnClassifyCloseddInDolibarr=Shipment %s classified re-open
ShipmentBackToDraftInDolibarr=Shipment %s go back to draft status
ShipmentDeletedInDolibarr=Shipment %s deleted
+ShipmentCanceledInDolibarr=Shipment %s canceled
ReceptionValidatedInDolibarr=Reception %s validated
OrderCreatedInDolibarr=Order %s created
OrderValidatedInDolibarr=Order %s validated
diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang
index ca962811831..d486fef0f5c 100644
--- a/htdocs/langs/en_US/languages.lang
+++ b/htdocs/langs/en_US/languages.lang
@@ -73,6 +73,7 @@ Language_it_IT=Italian
Language_it_CH=Italian (Switzerland)
Language_ja_JP=Japanese
Language_ka_GE=Georgian
+Language_kk_KZ=Kazakh
Language_km_KH=Khmer
Language_kn_IN=Kannada
Language_ko_KR=Korean
@@ -93,6 +94,7 @@ Language_ro_MD=Romanian (Moldavia)
Language_ro_RO=Romanian
Language_ru_RU=Russian
Language_ru_UA=Russian (Ukraine)
+Language_tg_TJ=Tajik
Language_tr_TR=Turkish
Language_sl_SI=Slovenian
Language_sv_SV=Swedish
diff --git a/htdocs/langs/en_US/printing.lang b/htdocs/langs/en_US/printing.lang
index 16494583550..bd9094f213d 100644
--- a/htdocs/langs/en_US/printing.lang
+++ b/htdocs/langs/en_US/printing.lang
@@ -1,10 +1,10 @@
# Dolibarr language file - Source file is en_US - printing
-Module64000Name=Direct Printing
-Module64000Desc=Enable Direct Printing System
-PrintingSetup=Setup of Direct Printing System
-PrintingDesc=This module adds a Print button to various modules to allow documents to be printed directly to a printer without needing to open the document in another application.
-MenuDirectPrinting=Direct Printing jobs
-DirectPrint=Direct print
+Module64000Name=One click Printing
+Module64000Desc=Enable One click Printing System
+PrintingSetup=Setup of One click Printing System
+PrintingDesc=This module adds a Print button to various modules to allow documents to be printed directly to a printer with no need to open the document into another application.
+MenuDirectPrinting=One click Printing jobs
+DirectPrint=One click Print
PrintingDriverDesc=Configuration variables for printing driver.
ListDrivers=List of drivers
PrintTestDesc=List of Printers.
diff --git a/htdocs/langs/en_US/receptions.lang b/htdocs/langs/en_US/receptions.lang
index 4ee0555c396..46b2d689609 100644
--- a/htdocs/langs/en_US/receptions.lang
+++ b/htdocs/langs/en_US/receptions.lang
@@ -45,3 +45,4 @@ ReceptionsNumberingModules=Numbering module for receptions
ReceptionsReceiptModel=Document templates for receptions
NoMorePredefinedProductToDispatch=No more predefined products to dispatch
ReceptionExist=A reception exists
+ByingPrice=Bying price
diff --git a/htdocs/langs/fr_FR/receptions.lang b/htdocs/langs/fr_FR/receptions.lang
index 2becadf52c4..5d01e6a75bd 100644
--- a/htdocs/langs/fr_FR/receptions.lang
+++ b/htdocs/langs/fr_FR/receptions.lang
@@ -45,3 +45,4 @@ ReceptionsNumberingModules=Module de numérotation pour les réceptions
ReceptionsReceiptModel=Modèles de document pour les réceptions
NoMorePredefinedProductToDispatch=Plus de produits prédéfinis à expédier
ReceptionExist=Une réception existe
+ByingPrice=Prix d'achat
diff --git a/htdocs/langs/gl_ES/main.lang b/htdocs/langs/gl_ES/main.lang
index a330cb6d7c1..1e13deb814d 100644
--- a/htdocs/langs/gl_ES/main.lang
+++ b/htdocs/langs/gl_ES/main.lang
@@ -4,7 +4,7 @@ DIRECTION=ltr
# msungstdlight or cid0ct are for traditional Chinese (traditional does not render with Ubuntu pdf reader)
# stsongstdlight or cid0cs are for simplified Chinese
# To read Chinese pdf with Linux: sudo apt-get install poppler-data
-FONTFORPDF=helvética
+FONTFORPDF=helvetica
FONTSIZEFORPDF=10
SeparatorDecimal=,
SeparatorThousand=.
diff --git a/htdocs/langs/ko_KR/main.lang b/htdocs/langs/ko_KR/main.lang
index d4c9db86587..4866f431c83 100644
--- a/htdocs/langs/ko_KR/main.lang
+++ b/htdocs/langs/ko_KR/main.lang
@@ -4,7 +4,7 @@ DIRECTION=ltr
# msungstdlight or cid0ct are for traditional Chinese (traditional does not render with Ubuntu pdf reader)
# stsongstdlight or cid0cs are for simplified Chinese
# To read Chinese pdf with Linux: sudo apt-get install poppler-data
-FONTFORPDF=헬 베티 카
+FONTFORPDF=cid0kr
FONTSIZEFORPDF=10
SeparatorDecimal=.
SeparatorThousand=None
diff --git a/htdocs/langs/lv_LV/main.lang b/htdocs/langs/lv_LV/main.lang
index d380a59d050..9f0539dac39 100644
--- a/htdocs/langs/lv_LV/main.lang
+++ b/htdocs/langs/lv_LV/main.lang
@@ -4,7 +4,7 @@ DIRECTION=ltr
# msungstdlight or cid0ct are for traditional Chinese (traditional does not render with Ubuntu pdf reader)
# stsongstdlight or cid0cs are for simplified Chinese
# To read Chinese pdf with Linux: sudo apt-get install poppler-data
-FONTFORPDF=Helvetica
+FONTFORPDF=helvetica
FONTSIZEFORPDF=10
SeparatorDecimal=,
SeparatorThousand=None
diff --git a/htdocs/langs/th_TH/main.lang b/htdocs/langs/th_TH/main.lang
index 367ef49849e..7f635f1da50 100644
--- a/htdocs/langs/th_TH/main.lang
+++ b/htdocs/langs/th_TH/main.lang
@@ -4,7 +4,7 @@ DIRECTION=ltr
# msungstdlight or cid0ct are for traditional Chinese (traditional does not render with Ubuntu pdf reader)
# stsongstdlight or cid0cs are for simplified Chinese
# To read Chinese pdf with Linux: sudo apt-get install poppler-data
-FONTFORPDF=Helvetica
+FONTFORPDF=helvetica
FONTSIZEFORPDF=10
SeparatorDecimal=.
SeparatorThousand=,
diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php
index df24e022d90..a15f6c926a6 100644
--- a/htdocs/loan/card.php
+++ b/htdocs/loan/card.php
@@ -717,12 +717,12 @@ if ($id > 0) {
// Edit
if (($object->paid == 0 || $object->paid == 2) && $user->rights->loan->write) {
- print '
';
+ print '
';
}
// Emit payment
if (($object->paid == 0 || $object->paid == 2) && ((price2num($object->capital) > 0 && round($staytopay) < 0) || (price2num($object->capital) > 0 && round($staytopay) > 0)) && $user->rights->loan->write) {
- print '
';
+ print '
';
}
// Classify 'paid'
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 1567df55a56..6f6d74c0cda 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -450,10 +450,12 @@ if (!defined('NOTOKENRENEWAL') && !defined('NOSESSION')) {
$_SESSION['token'] = $_SESSION['newtoken'];
}
- // Save in $_SESSION['newtoken'] what will be next token. Into forms, we will add param token = $_SESSION['newtoken']
- $token = dol_hash(uniqid(mt_rand(), false), 'md5'); // Generates a hash of a random number. We don't need a secured hash, just a changing random value.
- $_SESSION['newtoken'] = $token;
- dol_syslog("NEW TOKEN generated by : " . $_SERVER['PHP_SELF'], LOG_DEBUG);
+ if (!isset($_SESSION['newtoken']) || getDolGlobalInt('MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL')) {
+ // Save in $_SESSION['newtoken'] what will be next token. Into forms, we will add param token = $_SESSION['newtoken']
+ $token = dol_hash(uniqid(mt_rand(), false), 'md5'); // Generates a hash of a random number. We don't need a secured hash, just a changing random value.
+ $_SESSION['newtoken'] = $token;
+ dol_syslog("NEW TOKEN generated by : " . $_SERVER['PHP_SELF'], LOG_DEBUG);
+ }
}
}
@@ -504,7 +506,11 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt(
} else {
dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"])?'':$_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (POST method or GET with a sensible value for 'action' parameter) in main.inc.php. Token not provided.", LOG_WARNING);
print "Access to this page this way (POST method or GET with a sensible value for 'action' parameter) is refused by CSRF protection in main.inc.php. Token not provided.\n";
- print "If you access your server behind a proxy using url rewriting and the parameter is provided by caller, you might check that all HTTP header are propagated (or add the line \$dolibarr_nocsrfcheck=1 into your conf.php file or MAIN_SECURITY_CSRF_WITH_TOKEN to 0 into setup).\n";
+ print "If you access your server behind a proxy using url rewriting and the parameter is provided by caller, you might check that all HTTP header are propagated (or add the line \$dolibarr_nocsrfcheck=1 into your conf.php file or MAIN_SECURITY_CSRF_WITH_TOKEN to 0";
+ if (! empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)) {
+ print " instead of ".$conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN;
+ }
+ print " into setup).\n";
}
die;
}
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index db8bc85816e..4a3f9fd6e25 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -1999,15 +1999,15 @@ if ($module == 'initmodule') {
print '
';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.' ';
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
print '';
print '
'.$langs->trans("ReadmeFile").' : '.$pathtofilereadme.' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
print '';
print '
'.$langs->trans("ChangeLog").' : '.$pathtochangelog.' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
print '';
print '';
@@ -2177,8 +2177,8 @@ if ($module == 'initmodule') {
$pathtofile = 'langs/'.$langfile['relativename'];
}
print '
'.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : '.$pathtofile.' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
print ' ';
}
print '';
@@ -2226,7 +2226,7 @@ if ($module == 'initmodule') {
print ' ';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.' ';
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
print ' ';
if (is_array($dicts) && !empty($dicts)) {
print ' '.$langs->trans("LanguageFile").' : ';
@@ -2502,13 +2502,13 @@ if ($module == 'initmodule') {
print '';
print '
'.$langs->trans("ClassFile").' :
'.($realpathtoclass ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoclass).($realpathtoclass ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
print '
'.$langs->trans("ApiClassFile").' :
'.($realpathtoapi ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).($realpathtoapi ? '' : ' ').' ';
if (dol_is_file($realpathtoapi)) {
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print ' ';
- print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
+ print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
print ' ';
if (empty($conf->global->$const_name)) { // If module is not activated
print '
'.$langs->trans("GoToApiExplorer").' ';
@@ -2517,99 +2517,99 @@ if ($module == 'initmodule') {
}
} else {
//print '
'.$langs->trans("FileNotYetGenerated").' ';
- print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
+ print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
}
// PHPUnit
print '
';
print '
'.$langs->trans("TestClassFile").' :
'.($realpathtophpunit ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtophpunit).($realpathtophpunit ? '' : ' ').' ';
if (dol_is_file($realpathtophpunit)) {
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print ' ';
- print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
+ print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
} else {
//print '
'.$langs->trans("FileNotYetGenerated").' ';
- print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
+ print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
}
print '
';
print '
';
print '
'.$langs->trans("PageForLib").' :
'.($realpathtolib ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtolib).($realpathtolib ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
print '
'.$langs->trans("PageForObjLib").' :
'.($realpathtoobjlib ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoobjlib).($realpathtoobjlib ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
print '
'.$langs->trans("Image").' :
'.($realpathtopicto ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtopicto).($realpathtopicto ? '' : ' ').' ';
- //print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ //print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
print '
';
print '
'.$langs->trans("SqlFile").' :
'.($realpathtosql ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosql).($realpathtosql ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
- print '
'.$langs->trans("DropTableIfEmpty").' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.$langs->trans("DropTableIfEmpty").' ';
//print '
'.$langs->trans("RunSql").' ';
print '
';
print '
'.$langs->trans("SqlFileKey").' :
'.($realpathtosqlkey ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlkey).($realpathtosqlkey ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
//print '
'.$langs->trans("RunSql").' ';
print '
';
print '
'.$langs->trans("SqlFileExtraFields").' :
'.($realpathtosqlextra ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlextra).($realpathtosqlextra ? '' : ' ').' ';
if (dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey)) {
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print ' ';
- print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
+ print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
print ' ';
- print '
'.$langs->trans("DropTableIfEmpty").' ';
+ print '
'.$langs->trans("DropTableIfEmpty").' ';
} else {
- print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
+ print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
}
//print '
'.$langs->trans("RunSql").' ';
print '
';
print '
'.$langs->trans("SqlFileKeyExtraFields").' :
'.($realpathtosqlextrakey ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlextrakey).($realpathtosqlextrakey ? '' : ' ').' ';
if (dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey)) {
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print ' ';
- print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
+ print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
} else {
- print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
+ print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
}
print '
';
print '
';
print '';
print '
'.$langs->trans("PageForList").' :
'.($realpathtolist ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtolist).($realpathtolist ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
print '
'.$langs->trans("PageForCreateEditView").' :
'.($realpathtocard ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtocard).($realpathtocard ? '' : ' ').'?action=create ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
print '
'.$langs->trans("PageForContactTab").' :
'.($realpathtocontact ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtocontact).($realpathtocontact ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
if (dol_is_file($realpathtocontact)) {
print ' ';
- print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
+ print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
}
print '
';
print '
'.$langs->trans("PageForDocumentTab").' :
'.($realpathtodocument ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtodocument).($realpathtodocument ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
if (dol_is_file($realpathtodocument)) {
print ' ';
- print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
+ print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
}
print '
';
print '
'.$langs->trans("PageForNoteTab").' :
'.($realpathtonote ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtonote).($realpathtonote ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
if (dol_is_file($realpathtonote)) {
print ' ';
- print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
+ print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
}
print '
';
print '
'.$langs->trans("PageForAgendaTab").' :
'.($realpathtoagenda ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoagenda).($realpathtoagenda ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
if (dol_is_file($realpathtoagenda)) {
print ' ';
- print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
+ print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
}
print '
';
print '
';
@@ -2928,7 +2928,7 @@ if ($module == 'initmodule') {
$format = 'markdown';
}
print '
'.$langs->trans("SpecificationFile").' :
'.$pathtofile.' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
}
} else {
@@ -3020,7 +3020,7 @@ if ($module == 'initmodule') {
print '
';
print '
'.$langs->trans("DescriptorFile").' :
'.$pathtofile.' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
print '
';
@@ -3153,7 +3153,7 @@ if ($module == 'initmodule') {
print '
';
print '
'.$langs->trans("DescriptorFile").' :
'.$pathtofile.' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
print '
';
@@ -3243,7 +3243,7 @@ if ($module == 'initmodule') {
print '
';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.' ';
print ' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
print ' ';
print '
';
@@ -3252,7 +3252,7 @@ if ($module == 'initmodule') {
if (dol_is_file($dirins.'/'.$pathtohook)) {
print ''.$pathtohook.' ';
print ' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
print ''.img_picto($langs->trans("Delete"), 'delete').' ';
} else {
print ''.$langs->trans("FileNotYetGenerated").' ';
@@ -3302,7 +3302,7 @@ if ($module == 'initmodule') {
print '';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.' ';
print ' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
print ' ';
if (!empty($triggers)) {
@@ -3311,7 +3311,7 @@ if ($module == 'initmodule') {
print '
';
print ' '.$langs->trans("TriggersFile").' : '.$pathtofile.' ';
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
print ''.img_picto($langs->trans("Delete"), 'delete').' ';
print '';
}
@@ -3407,11 +3407,11 @@ if ($module == 'initmodule') {
print '
'.$langs->trans("JSFile").' : ';
if (dol_is_file($dirins.'/'.$pathtohook)) {
print '
'.$pathtohook.' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
- print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
} else {
print '
'.$langs->trans("FileNotYetGenerated").' ';
- print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
+ print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
}
print '
';
} else {
@@ -3455,13 +3455,13 @@ if ($module == 'initmodule') {
$pathtofile = $widget['relpath'];
print '
'.$langs->trans("WidgetFile").' : '.$pathtofile.' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
print '';
}
} else {
print '
'.$langs->trans("WidgetFile").' : '.$langs->trans("NoWidget").' ';
- print ''.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
+ print ''.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
print '';
}
print '';
@@ -3502,7 +3502,7 @@ if ($module == 'initmodule') {
print '
';
print '
'.$langs->trans("DescriptorFile").' :
'.$pathtofile.' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
} else {
$fullpathoffile = dol_buildpath($file, 0);
@@ -3572,13 +3572,13 @@ if ($module == 'initmodule') {
$pathtofile = $clifile['relpath'];
print '
'.$langs->trans("CLIFile").' : '.$pathtofile.' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
print '';
}
} else {
print '
'.$langs->trans("CLIFile").' : '.$langs->trans("FileNotYetGenerated");' ';
- print ''.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
+ print ''.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
print '';
}
print '';
@@ -3618,7 +3618,7 @@ if ($module == 'initmodule') {
print '
';
print '
'.$langs->trans("DescriptorFile").' :
'.$pathtofile.' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
print '
';
@@ -3746,14 +3746,14 @@ if ($module == 'initmodule') {
}
print '
';
print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.' ';
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
print '';
}
} else {
print '
';
print ' '.$langs->trans("SpecificationFile").' : '.$langs->trans("FileNotYetGenerated").' ';
- print ' '.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
+ print ''.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
print '';
}
print '';
diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php
index d0d4a404dcf..7c6c6b2c04e 100644
--- a/htdocs/modulebuilder/template/admin/setup.php
+++ b/htdocs/modulebuilder/template/admin/setup.php
@@ -389,7 +389,7 @@ if ($action == 'edit') {
print '';
print '
';
} else {
print '
'.$langs->trans("NothingToSetup");
diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php
index 51f35bbc33d..136952662cc 100644
--- a/htdocs/mrp/mo_card.php
+++ b/htdocs/mrp/mo_card.php
@@ -609,7 +609,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Modify
if ($object->status == $object::STATUS_DRAFT) {
if ($permissiontoadd) {
- print '
id.'&action=edit">'.$langs->trans("Modify").' '."\n";
+ print '
id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify").' '."\n";
} else {
print '
'.$langs->trans('Modify').' '."\n";
}
diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php
index a811a396811..5e145dbd8a6 100644
--- a/htdocs/multicurrency/class/multicurrency.class.php
+++ b/htdocs/multicurrency/class/multicurrency.class.php
@@ -432,7 +432,7 @@ class MultiCurrency extends CommonObject
*/
public function addRateFromDolibarr($code, $rate)
{
- global $db, $user;
+ global $user;
$currency = new MultiCurrency($this->db);
$currency->code = $code;
@@ -441,8 +441,8 @@ class MultiCurrency extends CommonObject
$sql = 'SELECT label FROM '.MAIN_DB_PREFIX."c_currencies WHERE code_iso = '".$this->db->escape($code)."'";
dol_syslog(__METHOD__, LOG_DEBUG);
- $resql = $db->query($sql);
- if ($resql && ($line = $db->fetch_object($resql))) {
+ $resql = $this->db->query($sql);
+ if ($resql && ($line = $this->db->fetch_object($resql))) {
$currency->name = $line->label;
}
@@ -521,7 +521,7 @@ class MultiCurrency extends CommonObject
* @param integer $date_document Date from document (propal, order, invoice, ...)
*
* @return array [0] => id currency
- * [1] => rate
+ * [1] => rate
*/
public static function getIdAndTxFromCode($db, $code, $date_document = '')
{
@@ -687,12 +687,10 @@ class MultiCurrency extends CommonObject
* @param string $code current code to search
* @return boolean True if exists, false if not exists
*/
- public static function checkCodeAlreadyExists($code)
+ public function checkCodeAlreadyExists($code)
{
- global $db;
-
- $currency = new MultiCurrency($db);
- if ($currency->fetch('', $code) > 0) {
+ $currencytmp = new MultiCurrency($this->db);
+ if ($currencytmp->fetch('', $code) > 0) {
return true;
} else {
return false;
diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php
index db637136cad..2a281931046 100644
--- a/htdocs/partnership/partnership_card.php
+++ b/htdocs/partnership/partnership_card.php
@@ -556,7 +556,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (empty($reshook)) {
// Send
if (empty($user->socid)) {
- print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle');
+ print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
}
if ($object->status == $object::STATUS_DRAFT) {
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index fd9b129e30d..80378bd1b2a 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -1262,7 +1262,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '
'.$langs->trans("DefaultWarehouse").' ';
print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"');
print $formproduct->selectWarehouses(GETPOST('fk_default_warehouse', 'int'), 'fk_default_warehouse', 'warehouseopen', 1, 0, 0, '', 0, 0, array(), 'minwidth300 widthcentpercentminusxx maxwidth500');
- print ' ';
+ print ' ';
print ' ';
print ' ';
print ' ';
@@ -2543,14 +2543,14 @@ if ($action != 'create' && $action != 'edit') {
if (empty($reshook)) {
if ($usercancreate) {
if (!isset($object->no_button_edit) || $object->no_button_edit <> 1) {
- print 'id.'">'.$langs->trans("Modify").' ';
+ print 'id.'">'.$langs->trans("Modify").' ';
}
if (!isset($object->no_button_copy) || $object->no_button_copy <> 1) {
if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) {
print ''.$langs->trans('ToClone').' '."\n";
} else {
- print 'id.'">'.$langs->trans("ToClone").' ';
+ print 'id.'">'.$langs->trans("ToClone").' ';
}
}
}
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index fd5d8ecf1db..2702f7989b3 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -5306,7 +5306,7 @@ class Product extends CommonObject
}
$stock_commande_fournisseur = $this->stats_commande_fournisseur['qty'];
}
- if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->reception->enabled)) {
+ if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && !empty($conf->reception->enabled)) {
$filterStatus = '4';
if (isset($includedraftpoforvirtual)) {
$filterStatus = '0,'.$filterStatus;
diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php
index f7f604b5399..9bd361858ba 100644
--- a/htdocs/product/class/productbatch.class.php
+++ b/htdocs/product/class/productbatch.class.php
@@ -437,6 +437,7 @@ class Productbatch extends CommonObject
public static function findAll($db, $fk_product_stock, $with_qty = 0, $fk_product = 0)
{
global $langs, $conf;
+
$ret = array();
$sql = "SELECT";
diff --git a/htdocs/product/dynamic_price/editor.php b/htdocs/product/dynamic_price/editor.php
index 784be41dfe9..893cc654f89 100644
--- a/htdocs/product/dynamic_price/editor.php
+++ b/htdocs/product/dynamic_price/editor.php
@@ -204,7 +204,7 @@ print '