Fix look and feel v6
This commit is contained in:
parent
30cedd154e
commit
470165615f
@ -1327,13 +1327,7 @@ $formorder = new FormOrder($db);
|
||||
$formmargin = new FormMargin($db);
|
||||
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
|
||||
|
||||
/**
|
||||
* *******************************************************************
|
||||
*
|
||||
* Mode creation
|
||||
*
|
||||
* *******************************************************************
|
||||
*/
|
||||
// Mode creation
|
||||
if ($action == 'create' && $user->rights->commande->creer)
|
||||
{
|
||||
print load_fiche_titre($langs->trans('CreateOrder'),'','title_commercial.png');
|
||||
@ -1501,9 +1495,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
}
|
||||
print '</tr>' . "\n";
|
||||
|
||||
/*
|
||||
* Contact de la commande
|
||||
*/
|
||||
// Contact of order
|
||||
if ($socid > 0) {
|
||||
print "<tr><td>" . $langs->trans("DefaultContact") . '</td><td colspan="2">';
|
||||
$form->select_contacts($soc->id, $setcontact, 'contactid', 1, $srccontactslist);
|
||||
@ -1748,11 +1740,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</table>';
|
||||
}
|
||||
} else {
|
||||
/* *************************************************************************** */
|
||||
/* */
|
||||
/* Mode vue et edition */
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
// Mode view
|
||||
$now = dol_now();
|
||||
|
||||
if ($object->id > 0) {
|
||||
@ -2447,8 +2435,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
dol_fiche_end();
|
||||
|
||||
/*
|
||||
* Boutons actions
|
||||
*/
|
||||
* Buttons for actions
|
||||
*/
|
||||
if ($action != 'presend' && $action != 'editline') {
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
|
||||
@ -120,7 +120,7 @@ if ($result)
|
||||
print '<td align="left">'.$obj->town.'</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
print $establishmentstatic->getLibStatus(5);
|
||||
print $establishmentstatic->getLibStatut(5);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -33,8 +33,10 @@ class Establishment extends CommonObject
|
||||
public $table_element_line = '';
|
||||
public $fk_element = 'fk_establishment';
|
||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
|
||||
public $id;
|
||||
public $picto='building';
|
||||
|
||||
public $id;
|
||||
public $ref;
|
||||
public $rowid;
|
||||
|
||||
public $name;
|
||||
@ -160,7 +162,7 @@ class Establishment extends CommonObject
|
||||
$sql .= ", zip = '".$this->db->escape($this->zip)."'";
|
||||
$sql .= ", town = '".$this->db->escape($this->town)."'";
|
||||
$sql .= ", fk_country = ".($this->country_id > 0 ? $this->country_id : 'null');
|
||||
$sql .= ", status = '".$this->db->escape($this->status)."'";
|
||||
$sql .= ", status = ".$this->db->escape($this->status);
|
||||
$sql .= ", fk_user_mod = " . $user->id;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
@ -197,6 +199,7 @@ class Establishment extends CommonObject
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->name = $obj->name;
|
||||
$this->address = $obj->address;
|
||||
$this->zip = $obj->zip;
|
||||
@ -249,9 +252,9 @@ class Establishment extends CommonObject
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @return string Label
|
||||
*/
|
||||
function getLibStatus($mode=0)
|
||||
function getLibStatut($mode=0)
|
||||
{
|
||||
return $this->LibStatus($this->status,$mode);
|
||||
return $this->LibStatut($this->status,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -261,7 +264,7 @@ class Establishment extends CommonObject
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @return string Label
|
||||
*/
|
||||
function LibStatus($status,$mode=0)
|
||||
function LibStatut($status,$mode=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -383,4 +386,16 @@ class Establishment extends CommonObject
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise object with example values
|
||||
* Id must be 0 if object instance is a specimen
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
$this->id = 0;
|
||||
$this->ref = 'DEAAA';
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,7 +140,8 @@ else if ($action == 'update')
|
||||
$object->town = GETPOST('town', 'alpha');
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->fk_user_mod = $user->id;
|
||||
|
||||
$object->status = GETPOST('status','int');
|
||||
|
||||
$result = $object->update($user);
|
||||
|
||||
if ($result > 0)
|
||||
@ -184,13 +185,13 @@ if ($action == 'create')
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Name
|
||||
print '<tr><td>'. fieldLabel('Name','name',1).'</td><td><input name="name" id="name" size="32" value="' . GETPOST("name") . '"></td></tr>';
|
||||
print '<tr><td>'. fieldLabel('Name','name',1).'</td><td><input name="name" id="name" size="32" value="' . GETPOST("name", "alpha") . '"></td></tr>';
|
||||
|
||||
// Address
|
||||
print '<tr>';
|
||||
print '<td>'.fieldLabel('Address','address',0).'</td>';
|
||||
print '<td>';
|
||||
print '<input name="address" id="address" size="32" value="' . $object->address . '">';
|
||||
print '<input name="address" id="address" class="qutrevingtpercent" value="' . GETPOST('address','alpha') . '">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -220,7 +221,7 @@ if ($action == 'create')
|
||||
print '<tr>';
|
||||
print '<td>'.fieldLabel('Country','selectcountry_id',0).'</td>';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print $form->select_country($mysoc->country_id,'country_id');
|
||||
print $form->select_country(GETPOST('country_id','int')>0?GETPOST('country_id','int'):$mysoc->country_id,'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -229,7 +230,7 @@ if ($action == 'create')
|
||||
print '<tr>';
|
||||
print '<td>'.fieldLabel('Status','status',1).'</td>';
|
||||
print '<td>';
|
||||
print $form->selectarray('status',$status2label,GETPOST('status'));
|
||||
print $form->selectarray('status',$status2label,GETPOST('status','alpha'));
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -244,7 +245,9 @@ if ($action == 'create')
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else if ($id)
|
||||
|
||||
// Part to edit record
|
||||
if (($id || $ref) && $action == 'edit')
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result > 0)
|
||||
@ -316,91 +319,94 @@ else if ($id)
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Confirm delete
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteEstablishment"),$langs->trans("ConfirmDeleteEstablishment"),"confirm_delete");
|
||||
|
||||
}
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("Establishment"), 0, 'building');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="../admin/admin_establishment.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td width="50%">';
|
||||
print $object->id;
|
||||
print '</td><td width="25%">';
|
||||
print $linkback;
|
||||
print '</td></tr>';
|
||||
|
||||
// Name
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td colspan="2">'.$object->name.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Address
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Address").'</td>';
|
||||
print '<td colspan="2">'.$object->address.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Zipcode
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Zipcode").'</td>';
|
||||
print '<td colspan="2">'.$object->zip.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Town
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Town").'</td>';
|
||||
print '<td colspan="2">'.$object->town.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Country
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Country").'</td>';
|
||||
print '<td colspan="2">';
|
||||
if ($object->country_id > 0)
|
||||
{
|
||||
$img=picto_from_langcode($object->country_code);
|
||||
print $img?$img.' ':'';
|
||||
print getCountry($object->getCountryCode(),0,$db);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
|
||||
print $object->getLibStatus(4).'</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
/*
|
||||
* Barre d'actions
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
|
||||
{
|
||||
$res = $object->fetch_optionals($object->id, $extralabels);
|
||||
|
||||
$head = establishment_prepare_head($object);
|
||||
dol_fiche_head($head, 'card', $langs->trans("Establishment"), -1, 'building');
|
||||
|
||||
// Confirmation to delete
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteEstablishment"),$langs->trans("ConfirmDeleteEstablishment"),"confirm_delete");
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Object card
|
||||
// ------------------------------------------------------------
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/hrm/admin/admin_establishment.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'id', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
//print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">'."\n";
|
||||
|
||||
// Name
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$object->name.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Address
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Address").'</td>';
|
||||
print '<td>'.$object->address.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Zipcode
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Zipcode").'</td>';
|
||||
print '<td>'.$object->zip.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Town
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Town").'</td>';
|
||||
print '<td>'.$object->town.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Country
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Country").'</td>';
|
||||
print '<td>';
|
||||
if ($object->country_id > 0)
|
||||
{
|
||||
$img=picto_from_langcode($object->country_code);
|
||||
print $img?$img.' ':'';
|
||||
print getCountry($object->getCountryCode(),0,$db);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="clearboth"></div><br>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
/*
|
||||
* Barre d'actions
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -297,52 +297,305 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
{
|
||||
$res = $object->fetch_optionals($object->id, $extralabels);
|
||||
|
||||
$head = commande_prepare_head($object);
|
||||
dol_fiche_head($head, 'order', $langs->trans("CustomerOrder"), 0, 'order');
|
||||
$head = mymodule_prepare_head($object);
|
||||
dol_fiche_head($head, 'order', $langs->trans("CustomerOrder"), -1, 'order');
|
||||
|
||||
print load_fiche_titre($langs->trans("MyModule"));
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
$formconfirm = '';
|
||||
|
||||
// Confirmation to delete
|
||||
if ($action == 'delete') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyOjbect'), $langs->trans('ConfirmDeleteMyObject'), 'confirm_delete', '', 0, 1);
|
||||
print $formconfirm;
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
|
||||
// Confirmation of action xxxx
|
||||
if ($action == 'xxx')
|
||||
{
|
||||
$formquestion=array();
|
||||
/*
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
// array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1)));
|
||||
}*/
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
|
||||
}
|
||||
|
||||
if (! $formconfirm) {
|
||||
$parameters = array('lineid' => $lineid);
|
||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||
}
|
||||
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
|
||||
|
||||
|
||||
// Object card
|
||||
// ------------------------------------------------------------
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/mymodule/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
/*
|
||||
// Ref bis
|
||||
$morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mymodule->creer, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mymodule->creer, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->mymodule->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
{
|
||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">'."\n";
|
||||
// print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
|
||||
// LIST_OF_TD_LABEL_FIELDS_VIEW
|
||||
|
||||
|
||||
// Other attributes
|
||||
$cols = 2;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="clearboth"></div><br>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
// Buttons
|
||||
print '<div class="tabsAction">'."\n";
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($user->rights->mymodule->write)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
|
||||
}
|
||||
|
||||
if ($user->rights->mymodule->delete)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a></div>'."\n";
|
||||
}
|
||||
// Buttons for actions
|
||||
if ($action != 'presend' && $action != 'editline') {
|
||||
print '<div class="tabsAction">'."\n";
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($user->rights->mymodule->write)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
|
||||
}
|
||||
|
||||
if ($user->rights->mymodule->delete)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a></div>'."\n";
|
||||
}
|
||||
}
|
||||
print '</div>'."\n";
|
||||
}
|
||||
print '</div>'."\n";
|
||||
|
||||
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
if ($action != 'presend')
|
||||
{
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
// Documents
|
||||
$comref = dol_sanitizeFileName($object->ref);
|
||||
$relativepath = $comref . '/' . $comref . '.pdf';
|
||||
$filedir = $conf->mymodule->dir_output . '/' . $comref;
|
||||
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
||||
$genallowed = $user->rights->mymodule->creer;
|
||||
$delallowed = $user->rights->mymodule->supprimer;
|
||||
print $formfile->showdocuments('mymodule', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
||||
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('order'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'order', $socid);
|
||||
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
|
||||
// Example 2 : Adding links to objects
|
||||
// Show links to link elements
|
||||
//$linktoelem = $form->showLinkToObjectBlock($object, null, array('skeleton'));
|
||||
//$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
/*
|
||||
* Action presend
|
||||
*/
|
||||
/*
|
||||
if ($action == 'presend')
|
||||
{
|
||||
$object->fetch_projet();
|
||||
|
||||
$ref = dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
|
||||
if (!empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$outputlangs->load('commercial');
|
||||
}
|
||||
|
||||
// Build document if it not exists
|
||||
if (! $file || ! is_readable($file)) {
|
||||
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
exit();
|
||||
}
|
||||
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
}
|
||||
|
||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans('SendOrderByMail'));
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||
|
||||
if($formmail->fromtype === 'user'){
|
||||
$formmail->fromid = $user->id;
|
||||
|
||||
}
|
||||
$formmail->trackid='ord'.$object->id;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id);
|
||||
}
|
||||
$formmail->withfrom = 1;
|
||||
$liste = array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value)
|
||||
$liste [$key] = $value;
|
||||
$formmail->withto = GETPOST('sendto') ? GETPOST('sendto') : $liste;
|
||||
$formmail->withtocc = $liste;
|
||||
$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
|
||||
if (empty($object->ref_client)) {
|
||||
$formmail->withtopic = $outputlangs->trans('SendOrderRef', '__ORDERREF__');
|
||||
} else if (! empty($object->ref_client)) {
|
||||
$formmail->withtopic = $outputlangs->trans('SendOrderRef', '__ORDERREF__ (__REFCLIENT__)');
|
||||
}
|
||||
$formmail->withfile = 2;
|
||||
$formmail->withbody = 1;
|
||||
$formmail->withdeliveryreceipt = 1;
|
||||
$formmail->withcancel = 1;
|
||||
// Tableau des substitutions
|
||||
$formmail->setSubstitFromObject($object);
|
||||
$formmail->substit ['__ORDERREF__'] = $object->ref;
|
||||
|
||||
$custcontact = '';
|
||||
$contactarr = array();
|
||||
$contactarr = $object->liste_contact(- 1, 'external');
|
||||
|
||||
if (is_array($contactarr) && count($contactarr) > 0)
|
||||
{
|
||||
foreach ($contactarr as $contact)
|
||||
{
|
||||
if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label
|
||||
$contactstatic = new Contact($db);
|
||||
$contactstatic->fetch($contact ['id']);
|
||||
$custcontact = $contactstatic->getFullName($langs, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($custcontact)) {
|
||||
$formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
|
||||
}
|
||||
}
|
||||
|
||||
// Tableau des parametres complementaires
|
||||
$formmail->param['action'] = 'send';
|
||||
$formmail->param['models'] = 'order_send';
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['orderid'] = $object->id;
|
||||
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
||||
|
||||
// Init list of files
|
||||
if (GETPOST("mode") == 'init') {
|
||||
$formmail->clear_attached_files();
|
||||
$formmail->add_attached_files($file, basename($file), dol_mimetype($file));
|
||||
}
|
||||
|
||||
// Show form
|
||||
print $formmail->get_form();
|
||||
|
||||
dol_fiche_end();
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user