29require
'../../../main.inc.php';
31$langs->loadLangs(array(
'facture',
'orders',
'sendings',
'companies',
'stocks'));
35$lineid =
GETPOST(
'lineid',
'int');
36$action =
GETPOST(
'action',
'alpha');
39if ($user->socid) $socid = $user->socid;
41$result =
restrictedArea($user,
'stocktransfer', $id,
'',
'stocktransfer');
46if ($id > 0 || !empty($ref)) {
47 $ret = $object->fetch($id, $ref);
49 $langs->load(
"errors");
58 $object->fetch_thirdparty();
60 header(
'Location: '.
dol_buildpath(
'/stocktransfer/stocktransfer_list.php', 1));
69if ($action ==
'addcontact' && $user->rights->stocktransfer->stocktransfer->write) {
70 if ($object->id > 0) {
72 $result = $object->add_contact($contactid, !empty($_POST[
"typecontact"]) ? $_POST[
"typecontact"] : $_POST[
"type"], $_POST[
"source"]);
76 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
79 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
80 $langs->load(
"errors");
81 setEventMessages($langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType"),
null,
'errors');
86} elseif ($action ==
'swapstatut' && $user->rights->stocktransfer->stocktransfer->write) {
87 if ($object->id > 0) {
88 $result = $object->swapContactStatus(
GETPOST(
'ligne'));
90} elseif ($action ==
'deletecontact' && $user->rights->stocktransfer->stocktransfer->write) {
91 $result = $object->delete_contact($lineid);
94 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
112llxHeader(
'', $langs->trans(
'ModuleStockTransferName'),
'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos');
114$form =
new Form($db);
118if ($object->id > 0) {
120 print
dol_get_fiche_head($head,
'contact', $langs->trans(
"StockTransfer"), -1,
'stock');
125 $linkback =
'<a href="'.DOL_URL_ROOT.
'/comm/propal/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
128 $morehtmlref =
'<div class="refidno">';
130 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_client', $object->ref_client, $object, 0,
'string',
'', 0, 1);
131 $morehtmlref .= $form->editfieldval(
"RefCustomer",
'ref_client', $object->ref_client, $object, 0,
'string',
'',
null,
null,
'', 1);
133 if (!empty($object->thirdparty)) {
134 $morehtmlref .=
'<br>' . $langs->trans(
'ThirdParty') .
' : ' . $object->thirdparty->getNomUrl(1,
'customer');
137 if (isModEnabled(
'project')) {
138 $langs->load(
"projects");
139 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
140 if ($user->rights->stocktransfer->stocktransfer->write) {
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,
'',
'maxwidth300');
157 if (!empty($object->fk_project)) {
159 $proj->fetch($object->fk_project);
160 $morehtmlref .=
'<a href="'.DOL_URL_ROOT.
'/projet/card.php?id='.$object->fk_project.
'" title="'.$langs->trans(
'ShowProject').
'">';
161 $morehtmlref .= $proj->ref;
162 $morehtmlref .=
'</a>';
168 $morehtmlref .=
'</div>';
170 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref,
'', 0,
'',
'', 1);
174 $user->rights->stocktransfer->write = $user->rights->stocktransfer->stocktransfer->write;
176 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array(
'/core/tpl'));
177 foreach ($dirtpls as $reldir) {
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage projects.
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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
restrictedArea(User $user, $features, $object=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.
stocktransferPrepareHead($object)
Prepare array of tabs for StockTransfer.