code syntax zapier directory
This commit is contained in:
parent
34ed5519fd
commit
7d97d16eeb
@ -34,7 +34,9 @@ require_once '../lib/zapier.lib.php';
|
|||||||
$langs->loadLangs(array("errors", "admin", "zapier@zapier"));
|
$langs->loadLangs(array("errors", "admin", "zapier@zapier"));
|
||||||
|
|
||||||
// Access control
|
// Access control
|
||||||
if (!$user->admin) accessforbidden();
|
if (!$user->admin) {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
|
||||||
// Parameters
|
// Parameters
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
|
|||||||
@ -33,7 +33,9 @@ require_once '../lib/zapier.lib.php';
|
|||||||
$langs->loadLangs(array("admin", "zapier@zapier"));
|
$langs->loadLangs(array("admin", "zapier@zapier"));
|
||||||
|
|
||||||
// Access control
|
// Access control
|
||||||
if (!$user->admin) accessforbidden();
|
if (!$user->admin) {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
|
||||||
// Parameters
|
// Parameters
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
|
|||||||
@ -37,7 +37,7 @@ class ZapierApi extends DolibarrApi
|
|||||||
/**
|
/**
|
||||||
* @var array $FIELDS Mandatory fields, checked when create and update object
|
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||||
*/
|
*/
|
||||||
static $FIELDS = array(
|
public static $FIELDS = array(
|
||||||
'url',
|
'url',
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -163,7 +163,9 @@ class ZapierApi extends DolibarrApi
|
|||||||
}
|
}
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."hook_mytable as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX."hook_mytable as t";
|
||||||
|
|
||||||
if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) {
|
||||||
|
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||||
|
}
|
||||||
$sql .= " WHERE 1 = 1";
|
$sql .= " WHERE 1 = 1";
|
||||||
|
|
||||||
// Example of use $mode
|
// Example of use $mode
|
||||||
@ -270,33 +272,33 @@ class ZapierApi extends DolibarrApi
|
|||||||
// * @url PUT /hooks/{id}
|
// * @url PUT /hooks/{id}
|
||||||
// */
|
// */
|
||||||
/*public function put($id, $request_data = null)
|
/*public function put($id, $request_data = null)
|
||||||
{
|
{
|
||||||
if (! DolibarrApiAccess::$user->rights->zapier->write) {
|
if (! DolibarrApiAccess::$user->rights->zapier->write) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->hook->fetch($id);
|
$result = $this->hook->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Hook not found');
|
throw new RestException(404, 'Hook not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('hook', $this->hook->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('hook', $this->hook->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($request_data as $field => $value) {
|
foreach($request_data as $field => $value) {
|
||||||
if ($field == 'id') {
|
if ($field == 'id') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$this->hook->$field = $value;
|
$this->hook->$field = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->hook->update($id, DolibarrApiAccess::$user) > 0) {
|
if ($this->hook->update($id, DolibarrApiAccess::$user) > 0) {
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
} else {
|
} else {
|
||||||
throw new RestException(500, $this->hook->error);
|
throw new RestException(500, $this->hook->error);
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete hook
|
* Delete hook
|
||||||
|
|||||||
@ -385,13 +385,13 @@ class Hook extends CommonObject
|
|||||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||||
*/
|
*/
|
||||||
/*public function fetchLines()
|
/*public function fetchLines()
|
||||||
{
|
{
|
||||||
$this->lines=array();
|
$this->lines=array();
|
||||||
|
|
||||||
// Load lines with object MyObjectLine
|
// Load lines with object MyObjectLine
|
||||||
|
|
||||||
return count($this->lines)?1:0;
|
return count($this->lines)?1:0;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load list of objects in memory from the database.
|
* Load list of objects in memory from the database.
|
||||||
@ -542,11 +542,11 @@ class Hook extends CommonObject
|
|||||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$hookmanager->initHooks(array('hookdao'));
|
$hookmanager->initHooks(array('hookdao'));
|
||||||
$parameters=array('id'=>$this->id);
|
$parameters=array('id'=>$this->id);
|
||||||
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
|
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
|
||||||
*/
|
*/
|
||||||
} else {
|
} else {
|
||||||
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||||
}
|
}
|
||||||
@ -621,7 +621,9 @@ class Hook extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$statusType = 'status5';
|
$statusType = 'status5';
|
||||||
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
|
if ($status == self::STATUS_VALIDATED) {
|
||||||
|
$statusType = 'status4';
|
||||||
|
}
|
||||||
|
|
||||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||||
}
|
}
|
||||||
@ -720,11 +722,11 @@ class Hook extends CommonObject
|
|||||||
/*
|
/*
|
||||||
class MyObjectLine
|
class MyObjectLine
|
||||||
{
|
{
|
||||||
// @var int ID
|
// @var int ID
|
||||||
public $id;
|
public $id;
|
||||||
// @var mixed Sample line property 1
|
// @var mixed Sample line property 1
|
||||||
public $prop1;
|
public $prop1;
|
||||||
// @var mixed Sample line property 2
|
// @var mixed Sample line property 2
|
||||||
public $prop2;
|
public $prop2;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -43,7 +43,9 @@ $backtopage = GETPOST('backtopage', 'alpha');
|
|||||||
|
|
||||||
if (GETPOST('actioncode', 'array')) {
|
if (GETPOST('actioncode', 'array')) {
|
||||||
$actioncode = GETPOST('actioncode', 'array', 3);
|
$actioncode = GETPOST('actioncode', 'array', 3);
|
||||||
if (!count($actioncode)) $actioncode = '0';
|
if (!count($actioncode)) {
|
||||||
|
$actioncode = '0';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
|
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
|
||||||
}
|
}
|
||||||
@ -58,12 +60,18 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
|||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == -1) {
|
||||||
|
$page = 0;
|
||||||
|
} // If $page is not defined, or '' or -1
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (!$sortfield) $sortfield = 'a.datep,a.id';
|
if (!$sortfield) {
|
||||||
if (!$sortorder) $sortorder = 'DESC';
|
$sortfield = 'a.datep,a.id';
|
||||||
|
}
|
||||||
|
if (!$sortorder) {
|
||||||
|
$sortorder = 'DESC';
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize technical objects
|
// Initialize technical objects
|
||||||
$object = new MyObject($db);
|
$object = new MyObject($db);
|
||||||
@ -76,7 +84,9 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
|||||||
|
|
||||||
// Load object
|
// Load object
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||||
if ($id > 0 || !empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity]."/".$object->id;
|
if ($id > 0 || !empty($ref)) {
|
||||||
|
$upload_dir = $conf->mymodule->multidir_output[$object->entity]."/".$object->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -86,7 +96,9 @@ if ($id > 0 || !empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$obj
|
|||||||
|
|
||||||
$parameters = array('id'=>$socid);
|
$parameters = array('id'=>$socid);
|
||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) {
|
||||||
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
// Cancel
|
// Cancel
|
||||||
@ -118,7 +130,9 @@ if ($object->id > 0) {
|
|||||||
$help_url = '';
|
$help_url = '';
|
||||||
llxHeader('', $title, $help_url);
|
llxHeader('', $title, $help_url);
|
||||||
|
|
||||||
if (!empty($conf->notification->enabled)) $langs->load("mails");
|
if (!empty($conf->notification->enabled)) {
|
||||||
|
$langs->load("mails");
|
||||||
|
}
|
||||||
$head = myobjectPrepareHead($object);
|
$head = myobjectPrepareHead($object);
|
||||||
|
|
||||||
|
|
||||||
@ -143,31 +157,31 @@ if ($object->id > 0) {
|
|||||||
if ($user->rights->mymodule->creer)
|
if ($user->rights->mymodule->creer)
|
||||||
{
|
{
|
||||||
if ($action != 'classify')
|
if ($action != 'classify')
|
||||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||||
$morehtmlref.=' : ';
|
$morehtmlref.=' : ';
|
||||||
if ($action == 'classify') {
|
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->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.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||||
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
|
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
$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.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||||
$morehtmlref.='</form>';
|
$morehtmlref.='</form>';
|
||||||
} else {
|
} else {
|
||||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (! empty($object->fk_project)) {
|
if (! empty($object->fk_project)) {
|
||||||
$proj = new Project($db);
|
$proj = new Project($db);
|
||||||
$proj->fetch($object->fk_project);
|
$proj->fetch($object->fk_project);
|
||||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||||
$morehtmlref.=$proj->ref;
|
$morehtmlref.=$proj->ref;
|
||||||
$morehtmlref.='</a>';
|
$morehtmlref.='</a>';
|
||||||
} else {
|
} else {
|
||||||
$morehtmlref.='';
|
$morehtmlref.='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
$morehtmlref .= '</div>';
|
$morehtmlref .= '</div>';
|
||||||
|
|
||||||
|
|
||||||
@ -194,7 +208,9 @@ if ($object->id > 0) {
|
|||||||
$permok = $user->rights->agenda->myactions->create;
|
$permok = $user->rights->agenda->myactions->create;
|
||||||
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
|
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
|
||||||
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
|
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
|
||||||
if (get_class($objthirdparty) == 'Societe') $out .= '&socid='.$objthirdparty->id;
|
if (get_class($objthirdparty) == 'Societe') {
|
||||||
|
$out .= '&socid='.$objthirdparty->id;
|
||||||
|
}
|
||||||
$out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&backtopage=1&percentage=-1';
|
$out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&backtopage=1&percentage=-1';
|
||||||
//$out.=$langs->trans("AddAnAction").' ';
|
//$out.=$langs->trans("AddAnAction").' ';
|
||||||
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
|
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
|
||||||
@ -216,8 +232,12 @@ if ($object->id > 0) {
|
|||||||
|
|
||||||
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
|
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
|
||||||
$param = '&socid='.$socid;
|
$param = '&socid='.$socid;
|
||||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
|
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
$param .= '&contextpage='.$contextpage;
|
||||||
|
}
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||||
|
$param .= '&limit='.$limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("ActionsOnMyObject"), '', '');
|
print load_fiche_titre($langs->trans("ActionsOnMyObject"), '', '');
|
||||||
|
|||||||
@ -56,10 +56,14 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
|||||||
$search_all = GETPOST("search_all", 'alpha');
|
$search_all = GETPOST("search_all", 'alpha');
|
||||||
$search = array();
|
$search = array();
|
||||||
foreach ($object->fields as $key => $val) {
|
foreach ($object->fields as $key => $val) {
|
||||||
if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
|
if (GETPOST('search_'.$key, 'alpha')) {
|
||||||
|
$search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($action) && empty($id) && empty($ref)) $action = 'view';
|
if (empty($action) && empty($id) && empty($ref)) {
|
||||||
|
$action = 'view';
|
||||||
|
}
|
||||||
|
|
||||||
// Load object
|
// Load object
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||||
@ -79,7 +83,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
|
|||||||
|
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) {
|
||||||
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -88,8 +94,11 @@ if (empty($reshook)) {
|
|||||||
$permissiontodelete = $user->rights->mymodule->delete || ($permissiontoadd && $object->status == 0);
|
$permissiontodelete = $user->rights->mymodule->delete || ($permissiontoadd && $object->status == 0);
|
||||||
$backurlforlist = dol_buildpath('/mymodule/myobject_list.php', 1);
|
$backurlforlist = dol_buildpath('/mymodule/myobject_list.php', 1);
|
||||||
if (empty($backtopage)) {
|
if (empty($backtopage)) {
|
||||||
if (empty($id)) $backtopage = $backurlforlist;
|
if (empty($id)) {
|
||||||
else $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).($id > 0 ? $id : '__ID__');
|
$backtopage = $backurlforlist;
|
||||||
|
} else {
|
||||||
|
$backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).($id > 0 ? $id : '__ID__');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record
|
$triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||||
|
|
||||||
@ -223,21 +232,24 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
/*
|
/*
|
||||||
$forcecombo=0;
|
$forcecombo=0;
|
||||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||||
$formquestion = array(
|
$formquestion = array(
|
||||||
// 'text' => $langs->trans("ConfirmClone"),
|
// 'text' => $langs->trans("ConfirmClone"),
|
||||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
// 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' => '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, 0, 0, '', 0, $forcecombo))
|
// array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
||||||
);
|
);
|
||||||
*/
|
*/
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call Hook formConfirm
|
// Call Hook formConfirm
|
||||||
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
|
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
|
||||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
|
if (empty($reshook)) {
|
||||||
elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
|
$formconfirm .= $hookmanager->resPrint;
|
||||||
|
} elseif ($reshook > 0) {
|
||||||
|
$formconfirm = $hookmanager->resPrint;
|
||||||
|
}
|
||||||
|
|
||||||
// Print form confirm
|
// Print form confirm
|
||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
@ -257,32 +269,32 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
// Project
|
// Project
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||||
if ($user->rights->mymodule->write)
|
if ($user->rights->mymodule->write)
|
||||||
{
|
{
|
||||||
if ($action != 'classify')
|
if ($action != 'classify')
|
||||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||||
if ($action == 'classify') {
|
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->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.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||||
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
|
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1);
|
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1);
|
||||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||||
$morehtmlref.='</form>';
|
$morehtmlref.='</form>';
|
||||||
} else {
|
} else {
|
||||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (! empty($object->fk_project)) {
|
if (! empty($object->fk_project)) {
|
||||||
$proj = new Project($db);
|
$proj = new Project($db);
|
||||||
$proj->fetch($object->fk_project);
|
$proj->fetch($object->fk_project);
|
||||||
$morehtmlref.=$proj->getNomUrl();
|
$morehtmlref.=$proj->getNomUrl();
|
||||||
} else {
|
} else {
|
||||||
$morehtmlref.='';
|
$morehtmlref.='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
$morehtmlref .= '</div>';
|
$morehtmlref .= '</div>';
|
||||||
@ -317,7 +329,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print '<div class="tabsAction">'."\n";
|
print '<div class="tabsAction">'."\n";
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$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 ($reshook < 0) {
|
||||||
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
// Modify
|
// Modify
|
||||||
@ -333,18 +347,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if ($user->rights->mymodule->write)
|
if ($user->rights->mymodule->write)
|
||||||
{
|
{
|
||||||
if ($object->status == 1)
|
if ($object->status == 1)
|
||||||
{
|
{
|
||||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable">'.$langs->trans("Disable").'</a>'."\n";
|
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable">'.$langs->trans("Disable").'</a>'."\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=enable">'.$langs->trans("Enable").'</a>'."\n";
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=enable">'.$langs->trans("Enable").'</a>'."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($user->rights->mymodule->delete) {
|
if ($user->rights->mymodule->delete) {
|
||||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'."\n";
|
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'."\n";
|
||||||
|
|||||||
@ -50,12 +50,18 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
|||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == -1) {
|
||||||
|
$page = 0;
|
||||||
|
} // If $page is not defined, or '' or -1
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (!$sortorder) $sortorder = "ASC";
|
if (!$sortorder) {
|
||||||
if (!$sortfield) $sortfield = "name";
|
$sortorder = "ASC";
|
||||||
|
}
|
||||||
|
if (!$sortfield) {
|
||||||
|
$sortfield = "name";
|
||||||
|
}
|
||||||
//if (! $sortfield) $sortfield="position_name";
|
//if (! $sortfield) $sortfield="position_name";
|
||||||
|
|
||||||
// Initialize technical objects
|
// Initialize technical objects
|
||||||
@ -71,7 +77,9 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||||
|
|
||||||
//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/myobject/" . dol_sanitizeFileName($object->id);
|
//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/myobject/" . dol_sanitizeFileName($object->id);
|
||||||
if ($id > 0 || !empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity]."/myobject/".dol_sanitizeFileName($object->ref);
|
if ($id > 0 || !empty($ref)) {
|
||||||
|
$upload_dir = $conf->sellyoursaas->multidir_output[$object->entity]."/myobject/".dol_sanitizeFileName($object->ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -96,20 +96,26 @@ if ($user->socid > 0) {
|
|||||||
$search_all = GETPOST("search_all", 'alpha');
|
$search_all = GETPOST("search_all", 'alpha');
|
||||||
$search = array();
|
$search = array();
|
||||||
foreach ($object->fields as $key => $val) {
|
foreach ($object->fields as $key => $val) {
|
||||||
if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
|
if (GETPOST('search_'.$key, 'alpha')) {
|
||||||
|
$search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of fields to search into when doing a "search in all"
|
// List of fields to search into when doing a "search in all"
|
||||||
$fieldstosearchall = array();
|
$fieldstosearchall = array();
|
||||||
foreach ($object->fields as $key => $val) {
|
foreach ($object->fields as $key => $val) {
|
||||||
if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
|
if ($val['searchall']) {
|
||||||
|
$fieldstosearchall['t.'.$key] = $val['label'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Definition of fields for list
|
// Definition of fields for list
|
||||||
$arrayfields = array();
|
$arrayfields = array();
|
||||||
foreach ($object->fields as $key => $val) {
|
foreach ($object->fields as $key => $val) {
|
||||||
// If $val['visible']==0, then we never show the field
|
// If $val['visible']==0, then we never show the field
|
||||||
if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
|
if (!empty($val['visible'])) {
|
||||||
|
$arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
@ -133,7 +139,9 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
|
|||||||
|
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) {
|
||||||
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
// Selection of new fields
|
// Selection of new fields
|
||||||
@ -195,7 +203,9 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
|
|||||||
$sql .= $hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
$sql = preg_replace('/, $/', '', $sql);
|
$sql = preg_replace('/, $/', '', $sql);
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||||
|
}
|
||||||
if ($object->ismultientitymanaged == 1) {
|
if ($object->ismultientitymanaged == 1) {
|
||||||
$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
|
$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
|
||||||
} else {
|
} else {
|
||||||
@ -224,11 +234,11 @@ $sql .= $hookmanager->resPrint;
|
|||||||
$sql.= " GROUP BY "
|
$sql.= " GROUP BY "
|
||||||
foreach($object->fields as $key => $val)
|
foreach($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
$sql.='t.'.$key.', ';
|
$sql.='t.'.$key.', ';
|
||||||
}
|
}
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
|
||||||
// Add where from hooks
|
// Add where from hooks
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
@ -296,8 +306,12 @@ llxHeader('', $title, $help_url);
|
|||||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||||
|
|
||||||
$param = '';
|
$param = '';
|
||||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
$param .= '&contextpage='.urlencode($contextpage);
|
||||||
|
}
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||||
|
$param .= '&limit='.urlencode($limit);
|
||||||
|
}
|
||||||
foreach ($search as $key => $val) {
|
foreach ($search as $key => $val) {
|
||||||
if (is_array($search[$key]) && count($search[$key])) {
|
if (is_array($search[$key]) && count($search[$key])) {
|
||||||
foreach ($search[$key] as $skey) {
|
foreach ($search[$key] as $skey) {
|
||||||
@ -307,7 +321,9 @@ foreach ($search as $key => $val) {
|
|||||||
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
if ($optioncss != '') {
|
||||||
|
$param .= '&optioncss='.urlencode($optioncss);
|
||||||
|
}
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||||
|
|
||||||
@ -316,12 +332,18 @@ $arrayofmassactions = array(
|
|||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
if ($user->rights->zapier->delete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
if ($user->rights->zapier->delete) {
|
||||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||||
|
}
|
||||||
|
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
|
||||||
|
$arrayofmassactions = array();
|
||||||
|
}
|
||||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
if ($optioncss != '') {
|
||||||
|
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
|
}
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
print '<input type="hidden" name="action" value="list">';
|
print '<input type="hidden" name="action" value="list">';
|
||||||
@ -354,7 +376,9 @@ $trackid = 'zapier'.$object->id;
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||||
|
|
||||||
if ($sall) {
|
if ($sall) {
|
||||||
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
|
foreach ($fieldstosearchall as $key => $val) {
|
||||||
|
$fieldstosearchall[$key] = $langs->trans($val);
|
||||||
|
}
|
||||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
|
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,8 +389,11 @@ $moreforfilter.= '</div>';*/
|
|||||||
|
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
if (empty($reshook)) {
|
||||||
else $moreforfilter = $hookmanager->resPrint;
|
$moreforfilter .= $hookmanager->resPrint;
|
||||||
|
} else {
|
||||||
|
$moreforfilter = $hookmanager->resPrint;
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($moreforfilter)) {
|
if (!empty($moreforfilter)) {
|
||||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
@ -423,9 +450,15 @@ print '</tr>'."\n";
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
foreach ($object->fields as $key => $val) {
|
foreach ($object->fields as $key => $val) {
|
||||||
$cssforfield = '';
|
$cssforfield = '';
|
||||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||||
if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
}
|
||||||
|
if (in_array($val['type'], array('timestamp'))) {
|
||||||
|
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||||
|
}
|
||||||
|
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) {
|
||||||
|
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||||
|
}
|
||||||
if ($key == 'status') {
|
if ($key == 'status') {
|
||||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||||
}
|
}
|
||||||
@ -474,7 +507,9 @@ while ($i < min($num, $limit)) {
|
|||||||
// Store properties in $object
|
// Store properties in $object
|
||||||
$object->id = $obj->rowid;
|
$object->id = $obj->rowid;
|
||||||
foreach ($object->fields as $key => $val) {
|
foreach ($object->fields as $key => $val) {
|
||||||
if (isset($obj->$key)) $object->$key = $obj->$key;
|
if (isset($obj->$key)) {
|
||||||
|
$object->$key = $obj->$key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show here line of result
|
// Show here line of result
|
||||||
@ -487,26 +522,45 @@ while ($i < min($num, $limit)) {
|
|||||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
if (in_array($val['type'], array('timestamp'))) {
|
||||||
elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||||
|
} elseif ($key == 'ref') {
|
||||||
|
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||||
|
}
|
||||||
|
|
||||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) {
|
||||||
|
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||||
print '<td';
|
print '<td';
|
||||||
if ($cssforfield || $val['css']) print ' class="';
|
if ($cssforfield || $val['css']) {
|
||||||
|
print ' class="';
|
||||||
|
}
|
||||||
print $cssforfield;
|
print $cssforfield;
|
||||||
if ($cssforfield && $val['css']) print ' ';
|
if ($cssforfield && $val['css']) {
|
||||||
|
print ' ';
|
||||||
|
}
|
||||||
print $val['css'];
|
print $val['css'];
|
||||||
if ($cssforfield || $val['css']) print '"';
|
if ($cssforfield || $val['css']) {
|
||||||
|
print '"';
|
||||||
|
}
|
||||||
print '>';
|
print '>';
|
||||||
if ($key == 'status') print $object->getLibStatut(5);
|
if ($key == 'status') {
|
||||||
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
|
print $object->getLibStatut(5);
|
||||||
else print $object->showOutputField($val, $key, $obj->$key, '');
|
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||||
|
print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
|
||||||
|
} else {
|
||||||
|
print $object->showOutputField($val, $key, $obj->$key, '');
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
if (!empty($val['isameasure'])) {
|
if (!empty($val['isameasure'])) {
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
if (!$i) {
|
||||||
|
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||||
|
}
|
||||||
$totalarray['val']['t.'.$key] += $obj->$key;
|
$totalarray['val']['t.'.$key] += $obj->$key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -522,11 +576,15 @@ while ($i < min($num, $limit)) {
|
|||||||
if ($massactionbutton || $massaction) {
|
if ($massactionbutton || $massaction) {
|
||||||
// If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
// If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||||
$selected = 0;
|
$selected = 0;
|
||||||
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
|
if (in_array($obj->rowid, $arrayofselected)) {
|
||||||
|
$selected = 1;
|
||||||
|
}
|
||||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,9 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
|||||||
|
|
||||||
// Load object
|
// Load object
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||||
if ($id > 0 || !empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity]."/".$object->id;
|
if ($id > 0 || !empty($ref)) {
|
||||||
|
$upload_dir = $conf->mymodule->multidir_output[$object->entity]."/".$object->id;
|
||||||
|
}
|
||||||
|
|
||||||
$permissionnote = 1;
|
$permissionnote = 1;
|
||||||
//$permissionnote=$user->rights->mymodule->creer; // Used by the include of actions_setnotes.inc.php
|
//$permissionnote=$user->rights->mymodule->creer; // Used by the include of actions_setnotes.inc.php
|
||||||
@ -98,35 +100,35 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
// Project
|
// Project
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||||
if ($user->rights->mymodule->creer)
|
if ($user->rights->mymodule->creer)
|
||||||
{
|
{
|
||||||
if ($action != 'classify')
|
if ($action != 'classify')
|
||||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||||
$morehtmlref.=' : ';
|
$morehtmlref.=' : ';
|
||||||
if ($action == 'classify') {
|
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->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.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||||
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
|
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
$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.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||||
$morehtmlref.='</form>';
|
$morehtmlref.='</form>';
|
||||||
} else {
|
} else {
|
||||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (! empty($object->fk_project)) {
|
if (! empty($object->fk_project)) {
|
||||||
$proj = new Project($db);
|
$proj = new Project($db);
|
||||||
$proj->fetch($object->fk_project);
|
$proj->fetch($object->fk_project);
|
||||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||||
$morehtmlref.=$proj->ref;
|
$morehtmlref.=$proj->ref;
|
||||||
$morehtmlref.='</a>';
|
$morehtmlref.='</a>';
|
||||||
} else {
|
} else {
|
||||||
$morehtmlref.='';
|
$morehtmlref.='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
$morehtmlref .= '</div>';
|
$morehtmlref .= '</div>';
|
||||||
|
|
||||||
|
|||||||
@ -43,11 +43,17 @@ function myobjectPrepareHead($object)
|
|||||||
|
|
||||||
if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) {
|
if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) {
|
||||||
$nbNote = 0;
|
$nbNote = 0;
|
||||||
if (!empty($object->note_private)) $nbNote++;
|
if (!empty($object->note_private)) {
|
||||||
if (!empty($object->note_public)) $nbNote++;
|
$nbNote++;
|
||||||
|
}
|
||||||
|
if (!empty($object->note_public)) {
|
||||||
|
$nbNote++;
|
||||||
|
}
|
||||||
$head[$h][0] = dol_buildpath('/mymodule/myobject_note.php', 1).'?id='.$object->id;
|
$head[$h][0] = dol_buildpath('/mymodule/myobject_note.php', 1).'?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans('Notes');
|
$head[$h][1] = $langs->trans('Notes');
|
||||||
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
if ($nbNote > 0) {
|
||||||
|
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||||
|
}
|
||||||
$head[$h][2] = 'note';
|
$head[$h][2] = 'note';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
@ -59,7 +65,9 @@ function myobjectPrepareHead($object)
|
|||||||
$nbLinks = Link::count($db, $object->element, $object->id);
|
$nbLinks = Link::count($db, $object->element, $object->id);
|
||||||
$head[$h][0] = dol_buildpath("/mymodule/myobject_document.php", 1).'?id='.$object->id;
|
$head[$h][0] = dol_buildpath("/mymodule/myobject_document.php", 1).'?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans('Documents');
|
$head[$h][1] = $langs->trans('Documents');
|
||||||
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
|
if (($nbFiles + $nbLinks) > 0) {
|
||||||
|
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
|
||||||
|
}
|
||||||
$head[$h][2] = 'document';
|
$head[$h][2] = 'document';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,9 @@ $action = GETPOST('action', 'aZ09');
|
|||||||
|
|
||||||
|
|
||||||
// Securite acces client
|
// Securite acces client
|
||||||
if (!$user->rights->zapier->read) accessforbidden();
|
if (!$user->rights->zapier->read) {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
$socid = GETPOST('socid', 'int');
|
$socid = GETPOST('socid', 'int');
|
||||||
if (isset($user->socid) && $user->socid > 0) {
|
if (isset($user->socid) && $user->socid > 0) {
|
||||||
$action = '';
|
$action = '';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user