Add hidden option COMMANDE_ADD_DELIVERY_ADDRESS to continue to have the delivery addresse asked in the old way.

For using the new way, just add a contact of type "delivery" on the contacts tab of order.
This commit is contained in:
Laurent Destailleur 2009-07-21 12:03:30 +00:00
parent 1af71edc1d
commit eb40118ed2
4 changed files with 88 additions and 73 deletions

View File

@ -987,16 +987,15 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
} }
print "</td></tr>"; print "</td></tr>";
// Adresse de livraison // Delivery address
if ($conf->global->COMMANDE_ADD_DELIVERY_ADDRESS)
{
// Link to edit: $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?action=create','',$soc->id,'adresse_livraison_id','commande','');
print '<tr><td nowrap="nowrap">'.$langs->trans('DeliveryAddress').'</td><td>'; print '<tr><td nowrap="nowrap">'.$langs->trans('DeliveryAddress').'</td><td>';
$numaddress = $html->select_adresse_livraison($soc->adresse_livraison_id, $_GET['socid'],'adresse_livraison_id',1); $numaddress = $html->select_adresse_livraison($soc->adresse_livraison_id, $_GET['socid'],'adresse_livraison_id',1);
if ($numaddress==0)
{
print ' &nbsp; <a href="../comm/adresse_livraison.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddAddress").'</a>'; print ' &nbsp; <a href="../comm/adresse_livraison.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddAddress").'</a>';
}
print '</td></tr>'; print '</td></tr>';
}
// Conditions de reglement // Conditions de reglement
print '<tr><td nowrap="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>'; print '<tr><td nowrap="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
@ -1396,6 +1395,8 @@ else
print '</tr>'; print '</tr>';
// Delivery address // Delivery address
if ($conf->global->COMMANDE_ADD_DELIVERY_ADDRESS)
{
print '<tr><td height="10">'; print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DeliveryAddress'); print $langs->trans('DeliveryAddress');
@ -1414,6 +1415,7 @@ else
$html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'none','commande',$commande->id); $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'none','commande',$commande->id);
} }
print '</td></tr>'; print '</td></tr>';
}
// Terms of payment // Terms of payment
print '<tr><td height="10">'; print '<tr><td height="10">';

View File

@ -260,8 +260,9 @@ if ($id > 0 || ! empty($ref))
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Delivery address
// Adresse de livraison if ($conf->global->COMMANDE_ADD_DELIVERY_ADDRESS)
{
print '<tr><td height="10">'; print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DeliveryAddress'); print $langs->trans('DeliveryAddress');
@ -280,6 +281,7 @@ if ($id > 0 || ! empty($ref))
$html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'none','commande',$commande->id); $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'none','commande',$commande->id);
} }
print '</td></tr>'; print '</td></tr>';
}
// Conditions et modes de règlement // Conditions et modes de règlement
print '<tr><td height="10">'; print '<tr><td height="10">';

View File

@ -278,6 +278,8 @@ if ($id > 0 || ! empty($ref))
print '</tr>'; print '</tr>';
// Delivery address // Delivery address
if ($conf->global->COMMANDE_ADD_DELIVERY_ADDRESS)
{
print '<tr><td height="10">'; print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DeliveryAddress'); print $langs->trans('DeliveryAddress');
@ -296,6 +298,7 @@ if ($id > 0 || ! empty($ref))
$html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'none','commande',$commande->id); $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'none','commande',$commande->id);
} }
print '</td></tr>'; print '</td></tr>';
}
// Terms of payment // Terms of payment
print '<tr><td height="10">'; print '<tr><td height="10">';

View File

@ -284,6 +284,9 @@ if ($_GET["action"] == 'create')
print '<td colspan="3">'.dol_print_date($object->date,"day")."</td></tr>\n"; print '<td colspan="3">'.dol_print_date($object->date,"day")."</td></tr>\n";
// Delivery address // Delivery address
if (($origin == 'commande' && $conf->global->COMMANDE_ADD_DELIVERY_ADDRESS)
|| ($origin == 'propal' && $conf->global->PROPAL_ADD_DELIVERY_ADDRESS))
{
print '<tr><td>'.$langs->trans('DeliveryAddress').'</td>'; print '<tr><td>'.$langs->trans('DeliveryAddress').'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
if (!empty($object->fk_delivery_address)) if (!empty($object->fk_delivery_address))
@ -291,6 +294,7 @@ if ($_GET["action"] == 'create')
$html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$_GET['socid'],'none','commande',$object->id); $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$_GET['socid'],'none','commande',$object->id);
} }
print '</td></tr>'."\n"; print '</td></tr>'."\n";
}
// Warehouse (id forced) // Warehouse (id forced)
if ($conf->stock->enabled && $_GET["entrepot_id"]) if ($conf->stock->enabled && $_GET["entrepot_id"])
@ -532,6 +536,7 @@ else
if ($expedition->id > 0) if ($expedition->id > 0)
{ {
$typeobject = $expedition->origin; $typeobject = $expedition->origin;
$origin = $expedition->origin;
$expedition->fetch_object(); $expedition->fetch_object();
if (strlen($expedition->tracking_number)) if (strlen($expedition->tracking_number))
@ -617,24 +622,23 @@ else
// Linked documents // Linked documents
print '<tr><td>'; print '<tr><td>';
if ($conf->commande->enabled) if ($origin == 'commande')
{ {
$order=new Commande($db); $order=new Commande($db);
$order->fetch($expedition->$typeobject->id); $order->fetch($expedition->$origin->id);
print $langs->trans("RefOrder").'</td>'; print $langs->trans("RefOrder").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $order->getNomUrl(1,'commande'); print $order->getNomUrl(1,'commande');
print "</td>\n";
} }
else if ($origin == 'propal')
{ {
$propal=new Propal($db); $propal=new Propal($db);
$propal->fetch($livraison->origin_id); $propal->fetch($expedition->$origin->id);
print $langs->trans("RefProposal").'</td>'; print $langs->trans("RefProposal").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $propal->getNomUrl(1,'expedition'); print $propal->getNomUrl(1,'expedition');
print "</td>\n";
} }
print "</td>\n";
print '</tr>'; print '</tr>';
// Ref customer // Ref customer
@ -648,6 +652,9 @@ else
print '</tr>'; print '</tr>';
// Delivery address // Delivery address
if (($origin == 'commande' && $conf->global->COMMANDE_ADD_DELIVERY_ADDRESS)
|| ($origin == 'propal' && $conf->global->PROPAL_ADD_DELIVERY_ADDRESS))
{
print '<tr><td>'.$langs->trans('DeliveryAddress').'</td>'; print '<tr><td>'.$langs->trans('DeliveryAddress').'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
if (!empty($expedition->fk_delivery_address)) if (!empty($expedition->fk_delivery_address))
@ -655,6 +662,7 @@ else
$html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$expedition->id,$expedition->fk_delivery_address,$expedition->deliveryaddress->socid,'none','shipment',$expedition->id); $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$expedition->id,$expedition->fk_delivery_address,$expedition->deliveryaddress->socid,'none','shipment',$expedition->id);
} }
print '</td></tr>'."\n"; print '</td></tr>'."\n";
}
// Weight // Weight
print '<tr><td>'.$langs->trans("TotalWeight").'</td>'; print '<tr><td>'.$langs->trans("TotalWeight").'</td>';