Fix: homognisation du code

Add: modle de numrotation paramtrable "orchidee" pour les commandes fournisseurs
This commit is contained in:
Regis Houssin 2007-05-15 15:53:46 +00:00
parent cd6cb2a8f6
commit 8d2c92818b
18 changed files with 196 additions and 172 deletions

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com>
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@cap-networks.com>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
*
@ -49,8 +49,8 @@ if ($_GET["action"] == 'specimen')
{
$modele=$_GET["module"];
$facture = new CommandeFournisseur($db);
$facture->initAsSpecimen();
$commande = new CommandeFournisseur($db);
$commande->initAsSpecimen();
// Charge le modele
$dir = DOL_DOCUMENT_ROOT . "/fourn/commande/modules/pdf/";
@ -62,7 +62,7 @@ if ($_GET["action"] == 'specimen')
$obj = new $classname($db);
if ($obj->write_pdf_file($facture,$langs) > 0)
if ($obj->write_pdf_file($commande,$langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf");
return;
@ -135,6 +135,13 @@ if ($_POST["action"] == 'addcat')
$fourn->CreateCategory($user,$_POST["cat"]);
}
// défini les constantes du modèle orchidee
if ($_POST["action"] == 'updateMatrice') dolibarr_set_const($db, "COMMANDE_FOURNISSEUR_NUM_MATRICE",$_POST["matrice"]);
if ($_POST["action"] == 'updatePrefixCommande') dolibarr_set_const($db, "COMMANDE_FOURNISSEUR_NUM_PREFIX",$_POST["prefixcommande"]);
if ($_POST["action"] == 'setOffset') dolibarr_set_const($db, "COMMANDE_FOURNISSEUR_NUM_DELTA",$_POST["offset"]);
if ($_POST["action"] == 'setFiscalMonth') dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START",$_POST["fiscalmonth"]);
if ($_POST["action"] == 'setNumRestart') dolibarr_set_const($db, "COMMANDE_FOURNISSEUR_NUM_RESTART_BEGIN_YEAR",$_POST["numrestart"]);
/*
* Affichage page
*/
@ -196,13 +203,15 @@ if ($handle)
}
print '</td>';
$commande = new CommandeFournisseur($db);
// Info
$htmltooltip='';
$nextval=$module->getNextValue($mysoc);
$nextval=$module->getNextValue($mysoc,$commande);
if ($nextval != $langs->trans("NotAvailable"))
{
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
}
{
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
}
print '<td align="center">';
print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>';

View File

@ -897,10 +897,19 @@ class Commande extends CommonObject
*/
function fetch($id)
{
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva, c.fk_cond_reglement, c.fk_mode_reglement,';
$sql.= ' '.$this->db->pdate('c.date_commande').' as date_commande, '.$this->db->pdate('c.date_livraison').' as date_livraison,';
$sql.= ' c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as facturee, c.note, c.note_public, c.ref_client, c.model_pdf, c.fk_adresse_livraison';
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut';
$sql.= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva, c.fk_cond_reglement, c.fk_mode_reglement';
$sql.= ', '.$this->db->pdate('c.date_commande').' as date_commande';
$sql.= ', '.$this->db->pdate('c.date_livraison').' as date_livraison';
$sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as facturee';
$sql.= ', c.note, c.note_public, c.ref_client, c.model_pdf, c.fk_adresse_livraison';
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
$sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_facture';
$sql.= ', cp.fk_propale';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'cond_reglement as cr ON (c.fk_cond_reglement = cr.rowid)';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON (c.fk_mode_reglement = p.id)';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'co_pr as cp ON (cp.fk_commande = c.rowid)';
$sql.= ' WHERE c.rowid = '.$id;
dolibarr_syslog("Commande::fetch sql=$sql");
@ -911,84 +920,81 @@ class Commande extends CommonObject
$obj = $this->db->fetch_object($result);
if ($obj)
{
$this->id = $obj->rowid;
$this->ref = $obj->ref;
$this->ref_client = $obj->ref_client;
$this->socid = $obj->fk_soc;
$this->statut = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author;
$this->total_ht = $obj->total_ht;
$this->total_tva = $obj->tva;
$this->total_ttc = $obj->total_ttc;
$this->date = $obj->date_commande;
$this->remise = $obj->remise;
$this->remise_percent = $obj->remise_percent;
$this->remise_absolue = $obj->remise_absolue;
$this->source = $obj->source;
$this->facturee = $obj->facturee;
$this->note = $obj->note;
$this->note_public = $obj->note_public;
$this->projet_id = $obj->fk_projet;
$this->modelpdf = $obj->model_pdf;
$this->cond_reglement_id = $obj->fk_cond_reglement;
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->date_livraison = $obj->date_livraison;
$this->adresse_livraison_id = $obj->fk_adresse_livraison;
$this->id = $obj->rowid;
$this->ref = $obj->ref;
$this->ref_client = $obj->ref_client;
$this->socid = $obj->fk_soc;
$this->statut = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author;
$this->total_ht = $obj->total_ht;
$this->total_tva = $obj->tva;
$this->total_ttc = $obj->total_ttc;
$this->date = $obj->date_commande;
$this->remise = $obj->remise;
$this->remise_percent = $obj->remise_percent;
$this->remise_absolue = $obj->remise_absolue;
$this->source = $obj->source;
$this->facturee = $obj->facturee;
$this->note = $obj->note;
$this->note_public = $obj->note_public;
$this->projet_id = $obj->fk_projet;
$this->modelpdf = $obj->model_pdf;
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code;
$this->mode_reglement = $obj->mode_reglement_libelle;
$this->cond_reglement_id = $obj->fk_cond_reglement;
$this->cond_reglement_code = $obj->cond_reglement_code;
$this->cond_reglement = $obj->cond_reglement_libelle;
$this->cond_reglement_facture = $obj->cond_reglement_libelle_facture;
$this->date_livraison = $obj->date_livraison;
$this->adresse_livraison_id = $obj->fk_adresse_livraison;
$this->propale_id = $obj->fk_propale;
$this->lignes = array();
if ($this->statut == 0) $this->brouillon = 1;
$this->db->free();
if ($this->cond_reglement_id)
{
$sql = "SELECT rowid, libelle, code";
$sql.= " FROM ".MAIN_DB_PREFIX."cond_reglement";
$sql.= " WHERE rowid = ".$this->cond_reglement_id;
$resqlcond = $this->db->query($sql);
if ($resqlcond)
{
$objc = $this->db->fetch_object($resqlcond);
$this->cond_reglement = $objc->libelle;
$this->cond_reglement_code = $objc->code;
}
}
$this->lignes = $this->fetch_lignes();
if ($this->propale_id)
{
$sqlp = "SELECT ref";
$sqlp.= " FROM ".MAIN_DB_PREFIX."propal";
$sqlp.= " WHERE rowid = ".$this->propale_id;
$resqlprop = $this->db->query($sqlp);
if ($resqlprop)
{
$objp = $this->db->fetch_object($resqlprop);
$this->propale_ref = $objp->ref;
$this->db->free($resqlprop);
}
}
/*
* Propale associée
* Lignes
*/
$sql = 'SELECT cp.fk_propale';
$sql .= ' FROM '.MAIN_DB_PREFIX.'co_pr as cp';
$sql .= ' WHERE cp.fk_commande = '.$this->id;
if ($this->db->query($sql))
{
if ($this->db->num_rows())
{
$obj = $this->db->fetch_object();
$this->propale_id = $obj->fk_propale;
}
return 1;
}
else
{
dolibarr_print_error($this->db);
return -1;
}
$result=$this->fetch_lines();
if ($result < 0)
{
return -3;
}
return 1;
}
else
else
{
$this->error="Order not found";
dolibarr_syslog('Commande::Fetch Error rowid='.$rowid.' numrows=0 sql='.$sql);
$this->error='Order with id '.$rowid.' not found sql='.$sql;
return -2;
}
}
else
{
dolibarr_print_error($this->db);
return -3;
}
}
else
{
dolibarr_syslog('Commande::Fetch Error rowid='.$rowid.' Erreur dans fetch de la commande');
$this->error=$this->db->error();
return -1;
}
}
/**
@ -1095,9 +1101,8 @@ class Commande extends CommonObject
* \param only_product Ne renvoie que ligne liées à des produits physiques prédéfinis
* \return array Tableau de CommandeLigne
*/
function fetch_lignes($only_product=0)
function fetch_lines($only_product=0)
{
$this->lignes = array();
$sql = 'SELECT l.rowid, l.fk_product, l.fk_commande, l.description, l.price, l.qty, l.tva_tx,';
$sql.= ' l.fk_remise_except, l.remise_percent, l.subprice, l.coef, l.rang, l.info_bits,';
$sql.= ' l.total_ht, l.total_ttc, l.total_tva,';
@ -1110,12 +1115,12 @@ class Commande extends CommonObject
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows();
$i = 0;
while ($i < $num)
{
$objp = $this->db->fetch_object($result);
{
$num = $this->db->num_rows($result);
$i = 0;
while ($i < $num)
{
$objp = $this->db->fetch_object($result);
$ligne = new CommandeLigne($this->db);
$ligne->rowid = $objp->rowid;
@ -1145,14 +1150,20 @@ class Commande extends CommonObject
$this->lignes[$i] = $ligne;
$i++;
}
$this->db->free();
}
return $this->lignes;
$this->db->free($result);
return 1;
}
else
{
$this->error=$this->db->error();
dolibarr_syslog('Commande::fetch_lines: Error '.$this->error);
return -3;
}
}
/**
* \brief Renvoie nombre de lignes de type produits. Doit etre appelé après fetch_lignes
* \brief Renvoie nombre de lignes de type produits. Doit etre appelé après fetch_lines
* \return int <0 si ko, Nbre de lignes produits sinon
*/
function getNbOfProductsLines()

