diff --git a/build/exe/doliwamp/index.php.install b/build/exe/doliwamp/index.php.install
index 1245e1f18b2..0df983529f4 100644
--- a/build/exe/doliwamp/index.php.install
+++ b/build/exe/doliwamp/index.php.install
@@ -304,22 +304,15 @@ if (isset($_GET['img']))
-// Definition de la langue et des textes
+// Definition of language and texts
-if (isset ($_GET['lang']))
-{
- $langue = $_GET['lang'];
-}
-elseif (preg_match("/^fr/", $_SERVER['HTTP_ACCEPT_LANGUAGE']))
-{
+if (isset ($_GET['lang'])) {
+ $langue = preg_replace('/[^a-z_]/i', '', $_GET['lang']);
+} elseif (preg_match("/^fr/", $_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$langue = 'fr';
-}
-elseif (preg_match("/^es/", $_SERVER['HTTP_ACCEPT_LANGUAGE']))
-{
+} elseif (preg_match("/^es/", $_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$langue = 'es';
-}
-else
-{
+} else {
$langue = 'en';
}
@@ -327,29 +320,25 @@ else
// Read PHP extensions
$loaded_extensions = get_loaded_extensions();
$phpExtContents='';
-foreach ($loaded_extensions as $extension)
+foreach ($loaded_extensions as $extension) {
$phpExtContents .= "
|
';
}
diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php
index 5bd87245f77..d3d1ecfb833 100644
--- a/htdocs/comm/action/list.php
+++ b/htdocs/comm/action/list.php
@@ -348,41 +348,41 @@ if ($search_title != '') {
if ($search_note != '') {
$param .= '&search_note='.urlencode($search_note);
}
-if (GETPOST('datestartday_dtstart', 'int')) {
- $param .= '&datestartday_dtstart='.GETPOST('datestartday_dtstart', 'int');
+if (GETPOST('datestart_dtstartday', 'int')) {
+ $param .= '&datestart_dtstartday='.GETPOST('datestart_dtstartday', 'int');
}
-if (GETPOST('datestartmonth_dtstart', 'int')) {
- $param .= '&datestartmonth_dtstart='.GETPOST('datestartmonth_dtstart', 'int');
+if (GETPOST('datestart_dtstartmonth', 'int')) {
+ $param .= '&datestart_dtstartmonth='.GETPOST('datestart_dtstartmonth', 'int');
}
-if (GETPOST('datestartyear_dtstart', 'int')) {
- $param .= '&datestartyear_dtstart='.GETPOST('datestartyear_dtstart', 'int');
+if (GETPOST('datestart_dtstartyear', 'int')) {
+ $param .= '&datestart_dtstartyear='.GETPOST('datestart_dtstartyear', 'int');
}
-if (GETPOST('datestartday_dtend', 'int')) {
- $param .= '&datestartday_dtend='.GETPOST('datestartday_dtend', 'int');
+if (GETPOST('datestart_dtendday', 'int')) {
+ $param .= '&datestart_dtendday='.GETPOST('datestart_dtendday', 'int');
}
-if (GETPOST('datestartmonth_dtend', 'int')) {
- $param .= '&datestartmonth_dtend='.GETPOST('datestartmonth_dtend', 'int');
+if (GETPOST('datestart_dtendmonth', 'int')) {
+ $param .= '&datestart_dtendmonth='.GETPOST('datestart_dtendmonth', 'int');
}
-if (GETPOST('datestartyear_dtend', 'int')) {
- $param .= '&datestartyear_dtend='.GETPOST('datestartyear_dtend', 'int');
+if (GETPOST('datestart_dtendyear', 'int')) {
+ $param .= '&datestart_dtendyear='.GETPOST('datestart_dtendyear', 'int');
}
-if (GETPOST('dateendday_dtstart', 'int')) {
- $param .= '&dateendday_dtstart='.GETPOST('dateendday_dtstart', 'int');
+if (GETPOST('dateend_dtstartday', 'int')) {
+ $param .= '&dateend_dtstartday='.GETPOST('dateend_dtstartday', 'int');
}
-if (GETPOST('dateendmonth_dtstart', 'int')) {
- $param .= '&dateendmonth_dtstart='.GETPOST('dateendmonth_dtstart', 'int');
+if (GETPOST('dateend_dtstartmonth', 'int')) {
+ $param .= '&dateend_dtstartmonth='.GETPOST('dateend_dtstartmonth', 'int');
}
-if (GETPOST('dateendyear_dtstart', 'int')) {
- $param .= '&dateendyear_dtstart='.GETPOST('dateendyear_dtstart', 'int');
+if (GETPOST('dateend_dtstartyear', 'int')) {
+ $param .= '&dateend_dtstartyear='.GETPOST('dateend_dtstartyear', 'int');
}
-if (GETPOST('dateendday_dtend', 'int')) {
- $param .= '&dateendday_dtend='.GETPOST('dateendday_dtend', 'int');
+if (GETPOST('dateend_dtendday', 'int')) {
+ $param .= '&dateend_dtendday='.GETPOST('dateend_dtendday', 'int');
}
-if (GETPOST('dateendmonth_dtend', 'int')) {
- $param .= '&dateendmonth_dtend='.GETPOST('dateendmonth_dtend', 'int');
+if (GETPOST('dateend_dtendmonth', 'int')) {
+ $param .= '&dateend_dtendmonth='.GETPOST('dateend_dtendmonth', 'int');
}
-if (GETPOST('dateendyear_dtend', 'int')) {
- $param .= '&dateendyear_dtend='.GETPOST('dateendyear_dtend', 'int');
+if (GETPOST('dateend_dtendyear', 'int')) {
+ $param .= '&dateend_dtendyear='.GETPOST('dateend_dtendyear', 'int');
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 205eab09655..1bc57c89698 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -780,10 +780,14 @@ if (empty($reshook)) {
if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) {
$db->begin();
- $result = $object->reopen($user, empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE));
+ $newstatus = (getDolGlobalInt('PROPAL_SKIP_ACCEPT_REFUSE') ? Propal::STATUS_DRAFT : Propal::STATUS_VALIDATED);
+ $result = $object->reopen($user, $newstatus);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
+ } else {
+ $object->statut = $newstatus;
+ $object->status = $newstatus;
}
if (!$error) {
@@ -1631,14 +1635,15 @@ if (empty($reshook)) {
$result = $object->setWarehouse(GETPOST('warehouse_id', 'int'));
} elseif ($action == 'update_extras') {
$object->oldcopy = dol_clone($object, 2);
+ $attribute_name = GETPOST('attribute', 'restricthtml');
// Fill array 'array_options' with data from update form
- $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
+ $ret = $extrafields->setOptionalsFromPost(null, $object, $attribute_name);
if ($ret < 0) {
$error++;
}
if (!$error) {
- $result = $object->insertExtraFields('PROPAL_MODIFY');
+ $result = $object->updateExtraField($attribute_name, 'PROPAL_MODIFY');
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php
index 38f10628495..ca542017360 100644
--- a/htdocs/compta/bank/class/account.class.php
+++ b/htdocs/compta/bank/class/account.class.php
@@ -559,6 +559,8 @@ class Account extends CommonObject
*/
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '', $amount_main_currency = null)
{
+ global $langs;
+
// Deprecation warning
if (is_numeric($oper)) {
dol_syslog(__METHOD__.": using numeric operations is deprecated", LOG_WARNING);
@@ -591,11 +593,11 @@ class Account extends CommonObject
// Check parameters
if (!$oper) {
- $this->error = "oper not defined";
+ $this->error = $langs->trans("OperNotDefined");
return -1;
}
if (!$this->id) {
- $this->error = "this->id not defined";
+ $this->error = $langs->trans("ThisIdNotDefined");
return -2;
}
if ($this->courant == Account::TYPE_CASH && $oper != 'LIQ') {
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index e9be3761efa..810bba691c4 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -5853,7 +5853,7 @@ if ($action == 'create') {
print dolGetButtonAction($htmltooltip, $langs->trans('Delete'), 'delete', $deleteHref, '', $enableDelete, $params);
} else {
$params['attr']['title'] = '';
- print dolGetButtonAction($langs->trans('Delete'), $langs->trans('Delete'), 'delete', '#', '', false);
+ print dolGetButtonAction($htmltooltip, $langs->trans('Delete'), 'delete', '#', '', false);
}
}
print '';
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index 0c2936d5791..94e2d570fcf 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -275,7 +275,7 @@ class Paiement extends CommonObject
// Add controls of input validity
if ($value_converted === false) {
// We failed to find the conversion for one invoice
- $this->error = 'FailedToFoundTheConversionRateForInvoice';
+ $this->error = $langs->trans('FailedToFoundTheConversionRateForInvoice');
return -1;
}
if (empty($currencyofpayment)) {
@@ -324,7 +324,7 @@ class Paiement extends CommonObject
// Check parameters
if (empty($totalamount) && empty($atleastonepaymentnotnull)) { // We accept negative amounts for withdraw reject but not empty arrays
$this->errors[] = 'TotalAmountEmpty';
- $this->error = 'TotalAmountEmpty';
+ $this->error = $langs->trans('TotalAmountEmpty');
return -1;
}
diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php
index 3b455d93ce8..7ac0669a28a 100644
--- a/htdocs/compta/paiement/list.php
+++ b/htdocs/compta/paiement/list.php
@@ -70,6 +70,7 @@ $search_account = GETPOST("search_account", "int");
$search_payment_num = GETPOST('search_payment_num', 'alpha');
$search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x"
$search_status = GETPOST('search_status', 'intcomma');
+$search_sale = GETPOST('search_sale', 'int');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
@@ -117,6 +118,17 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
$hookmanager->initHooks(array('paymentlist'));
$object = new Paiement($db);
+if (!$user->hasRight('societe', 'client', 'voir')) {
+ $search_sale = $user->id;
+}
+
+// Security check
+if ($user->socid) {
+ $socid = $user->socid;
+}
+$result = restrictedArea($user, 'facture', $facid, '');
+
+
/*
* Actions
*/
@@ -185,8 +197,7 @@ if (GETPOST("orphelins", "alpha")) {
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
} else {
- // DISTINCT is to avoid duplicate when there is a link to sales representatives
- $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep, p.fk_bank, p.amount, p.statut, p.num_paiement";
+ $sql = "SELECT p.rowid, p.ref, p.datep, p.fk_bank, p.amount, p.statut, p.num_paiement";
$sql .= ", c.code as paiement_code";
$sql .= ", ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal";
$sql .= ", s.rowid as socid, s.nom as name, s.email";
@@ -205,13 +216,7 @@ if (GETPOST("orphelins", "alpha")) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
- if (empty($user->rights->societe->client->voir) && !$socid) {
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
- }
$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
- if (empty($user->rights->societe->client->voir) && !$socid) {
- $sql .= " AND sc.fk_user = ".((int) $user->id);
- }
if ($socid > 0) {
$sql .= " AND f.fk_soc = ".((int) $socid);
}
@@ -248,6 +253,14 @@ if (GETPOST("orphelins", "alpha")) {
if ($search_company) {
$sql .= natural_search('s.nom', $search_company);
}
+ // Search on sale representative
+ if ($search_sale && $search_sale != '-1') {
+ if ($search_sale == -2) {
+ $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
+ } elseif ($search_sale > 0) {
+ $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc AND sc.fk_user = ".((int) $search_sale).")";
+ }
+ }
if ($search_all) {
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php
index 584ece47079..cf2a26979a9 100644
--- a/htdocs/compta/resultat/clientfourn.php
+++ b/htdocs/compta/resultat/clientfourn.php
@@ -214,12 +214,12 @@ if (isModEnabled('accounting')) {
$calcmode .= '