2
0
forked from Wavyzz/dolibarr

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 <?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * 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 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* *
@@ -49,8 +49,8 @@ if ($_GET["action"] == 'specimen')
{ {
$modele=$_GET["module"]; $modele=$_GET["module"];
$facture = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
$facture->initAsSpecimen(); $commande->initAsSpecimen();
// Charge le modele // Charge le modele
$dir = DOL_DOCUMENT_ROOT . "/fourn/commande/modules/pdf/"; $dir = DOL_DOCUMENT_ROOT . "/fourn/commande/modules/pdf/";
@@ -62,7 +62,7 @@ if ($_GET["action"] == 'specimen')
$obj = new $classname($db); $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"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf");
return; return;
@@ -135,6 +135,13 @@ if ($_POST["action"] == 'addcat')
$fourn->CreateCategory($user,$_POST["cat"]); $fourn->CreateCategory($user,$_POST["cat"]);
} }
// d<>fini les constantes du mod<6F>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 * Affichage page
*/ */
@@ -196,13 +203,15 @@ if ($handle)
} }
print '</td>'; print '</td>';
$commande = new CommandeFournisseur($db);
// Info // Info
$htmltooltip=''; $htmltooltip='';
$nextval=$module->getNextValue($mysoc); $nextval=$module->getNextValue($mysoc,$commande);
if ($nextval != $langs->trans("NotAvailable")) if ($nextval != $langs->trans("NotAvailable"))
{ {
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval; $htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
} }
print '<td align="center">'; print '<td align="center">';
print $html->textwithhelp('',$htmltooltip,1,0); print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>'; print '</td>';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -467,34 +467,31 @@ class Facture extends CommonObject
$this->lignes = array(); $this->lignes = array();
if ($this->commande_id) if ($this->commande_id)
{ {
$sql = "SELECT ref"; $sql = "SELECT ref";
$sql.= " FROM ".MAIN_DB_PREFIX."commande"; $sql.= " FROM ".MAIN_DB_PREFIX."commande";
$sql.= " WHERE rowid = ".$this->commande_id; $sql.= " WHERE rowid = ".$this->commande_id;
$resqlcomm = $this->db->query($sql); $resqlcomm = $this->db->query($sql);
if ($resqlcomm) if ($resqlcomm)
{ {
$objc = $this->db->fetch_object($resqlcomm); $objc = $this->db->fetch_object($resqlcomm);
$this->commande_ref = $objc->ref; $this->commande_ref = $objc->ref;
$this->db->free($resqlcomm); $this->db->free($resqlcomm);
} }
} }
if ($this->statut == 0) if ($this->statut == 0) $this->brouillon = 1;
{
$this->brouillon = 1;
}
/* /*
* Lignes * Lignes
*/ */
$result=$this->fetch_lines(); $result=$this->fetch_lines();
if ($result < 0) if ($result < 0)
{ {
return -3; return -3;
} }
return 1; return 1;
} }
else else
@@ -568,15 +565,15 @@ class Facture extends CommonObject
$this->lignes[$i] = $faclig; $this->lignes[$i] = $faclig;
$i++; $i++;
} }
$this->db->free($result); $this->db->free($result);
return 1; return 1;
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dolibarr_syslog('Facture::fetch_lines: Error '.$this->error); dolibarr_syslog('Facture::fetch_lines: Error '.$this->error);
return -3; 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 = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $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 else
{ {
@@ -179,7 +179,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->fournisseur->commande->c
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $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 else
{ {
@@ -206,7 +206,7 @@ if ($_GET['action'] == 'deleteline' && $user->rights->fournisseur->commande->cre
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $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']); Header('Location: fiche.php?id='.$_GET['id']);
exit; exit;
} }
@@ -220,7 +220,7 @@ if ($_POST['action'] == 'confirm_valid' && $_POST['confirm'] == 'yes' && $user->
$result = $commande->valid($user); $result = $commande->valid($user);
if ($result >= 0) 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"]); Header("Location: fiche.php?id=".$_GET["id"]);
exit; exit;
} }
@@ -305,7 +305,7 @@ if ($_GET['action'] == 'up' && $user->rights->fournisseur->commande->creer)
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $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']); Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
exit; exit;
} }
@@ -320,7 +320,7 @@ if ($_GET['action'] == 'down' && $user->rights->fournisseur->commande->creer)
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $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']); Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
exit; exit;
} }
@@ -346,7 +346,7 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $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) if ($result <= 0)
{ {
dolibarr_print_error($db,$result); dolibarr_print_error($db,$result);

View File

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

View File

@@ -25,11 +25,12 @@
/** /**
\file htdocs/fourn/commande/modules/pdf/mod_commande_fournisseur_rose.php \file htdocs/fourn/commande/modules/pdf/mod_commande_fournisseur_rose.php
\ingroup fournisseur \ingroup fournisseur
\brief Fichier contenant la classe du mod<6F>le de num<75>rotation de r<>f<EFBFBD>rence de commande Rose \brief Fichier contenant la classe du mod<6F>le de num<75>rotation de r<>f<EFBFBD>rence de commande fournisseur Rose
\version $Revision$ \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<6F>le de num<75>rotation de r<>f<EFBFBD>rence de commande fournisseur Rose \brief Classe du mod<6F>le de num<75>rotation de r<>f<EFBFBD>rence de commande fournisseur Rose
*/ */
class mod_commande_fournisseur_rose extends ModeleNumRefCommandesSuppliers class mod_commande_fournisseur_rose extends ModeleNumRefSuppliersOrders
{ {
/** \brief Constructeur /** \brief Constructeur

View File

@@ -37,7 +37,7 @@ include_once("modules_commandefournisseur.php");
\brief Classe du mod<6F>le de num<75>rotation de r<>f<EFBFBD>rence de commande fournisseur Tulipe \brief Classe du mod<6F>le de num<75>rotation de r<>f<EFBFBD>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 \class ModelePDFSuppliersorders
\brief Classe m<>re des mod<6F>les de commandes \brief Classe m<>re des mod<6F>les de commandes fournisseurs
*/ */
class ModelePDFCommandesSuppliers extends FPDF class ModelePDFSuppliersOrders extends FPDF
{ {
var $error=''; var $error='';
@@ -88,11 +88,11 @@ class ModelePDFCommandesSuppliers extends FPDF
/** /**
\class ModeleNumRefCommandesSuppliers \class ModeleNumRefSuppliersOrders
\brief Classe m<>re des mod<6F>les de num<75>rotation des r<>f<EFBFBD>rences de commandes fournisseurs \brief Classe m<>re des mod<6F>les de num<75>rotation des r<>f<EFBFBD>rences de commandes fournisseurs
*/ */
class ModeleNumRefCommandesSuppliers class ModeleNumRefSuppliersOrders
{ {
var $error=''; 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; global $langs;
$langs->load("suppliers"); $langs->load("suppliers");
@@ -169,12 +169,12 @@ function commande_supplier_pdf_create($db, $comid, $modele='',$outputlangs='')
if ($obj->write_pdf_file($comid,$outputlangs) > 0) if ($obj->write_pdf_file($comid,$outputlangs) > 0)
{ {
// on supprime l'image correspondant au preview // on supprime l'image correspondant au preview
commande_supplier_delete_preview($db, $comid); supplier_order_delete_preview($db, $comid);
return 1; return 1;
} }
else else
{ {
dolibarr_syslog("Erreur dans commande_supplier_pdf_create"); dolibarr_syslog("Erreur dans supplier_order_pdf_create");
dolibarr_print_error($db,$obj->pdferror()); dolibarr_print_error($db,$obj->pdferror());
return 0; return 0;
} }
@@ -185,7 +185,7 @@ function commande_supplier_pdf_create($db, $comid, $modele='',$outputlangs='')
return 0; return 0;
} }
} }
function commande_supplier_delete_preview($db, $propalid) function supplier_order_delete_preview($db, $propalid)
{ {
global $langs,$conf; global $langs,$conf;

View File

@@ -40,7 +40,7 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php");
\brief Classe permettant de g<>n<EFBFBD>rer les commandes fournisseurs au mod<6F>le Muscadet \brief Classe permettant de g<>n<EFBFBD>rer les commandes fournisseurs au mod<6F>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.= '<tr><td>Appliquer un offset sur le compteur</td>';
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte.= '<input type="hidden" name="action" value="setOffset">'; $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 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.= '<td aligne="center">'.$form->textwithhelp('',$langs->trans("OffsetDesc"),1,1).'</td>';
$texte.= '</tr></form>'; $texte.= '</tr></form>';
@@ -378,7 +378,7 @@ function info()
if ($row) $comyy = substr($row[0],0,-$posindice); 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<6E>e pr<70>c<EFBFBD>dente //on v<>rifie si il y a une ann<6E>e pr<70>c<EFBFBD>dente
//pour <20>viter que le delta soit appliqu<71> de nouveau sur la nouvelle ann<6E>e //pour <20>viter que le delta soit appliqu<71> de nouveau sur la nouvelle ann<6E>e
@@ -408,7 +408,7 @@ function info()
$max = $row[0]; $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 // on applique le delta une seule fois
$max=$conf->global->COMMANDE_NUM_DELTA?$conf->global->COMMANDE_NUM_DELTA-1:0; $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 // Affiche zone infos
$posy=$this->_tableau_tot($pdf, $com, $deja_regle, $bottomlasttab, $outputlangs); $posy=$this->_tableau_info($pdf, $com, $bottomlasttab, $outputlangs);
// Affiche zone totaux // Affiche zone totaux
$posy=$this->_tableau_tot($pdf, $com, $deja_regle, $bottomlasttab, $outputlangs); $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) 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; return $nbjours;
} }
@@ -2604,16 +2607,19 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0)
*/ */
function num_open_day($timestampStart, $timestampEnd,$inhour=0,$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; return $nbOpenDay;
} }

View File

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

View File

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