View File

@ -590,7 +590,8 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
$comm = New Commande($db);
if ( $comm->fetch($_POST['commandeid']) )
{
$lines = $comm->fetch_lignes();
$comm->fetch_lines();
$lines = $comm->lignes;
for ($i = 0 ; $i < sizeof($lines) ; $i++)
{
$desc=($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
@ -2553,7 +2554,7 @@ else
}
// Valider
if ($fac->statut == 0 && $num_lignes > 0 && $fac->total_ttc >= 0)
if ($fac->statut == 0 && $num_lignes > 0 && (($fac->type < 2 && $fac->total_ttc >= 0) || ($fac->type == 2 && $fac->total_ttc <= 0)))
{
if ($user->rights->facture->valider)
{

View File

@ -97,7 +97,7 @@ class Expedition extends CommonObject
$this->commande = new Commande($this->db);
$this->commande->id = $this->commande_id;
$this->commande->fetch_lignes();
$this->commande->fetch_lines();
/*
* Insertion des produits dans la base

View File

@ -77,7 +77,7 @@ if ($_POST["action"] == 'add')
// avec qté à livrer
$commande = new Commande($db);
$commande->fetch($expedition->commande_id);
$commande->fetch_lignes();
$commande->fetch_lines();
for ($i = 0 ; $i < sizeof($commande->lignes) ; $i++)
{
$qty = "qtyl".$i;
@ -271,7 +271,7 @@ if ($_GET["action"] == 'create')
*/
echo '<br><table class="noborder" width="100%">';
$lignes = $commande->fetch_lignes(1);
$lignes = $commande->fetch_lines(1);
/* Lecture des expeditions déjà effectuées */
$commande->loadExpeditions();

View File

@ -182,7 +182,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
//Generation du tableau
$this->_tableau($pdf, $tab_top, $tab_height, $nexY);
//Recuperation des produits de la commande.
$this->expe->commande->fetch_lignes(1);
$this->expe->commande->fetch_lines(1);
$Produits = $this->expe->commande->lignes;
$nblignes = sizeof($Produits);
for ($i = 0 ; $i < $nblignes ; $i++){

View File

@ -467,34 +467,31 @@ class Facture extends CommonObject
$this->lignes = array();
if ($this->commande_id)
{
$sql = "SELECT ref";
$sql.= " FROM ".MAIN_DB_PREFIX."commande";
$sql.= " WHERE rowid = ".$this->commande_id;
{
$sql = "SELECT ref";
$sql.= " FROM ".MAIN_DB_PREFIX."commande";
$sql.= " WHERE rowid = ".$this->commande_id;
$resqlcomm = $this->db->query($sql);
$resqlcomm = $this->db->query($sql);
if ($resqlcomm)
{
$objc = $this->db->fetch_object($resqlcomm);
$this->commande_ref = $objc->ref;
$this->db->free($resqlcomm);
}
}
if ($resqlcomm)
{
$objc = $this->db->fetch_object($resqlcomm);
$this->commande_ref = $objc->ref;
$this->db->free($resqlcomm);
}
}
if ($this->statut == 0)
{
$this->brouillon = 1;
}
if ($this->statut == 0) $this->brouillon = 1;
/*
* Lignes
*/
$result=$this->fetch_lines();
if ($result < 0)
{
return -3;
}
{
return -3;
}
return 1;
}
else
@ -568,15 +565,15 @@ class Facture extends CommonObject
$this->lignes[$i] = $faclig;
$i++;
}
$this->db->free($result);
return 1;
}
else
{
$this->error=$this->db->error();
dolibarr_syslog('Facture::fetch_lines: Error '.$this->error);
return -3;
}
$this->db->free($result);
return 1;
}
else
{
$this->error=$this->db->error();
dolibarr_syslog('Facture::fetch_lines: Error '.$this->error);
return -3;
}
}
/**

View File

@ -147,7 +147,7 @@ if ($_POST['action'] == 'addligne' && $user->rights->fournisseur->commande->cree
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
commande_supplier_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
supplier_order_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
}
else
{
@ -179,7 +179,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->fournisseur->commande->c
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
commande_supplier_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
supplier_order_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
}
else
{
@ -206,7 +206,7 @@ if ($_GET['action'] == 'deleteline' && $user->rights->fournisseur->commande->cre
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
commande_supplier_pdf_create($db, $_GET['id'], $commande->modelpdf, $outputlangs);
supplier_order_pdf_create($db, $_GET['id'], $commande->modelpdf, $outputlangs);
Header('Location: fiche.php?id='.$_GET['id']);
exit;
}
@ -220,7 +220,7 @@ if ($_POST['action'] == 'confirm_valid' && $_POST['confirm'] == 'yes' && $user->
$result = $commande->valid($user);
if ($result >= 0)
{
commande_supplier_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
supplier_order_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
Header("Location: fiche.php?id=".$_GET["id"]);
exit;
}
@ -305,7 +305,7 @@ if ($_GET['action'] == 'up' && $user->rights->fournisseur->commande->creer)
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
commande_supplier_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
supplier_order_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
exit;
}
@ -320,7 +320,7 @@ if ($_GET['action'] == 'down' && $user->rights->fournisseur->commande->creer)
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
commande_supplier_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
supplier_order_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
exit;
}
@ -346,7 +346,7 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
$result=commande_supplier_pdf_create($db, $commande->id,$commande->modelpdf,$outputlangs);
$result=supplier_order_pdf_create($db, $commande->id,$commande->modelpdf,$outputlangs);
if ($result <= 0)
{
dolibarr_print_error($db,$result);

View File

@ -24,18 +24,17 @@
/**
\file htdocs/four/commande/modules/mod_commande_fournisseur_muguet.php
\ingroup commande
\brief Fichier contenant la classe du modèle de numérotation de référence de commande Muguet
\brief Fichier contenant la classe du modèle de numérotation de référence de commande fournisseur Muguet
\version $Revision$
*/
//require_once(DOL_DOCUMENT_ROOT ."/fourn/commande/modules/mod_commande_fournisseur_muguet.php");
require_once(DOL_DOCUMENT_ROOT ."/fourn/commande/modules/modules_commandefournisseur.php");
/** \class mod_commande_fournisseur_muguet
\brief Classe du modèle de numérotation de référence de commande Marbre
\brief Classe du modèle de numérotation de référence de commande fournisseur Muguet
*/
class mod_commande_fournisseur_muguet extends ModeleNumRefCommandesSuppliers
class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
{
var $prefix='CF';
var $error='';

View File

@ -25,11 +25,12 @@
/**
\file htdocs/fourn/commande/modules/pdf/mod_commande_fournisseur_rose.php
\ingroup fournisseur
\brief Fichier contenant la classe du modèle de numérotation de référence de commande Rose
\brief Fichier contenant la classe du modèle de numérotation de référence de commande fournisseur Rose
\version $Revision$
*/
include_once("modules_commandefournisseur.php");
require_once(DOL_DOCUMENT_ROOT ."/fourn/commande/modules/modules_commandefournisseur.php");
/**
@ -37,7 +38,7 @@ include_once("modules_commandefournisseur.php");
\brief Classe du modèle de numérotation de référence de commande fournisseur Rose
*/
class mod_commande_fournisseur_rose extends ModeleNumRefCommandesSuppliers
class mod_commande_fournisseur_rose extends ModeleNumRefSuppliersOrders
{
/** \brief Constructeur

View File

@ -37,7 +37,7 @@ include_once("modules_commandefournisseur.php");
\brief Classe du modèle de numérotation de référence de commande fournisseur Tulipe
*/
class mod_commande_fournisseur_tulipe extends ModeleNumRefCommandesSuppliers
class mod_commande_fournisseur_tulipe extends ModeleNumRefSuppliersOrders
{
/**

View File

@ -36,11 +36,11 @@ require_once(FPDF_PATH.'fpdi_protection.php');
/**
\class ModelePDFCommandesSuppliers
\brief Classe mère des modèles de commandes
\class ModelePDFSuppliersorders
\brief Classe mère des modèles de commandes fournisseurs
*/
class ModelePDFCommandesSuppliers extends FPDF
class ModelePDFSuppliersOrders extends FPDF
{
var $error='';
@ -88,11 +88,11 @@ class ModelePDFCommandesSuppliers extends FPDF
/**
\class ModeleNumRefCommandesSuppliers
\class ModeleNumRefSuppliersOrders
\brief Classe mère des modèles de numérotation des références de commandes fournisseurs
*/
class ModeleNumRefCommandesSuppliers
class ModeleNumRefSuppliersOrders
{
var $error='';
@ -137,7 +137,7 @@ class ModeleNumRefCommandesSuppliers
}
function commande_supplier_pdf_create($db, $comid, $modele='',$outputlangs='')
function supplier_order_pdf_create($db, $comid, $modele='',$outputlangs='')
{
global $langs;
$langs->load("suppliers");
@ -169,12 +169,12 @@ function commande_supplier_pdf_create($db, $comid, $modele='',$outputlangs='')
if ($obj->write_pdf_file($comid,$outputlangs) > 0)
{
// on supprime l'image correspondant au preview
commande_supplier_delete_preview($db, $comid);
supplier_order_delete_preview($db, $comid);
return 1;
}
else
{
dolibarr_syslog("Erreur dans commande_supplier_pdf_create");
dolibarr_syslog("Erreur dans supplier_order_pdf_create");
dolibarr_print_error($db,$obj->pdferror());
return 0;
}
@ -185,7 +185,7 @@ function commande_supplier_pdf_create($db, $comid, $modele='',$outputlangs='')
return 0;
}
}
function commande_supplier_delete_preview($db, $propalid)
function supplier_order_delete_preview($db, $propalid)
{
global $langs,$conf;

View File

@ -40,7 +40,7 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php");
\brief Classe permettant de générer les commandes fournisseurs au modèle Muscadet
*/
class pdf_muscadet extends ModelePDFCommandesSuppliers
class pdf_muscadet extends ModelePDFSuppliersOrders
{
/**

View File

@ -85,7 +85,7 @@ function info()
$texte.= '<tr><td>Appliquer un offset sur le compteur</td>';
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte.= '<input type="hidden" name="action" value="setOffset">';
$texte.= '<td align="right"><input type="text" class="flat" size="30" name="offset" value="'.$conf->global->FACTURE_NUM_DELTA.'"></td>';
$texte.= '<td align="right"><input type="text" class="flat" size="30" name="offset" value="'.$conf->global->COMMANDE_NUM_DELTA.'"></td>';
$texte.= '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
$texte.= '<td aligne="center">'.$form->textwithhelp('',$langs->trans("OffsetDesc"),1,1).'</td>';
$texte.= '</tr></form>';
@ -378,7 +378,7 @@ function info()
if ($row) $comyy = substr($row[0],0,-$posindice);
}
if ($conf->global->PROPALE_NUM_DELTA != '')
if ($conf->global->COMMANDE_NUM_DELTA != '')
{
//on vérifie si il y a une année précédente
//pour éviter que le delta soit appliqué de nouveau sur la nouvelle année
@ -408,7 +408,7 @@ function info()
$max = $row[0];
}
}
else if ($conf->global->PROPALE_NUM_DELTA != '' && !eregi('^'.$searchLastWithPreviousYear.'',$lastyy))
else if ($conf->global->COMMANDE_NUM_DELTA != '' && !eregi('^'.$searchLastWithPreviousYear.'',$lastyy))
{
// on applique le delta une seule fois
$max=$conf->global->COMMANDE_NUM_DELTA?$conf->global->COMMANDE_NUM_DELTA-1:0;

View File

@ -363,7 +363,7 @@ class pdf_einstein extends ModelePDFCommandes
}
// Affiche zone infos
$posy=$this->_tableau_tot($pdf, $com, $deja_regle, $bottomlasttab, $outputlangs);
$posy=$this->_tableau_info($pdf, $com, $bottomlasttab, $outputlangs);
// Affiche zone totaux
$posy=$this->_tableau_tot($pdf, $com, $deja_regle, $bottomlasttab, $outputlangs);

View File

@ -2582,15 +2582,18 @@ function num_public_holiday($timestampStart, $timestampEnd)
*/
function num_between_day($timestampStart, $timestampEnd, $lastday=0)
{
if ($lastday == 1)
if ($timestampStart < $timestampEnd)
{
$bit = 0;
if ($lastday == 1)
{
$bit = 0;
}
else
{
$bit = 1;
}
$nbjours = round(($timestampEnd - $timestampStart)/(60*60*24)-$bit);
}
else
{
$bit = 1;
}
$nbjours = round(($timestampEnd - $timestampStart)/(60*60*24)-$bit);
return $nbjours;
}
@ -2604,16 +2607,19 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0)
*/
function num_open_day($timestampStart, $timestampEnd,$inhour=0,$lastday=0)
{
if ($lastday == 1)
if ($timestampStart < $timestampEnd)
{
$bit = 1;
if ($lastday == 1)
{
$bit = 1;
}
else
{
$bit = 0;
}
$nbOpenDay = num_between_day($timestampStart, $timestampEnd, $bit) - num_public_holiday($timestampStart, $timestampEnd);
if ($inhour == 1) $nbOpenDay = $nbOpenDay*24;
}
else
{
$bit = 0;
}
$nbOpenDay = num_between_day($timestampStart, $timestampEnd, $bit) - num_public_holiday($timestampStart, $timestampEnd);
if ($inhour == 1) $nbOpenDay = $nbOpenDay*24;
return $nbOpenDay;
}

View File

@ -77,7 +77,7 @@ if ($_POST["action"] == 'add')
// avec qté à livrer
$commande = new Commande($db);
$commande->fetch($livraison->commande_id);
$commande->fetch_lignes();
$commande->fetch_lines();
for ($i = 0 ; $i < sizeof($commande->lignes) ; $i++)
{
$qty = "qtyl".$i;
@ -245,7 +245,7 @@ if ($_GET["action"] == 'create')
*/
echo '<br><table class="noborder" width="100%">';
$lignes = $commande->fetch_lignes(1);
$lignes = $commande->fetch_lines(1);
/* Lecture des livraisons déjà effectuées */
$commande->livraison_array();

View File

@ -109,7 +109,7 @@ class Livraison extends CommonObject
{
$commande = new Commande($this->db);
$commande->id = $this->commande_id;
$this->lignes = $commande->fetch_lignes();
$this->lignes = $commande->fetch_lines();
}