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
This commit is contained in:
Laurent Destailleur 2016-07-21 10:30:51 +02:00
commit 774e327831
7 changed files with 81 additions and 53 deletions

View File

@ -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,39 +266,48 @@ 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>';
print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>'; if (! empty($user->fk_soc)) // No need to show this for external users
print '<td>'.$remise_user.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>'; {
print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>';
print '<td>'.$remise_user.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
}
print '</table>'; print '</table>';
print '<br>';
print load_fiche_titre($langs->trans("NewGlobalDiscount"),'',''); if ($user->rights->societe->creer)
print '<table class="border" width="100%">'; {
print '<tr><td width="38%" class="fieldrequired">'.$langs->trans("AmountHT").'</td>'; print '<br>';
print '<td><input type="text" size="5" name="amount_ht" value="'.$_POST["amount_ht"].'">';
print '<span class="hideonsmartphone">&nbsp;'.$langs->trans("Currency".$conf->currency).'</span></td></tr>';
print '<tr><td width="38%">'.$langs->trans("VAT").'</td>';
print '<td>';
print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object);
print '</td></tr>';
print '<tr><td class="fieldrequired" >'.$langs->trans("NoteReason").'</td>';
print '<td><input type="text" size="60" name="desc" value="'.GETPOST('desc').'"></td></tr>';
print "</table>"; print load_fiche_titre($langs->trans("NewGlobalDiscount"),'','');
print '<table class="border" width="100%">';
print '<tr><td width="38%" class="fieldrequired">'.$langs->trans("AmountHT").'</td>';
print '<td><input type="text" size="5" name="amount_ht" value="'.$_POST["amount_ht"].'">';
print '<span class="hideonsmartphone">&nbsp;'.$langs->trans("Currency".$conf->currency).'</span></td></tr>';
print '<tr><td width="38%">'.$langs->trans("VAT").'</td>';
print '<td>';
print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object);
print '</td></tr>';
print '<tr><td class="fieldrequired" >'.$langs->trans("NoteReason").'</td>';
print '<td><input type="text" size="60" name="desc" value="'.GETPOST('desc').'"></td></tr>';
print "</table>";
}
print '</div>'; print '</div>';
dol_fiche_end(); dol_fiche_end();
print '<div class="center">'; if ($user->rights->societe->creer)
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">'; {
if (! empty($backtopage)) print '<div class="center">';
{ print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; if (! empty($backtopage))
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; {
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
}
print '</div>';
} }
print '</div>';
print '</form>'; print '</form>';
print '<br>'; print '<br>';
@ -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

View File

@ -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');

View File

@ -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
$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

View File

@ -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();

View File

@ -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

View File

@ -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 ";

View File

@ -446,7 +446,7 @@ if (empty($reshook))
if (empty($object->fournisseur)) $object->code_fournisseur=''; if (empty($object->fournisseur)) $object->code_fournisseur='';
$result = $object->create($user); $result = $object->create($user);
if ($result >= 0) if ($result >= 0)
{ {
if ($object->particulier) if ($object->particulier)
{ {
@ -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
$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;
$object->code_client = GETPOST('code_client', 'alpha');
$object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur; if(empty($duplicate_code_error)) {
$object->code_client = GETPOST('code_client', 'alpha');
$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');
@ -1004,7 +1017,7 @@ else
print '<td>'.fieldLabel('CustomerCode','customer_code').'</td><td width="25%">'; print '<td>'.fieldLabel('CustomerCode','customer_code').'</td><td width="25%">';
print '<table class="nobordernopadding"><tr><td>'; print '<table class="nobordernopadding"><tr><td>';
$tmpcode=$object->code_client; $tmpcode=$object->code_client;
if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object,0); if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object,0);
print '<input type="text" name="code_client" id="customer_code" size="16" value="'.dol_escape_htmltag($tmpcode).'" maxlength="15">'; print '<input type="text" name="code_client" id="customer_code" size="16" value="'.dol_escape_htmltag($tmpcode).'" maxlength="15">';
print '</td><td>'; print '</td><td>';