Dbut modification expedition livraison

Phase2: modification des livraisons
- elles pourront dsormais etre li  une propale (pas encore effectif)
- on pourra faire un bon de livraison sans document de base
This commit is contained in:
Regis Houssin 2008-01-31 17:04:00 +00:00
parent 9dbcea96b9
commit 2d7d346df7
4 changed files with 42 additions and 22 deletions

View File

@ -592,8 +592,9 @@ class Expedition extends CommonObject
* Lit le document associé
*
*/
function fetch_object($object)
function fetch_object()
{
$object = $this->origin;
$class = ucfirst($object);
$this->$object = & new $class($this->db);
$this->$object->fetch($this->origin_id);

View File

@ -194,7 +194,7 @@ if ($_GET["action"] == 'create')
print $mesg.'<br>';
}
$class = ucfirst($origin);
$class = ucfirst($origin);
$object = new $class($db);
$object->loadExpeditions();
@ -439,8 +439,8 @@ else
if ($expedition->id > 0)
{
$object = New Commande($db);
$object->fetch($expedition->origin_id);
$object = $expedition->origin;
$expedition->fetch_object();
$soc = new Societe($db);
$soc->fetch($expedition->socid);
@ -466,7 +466,7 @@ else
*/
if ($_GET["action"] == 'delete')
{
$html->form_confirm("fiche.php?id=$expedition->id",$langs->trans("DeleteSending"),"Etes-vous sûr de vouloir supprimer cette expedition ?","confirm_delete");
$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$expedition->id,$langs->trans('DeleteSending'),'Etes-vous sûr de vouloir supprimer cette expedition ?','confirm_delete');
print '<br>';
}
@ -476,7 +476,7 @@ else
*/
if ($_GET["action"] == 'valid')
{
$html->form_confirm("fiche.php?id=$expedition->id",$langs->trans("ValidateSending"),"Etes-vous sûr de vouloir valider cette expédition ?","confirm_valid");
$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$expedition->id,$langs->trans('ValidateSending'),'Etes-vous sûr de vouloir valider cette expédition ?','confirm_valid');
print '<br>';
}
/*
@ -485,7 +485,7 @@ else
*/
if ($_GET["action"] == 'annuler')
{
$html->form_confirm("fiche.php?id=$expedition->id",$langs->trans("CancelSending"),"Etes-vous sûr de vouloir annuler cette commande ?","confirm_cancel");
$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$expedition->id,$langs->trans('CancelSending'),'Etes-vous sûr de vouloir annuler cette commande ?','confirm_cancel');
print '<br>';
}
@ -517,12 +517,12 @@ else
if ($conf->commande->enabled)
{
print $langs->trans("RefOrder").'</td>';
print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/expedition/commande.php?id='.$object->id.'">'.img_object($langs->trans("ShowOrder"),'order').' '.$object->ref;
print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/expedition/commande.php?id='.$expedition->$object->id.'">'.img_object($langs->trans("ShowOrder"),'order').' '.$expedition->$object->ref;
}
else
{
print $langs->trans("RefProposal").'</td>';
print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/expedition/propal.php?propalid='.$object->id.'">'.img_object($langs->trans("ShowProposal"),'propal').' '.$object->ref;
print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/expedition/propal.php?propalid='.$expedition->$object->id.'">'.img_object($langs->trans("ShowProposal"),'propal').' '.$expedition->$object->ref;
}
print "</a></td>\n";
print '</tr>';

View File

@ -361,7 +361,13 @@ else
{
$livraison = new Livraison($db);
$result = $livraison->fetch($_GET["id"]);
if ($livraison->origin_id)
{
$object = $livraison->origin;
$livraison->fetch_object();
}
if ( $livraison->id > 0)
{
$soc = new Societe($db);
@ -389,7 +395,7 @@ else
if ($_GET["action"] == 'delete')
{
$expedition_id = $_GET["expid"];
$html->form_confirm("fiche.php?id=$livraison->id&amp;expid=$expedition_id","Supprimer le bon de livraison","Etes-vous sûr de vouloir supprimer ce bon de livraison ?","confirm_delete");
$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id.'&amp;expid='.$expedition_id,'Supprimer le bon de livraison','Etes-vous sûr de vouloir supprimer ce bon de livraison ?','confirm_delete');
print '<br>';
}
@ -399,7 +405,7 @@ else
*/
if ($_GET["action"] == 'valid')
{
$html->form_confirm("fiche.php?id=$livraison->id","Valider le bon de livraison","Etes-vous sûr de vouloir valider ce bon de livraison ?","confirm_valid");
$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id,'Valider le bon de livraison','Etes-vous sûr de vouloir valider ce bon de livraison ?','confirm_valid');
print '<br>';
}
@ -419,12 +425,21 @@ else
print "</tr>";
// Document origine
print '<tr><td>'.$langs->trans("RefOrder").'</td>';
print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/expedition/commande.php?id='.$commande->id.'">'.img_object($langs->trans("ShowOrder"),'order').' '.$commande->ref."</a></td>\n";
print '</tr>';
if ($conf->commande->enabled)
{
print '<tr><td>'.$langs->trans("RefOrder").'</td>';
print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/expedition/commande.php?id='.$livraison->$object->id.'">'.img_object($langs->trans("ShowOrder"),'order').' '.$livraison->$object->ref."</a></td>\n";
print '</tr>';
}
else
{
print '<tr><td>'.$langs->trans("RefProposal").'</td>';
print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/expedition/propal.php?propalid='.$livraison->$object->id.'">'.img_object($langs->trans("ShowProposal"),'propal').' '.$livraison->$object->ref."</a></td>\n";
print '</tr>';
}
// Commande liée
print '<tr><td>'.$langs->trans("RefCustomerOrderShort").'</td>';
// Ref client
print '<tr><td>'.$langs->trans("RefCustomer").'</td>';
print '<td colspan="3">'.$livraison->ref_client."</a></td>\n";
print '</tr>';

View File

@ -31,6 +31,8 @@
require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
require_once(DOL_DOCUMENT_ROOT."/expedition/expedition.class.php");
require_once(DOL_DOCUMENT_ROOT."/product/stock/mouvementstock.class.php");
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
/**
@ -583,15 +585,17 @@ class Livraison extends CommonObject
}
}
/*
* Lit la commande associée
* Lit le document associé
*
*/
function fetch_commande()
function fetch_object()
{
$this->commande =& new Commande($this->db);
$this->commande->fetch($this->commande_id);
$object = $this->origin;
$class = ucfirst($this->origin);
$this->$object = & new $class($this->db);
$this->$object->fetch($this->origin_id);
}
/**