Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into 7.0
This commit is contained in:
commit
d458b383ad
@ -6,6 +6,7 @@
|
|||||||
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2018 Ferran Marcet <fmarcet@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
|
||||||
@ -288,39 +289,40 @@ class Paiement extends CommonObject
|
|||||||
{
|
{
|
||||||
$amount_ht = $amount_tva = $amount_ttc = array();
|
$amount_ht = $amount_tva = $amount_ttc = array();
|
||||||
|
|
||||||
// Loop on each vat rate
|
// Insert one discount by VAT rate category
|
||||||
$i = 0;
|
$discount = new DiscountAbsolute($this->db);
|
||||||
foreach ($invoice->lines as $line)
|
$discount->fetch('',$invoice->id);
|
||||||
{
|
if (empty($discount->id)) { // If the invoice was not yet converted into a discount (this may have been done manually before we come here)
|
||||||
if ($line->total_ht!=0)
|
|
||||||
{ // no need to create discount if amount is null
|
|
||||||
$amount_ht[$line->tva_tx] += $line->total_ht;
|
|
||||||
$amount_tva[$line->tva_tx] += $line->total_tva;
|
|
||||||
$amount_ttc[$line->tva_tx] += $line->total_ttc;
|
|
||||||
$i ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert one discount by VAT rate category
|
|
||||||
$discount = new DiscountAbsolute($this->db);
|
|
||||||
$discount->description = '(DEPOSIT)';
|
|
||||||
$discount->fk_soc = $invoice->socid;
|
|
||||||
$discount->fk_facture_source = $invoice->id;
|
|
||||||
|
|
||||||
foreach ($amount_ht as $tva_tx => $xxx)
|
$discount->description = '(DEPOSIT)';
|
||||||
{
|
$discount->fk_soc = $invoice->socid;
|
||||||
$discount->amount_ht = abs($amount_ht[$tva_tx]);
|
$discount->fk_facture_source = $invoice->id;
|
||||||
$discount->amount_tva = abs($amount_tva[$tva_tx]);
|
|
||||||
$discount->amount_ttc = abs($amount_ttc[$tva_tx]);
|
|
||||||
$discount->tva_tx = abs($tva_tx);
|
|
||||||
|
|
||||||
$result = $discount->create($user);
|
// Loop on each vat rate
|
||||||
if ($result < 0)
|
$i = 0;
|
||||||
{
|
foreach ($invoice->lines as $line) {
|
||||||
$error++;
|
if ($line->total_ht != 0) { // no need to create discount if amount is null
|
||||||
break;
|
$amount_ht[$line->tva_tx] += $line->total_ht;
|
||||||
}
|
$amount_tva[$line->tva_tx] += $line->total_tva;
|
||||||
}
|
$amount_ttc[$line->tva_tx] += $line->total_ttc;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($amount_ht as $tva_tx => $xxx) {
|
||||||
|
$discount->amount_ht = abs($amount_ht[$tva_tx]);
|
||||||
|
$discount->amount_tva = abs($amount_tva[$tva_tx]);
|
||||||
|
$discount->amount_ttc = abs($amount_ttc[$tva_tx]);
|
||||||
|
$discount->tva_tx = abs($tva_tx);
|
||||||
|
|
||||||
|
$result = $discount->create($user);
|
||||||
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -75,6 +75,7 @@ AvailabilityTypeAV_1M=1 month
|
|||||||
TypeContact_propal_internal_SALESREPFOLL=Representative following-up proposal
|
TypeContact_propal_internal_SALESREPFOLL=Representative following-up proposal
|
||||||
TypeContact_propal_external_BILLING=Customer invoice contact
|
TypeContact_propal_external_BILLING=Customer invoice contact
|
||||||
TypeContact_propal_external_CUSTOMER=Customer contact following-up proposal
|
TypeContact_propal_external_CUSTOMER=Customer contact following-up proposal
|
||||||
|
TypeContact_propal_external_SHIPPING=Customer contact for delivery
|
||||||
# Document models
|
# Document models
|
||||||
DocModelAzurDescription=A complete proposal model (logo...)
|
DocModelAzurDescription=A complete proposal model (logo...)
|
||||||
DefaultModelPropalCreate=Default model creation
|
DefaultModelPropalCreate=Default model creation
|
||||||
|
|||||||
@ -85,6 +85,9 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$result = $object->fetch($id, $ref);
|
$result = $object->fetch($id, $ref);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(empty($id) && !empty($object->id)) $id = $object->id;
|
||||||
|
|
||||||
$modulepart='product';
|
$modulepart='product';
|
||||||
|
|
||||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||||
@ -130,7 +133,7 @@ if ($action == 'addlimitstockwarehouse' && !empty($user->rights->produit->creer)
|
|||||||
if($maj_ok) {
|
if($maj_ok) {
|
||||||
|
|
||||||
$pse = new ProductStockEntrepot($db);
|
$pse = new ProductStockEntrepot($db);
|
||||||
if($pse->fetch('', GETPOST('id'), GETPOST('fk_entrepot')) > 0) {
|
if($pse->fetch('', $id, GETPOST('fk_entrepot')) > 0) {
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
$pse->seuil_stock_alerte = $seuil_stock_alerte;
|
$pse->seuil_stock_alerte = $seuil_stock_alerte;
|
||||||
@ -141,7 +144,7 @@ if ($action == 'addlimitstockwarehouse' && !empty($user->rights->produit->creer)
|
|||||||
|
|
||||||
// Create
|
// Create
|
||||||
$pse->fk_entrepot = GETPOST('fk_entrepot');
|
$pse->fk_entrepot = GETPOST('fk_entrepot');
|
||||||
$pse->fk_product = GETPOST('id');
|
$pse->fk_product = $id;
|
||||||
$pse->seuil_stock_alerte = GETPOST('seuil_stock_alerte');
|
$pse->seuil_stock_alerte = GETPOST('seuil_stock_alerte');
|
||||||
$pse->desiredstock = GETPOST('desiredstock');
|
$pse->desiredstock = GETPOST('desiredstock');
|
||||||
if($pse->create($user) > 0) setEventMessage($langs->trans('ProductStockWarehouseCreated'));
|
if($pse->create($user) > 0) setEventMessage($langs->trans('ProductStockWarehouseCreated'));
|
||||||
@ -150,7 +153,7 @@ if ($action == 'addlimitstockwarehouse' && !empty($user->rights->produit->creer)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id'));
|
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -951,7 +954,7 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE))
|
|||||||
if (!empty($user->rights->produit->creer)){
|
if (!empty($user->rights->produit->creer)){
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
print '<input type="hidden" name="action" value="addlimitstockwarehouse">';
|
print '<input type="hidden" name="action" value="addlimitstockwarehouse">';
|
||||||
print '<input type="hidden" name="id" value="'.GETPOST('id').'">';
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
}
|
}
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
if (!empty($user->rights->produit->creer)){
|
if (!empty($user->rights->produit->creer)){
|
||||||
@ -968,7 +971,7 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$pse = new ProductStockEntrepot($db);
|
$pse = new ProductStockEntrepot($db);
|
||||||
$lines = $pse->fetchAll(GETPOST('id'));
|
$lines = $pse->fetchAll($id);
|
||||||
|
|
||||||
if (!empty($lines))
|
if (!empty($lines))
|
||||||
{
|
{
|
||||||
@ -981,7 +984,7 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE))
|
|||||||
print '<td align="right">'.$line['seuil_stock_alerte'].'</td>';
|
print '<td align="right">'.$line['seuil_stock_alerte'].'</td>';
|
||||||
print '<td align="right">'.$line['desiredstock'].'</td>';
|
print '<td align="right">'.$line['desiredstock'].'</td>';
|
||||||
if (!empty($user->rights->produit->creer)){
|
if (!empty($user->rights->produit->creer)){
|
||||||
print '<td align="right"><a href="?id='.GETPOST('id').'&fk_productstockwarehouse='.$line['id'].'&action=delete_productstockwarehouse">'.img_delete().'</a></td>';
|
print '<td align="right"><a href="?id='.$id.'&fk_productstockwarehouse='.$line['id'].'&action=delete_productstockwarehouse">'.img_delete().'</a></td>';
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user