Add navigation on order pages
This commit is contained in:
parent
4e01c23974
commit
f31fd284a7
@ -17,117 +17,117 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/boutique/commande/commande.class.php
|
||||
\ingroup osc
|
||||
\brief Fichier de la classe des commandes OSC
|
||||
\version $Id$
|
||||
*/
|
||||
/**
|
||||
\file htdocs/boutique/commande/commande.class.php
|
||||
\ingroup osc
|
||||
\brief Fichier de la classe des commandes OSC
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/core/address.class.php");
|
||||
|
||||
|
||||
/**
|
||||
\class Commande
|
||||
\brief Classe permettant la gestion des commandes OSC
|
||||
*/
|
||||
/**
|
||||
\class Commande
|
||||
\brief Classe permettant la gestion des commandes OSC
|
||||
*/
|
||||
class Commande
|
||||
{
|
||||
var $db ;
|
||||
var $db ;
|
||||
|
||||
var $id ;
|
||||
var $nom;
|
||||
var $id ;
|
||||
var $nom;
|
||||
|
||||
function Commande($DB, $id=0) {
|
||||
$this->db = $DB;
|
||||
$this->id = $id ;
|
||||
function Commande($DB, $id=0) {
|
||||
$this->db = $DB;
|
||||
$this->id = $id ;
|
||||
|
||||
$this->billing_adr = new Address();
|
||||
$this->delivry_adr = new Address();
|
||||
$this->billing_adr = new Address();
|
||||
$this->delivry_adr = new Address();
|
||||
|
||||
$this->total_ot_subtotal = 0;
|
||||
$this->total_ot_shipping = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function fetch ($id) {
|
||||
$this->total_ot_subtotal = 0;
|
||||
$this->total_ot_shipping = 0;
|
||||
}
|
||||
|
||||
$sql = "SELECT orders_id, customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, last_modified, ".$this->db->pdate("date_purchased") . " as date_purchased, orders_status, orders_date_finished, currency, currency_value";
|
||||
|
||||
|
||||
$sql .= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders WHERE orders_id = $id";
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
|
||||
if ( $result )
|
||||
{
|
||||
$array = $this->db->fetch_array();
|
||||
|
||||
$this->id = $array["orders_id"];
|
||||
$this->client_id = stripslashes($array["customers_id"]);
|
||||
$this->client_name = stripslashes($array["customers_name"]);
|
||||
|
||||
$this->payment_method = stripslashes($array["payment_method"]);
|
||||
|
||||
$this->date = dolibarr_print_date($array["date_purchased"],'dayhour');
|
||||
|
||||
$this->delivery_adr->name = stripslashes($array["delivery_name"]);
|
||||
$this->delivery_adr->street = stripslashes($array["delivery_street_address"]);
|
||||
$this->delivery_adr->cp = stripslashes($array["delivery_postcode"]);
|
||||
$this->delivery_adr->city = stripslashes($array["delivery_city"]);
|
||||
$this->delivery_adr->country = stripslashes($array["delivery_country"]);
|
||||
|
||||
$this->billing_adr->name = stripslashes($array["billing_name"]);
|
||||
$this->billing_adr->street = stripslashes($array["billing_street_address"]);
|
||||
$this->billing_adr->cp = stripslashes($array["billing_postcode"]);
|
||||
$this->billing_adr->city = stripslashes($array["billing_city"]);
|
||||
$this->billing_adr->country = stripslashes($array["billing_country"]);
|
||||
|
||||
$this->db->free();
|
||||
|
||||
/*
|
||||
* Totaux
|
||||
/**
|
||||
* \brief Get object and lines from database
|
||||
* \param rowid id of object to load
|
||||
* \param ref Ref of order
|
||||
* \return int >0 si ok, <0 si ko
|
||||
*/
|
||||
$sql = "SELECT value, class ";
|
||||
$sql .= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders_total WHERE orders_id = $id";
|
||||
function fetch ($id,$ref='')
|
||||
{
|
||||
$sql = "SELECT orders_id, customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, last_modified, ".$this->db->pdate("date_purchased") . " as date_purchased, orders_status, orders_date_finished, currency, currency_value";
|
||||
$sql.= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders";
|
||||
$sql.= " WHERE orders_id = ".$id;
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql) ;
|
||||
|
||||
if ( $result )
|
||||
if ( $result )
|
||||
{
|
||||
$array = $this->db->fetch_array();
|
||||
|
||||
$this->id = $array["orders_id"];
|
||||
$this->client_id = stripslashes($array["customers_id"]);
|
||||
$this->client_name = stripslashes($array["customers_name"]);
|
||||
|
||||
$this->payment_method = stripslashes($array["payment_method"]);
|
||||
|
||||
$this->date = dolibarr_print_date($array["date_purchased"],'dayhour');
|
||||
|
||||
$this->delivery_adr->name = stripslashes($array["delivery_name"]);
|
||||
$this->delivery_adr->street = stripslashes($array["delivery_street_address"]);
|
||||
$this->delivery_adr->cp = stripslashes($array["delivery_postcode"]);
|
||||
$this->delivery_adr->city = stripslashes($array["delivery_city"]);
|
||||
$this->delivery_adr->country = stripslashes($array["delivery_country"]);
|
||||
|
||||
$this->billing_adr->name = stripslashes($array["billing_name"]);
|
||||
$this->billing_adr->street = stripslashes($array["billing_street_address"]);
|
||||
$this->billing_adr->cp = stripslashes($array["billing_postcode"]);
|
||||
$this->billing_adr->city = stripslashes($array["billing_city"]);
|
||||
$this->billing_adr->country = stripslashes($array["billing_country"]);
|
||||
|
||||
$this->db->free();
|
||||
|
||||
/*
|
||||
* Totaux
|
||||
*/
|
||||
$sql = "SELECT value, class ";
|
||||
$sql .= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders_total WHERE orders_id = $id";
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
|
||||
if ( $result )
|
||||
{
|
||||
$num = $this->db->num_rows();
|
||||
$num = $this->db->num_rows();
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$array = $this->db->fetch_array($i);
|
||||
if ($array["class"] == 'ot_total')
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$array = $this->db->fetch_array($i);
|
||||
if ($array["class"] == 'ot_total')
|
||||
{
|
||||
$this->total_ot_total = $array["value"];
|
||||
}
|
||||
if ($array["class"] == 'ot_shipping')
|
||||
{
|
||||
}
|
||||
if ($array["class"] == 'ot_shipping')
|
||||
{
|
||||
$this->total_ot_shipping = $array["value"];
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
print $this->db->error();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -207,7 +207,7 @@ class Commande extends CommonObject
|
||||
function valid($user)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
|
||||
$error=0;
|
||||
|
||||
// Protection
|
||||
@ -303,7 +303,7 @@ class Commande extends CommonObject
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
}
|
||||
|
||||
|
||||
if ($error == 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -344,7 +344,7 @@ class Commande extends CommonObject
|
||||
$this->error='Permission denied';
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande SET fk_statut = 0";
|
||||
@ -379,7 +379,7 @@ class Commande extends CommonObject
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->statut=0;
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
@ -435,7 +435,7 @@ class Commande extends CommonObject
|
||||
if ($user->rights->commande->valider)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET fk_statut = -1';
|
||||
$sql .= " WHERE rowid = $this->id AND fk_statut = 1 ;";
|
||||
|
||||
@ -448,7 +448,7 @@ class Commande extends CommonObject
|
||||
// We increment stock of product (and sub-products)
|
||||
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
|
||||
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty);
|
||||
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -461,7 +461,7 @@ class Commande extends CommonObject
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
@ -816,10 +816,12 @@ class Commande extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Load an order from database
|
||||
* \param rowid id de la commande a recuperer
|
||||
* \brief Get object and lines from database
|
||||
* \param rowid id of object to load
|
||||
* \param ref Ref of invoice
|
||||
* \return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function fetch($id)
|
||||
function fetch($id,$ref='')
|
||||
{
|
||||
$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 as total_tva, c.fk_cond_reglement, c.fk_mode_reglement';
|
||||
@ -834,89 +836,89 @@ class Commande extends CommonObject
|
||||
$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;
|
||||
if ($ref) $sql.= " WHERE c.ref='".$ref."'";
|
||||
else $sql.= " WHERE c.rowid=".$id;
|
||||
|
||||
dolibarr_syslog("Commande::fetch sql=$sql");
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
if ($result)
|
||||
{
|
||||
$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->total_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->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->total_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();
|
||||
|
||||
$this->db->free();
|
||||
|
||||
if ($this->propale_id)
|
||||
{
|
||||
$sqlp = "SELECT ref";
|
||||
$sqlp.= " FROM ".MAIN_DB_PREFIX."propal";
|
||||
$sqlp.= " WHERE rowid = ".$this->propale_id;
|
||||
if ($this->statut == 0) $this->brouillon = 1;
|
||||
|
||||
$resqlprop = $this->db->query($sqlp);
|
||||
$this->db->free();
|
||||
|
||||
if ($resqlprop)
|
||||
{
|
||||
$objp = $this->db->fetch_object($resqlprop);
|
||||
$this->propale_ref = $objp->ref;
|
||||
$this->db->free($resqlprop);
|
||||
}
|
||||
}
|
||||
if ($this->propale_id)
|
||||
{
|
||||
$sqlp = "SELECT ref";
|
||||
$sqlp.= " FROM ".MAIN_DB_PREFIX."propal";
|
||||
$sqlp.= " WHERE rowid = ".$this->propale_id;
|
||||
|
||||
/*
|
||||
* Lignes
|
||||
*/
|
||||
$result=$this->fetch_lines();
|
||||
if ($result < 0)
|
||||
{
|
||||
return -3;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog('Commande::Fetch Error rowid='.$rowid.' numrows=0 sql='.$sql);
|
||||
$this->error='Order with id '.$rowid.' not found sql='.$sql;
|
||||
return -2;
|
||||
}
|
||||
$resqlprop = $this->db->query($sqlp);
|
||||
|
||||
if ($resqlprop)
|
||||
{
|
||||
$objp = $this->db->fetch_object($resqlprop);
|
||||
$this->propale_ref = $objp->ref;
|
||||
$this->db->free($resqlprop);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Lignes
|
||||
*/
|
||||
$result=$this->fetch_lines();
|
||||
if ($result < 0)
|
||||
{
|
||||
return -3;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
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_syslog('Commande::Fetch Error rowid='.$rowid.' Erreur dans fetch de la commande');
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1812,7 +1814,7 @@ class Commande extends CommonObject
|
||||
global $conf, $user;
|
||||
|
||||
$now=gmmktime();
|
||||
|
||||
|
||||
$this->nbtodo=$this->nbtodolate=0;
|
||||
$clause = "WHERE";
|
||||
|
||||
|
||||
@ -154,14 +154,15 @@ $contactstatic=new Contact($db);
|
||||
/* Mode vue et edition */
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
if ( isset($mesg))
|
||||
print $mesg;
|
||||
$id = $_GET["id"];
|
||||
if ($id > 0)
|
||||
if (isset($mesg)) print $mesg;
|
||||
|
||||
$id = $_GET['id'];
|
||||
$ref= $_GET['ref'];
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$langs->trans("OrderCard");
|
||||
$commande = New Commande($db);
|
||||
if ( $commande->fetch($_GET['id'], $user->societe_id) > 0)
|
||||
$commande = new Commande($db);
|
||||
if ( $commande->fetch($_GET['id'],$_GET['ref']) > 0)
|
||||
{
|
||||
$soc = new Societe($db, $commande->socid);
|
||||
$soc->fetch($commande->socid);
|
||||
@ -178,7 +179,7 @@ if ($id > 0)
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="18%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $commande->ref;
|
||||
print $html->showrefnav($commande,'ref','',1,'ref','ref');
|
||||
print "</td></tr>";
|
||||
|
||||
// Ref commande client
|
||||
|
||||
@ -20,11 +20,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/commande/document.php
|
||||
\ingroup order
|
||||
\brief Page de gestion des documents attachees a une commande
|
||||
\version $Id$
|
||||
*/
|
||||
\file htdocs/commande/document.php
|
||||
\ingroup order
|
||||
\brief Page de gestion des documents attachees a une commande
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require('./pre.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/order.lib.php');
|
||||
@ -32,7 +32,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
|
||||
|
||||
if (!$user->rights->commande->lire)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
$langs->load('companies');
|
||||
//$langs->load("bills");
|
||||
@ -42,10 +42,10 @@ $id=empty($_GET['id']) ? 0 : intVal($_GET['id']);
|
||||
$action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action']) : $_GET['action'];
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
unset($_GET["action"]);
|
||||
$action='';
|
||||
$action='';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
@ -62,63 +62,70 @@ $pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
|
||||
$id = $_GET['id'];
|
||||
$ref= $_GET['ref'];
|
||||
$commande = new Commande($db);
|
||||
if (!$commande->fetch($id)) {
|
||||
dolibarr_print_error($db);
|
||||
if (! $commande->fetch($_GET['id'],$_GET['ref']) > 0)
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
// Envoi fichier
|
||||
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
$upload_dir = $conf->commande->dir_output . "/" . sanitizeFileName($commande->ref);
|
||||
if (! is_dir($upload_dir)) create_exdir($upload_dir);
|
||||
|
||||
if (is_dir($upload_dir))
|
||||
{
|
||||
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0) > 0)
|
||||
$upload_dir = $conf->commande->dir_output . "/" . sanitizeFileName($commande->ref);
|
||||
if (! is_dir($upload_dir)) create_exdir($upload_dir);
|
||||
|
||||
if (is_dir($upload_dir))
|
||||
{
|
||||
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0) > 0)
|
||||
{
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
//print_r($_FILES);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
// Echec transfert (fichier dépassant la limite ?)
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
|
||||
// print_r($_FILES);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($action=='delete')
|
||||
{
|
||||
$upload_dir = $conf->commande->dir_output . "/" . sanitizeFileName($commande->ref);
|
||||
$file = $upload_dir . '/' . urldecode($_GET['urlfile']);
|
||||
dol_delete_file($file);
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
|
||||
$upload_dir = $conf->commande->dir_output . "/" . sanitizeFileName($commande->ref);
|
||||
$file = $upload_dir . '/' . urldecode($_GET['urlfile']);
|
||||
dol_delete_file($file);
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Affichage
|
||||
* View
|
||||
*/
|
||||
if ($id > 0)
|
||||
{
|
||||
llxHeader();
|
||||
|
||||
$upload_dir = $conf->commande->dir_output.'/'.sanitizeFileName($commande->ref);
|
||||
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($commande->socid);
|
||||
|
||||
$head = commande_prepare_head($commande);
|
||||
dolibarr_fiche_head($head, 'documents', $langs->trans('CustomerOrder'));
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
$html = new Form($db);
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$upload_dir = $conf->commande->dir_output.'/'.sanitizeFileName($commande->ref);
|
||||
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($commande->socid);
|
||||
|
||||
$head = commande_prepare_head($commande);
|
||||
dolibarr_fiche_head($head, 'documents', $langs->trans('CustomerOrder'));
|
||||
|
||||
|
||||
// Construit liste des fichiers
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
|
||||
$totalsize=0;
|
||||
@ -126,35 +133,37 @@ if ($id > 0)
|
||||
{
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
|
||||
|
||||
print '<table class="border"width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">'.$commande->ref.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$societe->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
print "</table>\n";
|
||||
print "</div>\n";
|
||||
|
||||
if ($mesg) { print $mesg."<br>"; }
|
||||
|
||||
|
||||
print '<table class="border"width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
||||
print $html->showrefnav($commande,'ref','',1,'ref','ref');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$societe->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
print "</table>\n";
|
||||
print "</div>\n";
|
||||
|
||||
if ($mesg) { print $mesg."<br>"; }
|
||||
|
||||
|
||||
// Affiche formulaire upload
|
||||
$formfile=new FormFile($db);
|
||||
$formfile=new FormFile($db);
|
||||
$formfile->form_attach_new_file(DOL_URL_ROOT.'/commande/document.php?id='.$commande->id);
|
||||
|
||||
|
||||
|
||||
|
||||
// List of document
|
||||
$param='&id='.$commande->id;
|
||||
$formfile->list_of_documents($filearray,$commande,'commande',$param);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Header('Location: index.php');
|
||||
Header('Location: index.php');
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -1136,122 +1136,128 @@ else
|
||||
/* Mode vue et edition */
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
$now=gmmktime();
|
||||
|
||||
$id = $_GET['id'];
|
||||
if ($id > 0)
|
||||
$ref= $_GET['ref'];
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
if ($mesg) print $mesg.'<br>';
|
||||
|
||||
$commande = new Commande($db);
|
||||
if ( $commande->fetch($_GET['id']) > 0)
|
||||
$result=$commande->fetch($_GET['id'],$_GET['ref']);
|
||||
if ($result > 0)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($commande->socid);
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($commande->socid);
|
||||
|
||||
$author = new User($db);
|
||||
$author->id = $commande->user_author_id;
|
||||
$author->fetch();
|
||||
$author = new User($db);
|
||||
$author->id = $commande->user_author_id;
|
||||
$author->fetch();
|
||||
|
||||
$head = commande_prepare_head($commande);
|
||||
dolibarr_fiche_head($head, 'order', $langs->trans("CustomerOrder"));
|
||||
$head = commande_prepare_head($commande);
|
||||
dolibarr_fiche_head($head, 'order', $langs->trans("CustomerOrder"));
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression de la commande
|
||||
*/
|
||||
if ($_GET['action'] == 'delete')
|
||||
{
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete');
|
||||
print '<br />';
|
||||
}
|
||||
/*
|
||||
* Confirmation de la suppression de la commande
|
||||
*/
|
||||
if ($_GET['action'] == 'delete')
|
||||
{
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete');
|
||||
print '<br />';
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la validation
|
||||
*/
|
||||
if ($_GET['action'] == 'validate')
|
||||
{
|
||||
// on verifie si la facture est en numerotation provisoire
|
||||
$ref = substr($commande->ref, 1, 4);
|
||||
if ($ref == 'PROV')
|
||||
{
|
||||
$num = $commande->getNextNumRef($soc);
|
||||
}
|
||||
else
|
||||
{
|
||||
$num = $commande->ref;
|
||||
}
|
||||
|
||||
$text=$langs->trans('ConfirmValidateOrder',$num);
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('ValidateOrder'), $text, 'confirm_validate');
|
||||
print '<br />';
|
||||
}
|
||||
/*
|
||||
* Confirmation de la validation
|
||||
*/
|
||||
if ($_GET['action'] == 'validate')
|
||||
{
|
||||
// on verifie si la facture est en numerotation provisoire
|
||||
$ref = substr($commande->ref, 1, 4);
|
||||
if ($ref == 'PROV')
|
||||
{
|
||||
$num = $commande->getNextNumRef($soc);
|
||||
}
|
||||
else
|
||||
{
|
||||
$num = $commande->ref;
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la cloture
|
||||
*/
|
||||
if ($_GET['action'] == 'close')
|
||||
{
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_close');
|
||||
print '<br />';
|
||||
}
|
||||
$text=$langs->trans('ConfirmValidateOrder',$num);
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('ValidateOrder'), $text, 'confirm_validate');
|
||||
print '<br />';
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de l'annulation
|
||||
*/
|
||||
if ($_GET['action'] == 'cancel')
|
||||
{
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('Cancel'), $langs->trans('ConfirmCancelOrder'), 'confirm_cancel');
|
||||
print '<br />';
|
||||
}
|
||||
/*
|
||||
* Confirmation de la cloture
|
||||
*/
|
||||
if ($_GET['action'] == 'close')
|
||||
{
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_close');
|
||||
print '<br />';
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression d'une ligne produit
|
||||
*/
|
||||
if ($_GET['action'] == 'ask_deleteline' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
||||
{
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline');
|
||||
print '<br>';
|
||||
}
|
||||
/*
|
||||
* Confirmation de l'annulation
|
||||
*/
|
||||
if ($_GET['action'] == 'cancel')
|
||||
{
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('Cancel'), $langs->trans('ConfirmCancelOrder'), 'confirm_cancel');
|
||||
print '<br />';
|
||||
}
|
||||
|
||||
/*
|
||||
* Commande
|
||||
*/
|
||||
$nbrow=8;
|
||||
if ($conf->projet->enabled) $nbrow++;
|
||||
/*
|
||||
* Confirmation de la suppression d'une ligne produit
|
||||
*/
|
||||
if ($_GET['action'] == 'ask_deleteline' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
||||
{
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline');
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
/*
|
||||
* Commande
|
||||
*/
|
||||
$nbrow=8;
|
||||
if ($conf->projet->enabled) $nbrow++;
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
|
||||
print '<td colspan="3">'.$commande->ref.'</td>';
|
||||
print '</tr>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref commande client
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">';
|
||||
print $langs->trans('RefCustomer').'</td><td align="left">';
|
||||
print '</td>';
|
||||
if ($_GET['action'] != 'RefCustomerOrder' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=RefCustomerOrder&id='.$commande->id.'">'.img_edit($langs->trans('Modify')).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($user->rights->commande->creer && $_GET['action'] == 'RefCustomerOrder')
|
||||
{
|
||||
print '<form action="fiche.php?id='.$id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="set_ref_client">';
|
||||
print '<input type="text" class="flat" size="20" name="ref_client" value="'.$commande->ref_client.'">';
|
||||
print ' <input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $commande->ref_client;
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
// Ref
|
||||
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $html->showrefnav($commande,'ref','',1,'ref','ref');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Ref commande client
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">';
|
||||
print $langs->trans('RefCustomer').'</td><td align="left">';
|
||||
print '</td>';
|
||||
if ($_GET['action'] != 'RefCustomerOrder' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=RefCustomerOrder&id='.$commande->id.'">'.img_edit($langs->trans('Modify')).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($user->rights->commande->creer && $_GET['action'] == 'RefCustomerOrder')
|
||||
{
|
||||
print '<form action="fiche.php?id='.$id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="set_ref_client">';
|
||||
print '<input type="text" class="flat" size="20" name="ref_client" value="'.$commande->ref_client.'">';
|
||||
print ' <input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $commande->ref_client;
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Societe
|
||||
print '<tr><td>'.$langs->trans('Company').'</td>';
|
||||
print '<td colspan="3">'.$soc->getNomUrl(1).'</td>';
|
||||
print '</tr>';
|
||||
// Societe
|
||||
print '<tr><td>'.$langs->trans('Company').'</td>';
|
||||
print '<td colspan="3">'.$soc->getNomUrl(1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Ligne info remises tiers
|
||||
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
|
||||
|
||||
@ -16,16 +16,14 @@
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/commande/note.php
|
||||
\ingroup commande
|
||||
\brief Fiche de notes sur une commande
|
||||
\version $Revision$
|
||||
*/
|
||||
\file htdocs/commande/note.php
|
||||
\ingroup commande
|
||||
\brief Fiche de notes sur une commande
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/order.lib.php');
|
||||
@ -33,27 +31,32 @@ require_once(DOL_DOCUMENT_ROOT.'/lib/order.lib.php');
|
||||
$socid=isset($_GET["socid"])?$_GET["socid"]:isset($_POST["socid"])?$_POST["socid"]:"";
|
||||
|
||||
if (!$user->rights->commande->lire)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
$langs->load("orders");
|
||||
|
||||
// Sécurité accés
|
||||
if ($user->societe_id > 0)
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
unset($_GET["action"]);
|
||||
$socid = $user->societe_id;
|
||||
unset($_GET["action"]);
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
|
||||
$id = $_GET['id'];
|
||||
$ref= $_GET['ref'];
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($_GET["id"]);
|
||||
if (! $commande->fetch($_GET['id'],$_GET['ref']) > 0)
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* Actions */
|
||||
/******************************************************************************/
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($_POST["action"] == 'update' && $user->rights->commande->creer)
|
||||
{
|
||||
@ -61,7 +64,7 @@ if ($_POST["action"] == 'update' && $user->rights->commande->creer)
|
||||
|
||||
$resPrivateNote=$commande->update_note($_POST["note"]);
|
||||
$resPublicNote=$commande->update_note_public($_POST["note_public"]);
|
||||
|
||||
|
||||
if ($resPrivateNote < 0 || $resPublicNote < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$commande->error.'</div>';
|
||||
@ -75,77 +78,77 @@ if ($_POST["action"] == 'update' && $user->rights->commande->creer)
|
||||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* Affichage fiche */
|
||||
/******************************************************************************/
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$html = new Form($db);
|
||||
|
||||
if ($_GET["id"])
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$soc = new Societe($db, $commande->socid);
|
||||
$soc->fetch($commande->socid);
|
||||
|
||||
$head = commande_prepare_head($commande);
|
||||
|
||||
dolibarr_fiche_head($head, 'note', $langs->trans("CustomerOrder"));
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
$soc->fetch($commande->socid);
|
||||
|
||||
$head = commande_prepare_head($commande);
|
||||
|
||||
dolibarr_fiche_head($head, 'note', $langs->trans("CustomerOrder"));
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="18%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $commande->ref;
|
||||
print $html->showrefnav($commande,'ref','',1,'ref','ref');
|
||||
print "</td></tr>";
|
||||
|
||||
// Ref commande client
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
|
||||
print $langs->trans('RefCustomer').'</td><td align="left">';
|
||||
print '</td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
print '</td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
print $commande->ref_client;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Customer
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$soc->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Note publique
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").' :</td>';
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").' :</td>';
|
||||
print '<td valign="top" colspan="3">';
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<textarea name="note_public" cols="80" rows="8">'.$commande->note_public."</textarea><br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print ($commande->note_public?nl2br($commande->note_public):" ");
|
||||
}
|
||||
print "</td></tr>";
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<textarea name="note_public" cols="80" rows="8">'.$commande->note_public."</textarea><br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print ($commande->note_public?nl2br($commande->note_public):" ");
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
// Note privée
|
||||
if (! $user->societe_id)
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePrivate").' :</td>';
|
||||
print '<td valign="top" colspan="3">';
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
print '<textarea name="note" cols="80" rows="8">'.$commande->note."</textarea><br>";
|
||||
}
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
print '<textarea name="note" cols="80" rows="8">'.$commande->note."</textarea><br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print ($commande->note?nl2br($commande->note):" ");
|
||||
print ($commande->note?nl2br($commande->note):" ");
|
||||
}
|
||||
print "</td></tr>";
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
print '<br><center>';
|
||||
@ -153,21 +156,21 @@ if ($_GET["id"])
|
||||
print '</center>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
* Actions
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->commande->creer && $_GET["action"] <> 'edit')
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"note.php?id=".$commande->id."&action=edit\">".$langs->trans('Modify')."</a>";
|
||||
}
|
||||
if ($user->rights->commande->creer && $_GET["action"] <> 'edit')
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"note.php?id=".$commande->id."&action=edit\">".$langs->trans('Modify')."</a>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -105,22 +105,21 @@ if ($_POST['action'] == 'setconditions' && $user->rights->commande->creer)
|
||||
}
|
||||
|
||||
|
||||
llxHeader('',$langs->trans("OrderCard"),"Commande");
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("OrderCard"),"Commande");
|
||||
|
||||
$html = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
/* *************************************************************************** */
|
||||
/* */
|
||||
/* Mode vue et edition */
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
|
||||
if ($_GET["id"] > 0)
|
||||
$id = $_GET['id'];
|
||||
$ref= $_GET['ref'];
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
if ( $commande->fetch($_GET["id"]) > 0)
|
||||
if ( $commande->fetch($_GET['id'],$_GET['ref']) > 0)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($commande->socid);
|
||||
@ -142,7 +141,9 @@ if ($_GET["id"] > 0)
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
|
||||
print '<td colspan="3">'.$commande->ref.'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $html->showrefnav($commande,'ref','',1,'ref','ref');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Ref commande client
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -123,10 +123,12 @@ $formfile = new FormFile($db);
|
||||
|
||||
llxHeader('',$langs->trans("OrderCard"));
|
||||
|
||||
if ($_GET["id"] > 0)
|
||||
$id = $_GET['id'];
|
||||
$ref= $_GET['ref'];
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
if ( $commande->fetch($_GET["id"]) > 0)
|
||||
if ( $commande->fetch($_GET['id'],$_GET['ref']) > 0)
|
||||
{
|
||||
$commande->loadExpeditions(1);
|
||||
|
||||
@ -158,7 +160,9 @@ if ($_GET["id"] > 0)
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
|
||||
print '<td colspan="3">'.$commande->ref.'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $html->showrefnav($commande,'ref','',1,'ref','ref');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Ref commande client
|
||||
@ -507,72 +511,85 @@ if ($_GET["id"] > 0)
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
// Bouton expedier sans gestion des stocks
|
||||
if (! $conf->stock->enabled && $reste_a_livrer_total > 0 && ! $commande->brouillon && $user->rights->expedition->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/fiche.php?action=create&origin=commande&object_id='.$_GET["id"].'">'.$langs->trans("NewSending").'</a>';
|
||||
if (! $conf->stock->enabled && ! $commande->brouillon)
|
||||
{
|
||||
if ($user->rights->expedition->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/fiche.php?action=create&origin=commande&object_id='.$_GET["id"].'">'.$langs->trans("NewSending").'</a>';
|
||||
if ($reste_a_livrer_total <= 0)
|
||||
{
|
||||
print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#">'.$langs->trans("NewSending").'</a>';
|
||||
}
|
||||
}
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
|
||||
// Bouton expedier avec gestion des stocks
|
||||
|
||||
print '<table width="100%"><tr><td width="100%" colspan="2" valign="top">';
|
||||
|
||||
if ($conf->stock->enabled && $reste_a_livrer_total > 0 && $commande->statut > 0 && $commande->statut < 3 && $user->rights->expedition->creer)
|
||||
if ($conf->stock->enabled && $commande->statut > 0 && $commande->statut < 3)
|
||||
{
|
||||
print_titre($langs->trans("NewSending"));
|
||||
|
||||
print '<form method="GET" action="'.DOL_URL_ROOT.'/expedition/fiche.php">';
|
||||
print '<input type="hidden" name="action" value="create">';
|
||||
print '<input type="hidden" name="id" value="'.$commande->id.'">';
|
||||
print '<input type="hidden" name="origin" value="commande">';
|
||||
print '<input type="hidden" name="object_id" value="'.$commande->id.'">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$entrepot = new Entrepot($db);
|
||||
$langs->load("stocks");
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Warehouse").'</td>';
|
||||
print '<td>';
|
||||
|
||||
if (sizeof($user->entrepots) === 1)
|
||||
if ($user->rights->expedition->creer)
|
||||
{
|
||||
$uentrepot = array();
|
||||
$uentrepot[$user->entrepots[0]['id']] = $user->entrepots[0]['label'];
|
||||
$html->select_array("entrepot_id",$uentrepot);
|
||||
print_titre($langs->trans("NewSending"));
|
||||
|
||||
print '<form method="GET" action="'.DOL_URL_ROOT.'/expedition/fiche.php">';
|
||||
print '<input type="hidden" name="action" value="create">';
|
||||
print '<input type="hidden" name="id" value="'.$commande->id.'">';
|
||||
print '<input type="hidden" name="origin" value="commande">';
|
||||
print '<input type="hidden" name="object_id" value="'.$commande->id.'">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$entrepot = new Entrepot($db);
|
||||
$langs->load("stocks");
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Warehouse").'</td>';
|
||||
print '<td>';
|
||||
|
||||
if (sizeof($user->entrepots) === 1)
|
||||
{
|
||||
$uentrepot = array();
|
||||
$uentrepot[$user->entrepots[0]['id']] = $user->entrepots[0]['label'];
|
||||
$html->select_array("entrepot_id",$uentrepot);
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->select_array("entrepot_id",$entrepot->list_array());
|
||||
}
|
||||
|
||||
if (sizeof($entrepot->list_array()) <= 0)
|
||||
{
|
||||
print ' No warehouse defined, <a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?action=create">add one</a>';
|
||||
}
|
||||
print '</td><td align="center">';
|
||||
print '<input type="submit" class="button" named="save" value="'.$langs->trans("NewSending").'">';
|
||||
if ($reste_a_livrer_total <= 0)
|
||||
{
|
||||
print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend"));
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
print "</form>\n";
|
||||
print '<br>';
|
||||
|
||||
$somethingshown=1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->select_array("entrepot_id",$entrepot->list_array());
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butActionRefused" href="#">'.$langs->trans("NewSending").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if (sizeof($entrepot->list_array()) <= 0)
|
||||
{
|
||||
print ' Aucun entrepôt définit, <a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?action=create">definissez en un</a>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
/*
|
||||
print '<tr><td width="20%">Mode d\'expédition</td>';
|
||||
print '<td>';
|
||||
$html->select_array("entrepot_id",$entrepot->list_array());
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
print '<tr><td align="center" colspan="2">';
|
||||
print '<input type="submit" class="button" named="save" value="'.$langs->trans("NewSending").'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
print "</form>\n";
|
||||
|
||||
$somethingshown=1;
|
||||
}
|
||||
|
||||
print "</td></tr></table>";
|
||||
|
||||
print '<br>';
|
||||
show_list_sending_receive('commande',$commande->id);
|
||||
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ if ($_GET["action"] == 'create')
|
||||
|
||||
$expe = new Expedition($db);
|
||||
|
||||
print_titre($langs->trans("CreateASending"));
|
||||
print_fiche_titre($langs->trans("CreateASending"));
|
||||
if (! $origin)
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorBadParameters").'</div>';
|
||||
@ -295,9 +295,8 @@ if ($_GET["action"] == 'create')
|
||||
{
|
||||
print '<tr><td colspan="3">'.$langs->trans("NotePrivate").': '.nl2br($object->note)."</td></tr>";
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
print '<table><tr><td>';
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans("Weight");
|
||||
print '</td><td><input name="weight" size="4" value=""></td><td>';
|
||||
print $formproduct->select_measuring_units("weight_units","weight");
|
||||
@ -311,10 +310,7 @@ if ($_GET["action"] == 'create')
|
||||
print '</td></tr><tr><td>';
|
||||
print $langs->trans("Depth");
|
||||
print '</td><td><input name="sizeS" size="4" value=""></td>';
|
||||
print '<td> </td></tr></table>';
|
||||
|
||||
|
||||
print '<table>';
|
||||
print '<td> </td></tr>';
|
||||
|
||||
// Delivery method
|
||||
print "<tr><td>".$langs->trans("DeliveryMethod")."</td>";
|
||||
|
||||
@ -485,10 +485,10 @@ class Facture extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Recupére l'objet facture et ses lignes de factures
|
||||
* \param rowid id de la facture a récupérer
|
||||
* \brief Get object and lines from database
|
||||
* \param rowid id of object to load
|
||||
* \param ref Ref of invoice
|
||||
* \return int >0 si ok, <0 si ko
|
||||
* \return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function fetch($rowid,$ref='')
|
||||
{
|
||||
|
||||
@ -62,6 +62,7 @@ FeaturesSupported=Features supported
|
||||
Width=Width
|
||||
Height=Height
|
||||
Weight=Weight
|
||||
Depth=Depth
|
||||
TotalWeight=Total weight
|
||||
WeightUnitton=tonnes
|
||||
WeightUnitkg=kg
|
||||
@ -73,9 +74,6 @@ VolumeUnitm3=m3
|
||||
VolumeUnitdm3=dm3
|
||||
VolumeUnitcm3=cm3
|
||||
VolumeUnitmm3=mm3
|
||||
Height=height
|
||||
Width=width
|
||||
Depth=depth
|
||||
Size=size
|
||||
SizeUnitm=m
|
||||
SizeUnitdm=dm
|
||||
|
||||
@ -41,6 +41,7 @@ ConfirmCancelSending=Are you sure you want to cancel this sending ?
|
||||
GenericTransport=Generic transport
|
||||
Enlevement=Gotten by customer
|
||||
DocumentModelSimple=Simple document model
|
||||
|
||||
WarningNoQtyLeftToSend=Warning, no products waiting to be shipped.
|
||||
|
||||
# NumRef
|
||||
NumRefModelJade=Return a reference number with format BLYY00001, ... where YY is year. Number at end is never reset to zero.
|
||||
|
||||
@ -62,6 +62,7 @@ FeaturesSupported=Fonctionnalit
|
||||
Width=Largeur
|
||||
Height=Hauteur
|
||||
Weight=Poids
|
||||
Depth=Profondeur
|
||||
TotalWeight=Poids total
|
||||
WeightUnitton=tonnes
|
||||
WeightUnitkg=kg
|
||||
@ -73,9 +74,6 @@ VolumeUnitm3=m3
|
||||
VolumeUnitdm3=dm3
|
||||
VolumeUnitcm3=cm3
|
||||
VolumeUnitmm3=mm3
|
||||
Height=hauteur
|
||||
Width=largeur
|
||||
Depth=profondeur
|
||||
Size=taille
|
||||
SizeUnitm=m
|
||||
SizeUnitdm=dm
|
||||
|
||||
@ -41,6 +41,7 @@ ConfirmCancelSending=Etes-vous s
|
||||
GenericTransport=Transporteur générique
|
||||
Enlevement=Enlèvement sur place par le client
|
||||
DocumentModelSimple=Modèle simple
|
||||
WarningNoQtyLeftToSend=Alerte, aucun produit en attente de livraison.
|
||||
|
||||
# NumRef
|
||||
NumRefModelJade=Renvoie un numéro de référence sous la forme numérique BLYY00001, ... où YY représente l'année. Le numéro d'incrément qui suit l'année n'est PAS remis à zéro en début d'année.
|
||||
|
||||
@ -1142,7 +1142,7 @@ if ($_GET["action"] == '')
|
||||
print '<a class="butAction" href="fiche.php?action=edit&id='.$product->id.'">'.$langs->trans("Modify").'</a>';
|
||||
|
||||
if ($product->no_button_copy <> 1)
|
||||
print '<a class="butAction" href="fiche.php?action=clone&id='.$product->id.'">'.$langs->trans("CreateCopy").'</a>';
|
||||
print '<a class="butAction" href="fiche.php?action=clone&id='.$product->id.'">'.$langs->trans("ToClone").'</a>';
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user