27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/supplier_proposal.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
35 $langs->loadLangs(array(
"propal",
"supplier_proposal",
"facture",
"orders",
"sendings",
"companies"));
39 $action =
GETPOST(
'action',
'aZ09');
43 $socid = $user->socid;
45 $result =
restrictedArea($user,
'supplier_proposal', $id,
'supplier_proposal',
'');
49 $permissiontoedit = $user->rights->supplier_proposal->creer;
56 if ($action ==
'addcontact' && $permissiontoedit) {
57 $result = $object->fetch($id);
59 if ($result > 0 && $id > 0) {
62 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source"));
66 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
69 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
70 $langs->load(
"errors");
71 setEventMessages($langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType"), null,
'errors');
76 } elseif ($action ==
'swapstatut' && $permissiontoedit) {
78 if ($object->fetch($id)) {
79 $result = $object->swapContactStatus(
GETPOST(
'ligne',
'int'));
83 } elseif ($action ==
'deletecontact' && $permissiontoedit) {
86 $result = $object->delete_contact(
GETPOST(
"lineid",
'int'));
89 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
101 $title = $langs->trans(
'CommRequest').
" - ".$langs->trans(
'ContactsAddresses');
102 $help_url =
'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur';
107 $contactstatic =
new Contact($db);
108 $userstatic =
new User($db);
117 if ($id > 0 || !empty($ref)) {
118 $langs->trans(
"SupplierProposal");
120 if ($object->fetch($id, $ref) > 0) {
121 $object->fetch_thirdparty();
123 $head = supplier_proposal_prepare_head($object);
124 print
dol_get_fiche_head($head,
'contact', $langs->trans(
"CommRequest"), -1,
'supplier_proposal');
128 $linkback =
'<a href="'.DOL_URL_ROOT.
'/supplier_proposal/list.php'.(!empty($socid) ?
'?socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
130 $morehtmlref =
'<div class="refidno">';
132 $morehtmlref .=
$form->editfieldkey(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, 0,
'string',
'', 0, 1);
133 $morehtmlref .=
$form->editfieldval(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, 0,
'string',
'', null, null,
'', 1);
135 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1);
137 if (!empty($conf->project->enabled)) {
138 $langs->load(
"projects");
139 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
140 if ($permissiontoedit) {
141 if ($action !=
'classify') {
143 $morehtmlref .=
' : ';
145 if ($action ==
'classify') {
147 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
148 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
149 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
150 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
151 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
152 $morehtmlref .=
'</form>';
154 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
157 if (!empty($object->fk_project)) {
159 $proj->fetch($object->fk_project);
160 $morehtmlref .=
' : '.$proj->getNomUrl(1);
162 $morehtmlref .=
' - '.$proj->title;
169 $morehtmlref .=
'</div>';
172 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref,
'', 0,
'',
'', 1);
177 include DOL_DOCUMENT_ROOT.
'/core/tpl/contacts.tpl.php';
180 print
"ErrorRecordNotFound";
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
Class to manage Dolibarr users.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save"&&empty($cancel)) $help_url
View.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage projects.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
Class to manage price ask supplier.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.