';
$entrepot = new Entrepot($db);
diff --git a/htdocs/expedition/expedition.class.php b/htdocs/expedition/expedition.class.php
index e92f0df2663..c9eccd37d4e 100644
--- a/htdocs/expedition/expedition.class.php
+++ b/htdocs/expedition/expedition.class.php
@@ -87,10 +87,10 @@ class Expedition extends CommonObject
$this->db->begin();
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."expedition (date_creation, fk_user_author, date_expedition";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."expedition (ref, date_creation, fk_user_author, date_expedition";
$sql.= ", fk_soc";
$sql.= ")";
- $sql.= " VALUES (now(), $user->id, ".$this->db->idate($this->date_expedition);
+ $sql.= " VALUES ('(PROV)', now(), $user->id, ".$this->db->idate($this->date_expedition);
$sql.= ", ".$this->socid;
$sql.= ")";
@@ -105,13 +105,13 @@ class Expedition extends CommonObject
// Insertion des lignes
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
{
- if (! $this->create_line($this->lignes[$i]->entrepot_id, $this->lignes[$i]->origin_line_id, $this->lignes[$i]->qty))
+ if (! $this->create_line($this->lignes[$i]->entrepot_id, $this->lignes[$i]->origin_line_id, $this->lignes[$i]->qty) > 0)
{
$error++;
}
}
- if ($this->id && $this->origin_id)
+ if (! $error && $this->id && $this->origin_id)
{
if ($conf->commande->enabled)
{
@@ -126,10 +126,10 @@ class Expedition extends CommonObject
{
$error++;
}
- }
- else
- {
- $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'pr_exp (fk_expedition, fk_propal) VALUES ('.$this->id.','.$this->origin_id.')';
+ }
+ else
+ {
+ $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'pr_exp (fk_expedition, fk_propal) VALUES ('.$this->id.','.$this->origin_id.')';
if (!$this->db->query($sql))
{
$error++;
@@ -142,9 +142,9 @@ class Expedition extends CommonObject
$error++;
}
}
- }
+ }
- if ($error==0)
+ if (! $error)
{
$this->db->commit();
return $this->id;
@@ -152,7 +152,7 @@ class Expedition extends CommonObject
else
{
$error++;
- $this->error=$this->db->error()." - sql=$sql";
+ $this->error=$this->db->lasterror()." - sql=$sql";
$this->db->rollback();
return -3;
}
@@ -160,7 +160,7 @@ class Expedition extends CommonObject
else
{
$error++;
- $this->error=$this->db->error()." - sql=$sql";
+ $this->error=$this->db->lasterror()." - sql=$sql";
$this->db->rollback();
return -2;
}
@@ -183,17 +183,15 @@ class Expedition extends CommonObject
$error = 0;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."expeditiondet (fk_expedition, fk_entrepot, fk_origin_line, qty)";
- $sql .= " VALUES (".$this->id.", ".$entrepot_id.", ".$origin_line_id.", ".$qty.")";
-
- if (! $this->db->query($sql) )
+ $sql .= " VALUES (".$this->id.", ".($entrepot_id?$entrepot_id:'null').", ".$origin_line_id.", ".$qty.")";
+ //print 'x'.$sql;
+ if (! $this->db->query($sql))
{
$error++;
}
- if ($error == 0 )
- {
- return 1;
- }
+ if (! $error) return 1;
+ else return -1;
}
/**
@@ -640,6 +638,11 @@ class Expedition extends CommonObject
if ($statut==0) return img_picto($langs->trans('StatusSendingDraft'),'statut0').' '.$langs->trans('StatusSendingDraft');
if ($statut==1) return img_picto($langs->trans('StatusSendingValidated'),'statut4').' '.$langs->trans('StatusSendingValidated');
}
+ if ($mode == 5)
+ {
+ if ($statut==0) return $langs->trans('StatusSendingDraftShort').' '.img_picto($langs->trans('StatusSendingDraft'),'statut0');
+ if ($statut==1) return $langs->trans('StatusSendingValidatedShort').' '.img_picto($langs->trans('StatusSendingValidated'),'statut4');
+ }
}
/**
@@ -683,13 +686,15 @@ class Expedition extends CommonObject
}
}
+ $order=new Commande($this->db);
+ $order->initAsSpecimen();
+
// Initialise paramètres
$this->id=0;
$this->ref = 'SPECIMEN';
$this->specimen=1;
$socid = rand(1, $num_socs);
$this->statut = 1;
- $this->commande_id = 0;
if ($conf->livraison->enabled)
{
$this->livraison_id = 0;
@@ -699,6 +704,9 @@ class Expedition extends CommonObject
$this->adresse_livraison_id = 0;
$this->socid = $socids[$socid];
+ $this->commande_id = 0;
+ $this->commande = $order;
+
$nbp = 5;
$xnbp = 0;
while ($xnbp < $nbp)
diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php
index be9076b4699..f6d4ec5102d 100644
--- a/htdocs/expedition/fiche.php
+++ b/htdocs/expedition/fiche.php
@@ -17,8 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
*/
// Code identique a /expedition/commande.php
@@ -27,7 +25,7 @@
\file htdocs/expedition/fiche.php
\ingroup expedition
\brief Fiche descriptive d'une expedition
- \version $Revision$
+ \version $Id$
*/
require("./pre.inc.php");
@@ -56,8 +54,8 @@ if ($user->societe_id > 0)
$socid = $user->societe_id;
}
-$origin = $_GET["origin"]?$_GET["origin"]:$_POST["origin"];
-$origin_id = $_GET["origin_id"]?$_GET["origin_id"]:$_POST["origin_id"];
+$origin = $_GET["origin"]?$_GET["origin"]:$_POST["origin"]; // Example: commande, propal
+$origin_id = $_GET["object_id"]?$_GET["object_id"]:$_POST["object_id"]; // Id of order or propal
/*
* Actions
@@ -81,6 +79,7 @@ if ($_POST["action"] == 'add')
$object = new $class($db);
$object->fetch($expedition->origin_id);
//$object->fetch_lines();
+
$expedition->socid = $object->socid;
@@ -188,239 +187,246 @@ if ($_GET["action"] == 'create')
{
print_titre($langs->trans("CreateASending"));
-
+ if (! $origin)
+ {
+ $mesg='
'.$langs->trans("ErrorBadParameters").'
';
+ }
+
if ($mesg)
{
print $mesg.' ';
}
- $class = ucfirst($origin);
-
- $object = new $class($db);
- $object->loadExpeditions();
-
- if ( $object->fetch($origin_id))
+ if ($origin)
{
- $soc = new Societe($db);
- $soc->fetch($object->socid);
-
- $author = new User($db);
- $author->id = $object->user_author_id;
- $author->fetch();
-
- $entrepot = new Entrepot($db);
-
- /*
- * Document source
- */
- print '';
- }
- else
- {
- dolibarr_print_error($db);
}
}
else
diff --git a/htdocs/expedition/liste.php b/htdocs/expedition/liste.php
index 9f8abc3da20..a2836786428 100644
--- a/htdocs/expedition/liste.php
+++ b/htdocs/expedition/liste.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2006 Laurent Destailleur
+ * Copyright (C) 2004-2008 Laurent Destailleur
* Copyright (C) 2005-2008 Regis Houssin
*
* This program is free software; you can redistribute it and/or modify
@@ -114,7 +114,7 @@ if ($resql)
print_liste_field_titre($langs->trans("Proposal"),"liste.php","ori.ref", "", "&socid=$socid",'width="25%" align="left"',$sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("Date"),"liste.php","e.date_expedition","","&socid=$socid", 'width="25%" align="right" colspan="2"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Status"),"liste.php","e.fk_statut","","&socid=$socid",'width="10%" align="center"',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Status"),"liste.php","e.fk_statut","","&socid=$socid",'width="10%" align="right"',$sortfield,$sortorder);
print "\n";
$var=True;
@@ -158,7 +158,7 @@ if ($resql)
print " ";
print strftime("%Y",$objp->date_expedition)."\n";
- print '
'.$expedition->statuts[$objp->fk_statut].'
';
+ print '
'.$expedition->LibStatut($objp->fk_statut,5).'
';
print "\n";
$i++;
diff --git a/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php b/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php
index 5bcb937c4d1..9e1fad2f523 100644
--- a/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php
+++ b/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php
@@ -17,16 +17,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/
- *
- * $Id$
- * $Source$
*/
/**
\file htdocs/expedition/mods/pdf/pdf_expedition_dorade.modules.php
\ingroup expedition
\brief Fichier de la classe permettant de générer les bordereaux envoi au modèle Merou
- \version $Revision$
+ \version $Id$
*/
require_once DOL_DOCUMENT_ROOT."/expedition/mods/pdf/ModelePdfExpedition.class.php";
diff --git a/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php b/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php
index 93de2ccb650..454402cd3f9 100644
--- a/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php
+++ b/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php
@@ -16,16 +16,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/
- *
- * $Id$
- * $Source$
*/
/**
\file htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php
\ingroup expedition
\brief Fichier de la classe permettant de générer les bordereaux envoi au modèle Rouget
- \version $Revision$
+ \version $Id$
*/
require_once DOL_DOCUMENT_ROOT."/expedition/mods/pdf/ModelePdfExpedition.class.php";
diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php
index fc1c5939a2b..8d226b5ea57 100644
--- a/htdocs/livraison/fiche.php
+++ b/htdocs/livraison/fiche.php
@@ -18,16 +18,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
- * $Source$
*/
/**
\file htdocs/livraison/fiche.php
\ingroup livraison
\brief Fiche descriptive d'un bon de livraison
- \version $Revision$
+ \version $Id$
*/
require("./pre.inc.php");