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:
commit
774e327831
@ -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->facture->creer)
|
||||
@ -266,39 +266,48 @@ if ($socid > 0)
|
||||
print '<tr><td class="titlefield">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>';
|
||||
print '<td>'.$remise_all.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>';
|
||||
print '<td>'.$remise_user.' '.$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 '<td>'.$remise_user.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
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"> '.$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>";
|
||||
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
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"> '.$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>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">';
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">';
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '</form>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
@ -423,7 +432,7 @@ if ($socid > 0)
|
||||
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
|
||||
|
||||
@ -438,7 +438,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$qualified_for_stock_change = 0;
|
||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
||||
@ -1022,7 +1022,7 @@ if (empty($reshook))
|
||||
|
||||
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines or deposit lines");
|
||||
$result = $srcobject->fetch($object->origin_id);
|
||||
|
||||
|
||||
// If deposit invoice
|
||||
if ($_POST['type'] == Facture::TYPE_DEPOSIT)
|
||||
{
|
||||
@ -1183,7 +1183,7 @@ if (empty($reshook))
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Now we create same links to contact than the ones found on origin object
|
||||
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
|
||||
{
|
||||
@ -1196,13 +1196,13 @@ if (empty($reshook))
|
||||
}
|
||||
$sqlcontact = "SELECT code, fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
|
||||
|
||||
|
||||
$resqlcontact = $db->query($sqlcontact);
|
||||
if ($resqlcontact)
|
||||
{
|
||||
while($objcontact = $db->fetch_object($resqlcontact))
|
||||
{
|
||||
//print $objcontact->code.'-'.$objcontact->fk_socpeople."\n";
|
||||
//print $objcontact->code.'-'.$objcontact->fk_socpeople."\n";
|
||||
$object->add_contact($objcontact->fk_socpeople, $objcontact->code);
|
||||
}
|
||||
}
|
||||
@ -1214,14 +1214,17 @@ if (empty($reshook))
|
||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
// modified by hook
|
||||
if ($reshook < 0)
|
||||
{
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{ // If some invoice's lines coming from page
|
||||
$id = $object->create($user);
|
||||
|
||||
@ -1393,7 +1396,7 @@ if (empty($reshook))
|
||||
// Ecrase $txtva par celui du produit
|
||||
// Ecrase $base_price_type par celui du produit
|
||||
// Replaces $fk_unit with the product's
|
||||
if (! empty($idprod))
|
||||
if (! empty($idprod))
|
||||
{
|
||||
$prod = new Product($db);
|
||||
$prod->fetch($idprod);
|
||||
@ -1404,7 +1407,7 @@ if (empty($reshook))
|
||||
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
|
||||
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
|
||||
|
||||
$pu_ht = $prod->price;
|
||||
$pu_ttc = $prod->price_ttc;
|
||||
$price_min = $prod->price_min;
|
||||
@ -1451,13 +1454,13 @@ if (empty($reshook))
|
||||
}
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
elseif ($tva_tx != $prod->tva_tx)
|
||||
elseif ($tva_tx != $prod->tva_tx)
|
||||
{
|
||||
if ($price_base_type != 'HT')
|
||||
if ($price_base_type != 'HT')
|
||||
{
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU');
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
|
||||
}
|
||||
@ -1519,7 +1522,7 @@ if (empty($reshook))
|
||||
// Local Taxes
|
||||
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr);
|
||||
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr);
|
||||
|
||||
|
||||
$info_bits = 0;
|
||||
if ($tva_npr)
|
||||
$info_bits |= 0x01;
|
||||
@ -1623,7 +1626,7 @@ if (empty($reshook))
|
||||
// Add buying price
|
||||
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||
|
||||
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
@ -2082,7 +2085,7 @@ if ($action == 'create')
|
||||
$invoice_predefined->fetch(GETPOST('fac_rec','int'));
|
||||
|
||||
$dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later
|
||||
|
||||
|
||||
$sql = 'SELECT r.rowid, r.titre, r.total_ttc';
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as r';
|
||||
$sql .= ' WHERE r.fk_soc = ' . $invoice_predefined->socid;
|
||||
@ -3087,7 +3090,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
// Remise dispo de type avoir
|
||||
if (! $absolute_discount)
|
||||
print '<br>';
|
||||
// $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer
|
||||
// $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer
|
||||
$more=' ('.$addcreditnote.')';
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0, $more); // We allow credit note even if amount is higher
|
||||
}
|
||||
@ -4038,7 +4041,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="facture/fiche-rec.php?facid=' . $object->id . '&action=create">' . $langs->trans("ChangeIntoRepeatableInvoice") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Create a credit note
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $user->rights->facture->creer)
|
||||
{
|
||||
@ -4193,7 +4196,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'inv'.$object->id);
|
||||
}
|
||||
}
|
||||
$formmail->withfrom = 1;
|
||||
$liste = array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) {
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* 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
|
||||
* 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->zip = $obj->zip;
|
||||
$this->town = $obj->town;
|
||||
$this->country_id = $obj->country_id;
|
||||
$this->country_id = $obj->fk_country;
|
||||
$this->country_code = $obj->country_code;
|
||||
$this->country = $obj->country;
|
||||
$this->country_olddata= $obj->country_olddata; // deprecated
|
||||
|
||||
@ -1810,6 +1810,7 @@ class ExpenseReportLine
|
||||
// Clean parameters
|
||||
$this->comments=trim($this->comments);
|
||||
$this->vatrate = price2num($this->vatrate);
|
||||
$this->value_unit = price2num($this->value_unit);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
@ -392,3 +392,5 @@ ThirdpartiesMergeSuccess=Thirdparties have been merged
|
||||
SaleRepresentativeLogin=Login of sales representative
|
||||
SaleRepresentativeFirstname=Firstname 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)
|
||||
|
||||
// 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.= " 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.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " WHERE f.entity = " . $conf->entity;
|
||||
$sql.= " AND f.rowid = fd.fk_facture";
|
||||
$sql.= " AND pf.fk_facture = f.rowid";
|
||||
$sql.= " AND pf.fk_paiement= p.rowid";
|
||||
$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.= " GROUP BY annee, mois ";
|
||||
$sql.= " ORDER BY annee, mois ";
|
||||
|
||||
@ -446,7 +446,7 @@ if (empty($reshook))
|
||||
if (empty($object->fournisseur)) $object->code_fournisseur='';
|
||||
|
||||
$result = $object->create($user);
|
||||
if ($result >= 0)
|
||||
if ($result >= 0)
|
||||
{
|
||||
if ($object->particulier)
|
||||
{
|
||||
@ -509,6 +509,13 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if($result == -3) {
|
||||
$duplicate_code_error = true;
|
||||
$object->code_fournisseur = null;
|
||||
$object->code_client = null;
|
||||
}
|
||||
|
||||
$error=$object->error; $errors=$object->errors;
|
||||
}
|
||||
|
||||
@ -802,8 +809,14 @@ else
|
||||
$object->particulier = $private;
|
||||
$object->prefix_comm = GETPOST('prefix_comm');
|
||||
$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->address = GETPOST('address', 'alpha');
|
||||
$object->zip = GETPOST('zipcode', 'alpha');
|
||||
@ -1004,7 +1017,7 @@ else
|
||||
|
||||
print '<td>'.fieldLabel('CustomerCode','customer_code').'</td><td width="25%">';
|
||||
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);
|
||||
print '<input type="text" name="code_client" id="customer_code" size="16" value="'.dol_escape_htmltag($tmpcode).'" maxlength="15">';
|
||||
print '</td><td>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user