diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index cf25ab9d9ab..9f2de6d3eb9 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4594,7 +4594,7 @@ else if ($id > 0 || ! empty($ref)) $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); // Form to add new line - if ($object->statut == 0 && $usercancreate && $action != 'valid' && $action != 'editline' && ($object->is_first() || !$object->situation_cycle_ref)) + if ($object->statut == 0 && $usercancreate && $action != 'valid' && $action != 'editline' && ($object->is_first() || empty($object->situation_cycle_ref))) { if ($action != 'editline' && $action != 'selectlines') { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7187a765de4..73ee29373f6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5910,6 +5910,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob // For backward compatibility $substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null)); $substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); + $substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs): ''); // TODO Remove this $msgishtml = 0; diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index ebb2863dbfa..381d3fbef86 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -100,7 +100,7 @@ $coldisplay=-1; // We remove first td } // Do not allow editing during a situation cycle - if (empty($this->situation_cycle_ref) || $this->situation_counter == 1) + if ($line->fk_prev_id == null ) { // editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -138,7 +138,7 @@ $coldisplay=-1; // We remove first td } $coldisplay++; - if ($this->situation_counter == 1 || !$this->situation_cycle_ref) { + if ($line->fk_prev_id == null ) { print '' . $form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1) . ''; } else { print '%'; @@ -146,7 +146,7 @@ $coldisplay=-1; // We remove first td $coldisplay++; print 'situation_counter > 1) print ' readonly'; + if ($line->fk_prev_id != null ) print ' readonly'; print '>'; if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { @@ -157,7 +157,7 @@ $coldisplay=-1; // We remove first td { $coldisplay++; print 'situation_counter > 1) print ' readonly'; + if ($line->fk_prev_id != null ) print ' readonly'; print '>'; } ?> @@ -168,7 +168,7 @@ $coldisplay=-1; // We remove first td // must also not be output for most entities (proposal, intervention, ...) //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; print 'situation_counter > 1) print ' readonly'; + if ($line->fk_prev_id != null ) print ' readonly'; print '>'; } else { ?>   @@ -187,7 +187,7 @@ $coldisplay=-1; // We remove first td info_bits & 2) != 2) { print 'situation_counter > 1) print ' readonly'; + if ($line->fk_prev_id != null ) print ' readonly'; print '>%'; } else { ?>   diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 57077dea056..ce5cfd2b947 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -283,7 +283,7 @@ $domData .= ' data-product_type="'.$line->product_type.'"'; situation_counter == 1 || !$this->situation_cycle_ref) && empty($disableremove)) { + if (($line->fk_prev_id == null ) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation print 'id . '">'; print img_delete(); print ''; diff --git a/htdocs/fourn/recap-fourn.php b/htdocs/fourn/recap-fourn.php index 1ff9f486510..a7bf791228e 100644 --- a/htdocs/fourn/recap-fourn.php +++ b/htdocs/fourn/recap-fourn.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2019 Pierre Ardoin * * 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 @@ -76,6 +77,7 @@ if ($socid > 0) $sql.= " u.login, u.rowid as userid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id; + $sql.= " AND f.entity IN (".getEntity("facture_fourn").")"; // Reconaissance de l'entité attribuée à cette facture pour Multicompany $sql.= " AND f.fk_user_valid = u.rowid"; $sql.= " ORDER BY f.datef DESC"; diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 5659be448de..15ee28c2961 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -144,7 +144,7 @@ if ($id > 0 || ! empty($ref)) if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.fk_statut > 0"; - $sql.= " AND s.entity = ".$conf->entity; + $sql.= " AND f.entity IN (".getEntity('invoice').")"; $sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND d.fk_product =".$object->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 8fb1fe7dd12..2f272b73059 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -182,7 +182,7 @@ else if ($type == '1') else { print $statProducts.$statServices; - $total=round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2])+round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2]); + $total=round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2])+round($prodser[0][3])+round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2])+round($prodser[1][3]); //Calcul du Total des Produits et Services } print ''.$langs->trans("Total").''; print $total; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 854ee1811f3..a22293f60e6 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3878,6 +3878,7 @@ class Societe extends CommonObject $sql .= " WHERE fk_soc = ". $this->id; $sql .= " AND paye = 0"; $sql .= " AND fk_statut <> 0"; // Not a draft + $sql .= " AND entity IN (".getEntity('invoice').")"; //$sql .= " AND (fk_statut <> 3 OR close_code <> 'abandon')"; // Not abandonned for undefined reason $sql .= " AND fk_statut <> 3"; // Not abandonned $sql .= " AND fk_statut <> 2"; // Not clasified as paid