Merge pull request #16453 from frederic34/zapier_code_syntax
code syntax zapier directory
This commit is contained in:
commit
e43314e81c
@ -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
|
||||||
|
|||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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);
|
||||||
|
|
||||||
|
|
||||||
@ -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
|
||||||
|
|
||||||
@ -236,8 +245,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
// 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;
|
||||||
@ -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
|
||||||
|
|||||||
@ -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 {
|
||||||
@ -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
|
||||||
|
|||||||
@ -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