2
0
forked from Wavyzz/dolibarr

Merge pull request #10446 from mapiolca/8.0

Fix #10317 et #10318
This commit is contained in:
Laurent Destailleur
2019-01-30 16:43:14 +01:00
committed by GitHub
8 changed files with 14 additions and 10 deletions

View File

@@ -4551,7 +4551,7 @@ else if ($id > 0 || ! empty($ref))
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
// Form to add new line
if ($object->statut == 0 && $user->rights->facture->creer && $action != 'valid' && $action != 'editline' && ($object->is_first() || !$object->situation_cycle_ref))
if ($object->statut == 0 && $usercancreate && $action != 'valid' && $action != 'editline')
{
if ($action != 'editline' && $action != 'selectlines')
{

View File

@@ -5998,6 +5998,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$substitutionarray['__REF__'] = $object->ref;
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : ''));
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : '');
$substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs): '');
// TODO Use this ?
$msgishtml = 0;

View File

@@ -99,7 +99,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';
@@ -137,7 +137,7 @@ $coldisplay=-1; // We remove first td
}
$coldisplay++;
if ($this->situation_counter == 1 || !$this->situation_cycle_ref) {
if ($line->fk_prev_id == null ) {
print '<td align="right">' . $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) . '</td>';
} else {
print '<td align="right"><input size="1" type="text" class="flat right" name="tva_tx" value="' . price($line->tva_tx) . '" readonly />%</td>';
@@ -145,7 +145,7 @@ $coldisplay=-1; // We remove first td
$coldisplay++;
print '<td align="right"><input type="text" class="flat right" size="5" id="price_ht" name="price_ht" value="' . (isset($line->pu_ht)?price($line->pu_ht,0,'',0):price($line->subprice,0,'',0)) . '"';
if ($this->situation_counter > 1) print ' readonly';
if ($line->fk_prev_id != null ) print ' readonly';
print '></td>';
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) {
@@ -156,7 +156,7 @@ $coldisplay=-1; // We remove first td
{
$coldisplay++;
print '<td align="right"><input type="text" class="flat right" size="5" id="price_ttc" name="price_ttc" value="'.(isset($line->pu_ttc)?price($line->pu_ttc,0,'',0):'').'"';
if ($this->situation_counter > 1) print ' readonly';
if ($line->fk_prev_id != null ) print ' readonly';
print '></td>';
}
?>
@@ -167,7 +167,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 '<input size="3" type="text" class="flat right" name="qty" id="qty" value="' . $line->qty . '"';
if ($this->situation_counter > 1) print ' readonly';
if ($line->fk_prev_id != null ) print ' readonly';
print '>';
} else { ?>
&nbsp;
@@ -186,7 +186,7 @@ $coldisplay=-1; // We remove first td
<td align="right" class="nowrap"><?php $coldisplay++; ?>
<?php if (($line->info_bits & 2) != 2) {
print '<input size="1" type="text" class="flat right" name="remise_percent" id="remise_percent" value="' . $line->remise_percent . '"';
if ($this->situation_counter > 1) print ' readonly';
if ($line->fk_prev_id != null ) print ' readonly';
print '>%';
} else { ?>
&nbsp;

View File

@@ -283,7 +283,7 @@ $domData .= ' data-product_type="'.$line->product_type.'"';
<td class="linecoldelete" align="center"><?php $coldisplay++; ?>
<?php
if (($this->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 '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $this->id . '&amp;action=ask_deleteline&amp;lineid=' . $line->id . '">';
print img_delete();
print '</a>';

View File

@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019 Pierre Ardoin <mapiolca@me.com>
*
* 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";

View File

@@ -147,7 +147,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;

View File

@@ -184,7 +184,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 '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">';
print $total;

View File

@@ -3801,6 +3801,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