Skip to content
Snippets Groups Projects
Commit 774e3278 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Merge remote-tracking branch 'origin/3.9' into 4.0

Conflicts:
	htdocs/comm/remx.php
	htdocs/compta/facture.php
	htdocs/langs/en_US/companies.lang
parents 6e1d7aeb 972d998f
Branches
Tags
No related merge requests found
...@@ -135,7 +135,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') ...@@ -135,7 +135,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
} }
} }
if ($action == 'setremise') if ($action == 'setremise' && $user->rights->societe->creer)
{ {
//if ($user->rights->societe->creer) //if ($user->rights->societe->creer)
//if ($user->rights->facture->creer) //if ($user->rights->facture->creer)
...@@ -266,9 +266,15 @@ if ($socid > 0) ...@@ -266,9 +266,15 @@ if ($socid > 0)
print '<tr><td class="titlefield">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>';
print '<td>'.$remise_all.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>'; print '<td>'.$remise_all.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
if (! empty($user->fk_soc)) // No need to show this for external users
{
print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>'; print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>';
print '<td>'.$remise_user.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>'; print '<td>'.$remise_user.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
}
print '</table>'; print '</table>';
if ($user->rights->societe->creer)
{
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("NewGlobalDiscount"),'',''); print load_fiche_titre($langs->trans("NewGlobalDiscount"),'','');
...@@ -284,11 +290,13 @@ if ($socid > 0) ...@@ -284,11 +290,13 @@ if ($socid > 0)
print '<td><input type="text" size="60" name="desc" value="'.GETPOST('desc').'"></td></tr>'; print '<td><input type="text" size="60" name="desc" value="'.GETPOST('desc').'"></td></tr>';
print "</table>"; print "</table>";
}
print '</div>'; print '</div>';
dol_fiche_end(); dol_fiche_end();
if ($user->rights->societe->creer)
{
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">'; print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">';
if (! empty($backtopage)) if (! empty($backtopage))
...@@ -297,6 +305,7 @@ if ($socid > 0) ...@@ -297,6 +305,7 @@ if ($socid > 0)
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
} }
print '</div>'; print '</div>';
}
print '</form>'; print '</form>';
...@@ -423,7 +432,7 @@ if ($socid > 0) ...@@ -423,7 +432,7 @@ if ($socid > 0)
print '<br>'; print '<br>';
/* /*
* Liste ristournes appliquees (=liees a une ligne de facture ou facture) * List discount consumed (=liees a une ligne de facture ou facture)
*/ */
// Remises liees a lignes de factures // Remises liees a lignes de factures
......
...@@ -1214,7 +1214,10 @@ if (empty($reshook)) ...@@ -1214,7 +1214,10 @@ if (empty($reshook))
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook // modified by hook
if ($reshook < 0) if ($reshook < 0)
{
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$error++; $error++;
}
} else { } else {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -633,7 +634,7 @@ class Don extends CommonObject ...@@ -633,7 +634,7 @@ class Don extends CommonObject
$this->town = $obj->town; $this->town = $obj->town;
$this->zip = $obj->zip; $this->zip = $obj->zip;
$this->town = $obj->town; $this->town = $obj->town;
$this->country_id = $obj->country_id; $this->country_id = $obj->fk_country;
$this->country_code = $obj->country_code; $this->country_code = $obj->country_code;
$this->country = $obj->country; $this->country = $obj->country;
$this->country_olddata= $obj->country_olddata; // deprecated $this->country_olddata= $obj->country_olddata; // deprecated
......
...@@ -1810,6 +1810,7 @@ class ExpenseReportLine ...@@ -1810,6 +1810,7 @@ class ExpenseReportLine
// Clean parameters // Clean parameters
$this->comments=trim($this->comments); $this->comments=trim($this->comments);
$this->vatrate = price2num($this->vatrate); $this->vatrate = price2num($this->vatrate);
$this->value_unit = price2num($this->value_unit);
$this->db->begin(); $this->db->begin();
......
...@@ -392,3 +392,5 @@ ThirdpartiesMergeSuccess=Thirdparties have been merged ...@@ -392,3 +392,5 @@ ThirdpartiesMergeSuccess=Thirdparties have been merged
SaleRepresentativeLogin=Login of sales representative SaleRepresentativeLogin=Login of sales representative
SaleRepresentativeFirstname=Firstname of sales representative SaleRepresentativeFirstname=Firstname of sales representative
SaleRepresentativeLastname=Lastname of sales representative SaleRepresentativeLastname=Lastname of sales representative
ErrorThirdpartiesMerge=There was an error when deleting the thirdparties. Please check the log. Changes have been reverted.
NewCustomerSupplierCodeProposed=New customer or supplier proposed on duplicate code
...@@ -377,14 +377,13 @@ function activitytrim($product_type) ...@@ -377,14 +377,13 @@ function activitytrim($product_type)
// breakdown by quarter // breakdown by quarter
$sql = "SELECT DATE_FORMAT(p.datep,'%Y') as annee, DATE_FORMAT(p.datep,'%m') as mois, SUM(fd.total_ht) as Mnttot"; $sql = "SELECT DATE_FORMAT(p.datep,'%Y') as annee, DATE_FORMAT(p.datep,'%m') as mois, SUM(fd.total_ht) as Mnttot";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as fd"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as fd";
$sql.= " , ".MAIN_DB_PREFIX."paiement as p,".MAIN_DB_PREFIX."paiement_facture as pf"; $sql.= " , ".MAIN_DB_PREFIX."paiement as p,".MAIN_DB_PREFIX."paiement_facture as pf";
$sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " WHERE f.entity = " . $conf->entity;
$sql.= " AND f.rowid = fd.fk_facture"; $sql.= " AND f.rowid = fd.fk_facture";
$sql.= " AND pf.fk_facture = f.rowid"; $sql.= " AND pf.fk_facture = f.rowid";
$sql.= " AND pf.fk_paiement= p.rowid"; $sql.= " AND pf.fk_paiement= p.rowid";
$sql.= " AND fd.product_type=".$product_type; $sql.= " AND fd.product_type=".$product_type;
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
$sql.= " AND p.datep >= '".$db->idate(dol_get_first_day($yearofbegindate),1)."'"; $sql.= " AND p.datep >= '".$db->idate(dol_get_first_day($yearofbegindate),1)."'";
$sql.= " GROUP BY annee, mois "; $sql.= " GROUP BY annee, mois ";
$sql.= " ORDER BY annee, mois "; $sql.= " ORDER BY annee, mois ";
......
...@@ -509,6 +509,13 @@ if (empty($reshook)) ...@@ -509,6 +509,13 @@ if (empty($reshook))
} }
else else
{ {
if($result == -3) {
$duplicate_code_error = true;
$object->code_fournisseur = null;
$object->code_client = null;
}
$error=$object->error; $errors=$object->errors; $error=$object->error; $errors=$object->errors;
} }
...@@ -802,8 +809,14 @@ else ...@@ -802,8 +809,14 @@ else
$object->particulier = $private; $object->particulier = $private;
$object->prefix_comm = GETPOST('prefix_comm'); $object->prefix_comm = GETPOST('prefix_comm');
$object->client = GETPOST('client')?GETPOST('client'):$object->client; $object->client = GETPOST('client')?GETPOST('client'):$object->client;
if(empty($duplicate_code_error)) {
$object->code_client = GETPOST('code_client', 'alpha'); $object->code_client = GETPOST('code_client', 'alpha');
$object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur; $object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur;
} else {
setEventMessages($langs->trans('NewCustomerSupplierCodeProposed'),'', 'warnings');
}
$object->code_fournisseur = GETPOST('code_fournisseur', 'alpha'); $object->code_fournisseur = GETPOST('code_fournisseur', 'alpha');
$object->address = GETPOST('address', 'alpha'); $object->address = GETPOST('address', 'alpha');
$object->zip = GETPOST('zipcode', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment