@@ -743,7 +743,8 @@ if (empty($reshook))
$parameters=array('id'=>$object->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
- { $result=$object->updateExtraField($_POST["attribute"]);
+ {
+ $result=$object->insertExtraFields();
if ($result < 0)
{
$error++;
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index 5e9974b26d5..e813268b8b2 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -1090,6 +1090,10 @@ class FactureFournisseur extends CommonInvoice
$error=0;
dol_syslog(get_class($this).'::validate user='.$user->id.', force_number='.$force_number.', idwarehouse='.$idwarehouse);
+ // Force to have object complete for checks
+ $this->fetch_thirdparty();
+ $this->fetch_lines();
+
// Check parameters
if ($this->statut > self::STATUS_DRAFT) // This is to avoid to validate twice (avoid errors on logs and stock management)
{
@@ -2550,15 +2554,10 @@ class SupplierInvoiceLine extends CommonObjectLine
}
// Clean parameters
- if (empty($this->tva_tx)) {
- $this->tva_tx = 0;
- }
- if (empty($this->localtax1_tx)) {
- $this->localtax1_tx = 0;
- }
- if (empty($this->localtax2_tx)) {
- $this->localtax2_tx = 0;
- }
+ if (empty($this->remise_percent)) $this->remise_percent = 0;
+ if (empty($this->tva_tx)) $this->tva_tx = 0;
+ if (empty($this->localtax1_tx)) $this->localtax1_tx = 0;
+ if (empty($this->localtax2_tx)) $this->localtax2_tx = 0;
$this->db->begin();
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index 4b7bcb454cd..ace85e8a3e8 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -232,7 +232,7 @@ if (empty($reshook))
// TODO Move this into mass action include
if ($massaction == 'confirm_createbills')
{
- $orders = GETPOST('toselect');
+ $orders = GETPOST('toselect','array');
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
$validate_invoices = GETPOST('valdate_invoices', 'int');
@@ -274,9 +274,8 @@ if (empty($reshook))
}
- if($object->id > 0) {
-
- $db->begin();
+ if ($object->id > 0)
+ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
$sql.= "fk_source";
$sql.= ", sourcetype";
@@ -289,118 +288,116 @@ if (empty($reshook))
$sql.= ", '".$object->element."'";
$sql.= ")";
- if ($db->query($sql))
+ if (! $db->query($sql))
{
- $db->commit();
- }
- else
- {
- $db->rollback();
+ $erorr++;
}
- $lines = $cmd->lines;
- if (empty($lines) && method_exists($cmd, 'fetch_lines'))
+ if (! $error)
{
- $cmd->fetch_lines();
- $lines = $cmd->lines;
+ $lines = $cmd->lines;
+ if (empty($lines) && method_exists($cmd, 'fetch_lines'))
+ {
+ $cmd->fetch_lines();
+ $lines = $cmd->lines;
+ }
+
+ $fk_parent_line=0;
+ $num=count($lines);
+
+ for ($i=0;$i<$num;$i++)
+ {
+ $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
+ if ($lines[$i]->subprice < 0)
+ {
+ // Negative line, we create a discount line
+ $discount = new DiscountAbsolute($db);
+ $discount->fk_soc=$object->socid;
+ $discount->amount_ht=abs($lines[$i]->total_ht);
+ $discount->amount_tva=abs($lines[$i]->total_tva);
+ $discount->amount_ttc=abs($lines[$i]->total_ttc);
+ $discount->tva_tx=$lines[$i]->tva_tx;
+ $discount->fk_user=$user->id;
+ $discount->description=$desc;
+ $discountid=$discount->create($user);
+ if ($discountid > 0)
+ {
+ $result=$object->insert_discount($discountid);
+ //$result=$discount->link_to_invoice($lineid,$id);
+ }
+ else
+ {
+ setEventMessages($discount->error, $discount->errors, 'errors');
+ $error++;
+ break;
+ }
+ }
+ else
+ {
+ // Positive line
+ $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
+ // Date start
+ $date_start=false;
+ if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue;
+ if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
+ if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
+ //Date end
+ $date_end=false;
+ if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue;
+ if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
+ if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
+ // Reset fk_parent_line for no child products and special product
+ if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9)
+ {
+ $fk_parent_line = 0;
+ }
+ $result = $object->addline(
+ $desc,
+ $lines[$i]->subprice,
+ $lines[$i]->qty,
+ $lines[$i]->tva_tx,
+ $lines[$i]->localtax1_tx,
+ $lines[$i]->localtax2_tx,
+ $lines[$i]->fk_product,
+ $lines[$i]->remise_percent,
+ $date_start,
+ $date_end,
+ 0,
+ $lines[$i]->info_bits,
+ $lines[$i]->fk_remise_except,
+ 'HT',
+ 0,
+ $product_type,
+ $ii,
+ $lines[$i]->special_code,
+ $object->origin,
+ $lines[$i]->rowid,
+ $fk_parent_line,
+ $lines[$i]->fk_fournprice,
+ $lines[$i]->pa_ht,
+ $lines[$i]->label
+ );
+ if ($result > 0)
+ {
+ $lineid=$result;
+ }
+ else
+ {
+ $lineid=0;
+ $error++;
+ break;
+ }
+ // Defined the new fk_parent_line
+ if ($result > 0 && $lines[$i]->product_type == 9)
+ {
+ $fk_parent_line = $result;
+ }
+ }
+ }
}
-
- $fk_parent_line=0;
- $num=count($lines);
-
- for ($i=0;$i<$num;$i++)
- {
- $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
- if ($lines[$i]->subprice < 0)
- {
- // Negative line, we create a discount line
- $discount = new DiscountAbsolute($db);
- $discount->fk_soc=$object->socid;
- $discount->amount_ht=abs($lines[$i]->total_ht);
- $discount->amount_tva=abs($lines[$i]->total_tva);
- $discount->amount_ttc=abs($lines[$i]->total_ttc);
- $discount->tva_tx=$lines[$i]->tva_tx;
- $discount->fk_user=$user->id;
- $discount->description=$desc;
- $discountid=$discount->create($user);
- if ($discountid > 0)
- {
- $result=$object->insert_discount($discountid);
- //$result=$discount->link_to_invoice($lineid,$id);
- }
- else
- {
- setEventMessages($discount->error, $discount->errors, 'errors');
- $error++;
- break;
- }
- }
- else
- {
- // Positive line
- $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
- // Date start
- $date_start=false;
- if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue;
- if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
- if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
- //Date end
- $date_end=false;
- if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue;
- if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
- if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
- // Reset fk_parent_line for no child products and special product
- if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9)
- {
- $fk_parent_line = 0;
- }
- $result = $object->addline(
- $desc,
- $lines[$i]->subprice,
- $lines[$i]->qty,
- $lines[$i]->tva_tx,
- $lines[$i]->localtax1_tx,
- $lines[$i]->localtax2_tx,
- $lines[$i]->fk_product,
- $lines[$i]->remise_percent,
- $date_start,
- $date_end,
- 0,
- $lines[$i]->info_bits,
- $lines[$i]->fk_remise_except,
- 'HT',
- 0,
- $product_type,
- $ii,
- $lines[$i]->special_code,
- $object->origin,
- $lines[$i]->rowid,
- $fk_parent_line,
- $lines[$i]->fk_fournprice,
- $lines[$i]->pa_ht,
- $lines[$i]->label
- );
- if ($result > 0)
- {
- $lineid=$result;
- }
- else
- {
- $lineid=0;
- $error++;
- break;
- }
- // Defined the new fk_parent_line
- if ($result > 0 && $lines[$i]->product_type == 9)
- {
- $fk_parent_line = $result;
- }
- }
- }
-
}
- $cmd->classifyBilled($user);
+ $cmd->classifyBilled($user); // TODO Move this in workflow like done for customer orders
if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object;
else $TFact[$object->id] = $object;
@@ -410,27 +407,30 @@ if (empty($reshook))
$TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
$toselect = array();
- if(!empty($validate_invoices)) {
+ if (! $error && $validate_invoices) {
$massaction = $action = 'builddoc';
- foreach($TAllFact as &$object) {
+ foreach($TAllFact as &$object)
+ {
$object->validate($user);
- $toselect[] = $object->id; // For builddoc action
+ if ($result <= 0)
+ {
+ $error++;
+ setEventMessages($object->error, $object->errors, 'errors');
+ break;
+ }
+
+ $id = $object->id; // For builddoc action
// Fac builddoc
+ $donotredirect = 1;
$upload_dir = $conf->facture->dir_output;
$permissioncreate=$user->rights->facture->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
}
- $objectclass='Facture';
- $objectlabel='Invoice';
- $permtoread = $user->rights->facture->lire;
- $permtodelete = $user->rights->facture->supprimer;
- $uploaddir = $conf->facture->dir_output;
- include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
-
+ $massaction = $action = 'confirm_createbills';
}
if (! $error)
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index bd868cf4e9e..a531186beff 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -584,7 +584,7 @@ Module3100Desc=Add a Skype button into users / third parties / contacts / member
Module3200Name=Non Reversible Logs
Module3200Desc=Activate log of some business events into a non reversible log. Events are archived in real-time. The log is a table of chained event that can be then read and exported. This module may be mandatory for some countries.
Module4000Name=HRM
-Module4000Desc=Human resources management (mangement of department, employee contracts and feelings)
+Module4000Desc=Human resources management (management of department, employee contracts and feelings)
Module5000Name=Multi-company
Module5000Desc=Allows you to manage multiple companies
Module6000Name=Workflow
diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php
index 2811ccce891..b959eebeb2d 100644
--- a/htdocs/product/stock/replenish.php
+++ b/htdocs/product/stock/replenish.php
@@ -115,7 +115,7 @@ if ($action == 'order' && isset($_POST['valid']))
$suppliers = array();
for ($i = 0; $i < $linecount; $i++)
{
- if (GETPOST($i, 'alpha') === 'on' && GETPOST('fourn' . $i, 'int') > 0)
+ if (GETPOST('choose' . $i, 'alpha') === 'on' && GETPOST('fourn' . $i, 'int') > 0)
{
//one line
$box = $i;
@@ -616,7 +616,7 @@ while ($i < ($limit ? min($num, $limit) : $num))
// Select field
//print ' | ';
- print ' | ';
+ print ' | ';
print ''.$prod->getNomUrl(1, '').' | ';
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index 36a92396d3e..1941c1a397f 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -269,7 +269,7 @@ input.select2-input {
.liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth],
.liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre select[name=month],
-.liste_titre input[name=month_lim] {
+.liste_titre input[name=month_lim], .liste_titre input[name=month_create] {
margin-right: 4px;
}
input[type=submit] {
@@ -2063,7 +2063,7 @@ div.tabBar {
background: rgb();
}
div.tabBar div.titre {
- padding-top: 10px;
+ padding-top: 20px;
}
div.tabBarWithBottom {
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index e29b3a7c9d3..c5577469182 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -284,7 +284,7 @@ textarea.cke_source:focus
.liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth],
.liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month],
-.liste_titre input[name=month_lim] {
+.liste_titre input[name=month_lim], .liste_titre input[name=month_create] {
margin-right: 4px;
}
input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select {