Début ajout de la gestion des adresses de livraison

This commit is contained in:
Regis Houssin 2006-04-24 11:28:02 +00:00
parent 827b97884c
commit 403fda125b
3 changed files with 15 additions and 4 deletions

View File

@ -47,6 +47,8 @@ if (! $user->rights->societe->creer)
} }
$idl = isset($_GET["idl"])?$_GET["idl"]:''; $idl = isset($_GET["idl"])?$_GET["idl"]:'';
$origin = isset($_GET["origin"])?$_GET["origin"]:'';
$originid = isset($_GET["originid"])?$_GET["originid"]:'';
$socid = isset($_GET["socid"])?$_GET["socid"]:''; $socid = isset($_GET["socid"])?$_GET["socid"]:'';
if (! $socid && ($_REQUEST["action"] != 'create' && $_REQUEST["action"] != 'add' && $_REQUEST["action"] != 'update')) accessforbidden(); if (! $socid && ($_REQUEST["action"] != 'create' && $_REQUEST["action"] != 'add' && $_REQUEST["action"] != 'update')) accessforbidden();
@ -98,8 +100,16 @@ if ($_POST["action"] == 'add' || $_POST["action"] == 'update')
if ($result >= 0) if ($result >= 0)
{ {
if ($origin == commande)
{
Header("Location: ../commande/fiche.php?action=editdelivery_adress&socid=".$socid."&id=".$originid);
exit;
}
else
{
Header("Location: adresse_livraison.php?socid=".$socid); Header("Location: adresse_livraison.php?socid=".$socid);
exit; exit;
}
} }
else else
{ {

View File

@ -739,7 +739,7 @@ else
print '</td><td colspan="2">'; print '</td><td colspan="2">';
if ($_GET['action'] == 'editdelivery_adress') if ($_GET['action'] == 'editdelivery_adress')
{ {
$html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'adresse_livraison_id'); $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'adresse_livraison_id','commande',$commande->id);
} }
else else
{ {

View File

@ -1584,9 +1584,10 @@ class Form
* \param page Page * \param page Page
* \param selected Id condition présélectionnée * \param selected Id condition présélectionnée
* \param htmlname Nom du formulaire select * \param htmlname Nom du formulaire select
* \param addempty Ajoute entrée vide * \param origin origine de l'appel pour pouvoir créer un retour
* \param id id de l'origine
*/ */
function form_adresse_livraison($page, $selected='', $socid, $htmlname='adresse_livraison_id') function form_adresse_livraison($page, $selected='', $socid, $htmlname='adresse_livraison_id', $origin='', $id)
{ {
global $langs,$conf; global $langs,$conf;
if ($htmlname != "none") if ($htmlname != "none")
@ -1602,7 +1603,7 @@ class Form
if ($numaddress==0) if ($numaddress==0)
{ {
$langs->load("companies"); $langs->load("companies");
print ' &nbsp; <a href='.DOL_DOCUMENT_ROOT .'/comm/adresse_livraison.php?socid='.$socid.'&action=create>'.$langs->trans("AddAddress").'</a>'; print ' &nbsp; <a href='.DOL_DOCUMENT_ROOT .'/comm/adresse_livraison.php?socid='.$socid.'&action=create&origin='.$origin.'&originid='.$id.'>'.$langs->trans("AddAddress").'</a>';
} }
print '</td></tr></table></form>'; print '</td></tr></table></form>';
} }