Works on an alternative address management
This commit is contained in:
parent
777c402f62
commit
ba15a73831
@ -201,19 +201,6 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Delivery address
|
|
||||||
if ($conf->global->PROPALE_ADD_DELIVERY_ADDRESS)
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans('DeliveryAddress').'</td>';
|
|
||||||
print '<td colspan="3">';
|
|
||||||
$numaddress = $form->select_address($soc->fk_delivery_address, $_GET['socid'],'fk_address',1);
|
|
||||||
if ($numaddress==0)
|
|
||||||
{
|
|
||||||
print ' <a href=../comm/address.php?socid='.$soc->id.'&action=create>'.$langs->trans("AddAddress").'</a>';
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Model
|
// Model
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("DefaultModel").'</td>';
|
print '<td>'.$langs->trans("DefaultModel").'</td>';
|
||||||
|
|||||||
@ -246,13 +246,6 @@ else if ($action == 'setdate_livraison')
|
|||||||
if ($result < 0) dol_print_error($db,$object->error);
|
if ($result < 0) dol_print_error($db,$object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setaddress' && $user->rights->propale->creer)
|
|
||||||
{
|
|
||||||
$object->fetch($id);
|
|
||||||
$result=$object->set_adresse_livraison($user,$_POST['fk_address']);
|
|
||||||
if ($result < 0) dol_print_error($db,$object->error);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Positionne ref client
|
// Positionne ref client
|
||||||
else if ($action == 'set_ref_client' && $user->rights->propale->creer)
|
else if ($action == 'set_ref_client' && $user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
@ -1340,29 +1333,6 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Delivery address (deprecated)
|
|
||||||
if ($conf->global->PROPALE_ADD_DELIVERY_ADDRESS)
|
|
||||||
{
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
|
||||||
print $langs->trans('DeliveryAddress');
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
if ($action != 'editdelivery_address' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_address&socid='.$object->socid.'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryAddress'),1).'</a></td>';
|
|
||||||
print '</tr></table>';
|
|
||||||
print '</td><td colspan="3">';
|
|
||||||
|
|
||||||
if ($action == 'editdelivery_address')
|
|
||||||
{
|
|
||||||
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid','int'),'fk_address','propal',$object->id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid','int'),'none','propal',$object->id);
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delivery delay
|
// Delivery delay
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
|
|||||||
@ -27,6 +27,7 @@ require("../../main.inc.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/propal.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/propal.lib.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||||
|
|
||||||
$langs->load("facture");
|
$langs->load("facture");
|
||||||
@ -43,6 +44,8 @@ $action=GETPOST('action', 'alpha');
|
|||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'propale', $id, 'propal');
|
$result = restrictedArea($user, 'propale', $id, 'propal');
|
||||||
|
|
||||||
|
$object = new Propal($db);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ajout d'un nouveau contact
|
* Ajout d'un nouveau contact
|
||||||
@ -50,42 +53,38 @@ $result = restrictedArea($user, 'propale', $id, 'propal');
|
|||||||
|
|
||||||
if ($action == 'addcontact' && $user->rights->propale->creer)
|
if ($action == 'addcontact' && $user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
|
$result = $object->fetch($id);
|
||||||
$result = 0;
|
|
||||||
$propal = new Propal($db);
|
|
||||||
$result = $propal->fetch($id);
|
|
||||||
|
|
||||||
if ($result > 0 && $id > 0)
|
if ($result > 0 && $id > 0)
|
||||||
{
|
{
|
||||||
$result = $propal->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$propal->id);
|
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($propal->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg = '<div class="error">'.$propal->error.'</div>';
|
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bascule du statut d'un contact
|
// Bascule du statut d'un contact
|
||||||
if ($action == 'swapstatut' && $user->rights->propale->creer)
|
else if ($action == 'swapstatut' && $user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
$propal = new Propal($db);
|
if ($object->fetch($id) > 0)
|
||||||
if ($propal->fetch($id) > 0)
|
|
||||||
{
|
{
|
||||||
$result=$propal->swapContactStatus(GETPOST('ligne'));
|
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -94,15 +93,14 @@ if ($action == 'swapstatut' && $user->rights->propale->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Efface un contact
|
// Efface un contact
|
||||||
if ($action == 'deleteline' && $user->rights->propale->creer)
|
else if ($action == 'deleteline' && $user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
$propal = new Propal($db);
|
$object->fetch($id);
|
||||||
$propal->fetch($id);
|
$result = $object->delete_contact($lineid);
|
||||||
$result = $propal->delete_contact($lineid);
|
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$propal->id);
|
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -111,6 +109,13 @@ if ($action == 'deleteline' && $user->rights->propale->creer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if ($action == 'setaddress' && $user->rights->propale->creer)
|
||||||
|
{
|
||||||
|
$object->fetch($id);
|
||||||
|
$result=$object->set_adresse_livraison($user,$_POST['fk_address']);
|
||||||
|
if ($result < 0) dol_print_error($db,$object->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -120,6 +125,7 @@ llxHeader('', $langs->trans("Proposal"), "Propal");
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formcompany= new FormCompany($db);
|
$formcompany= new FormCompany($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
$contactstatic=new Contact($db);
|
$contactstatic=new Contact($db);
|
||||||
$userstatic=new User($db);
|
$userstatic=new User($db);
|
||||||
|
|
||||||
@ -133,13 +139,12 @@ dol_htmloutput_mesg($mesg);
|
|||||||
|
|
||||||
if ($id > 0 || ! empty($ref))
|
if ($id > 0 || ! empty($ref))
|
||||||
{
|
{
|
||||||
$propal = New Propal($db);
|
if ($object->fetch($id,$ref) > 0)
|
||||||
if ($propal->fetch($id,$ref) > 0)
|
|
||||||
{
|
{
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
$soc->fetch($propal->socid);
|
$soc->fetch($object->socid);
|
||||||
|
|
||||||
$head = propal_prepare_head($propal);
|
$head = propal_prepare_head($object);
|
||||||
dol_fiche_head($head, 'contact', $langs->trans("Proposal"), 0, 'propal');
|
dol_fiche_head($head, 'contact', $langs->trans("Proposal"), 0, 'propal');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -151,7 +156,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
||||||
print $form->showrefnav($propal,'ref',$linkback,1,'ref','ref','');
|
print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Ref client
|
// Ref client
|
||||||
@ -161,15 +166,37 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
print $propal->ref_client;
|
print $object->ref_client;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Customer
|
// Customer
|
||||||
if ( is_null($propal->client) )
|
if (is_null($object->client)) $object->fetch_thirdparty();
|
||||||
$propal->fetch_thirdparty();
|
|
||||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||||
print '<td colspan="3">'.$propal->client->getNomUrl(1).'</td></tr>';
|
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
|
||||||
|
|
||||||
|
// Delivery address
|
||||||
|
if ($conf->global->PROPALE_ADD_DELIVERY_ADDRESS)
|
||||||
|
{
|
||||||
|
print '<tr><td>';
|
||||||
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
|
print $langs->trans('DeliveryAddress');
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
if ($action != 'editdelivery_address' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_address&socid='.$object->socid.'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryAddress'),1).'</a></td>';
|
||||||
|
print '</tr></table>';
|
||||||
|
print '</td><td colspan="3">';
|
||||||
|
|
||||||
|
if ($action == 'editdelivery_address')
|
||||||
|
{
|
||||||
|
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid','int'),'fk_address','propal',$object->id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid','int'),'none','propal',$object->id);
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
@ -215,11 +242,11 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
// On recupere les id des users deja selectionnes
|
// On recupere les id des users deja selectionnes
|
||||||
//$userAlreadySelected = $propal->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionne car on doit pouvoir le selectionner une deuxieme fois pour un autre type
|
//$userAlreadySelected = $object->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionne car on doit pouvoir le selectionner une deuxieme fois pour un autre type
|
||||||
$form->select_users($user->id,'contactid',0,$userAlreadySelected);
|
$form->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$formcompany->selectTypeContact($propal, '', 'type','internal');
|
$formcompany->selectTypeContact($object, '', 'type','internal');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -241,8 +268,8 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$propal->client->id;
|
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$object->client->id;
|
||||||
$selectedCompany = $formcompany->selectCompaniesForNewContact($propal, 'id', $selectedCompany, 'newcompany');
|
$selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -250,7 +277,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$formcompany->selectTypeContact($propal, '', 'type','external');
|
$formcompany->selectTypeContact($object, '', 'type','external');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||||
if (! $nbofcontacts) print ' disabled="disabled"';
|
if (! $nbofcontacts) print ' disabled="disabled"';
|
||||||
@ -278,7 +305,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
foreach(array('internal','external') as $source)
|
foreach(array('internal','external') as $source)
|
||||||
{
|
{
|
||||||
$tab = $propal->liste_contact(-1,$source);
|
$tab = $object->liste_contact(-1,$source);
|
||||||
$num=count($tab);
|
$num=count($tab);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -335,9 +362,9 @@ if ($id > 0 || ! empty($ref))
|
|||||||
// Statut
|
// Statut
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
// Activation desativation du contact
|
// Activation desativation du contact
|
||||||
if ($propal->statut >= 0) print '<a href="contact.php?id='.$propal->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
if ($object->statut >= 0) print '<a href="contact.php?id='.$object->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
||||||
print $contactstatic->LibStatut($tab[$i]['status'],3);
|
print $contactstatic->LibStatut($tab[$i]['status'],3);
|
||||||
if ($propal->statut >= 0) print '</a>';
|
if ($object->statut >= 0) print '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Icon update et delete
|
// Icon update et delete
|
||||||
@ -345,7 +372,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($user->rights->propale->creer)
|
if ($user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$propal->id.'&action=deleteline&lineid='.$tab[$i]['rowid'].'">';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deleteline&lineid='.$tab[$i]['rowid'].'">';
|
||||||
print img_delete();
|
print img_delete();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
@ -364,8 +391,6 @@ if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
llxFooter();
|
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
llxFooter();
|
||||||
?>
|
?>
|
||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
|
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
|
||||||
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -27,61 +27,61 @@ require("../main.inc.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/order.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/order.lib.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||||
|
|
||||||
$langs->load("orders");
|
$langs->load("orders");
|
||||||
$langs->load("sendings");
|
$langs->load("sendings");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
$comid = isset($_GET["id"])?$_GET["id"]:'';
|
$id=GETPOST('id','int');
|
||||||
|
$ref=GETPOST('ref','alpha');
|
||||||
|
$action=GETPOST('action','alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'commande', $comid,'');
|
$result = restrictedArea($user, 'commande', $id,'');
|
||||||
|
|
||||||
|
$object = new Commande($db);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ajout d'un nouveau contact
|
* Ajout d'un nouveau contact
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($_POST["action"] == 'addcontact' && $user->rights->commande->creer)
|
if ($action == 'addcontact' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
$result = 0;
|
if ($result > 0 && $id > 0)
|
||||||
$commande = new Commande($db);
|
|
||||||
$result = $commande->fetch($_GET["id"]);
|
|
||||||
|
|
||||||
if ($result > 0 && $_GET["id"] > 0)
|
|
||||||
{
|
{
|
||||||
$result = $commande->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
Header("Location: contact.php?id=".$commande->id);
|
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($commande->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg = '<div class="error">'.$commande->error.'</div>';
|
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// bascule du statut d'un contact
|
// bascule du statut d'un contact
|
||||||
if ($_GET["action"] == 'swapstatut' && $user->rights->commande->creer)
|
else if ($action == 'swapstatut' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
$commande = new Commande($db);
|
if ($object->fetch($id))
|
||||||
if ($commande->fetch(GETPOST('id','int')))
|
|
||||||
{
|
{
|
||||||
$result=$commande->swapContactStatus(GETPOST('ligne'));
|
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -90,15 +90,14 @@ if ($_GET["action"] == 'swapstatut' && $user->rights->commande->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Efface un contact
|
// Efface un contact
|
||||||
if ($_GET["action"] == 'deleteline' && $user->rights->commande->creer)
|
else if ($action == 'deleteline' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
$commande = new Commande($db);
|
$object->fetch($id);
|
||||||
$commande->fetch($_GET["id"]);
|
$result = $object->delete_contact($_GET["lineid"]);
|
||||||
$result = $commande->delete_contact($_GET["lineid"]);
|
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
Header("Location: contact.php?id=".$commande->id);
|
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -106,6 +105,11 @@ if ($_GET["action"] == 'deleteline' && $user->rights->commande->creer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if ($action == 'setaddress' && $user->rights->commande->creer)
|
||||||
|
{
|
||||||
|
$object->fetch($id);
|
||||||
|
$object->set_adresse_livraison($user,$_POST['fk_address']);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -115,6 +119,7 @@ llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formcompany = new FormCompany($db);
|
$formcompany = new FormCompany($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
$contactstatic=new Contact($db);
|
$contactstatic=new Contact($db);
|
||||||
$userstatic=new User($db);
|
$userstatic=new User($db);
|
||||||
|
|
||||||
@ -126,19 +131,17 @@ $userstatic=new User($db);
|
|||||||
/* *************************************************************************** */
|
/* *************************************************************************** */
|
||||||
dol_htmloutput_mesg($mesg);
|
dol_htmloutput_mesg($mesg);
|
||||||
|
|
||||||
$id = $_GET['id'];
|
|
||||||
$ref= $_GET['ref'];
|
|
||||||
if ($id > 0 || ! empty($ref))
|
if ($id > 0 || ! empty($ref))
|
||||||
{
|
{
|
||||||
$langs->trans("OrderCard");
|
$langs->trans("OrderCard");
|
||||||
$commande = new Commande($db);
|
|
||||||
if ( $commande->fetch($_GET['id'],$_GET['ref']) > 0)
|
if ($object->fetch($id, $ref) > 0)
|
||||||
{
|
{
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
$soc->fetch($commande->socid);
|
$soc->fetch($object->socid);
|
||||||
|
|
||||||
|
|
||||||
$head = commande_prepare_head($commande);
|
$head = commande_prepare_head($object);
|
||||||
dol_fiche_head($head, 'contact', $langs->trans("CustomerOrder"), 0, 'order');
|
dol_fiche_head($head, 'contact', $langs->trans("CustomerOrder"), 0, 'order');
|
||||||
|
|
||||||
|
|
||||||
@ -149,7 +152,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td width="18%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
print '<tr><td width="18%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||||
print $form->showrefnav($commande,'ref','',1,'ref','ref');
|
print $form->showrefnav($object,'ref','',1,'ref','ref');
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Ref commande client
|
// Ref commande client
|
||||||
@ -159,16 +162,39 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
print $commande->ref_client;
|
print $object->ref_client;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Customer
|
// Customer
|
||||||
if ( is_null($commande->client) )
|
if (is_null($object->client)) $object->fetch_thirdparty();
|
||||||
$commande->fetch_thirdparty();
|
|
||||||
|
|
||||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||||
print '<td colspan="3">'.$commande->client->getNomUrl(1).'</td></tr>';
|
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
|
||||||
|
|
||||||
|
// Delivery address
|
||||||
|
if ($conf->global->COMMANDE_ADD_DELIVERY_ADDRESS)
|
||||||
|
{
|
||||||
|
print '<tr><td>';
|
||||||
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
|
print $langs->trans('DeliveryAddress');
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
if ($action != 'editdelivery_address' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_address&socid='.$object->socid.'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryAddress'),1).'</a></td>';
|
||||||
|
print '</tr></table>';
|
||||||
|
print '</td><td colspan="3">';
|
||||||
|
|
||||||
|
if ($action == 'editdelivery_address')
|
||||||
|
{
|
||||||
|
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid','int'),'fk_address','commande',$object->id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid','int'),'none','commande',$object->id);
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -182,7 +208,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
* Ajouter une ligne de contact
|
* Ajouter une ligne de contact
|
||||||
* Non affiche en mode modification de ligne
|
* Non affiche en mode modification de ligne
|
||||||
*/
|
*/
|
||||||
if ($_GET["action"] != 'editline' && $user->rights->commande->creer)
|
if ($action != 'editline' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Source").'</td>';
|
print '<td>'.$langs->trans("Source").'</td>';
|
||||||
@ -195,7 +221,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
$var = false;
|
$var = false;
|
||||||
|
|
||||||
print '<form action="contact.php?id='.$id.'" method="post">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="post">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="addcontact">';
|
print '<input type="hidden" name="action" value="addcontact">';
|
||||||
print '<input type="hidden" name="source" value="internal">';
|
print '<input type="hidden" name="source" value="internal">';
|
||||||
@ -213,18 +239,18 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
//$userAlreadySelected = $commande->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionne car on doit pouvoir le selectionner une deuxieme fois pour un autre type
|
//$userAlreadySelected = $object->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionne car on doit pouvoir le selectionner une deuxieme fois pour un autre type
|
||||||
$form->select_users($user->id,'contactid',0,$userAlreadySelected);
|
$form->select_users($user->id,'contactid',0,$userAlreadySelected);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$formcompany->selectTypeContact($commande, '', 'type','internal');
|
$formcompany->selectTypeContact($object, '', 'type','internal');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
print '<form action="contact.php?id='.$id.'" method="post">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="post">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="addcontact">';
|
print '<input type="hidden" name="action" value="addcontact">';
|
||||||
print '<input type="hidden" name="source" value="external">';
|
print '<input type="hidden" name="source" value="external">';
|
||||||
@ -239,8 +265,8 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$commande->client->id;
|
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$object->client->id;
|
||||||
$selectedCompany = $formcompany->selectCompaniesForNewContact($commande, 'id', $selectedCompany, 'newcompany');
|
$selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="1">';
|
print '<td colspan="1">';
|
||||||
@ -248,7 +274,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$formcompany->selectTypeContact($commande, '', 'type','external');
|
$formcompany->selectTypeContact($object, '', 'type','external');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||||
if (! $nbofcontacts) print ' disabled="disabled"';
|
if (! $nbofcontacts) print ' disabled="disabled"';
|
||||||
@ -275,7 +301,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
foreach(array('internal','external') as $source)
|
foreach(array('internal','external') as $source)
|
||||||
{
|
{
|
||||||
$tab = $commande->liste_contact(-1,$source);
|
$tab = $object->liste_contact(-1,$source);
|
||||||
$num=count($tab);
|
$num=count($tab);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -332,17 +358,17 @@ if ($id > 0 || ! empty($ref))
|
|||||||
// Statut
|
// Statut
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
// Activation desativation du contact
|
// Activation desativation du contact
|
||||||
if ($commande->statut >= 0) print '<a href="contact.php?id='.$commande->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
if ($object->statut >= 0) print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
||||||
print $contactstatic->LibStatut($tab[$i]['status'],3);
|
print $contactstatic->LibStatut($tab[$i]['status'],3);
|
||||||
if ($commande->statut >= 0) print '</a>';
|
if ($object->statut >= 0) print '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Icon update et delete
|
// Icon update et delete
|
||||||
print '<td align="center" nowrap="nowrap" colspan="2">';
|
print '<td align="center" nowrap="nowrap" colspan="2">';
|
||||||
if ($commande->statut < 5 && $user->rights->commande->creer)
|
if ($object->statut < 5 && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a href="contact.php?id='.$commande->id.'&action=deleteline&lineid='.$tab[$i]['rowid'].'">';
|
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=deleteline&lineid='.$tab[$i]['rowid'].'">';
|
||||||
print img_delete();
|
print img_delete();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
@ -362,7 +388,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
|
$db->close();
|
||||||
llxFooter();
|
llxFooter();
|
||||||
?>
|
?>
|
||||||
@ -440,12 +440,6 @@ if ($action == 'setdate_livraison' && $user->rights->commande->creer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setaddress' && $user->rights->commande->creer)
|
|
||||||
{
|
|
||||||
$object->fetch($id);
|
|
||||||
$object->set_adresse_livraison($user,$_POST['fk_address']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'setmode' && $user->rights->commande->creer)
|
if ($action == 'setmode' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
@ -1330,15 +1324,6 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
$form->select_date($datedelivery,'liv_','','','',"crea_commande",1,1);
|
$form->select_date($datedelivery,'liv_','','','',"crea_commande",1,1);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Delivery address
|
|
||||||
if ($conf->global->COMMANDE_ADD_DELIVERY_ADDRESS)
|
|
||||||
{
|
|
||||||
print '<tr><td nowrap="nowrap">'.$langs->trans('DeliveryAddress').'</td><td colspan="2">';
|
|
||||||
$numaddress = $formother->select_address($soc->fk_delivery_address, $socid,'fk_address',1);
|
|
||||||
print ' <a href="../comm/address.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddAddress").'</a>';
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Conditions de reglement
|
// Conditions de reglement
|
||||||
print '<tr><td nowrap="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
|
print '<tr><td nowrap="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
|
||||||
$form->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id',-1,1);
|
$form->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id',-1,1);
|
||||||
|
|||||||
@ -733,6 +733,8 @@ class FormOther
|
|||||||
function form_address($page, $selected, $socid, $htmlname='address_id', $origin='', $originid='')
|
function form_address($page, $selected, $socid, $htmlname='address_id', $origin='', $originid='')
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
|
global $form;
|
||||||
|
|
||||||
if ($htmlname != "none")
|
if ($htmlname != "none")
|
||||||
{
|
{
|
||||||
print '<form method="post" action="'.$page.'">';
|
print '<form method="post" action="'.$page.'">';
|
||||||
@ -740,7 +742,7 @@ class FormOther
|
|||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
$this->select_address($selected, $socid, $htmlname, 1);
|
$form->select_address($selected, $socid, $htmlname, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|||||||
@ -7,7 +7,7 @@ Order=Order
|
|||||||
Orders=Orders
|
Orders=Orders
|
||||||
OrderLine=Order line
|
OrderLine=Order line
|
||||||
OrderFollow=Follow up
|
OrderFollow=Follow up
|
||||||
OrderContact=Order contact
|
OrderContact=Contacts / Addresses
|
||||||
OrderDate=Order date
|
OrderDate=Order date
|
||||||
OrderToProcess=Order to process
|
OrderToProcess=Order to process
|
||||||
NewOrder=New order
|
NewOrder=New order
|
||||||
|
|||||||
@ -10,7 +10,7 @@ Prop=Commercial proposals
|
|||||||
CommercialProposal=Commercial proposal
|
CommercialProposal=Commercial proposal
|
||||||
CommercialProposals=Commercial proposals
|
CommercialProposals=Commercial proposals
|
||||||
ProposalCard=Proposal card
|
ProposalCard=Proposal card
|
||||||
ProposalContact=Proposal contact
|
ProposalContact=Contacts / Addresses
|
||||||
NewProp=New commercial proposal
|
NewProp=New commercial proposal
|
||||||
NewProposal=New commercial proposal
|
NewProposal=New commercial proposal
|
||||||
NewPropal=New proposal
|
NewPropal=New proposal
|
||||||
|
|||||||
@ -7,7 +7,7 @@ Order=Commande
|
|||||||
Orders=Commandes
|
Orders=Commandes
|
||||||
OrderLine=Ligne de commande
|
OrderLine=Ligne de commande
|
||||||
OrderFollow=Suivi
|
OrderFollow=Suivi
|
||||||
OrderContact=Contacts commande
|
OrderContact=Contacts / Adresses
|
||||||
OrderDate=Date commande
|
OrderDate=Date commande
|
||||||
OrderToProcess=Commande à traiter
|
OrderToProcess=Commande à traiter
|
||||||
NewOrder=Nouvelle commande
|
NewOrder=Nouvelle commande
|
||||||
|
|||||||
@ -10,7 +10,7 @@ CommercialProposal=Proposition commerciale
|
|||||||
CommercialProposals=Propositions commerciales
|
CommercialProposals=Propositions commerciales
|
||||||
ProposalsOpened=Propositions commerciales ouvertes
|
ProposalsOpened=Propositions commerciales ouvertes
|
||||||
ProposalCard=Fiche proposition
|
ProposalCard=Fiche proposition
|
||||||
ProposalContact=Contact proposition
|
ProposalContact=Contacts / Adresses
|
||||||
NewProp=Nouvelle proposition commerciale
|
NewProp=Nouvelle proposition commerciale
|
||||||
NewProposal=Nouvelle proposition commerciale
|
NewProposal=Nouvelle proposition commerciale
|
||||||
NewPropal=Nouvelle proposition
|
NewPropal=Nouvelle proposition
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user