Merge branch 'Dolibarr:develop' into SELECT_PRODUITS_LIST
This commit is contained in:
commit
20c45e42c7
2
.github/workflows/code_quality.yml
vendored
2
.github/workflows/code_quality.yml
vendored
@ -18,7 +18,7 @@ jobs:
|
||||
fetch-depth: 1
|
||||
#php-version: '7.1'
|
||||
- name: 'Qodana Scan'
|
||||
uses: JetBrains/qodana-action@v2022.3.3
|
||||
uses: JetBrains/qodana-action@v2022.3.4
|
||||
#with:
|
||||
# php-version: '7.1'
|
||||
env:
|
||||
|
||||
@ -1 +1 @@
|
||||
7
|
||||
10
|
||||
@ -524,12 +524,13 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/ansible`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/codesniffer`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/codetemplates`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/dbmodel`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/examples/ldap`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/examples/zapier`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/initdata`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/initdemo`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/iso-normes`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/ldap`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/licence`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/resources/dbmodel`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/resources/iso-normes`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/resources/licence`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/mail`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/multitail`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/phpcheckstyle`;
|
||||
@ -894,7 +895,7 @@ if ($nboftargetok) {
|
||||
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build`;
|
||||
|
||||
|
||||
print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$PROJECT.tmp\n";
|
||||
$cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$PROJECT.tmp\"";
|
||||
$ret=`$cmd`;
|
||||
|
||||
@ -1,15 +1,17 @@
|
||||
*~
|
||||
.#*
|
||||
.git
|
||||
.gitignore
|
||||
.scrutinizer.yml
|
||||
Thumbs.db
|
||||
build/exe
|
||||
build/html
|
||||
dev/dbmodel
|
||||
dev/fpdf
|
||||
dev/examples/zapier
|
||||
dev/initdemo
|
||||
dev/initdata
|
||||
dev/iso-normes
|
||||
dev/licence
|
||||
dev/load
|
||||
dev/resources/dbmodel
|
||||
dev/resources/iso-normes
|
||||
dev/resources/licence
|
||||
htdocs/conf/conf.php
|
||||
htdocs/conf/conf.php.mysql
|
||||
htdocs/conf/conf.php.old
|
||||
|
||||
@ -504,8 +504,8 @@ if ($id) {
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '</td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Line to enter new values
|
||||
|
||||
@ -545,9 +545,9 @@ if ($tabname[$id]) {
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '</td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Line to enter new values
|
||||
|
||||
@ -431,9 +431,9 @@ if ($id) {
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '</td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Line to enter new values
|
||||
|
||||
@ -194,7 +194,7 @@ if ($action == 'update') {
|
||||
}
|
||||
if ($result <= 0) {
|
||||
// setEventMessages(null, $accounting->errors, 'errors');
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.$sql.'</pre></span></div>';
|
||||
$msg .= '<div><span class="error">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.$sql.'</pre></span></div>';
|
||||
$ko++;
|
||||
} else {
|
||||
$sql = '';
|
||||
@ -203,7 +203,7 @@ if ($action == 'update') {
|
||||
$sql_exists .= " WHERE fk_product = " . ((int) $productid) . " AND entity = " . ((int) $conf->entity);
|
||||
$resql_exists = $db->query($sql_exists);
|
||||
if (!$resql_exists) {
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.$resql_exists.'</pre></span></div>';
|
||||
$msg .= '<div><span class="error">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.$resql_exists.'</pre></span></div>';
|
||||
$ko++;
|
||||
} else {
|
||||
$nb_exists = $db->num_rows($resql_exists);
|
||||
|
||||
@ -527,7 +527,7 @@ if (!empty($object->piece_num)) {
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print '<div style="clear:both"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
@ -505,7 +505,7 @@ if (empty($reshook)) {
|
||||
$objectlabel = 'Bookkeeping';
|
||||
$permissiontoread = $user->hasRight('societe', 'lire');
|
||||
$permissiontodelete = $user->hasRight('societe', 'supprimer');
|
||||
$permissiontoadd = $user->rights->societe->creer;
|
||||
$permissiontoadd = $user->hasRight('societe', 'creer');
|
||||
$uploaddir = $conf->societe->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
@ -1006,7 +1006,7 @@ if (empty($reshook)) {
|
||||
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("ClickToHideAlreadyExportedLines").'</span>';
|
||||
$newcardbutton .= '</a>';
|
||||
} else {
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("DocsAlreadyExportedAreExcluded"), 'switch_on', 'class="warning size15x valignmiddle"').'';
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("DocsAlreadyExportedAreExcluded"), 'switch_on', 'class="warning size15x valignmiddle"');
|
||||
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("DocsAlreadyExportedAreExcluded").'</span>';
|
||||
$newcardbutton .= '</a>';
|
||||
}
|
||||
|
||||
@ -413,7 +413,7 @@ if (empty($reshook)) {
|
||||
$objectlabel = 'Bookkeeping';
|
||||
$permissiontoread = $user->hasRight('societe', 'lire');
|
||||
$permissiontodelete = $user->hasRight('societe', 'supprimer');
|
||||
$permissiontoadd = $user->rights->societe->creer;
|
||||
$permissiontoadd = $user->hasRight('societe', 'creer');
|
||||
$uploaddir = $conf->societe->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
|
||||
@ -839,20 +839,29 @@ class AccountancyCategory // extends CommonObject
|
||||
exit();
|
||||
}
|
||||
|
||||
$pcgverid = $conf->global->CHARTOFACCOUNTS;
|
||||
$pcgvercode = dol_getIdFromCode($this->db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');
|
||||
if (empty($pcgvercode)) {
|
||||
$pcgvercode = $pcgverid;
|
||||
}
|
||||
|
||||
if (!empty($cat_id)) {
|
||||
$sql = "SELECT t.rowid, t.account_number, t.label as account_label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
|
||||
$sql .= " WHERE t.fk_accounting_category = ".((int) $cat_id);
|
||||
$sql .= " AND t.entity = ".$conf->entity;
|
||||
$sql .= " AND t.active = 1";
|
||||
$sql .= " AND t.fk_pcg_version = '".$this->db->escape($pcgvercode)."'";
|
||||
$sql .= " ORDER BY t.account_number";
|
||||
} else {
|
||||
$sql = "SELECT t.rowid, t.account_number, t.label as account_label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
|
||||
$sql .= " WHERE ".$predefinedgroupwhere;
|
||||
$sql .= " AND t.entity = ".$conf->entity;
|
||||
$sql .= ' AND t.active = 1';
|
||||
$sql .= " AND t.fk_pcg_version = '".$this->db->escape($pcgvercode)."'";
|
||||
$sql .= " ORDER BY t.account_number";
|
||||
}
|
||||
//echo $sql;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
@ -2130,14 +2130,16 @@ class AccountancyExport
|
||||
//Calcul de la longueur des numéros de comptes
|
||||
$taille_numero = strlen(length_accountg($line->numero_compte));
|
||||
|
||||
//Création du numéro de client générique
|
||||
//Création du numéro de client et fournisseur générique
|
||||
$numero_cpt_client = '411';
|
||||
$numero_cpt_fourn = '401';
|
||||
for ($i = 1; $i <= ($taille_numero - 3); $i++) {
|
||||
$numero_cpt_client .= '0';
|
||||
$numero_cpt_fourn .= '0';
|
||||
}
|
||||
|
||||
//Création des comptes auxiliaire des clients
|
||||
if (length_accountg($line->numero_compte) == $numero_cpt_client) {
|
||||
//Création des comptes auxiliaire des clients et fournisseur
|
||||
if (length_accountg($line->numero_compte) == $numero_cpt_client || length_accountg($line->numero_compte) == $numero_cpt_fourn) {
|
||||
$tab[] = rtrim(length_accounta($line->subledger_account), "0");
|
||||
} else {
|
||||
$tab[] = length_accountg($line->numero_compte);
|
||||
|
||||
@ -38,6 +38,11 @@ class AccountancySystem
|
||||
*/
|
||||
public $error = '';
|
||||
|
||||
/**
|
||||
* @var string[] Array of Errors code (or messages)
|
||||
*/
|
||||
public $errors = array();
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
|
||||
@ -159,7 +159,6 @@ if (empty($reshook)) {
|
||||
if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
$msg = '';
|
||||
|
||||
//print '<div><span style="color:red">' . $langs->trans("Processing") . '...</span></div>';
|
||||
if (!empty($mesCasesCochees)) {
|
||||
$msg = '<div>'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'</div>';
|
||||
$msg .= '<div class="detail">';
|
||||
@ -173,7 +172,7 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
$monCompte = GETPOST('codeventil'.$monId);
|
||||
|
||||
if ($monCompte <= 0) {
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</span></div>';
|
||||
$msg .= '<div><span class="error">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</span></div>';
|
||||
$ko++;
|
||||
} else {
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."expensereport_det";
|
||||
@ -185,10 +184,10 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
|
||||
dol_syslog('accountancy/expensereport/list.php:: sql='.$sql, LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
$msg .= '<div><span style="color:green">'.$langs->trans("LineOfExpenseReport").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
||||
$msg .= '<div><span class="green">'.$langs->trans("LineOfExpenseReport").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
||||
$ok++;
|
||||
} else {
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></span></div>';
|
||||
$msg .= '<div><span class="error">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></span></div>';
|
||||
$ko++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -434,7 +434,7 @@ if ($result) {
|
||||
$tabpay[$obj->rowid]["paymentsalid"] = $paymentsalstatic->id;
|
||||
|
||||
// This part of code is no more required. it is here to solve case where a link were missing (ith v14.0.0) and keep writing in accountancy complete.
|
||||
// Note: A better way to fix this is to delete payement of salary and recreate it, or to fix the bookkeeping table manually after.
|
||||
// Note: A better way to fix this is to delete payment of salary and recreate it, or to fix the bookkeeping table manually after.
|
||||
if (!empty($conf->global->ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USEr_ON_SALARY_BANK_PAYMENT)) {
|
||||
$tmpsalary = new Salary($db);
|
||||
$tmpsalary->fetch($paymentsalstatic->id);
|
||||
|
||||
@ -170,7 +170,6 @@ if (empty($reshook)) {
|
||||
if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
$msg = '';
|
||||
|
||||
//print '<div><span style="color:red">' . $langs->trans("Processing") . '...</span></div>';
|
||||
if (!empty($mesCasesCochees)) {
|
||||
$msg = '<div>'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'</div>';
|
||||
$msg .= '<div class="detail">';
|
||||
@ -184,7 +183,7 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
$monCompte = GETPOST('codeventil'.$monId);
|
||||
|
||||
if ($monCompte <= 0) {
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</span></div>';
|
||||
$msg .= '<div><span class="error">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</span></div>';
|
||||
$ko++;
|
||||
} else {
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
|
||||
@ -196,10 +195,10 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
|
||||
dol_syslog('accountancy/supplier/list.php', LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
$msg .= '<div><span style="color:green">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
||||
$msg .= '<div><span class="green">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
||||
$ok++;
|
||||
} else {
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></span></div>';
|
||||
$msg .= '<div><span class="error">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></span></div>';
|
||||
$ko++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
|
||||
$textobject = $langs->transnoentitiesnoconv("Members");
|
||||
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
|
||||
llxHeader('', $langs->trans("MembersSetup"), $help_url);
|
||||
|
||||
|
||||
|
||||
@ -99,7 +99,7 @@ if ($action == 'update') {
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $langs->trans("MembersSetup");
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
|
||||
|
||||
@ -66,11 +66,15 @@ if (GETPOST('actioncode', 'array')) {
|
||||
} else {
|
||||
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
|
||||
}
|
||||
$search_rowid = GETPOST('search_rowid');
|
||||
$search_agenda_label = GETPOST('search_agenda_label');
|
||||
|
||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||
$objcanvas = null;
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('memberagenda'));
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'adherent', $id);
|
||||
|
||||
@ -105,6 +109,7 @@ if (empty($reshook)) {
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
|
||||
$actioncode = '';
|
||||
$search_rowid = '';
|
||||
$search_agenda_label = '';
|
||||
}
|
||||
}
|
||||
@ -184,6 +189,7 @@ if ($object->id > 0) {
|
||||
// List of all actions
|
||||
$filters = array();
|
||||
$filters['search_agenda_label'] = $search_agenda_label;
|
||||
$filters['search_rowid'] = $search_rowid;
|
||||
|
||||
// TODO Replace this with same code than into list.php
|
||||
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
|
||||
|
||||
@ -1873,7 +1873,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print "</table>\n";
|
||||
|
||||
print "</div></div>\n";
|
||||
print '<div style="clear:both"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
@ -2286,9 +2286,11 @@ class Adherent extends CommonObject
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$datas = [];
|
||||
$langs->loadLangs(['members', 'companies']);
|
||||
$nofetch = !empty($params['nofetch']);
|
||||
|
||||
$datas = array();
|
||||
|
||||
$nofetch = empty($params['nofetch']) ? false : true;
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
$langs->load("users");
|
||||
return ['optimize' => $langs->trans("ShowUser")];
|
||||
@ -2298,11 +2300,13 @@ class Adherent extends CommonObject
|
||||
$photo .= Form::showphoto('memberphoto', $this, 80, 0, 0, 'photoref photowithmargin photologintooltip', 'small', 0, 1);
|
||||
$photo .= '</div>';
|
||||
$datas['photo'] = $photo;
|
||||
//$label .= '<div style="clear: both;"></div>';
|
||||
}
|
||||
|
||||
$datas['divopen'] = '<div class="centpercent">';
|
||||
$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Member").'</u> '.$this->getLibStatut(4);
|
||||
if (!empty($this->morphy)) {
|
||||
$datas['picto'] .= ' ' . $this->getmorphylib('', 1);
|
||||
}
|
||||
if (!empty($this->ref)) {
|
||||
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
}
|
||||
@ -2407,7 +2411,7 @@ class Adherent extends CommonObject
|
||||
if ($withpictoimg) {
|
||||
$paddafterimage = '';
|
||||
if (abs($withpictoimg) == 1) {
|
||||
$paddafterimage = 'style="margin-right: 3px;"';
|
||||
$morecss .= ' paddingrightonly';
|
||||
}
|
||||
// Only picto
|
||||
if ($withpictoimg > 0) {
|
||||
|
||||
@ -706,6 +706,18 @@ class AdherentType extends CommonObject
|
||||
if (isset($this->subscription)) {
|
||||
$datas['subscription'] = '<br>'.$langs->trans("SubscriptionRequired").': '.yn($this->subscription);
|
||||
}
|
||||
if (isset($this->vote)) {
|
||||
$datas['vote'] = '<br>'.$langs->trans("VoteAllowed").': '.yn($this->vote);
|
||||
}
|
||||
if (isset($this->duration)) {
|
||||
$datas['duration'] = '<br>'.$langs->trans("Duration").': '.$this->duration_value;
|
||||
if ($this->duration_value > 1) {
|
||||
$dur = array("i"=>$langs->trans("Minutes"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years"));
|
||||
} elseif ($this->duration_value > 0) {
|
||||
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year"));
|
||||
}
|
||||
$datas['duration'] .= " " . (!empty($this->duration_unit) && isset($dur[$this->duration_unit]) ? $langs->trans($dur[$this->duration_unit]) : '');
|
||||
}
|
||||
|
||||
return $datas;
|
||||
}
|
||||
@ -733,6 +745,7 @@ class AdherentType extends CommonObject
|
||||
'id' => $this->id,
|
||||
'objecttype' => $this->element,
|
||||
'option' => $option,
|
||||
'nofetch' => 1,
|
||||
];
|
||||
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
|
||||
$classfortooltip = 'classforajaxtooltip';
|
||||
|
||||
@ -77,7 +77,7 @@ $form = new Form($db);
|
||||
// Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
|
||||
$resultboxes = FormOther::getBoxesArea($user, "2");
|
||||
|
||||
llxHeader('', $langs->trans("Members"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
llxHeader('', $langs->trans("Members"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder');
|
||||
|
||||
$staticmember = new Adherent($db);
|
||||
$statictype = new AdherentType($db);
|
||||
|
||||
@ -104,7 +104,7 @@ if ($action == 'dolibarr2ldap') {
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder');
|
||||
|
||||
$head = member_prepare_head($object);
|
||||
|
||||
|
||||
@ -325,7 +325,7 @@ $membertypestatic = new AdherentType($db);
|
||||
$memberstatic = new Adherent($db);
|
||||
|
||||
// Page Header
|
||||
$title = $langs->trans("Members")." - ".$langs->trans("List");;
|
||||
$title = $langs->trans("Members")." - ".$langs->trans("List");
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
@ -1051,7 +1051,7 @@ while ($i < min($num, $limit)) {
|
||||
if ($mode == 'kanban') {
|
||||
if ($i == 0) {
|
||||
print '<tr><td colspan="12">';
|
||||
print '<div class="box-flex-container">';
|
||||
print '<div class="box-flex-container kanban">';
|
||||
}
|
||||
$membertypestatic->id = $obj->type_id;
|
||||
$membertypestatic->label = $obj->type;
|
||||
|
||||
@ -225,7 +225,7 @@ print '</td></tr></table>';
|
||||
|
||||
|
||||
print '</div></div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
@ -664,7 +664,7 @@ if ($rowid > 0) {
|
||||
print "</table>\n";
|
||||
|
||||
print "</div></div>\n";
|
||||
print '<div style="clear:both"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
@ -160,7 +160,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('adheren
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
|
||||
llxHeader('', $langs->trans("SubscriptionCard"), $help_url);
|
||||
|
||||
|
||||
@ -375,8 +375,8 @@ if ($rowid && $action != 'edit') {
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id;
|
||||
$genallowed = $user->rights->facture->lire;
|
||||
$delallowed = $user->rights->facture->creer;
|
||||
$genallowed = $user->hasRight('facture', 'lire');
|
||||
$delallowed = $user->hasRight('facture', 'creer');
|
||||
|
||||
print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
||||
$somethingshown = $formfile->numoffiles;
|
||||
|
||||
@ -249,7 +249,7 @@ if (!empty($date_select)) {
|
||||
$title .= ' ('.$langs->trans("Year").' '.$date_select.')';
|
||||
}
|
||||
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$i = 0;
|
||||
@ -532,7 +532,7 @@ while ($i < min($num, $limit)) {
|
||||
if ($mode == 'kanban') {
|
||||
if ($i == 0) {
|
||||
print '<tr><td colspan="12">';
|
||||
print '<div class="box-flex-container">';
|
||||
print '<div class="box-flex-container kanban">';
|
||||
}
|
||||
|
||||
//fetch informations needs on this mode
|
||||
|
||||
@ -37,10 +37,12 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->load("members");
|
||||
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
@ -55,13 +57,15 @@ $type = GETPOST('type', 'intcomma');
|
||||
$status = GETPOST('status', 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) {
|
||||
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
// If $page is not defined, or '' or -1 or if we click on clear filters
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@ -84,14 +88,12 @@ $comment = GETPOST("comment", 'restricthtml');
|
||||
$mail_valid = GETPOST("mail_valid", 'restricthtml');
|
||||
$caneditamount = GETPOSTINT("caneditamount");
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'adherent', $rowid, 'adherent_type');
|
||||
|
||||
// Initialize technical objects
|
||||
$object = new AdherentType($db);
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$hookmanager->initHooks(array('membertypecard', 'globalcard'));
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
@ -103,14 +105,22 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter_x'
|
||||
}
|
||||
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('membertypecard', 'globalcard'));
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'adherent', $rowid, 'adherent_type');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
}
|
||||
|
||||
if ($cancel) {
|
||||
$action = '';
|
||||
|
||||
@ -327,7 +337,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
if ($mode == 'kanban') {
|
||||
if ($i == 0) {
|
||||
print '<tr><td colspan="12">';
|
||||
print '<div class="box-flex-container">';
|
||||
print '<div class="box-flex-container kanban">';
|
||||
}
|
||||
//output kanban
|
||||
$membertype->label = $objp->label;
|
||||
@ -340,9 +350,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
print '<tr class="oddeven">';
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
if ($user->rights->adherent->configurer) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
|
||||
} else {
|
||||
print '<td class="right"> </td>';
|
||||
print '<td class="center"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
|
||||
}
|
||||
}
|
||||
print '<td class="nowraponall">';
|
||||
@ -367,8 +375,6 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
if ($user->rights->adherent->configurer) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
|
||||
} else {
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
}
|
||||
print "</tr>";
|
||||
@ -384,7 +390,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
$colspan++;
|
||||
}
|
||||
}*/
|
||||
$colspan = 8;
|
||||
$colspan = 9;
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
@ -522,7 +528,7 @@ if ($rowid > 0) {
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td colspan="2">'.$object->duration_value.' ';
|
||||
if ($object->duration_value > 1) {
|
||||
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years"));
|
||||
$dur = array("i"=>$langs->trans("Minutes"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years"));
|
||||
} elseif ($object->duration_value > 0) {
|
||||
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year"));
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ if ($action == "save" && empty($cancel)) {
|
||||
|
||||
// $wikihelp = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
|
||||
|
||||
llxHeader('', $langs->trans("AgendaSetup"), $help_url);
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
|
||||
$textobject = $langs->transnoentitiesnoconv("Agenda");
|
||||
|
||||
$wikihelp = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
$wikihelp = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
|
||||
llxHeader('', $langs->trans("AgendaSetup"), $wikihelp);
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
@ -185,7 +185,7 @@ $formother = new FormOther($db);
|
||||
$arrayofjs = array();
|
||||
$arrayofcss = array();
|
||||
|
||||
$wikihelp = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
$wikihelp = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
|
||||
llxHeader('', $langs->trans("AgendaSetup"), $wikihelp, '', 0, 0, $arrayofjs, $arrayofcss);
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
@ -182,7 +182,7 @@ if ($action == 'set') {
|
||||
$formactions = new FormActions($db);
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
$wikihelp = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
$wikihelp = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
|
||||
llxHeader('', $langs->trans("AgendaSetup"), $wikihelp);
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
@ -70,7 +70,7 @@ if (!isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) {
|
||||
$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY = 100;
|
||||
}
|
||||
|
||||
$wikihelp = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
$wikihelp = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
|
||||
llxHeader('', $langs->trans("AgendaSetup"), $wikihelp);
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
@ -32,10 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
|
||||
// Load translation files required by the page
|
||||
$langs->load("admin");
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$entity = GETPOST('entity', 'int');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
@ -44,7 +40,6 @@ $consts = GETPOST('const', 'array');
|
||||
$constname = GETPOST('constname', 'alphanohtml');
|
||||
$constvalue = GETPOST('constvalue', 'restricthtml'); // We should be able to send everything here
|
||||
$constnote = GETPOST('constnote', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
@ -63,12 +58,30 @@ if (empty($sortorder)) {
|
||||
$sortorder = 'ASC';
|
||||
}
|
||||
|
||||
if ($action == 'add' && GETPOST('update')) { // Click on button update must be used in priority before param $action
|
||||
$action = 'update';
|
||||
}
|
||||
if ($action == 'add' && GETPOST('delete')) { // Click on button update must be used in priority before param $action
|
||||
$action = 'delete';
|
||||
}
|
||||
if ($action == 'update' && GETPOST('add')) { // Click on button add must be used in priority before param $action
|
||||
$action = 'add';
|
||||
}
|
||||
if ($action == 'delete' && GETPOST('add')) { // Click on button add must be used in priority before param $action
|
||||
$action = 'add';
|
||||
}
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'add' || (GETPOST('add') && $action != 'update')) {
|
||||
// Add a new record
|
||||
if ($action == 'add') {
|
||||
$error = 0;
|
||||
|
||||
if (empty($constname)) {
|
||||
@ -157,13 +170,12 @@ jQuery(document).ready(function() {
|
||||
jQuery("#delconst").hide();
|
||||
jQuery(".checkboxfordelete").click(function() {
|
||||
jQuery("#delconst").show();
|
||||
jQuery("#action").val('delete');
|
||||
});
|
||||
jQuery(".inputforupdate").keyup(function() { // keypress does not support back
|
||||
var field_id = jQuery(this).attr("id");
|
||||
var row_num = field_id.split("_");
|
||||
jQuery("#updateconst").show();
|
||||
jQuery("#action").val('update');
|
||||
jQuery("#action").val('update'); // so default action if we type enter will be update, but correct action is also detected correctly without that when clicking on "Update" button.
|
||||
jQuery("#check_" + row_num[1]).prop("checked",true);
|
||||
});
|
||||
});
|
||||
@ -180,7 +192,7 @@ $param = '';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug) ? '?debug=1' : '').'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" id="action" name="action" value="">';
|
||||
print '<input type="hidden" id="action" name="action" value="add">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
|
||||
@ -329,7 +329,6 @@ class Dolistore
|
||||
$html .= '</small></h2>';
|
||||
$html .= '<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.dol_escape_htmltag($product->reference).' - '.dol_escape_htmltag($langs->trans('Id')).': '.((int) $product->id).'</small><br><br>'.dol_escape_htmltag($product->description_short->language[$this->lang - 1]).'</td>';
|
||||
// do not load if display none
|
||||
//$html .= '<td style="display:none;" class="long_description">'.$product->description->language[$this->lang - 1].'</td>';
|
||||
$html .= '<td class="margeCote center">';
|
||||
$html .= $price;
|
||||
$html .= '</td>';
|
||||
|
||||
@ -552,7 +552,7 @@ while ($i < $imaxinloop) {
|
||||
if ($mode == 'kanban') {
|
||||
if ($i == 0) {
|
||||
print '<tr><td colspan="'.$savnbfield.'">';
|
||||
print '<div class="box-flex-container">';
|
||||
print '<div class="box-flex-container kanban">';
|
||||
}
|
||||
// Output Kanban
|
||||
print $object->getKanbanView('');
|
||||
|
||||
@ -296,9 +296,13 @@ if ($resql) {
|
||||
$imageurl = $rssparser->getImageUrl();
|
||||
$linkrss = $rssparser->getLink();
|
||||
if (!preg_match('/^http/', $imageurl)) {
|
||||
$imageurl = $linkrss.$imageurl;
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
if (image_format_supported($imageurl) >= 0) {
|
||||
// If we are sure imageurl is a path to an image file, and if it does not start with http, we append root url to it.
|
||||
$imageurl = $linkrss.$imageurl;
|
||||
}
|
||||
}
|
||||
if ($imageurl) {
|
||||
if ($imageurl && preg_match('/^http', $imageurl)) {
|
||||
print '<img height="32" src="'.$imageurl.'">';
|
||||
} else {
|
||||
print $langs->trans("None");
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2021 Anthony Berton <bertonanthony@gmail.com>
|
||||
* Copyright (C) 2023 Eric Seigne <eric.seigne@cap-rel.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -298,13 +299,19 @@ if ($action == 'update') {
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == 'css') {
|
||||
//file_put_contents(DOL_DATA_ROOT.'/admin/customcss.css', $data);
|
||||
//dol_chmod(DOL_DATA_ROOT.'/admin/customcss.css');
|
||||
dolibarr_set_const($db, "MAIN_IHM_CUSTOM_CSS", GETPOST('MAIN_IHM_CUSTOM_CSS', 'restricthtml'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
$_SESSION["mainmenu"] = ""; // The menu manager may have changed
|
||||
|
||||
if (GETPOST('dol_resetcache')) {
|
||||
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", ((int) $conf->global->MAIN_IHM_PARAMS_REV) + 1, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".'&mode='.$mode.(GETPOSTISSET('page_y') ? '&page_y='.GETPOST('page_y', 'int') : ''));
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup&mode=".$mode.(GETPOSTISSET('page_y') ? '&page_y='.GETPOST('page_y', 'int') : ''));
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -314,7 +321,13 @@ if ($action == 'update') {
|
||||
*/
|
||||
|
||||
$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
|
||||
llxHeader('', $langs->trans("Setup"), $wikihelp);
|
||||
|
||||
llxHeader('', $langs->trans("Setup"), $wikihelp, '', 0, 0,
|
||||
array(
|
||||
'/includes/ace/src/ace.js',
|
||||
'/includes/ace/src/ext-statusbar.js',
|
||||
'/includes/ace/src/ext-language_tools.js',
|
||||
), array());
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
@ -679,8 +692,27 @@ if ($mode == 'login') {
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if ($mode == 'css') {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">';
|
||||
|
||||
//$customcssValue = file_get_contents(DOL_DATA_ROOT.'/admin/customcss.css');
|
||||
$customcssValue = getDolGlobalString('MAIN_IHM_CUSTOM_CSS');
|
||||
|
||||
$doleditor = new DolEditor('MAIN_IHM_CUSTOM_CSS', $customcssValue, '80%', 400, 'Basic', 'In', true, false, 'ace', 10, '90%');
|
||||
$doleditor->Create(0, '', true, 'css', 'css');
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
|
||||
print '<input class="button button-save reposition buttonforacesave" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
|
||||
print '<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -582,8 +582,6 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$moreforfilter .= '</li></ul></div>';
|
||||
|
||||
//$moreforfilter .= '<div class="floatright center marginrightonly hideonsmartphone" style="padding-top: 3px"><span class="paddingright">'.$moreinfo.'</span> '.$moreinfo2.'</div>';
|
||||
|
||||
$moreforfilter .= '<div class="divfilteralone colorbacktimesheet float valignmiddle">';
|
||||
$moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
|
||||
$moreforfilter .= img_picto($langs->trans("Filter"), 'filter', 'class="paddingright opacityhigh hideonsmartphone"').'<input type="text" id="search_keyword" name="search_keyword" class="maxwidth125" value="'.dol_escape_htmltag($search_keyword).'" placeholder="'.dol_escape_htmltag($langs->trans('Keyword')).'">';
|
||||
@ -761,7 +759,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
print load_fiche_titre($familytext, '', '', 0, '', 'modulefamilygroup');
|
||||
|
||||
if ($mode == 'commonkanban') {
|
||||
print '<div class="box-flex-container">';
|
||||
print '<div class="box-flex-container kanban">';
|
||||
} else {
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste" summary="list_of_modules">'."\n";
|
||||
|
||||
@ -80,8 +80,18 @@ if ($action == 'updateform') {
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$tmpumask = GETPOST('MAIN_UMASK', 'alpha');
|
||||
$tmpumask = (octdec($tmpumask) & 0666);
|
||||
$tmpumask = decoct($tmpumask);
|
||||
if (!preg_match('/^0/', $tmpumask)) {
|
||||
$tmpumask = '0'.$tmpumask;
|
||||
}
|
||||
if (empty($tmpumask) || $tmpumask === '0') {
|
||||
$tmpumask = '0664';
|
||||
}
|
||||
|
||||
$res3 = dolibarr_set_const($db, 'MAIN_UPLOAD_DOC', GETPOST('MAIN_UPLOAD_DOC', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res4 = dolibarr_set_const($db, "MAIN_UMASK", GETPOST('MAIN_UMASK', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res4 = dolibarr_set_const($db, "MAIN_UMASK", $tmpumask, 'chaine', 0, '', $conf->entity);
|
||||
$res5 = dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", trim($antivircommand), 'chaine', 0, '', $conf->entity);
|
||||
$res6 = dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", trim($antivirparam), 'chaine', 0, '', $conf->entity);
|
||||
if ($res3 && $res4 && $res5 && $res6) {
|
||||
|
||||
@ -82,14 +82,14 @@ print '<br>';
|
||||
// Module log
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("Syslog").'</strong>: ';
|
||||
$test = empty($conf->syslog->enabled);
|
||||
$test = !isModEnabled('syslog');
|
||||
if ($test) {
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' <span class="opacitymedium">'.$langs->trans("NotSlowedDownByThis").'</span>';
|
||||
} else {
|
||||
if ($conf->global->SYSLOG_LEVEL > LOG_NOTICE) {
|
||||
if (getDolGlobalInt('SYSLOG_LEVEL') > LOG_NOTICE) {
|
||||
print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedWithTooHighLogLevel", $langs->transnoentities("Syslog"));
|
||||
} else {
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), $conf->global->SYSLOG_LEVEL);
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), getDolGlobalInt('SYSLOG_LEVEL'));
|
||||
}
|
||||
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
|
||||
}
|
||||
|
||||
@ -453,14 +453,14 @@ print load_fiche_titre($langs->trans("Modules"), '', 'folder');
|
||||
|
||||
// Module log
|
||||
print '<strong>'.$langs->trans("Syslog").'</strong>: ';
|
||||
$test = empty($conf->syslog->enabled);
|
||||
$test = !isModEnabled('syslog');
|
||||
if ($test) {
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
|
||||
} else {
|
||||
if ($conf->global->SYSLOG_LEVEL > LOG_NOTICE) {
|
||||
if (getDolGlobalInt('SYSLOG_LEVEL') > LOG_NOTICE) {
|
||||
print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedWithTooHighLogLevel", $langs->transnoentities("Syslog"));
|
||||
} else {
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), $conf->global->SYSLOG_LEVEL);
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), getDolGlobalInt('SYSLOG_LEVEL'));
|
||||
}
|
||||
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
|
||||
}
|
||||
@ -580,14 +580,15 @@ print '<br>';
|
||||
print '<strong>MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED</strong> = '.getDolGlobalString('MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED', '<span class="opacitymedium">'.$langs->trans("Undefined").' ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>')."<br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCECSP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' <span class="opacitymedium">('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self'; img-src *;\")</span><br>";
|
||||
print '<strong>MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCECSP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' <span class="opacitymedium">('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src *; img-src * data:; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';\")</span><br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_SECURITY_FORCERP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"same-origin\" so browser doesn't send any referrer when going into another web site domain)</span><br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>WEBSITE_MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCECSP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
|
||||
print ' <span class="opacitymedium">('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self'; style-src https://cdnjs.cloudflare.com https://fonts.googleapis.com; script-src https://cdn.transifex.com https://www.googletagmanager.com; object-src https://youtube.com; frame-src https://youtube.com; img-src *;\")</span><br>";
|
||||
print ' <span class="opacitymedium">('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self' 'unsafe-inline'; style-src https://cdnjs.cloudflare.com https://fonts.googleapis.com 'unsafe-inline'; script-src https://cdn.transifex.com https://www.googletagmanager.com 'unsafe-inline'; object-src https://youtube.com; frame-src https://youtube.com; img-src * data:;\")</span><br>";
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<strong>WEBSITE_MAIN_SECURITY_FORCERP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"strict-origin-when-cross-origin\")</span><br>";
|
||||
|
||||
@ -169,7 +169,7 @@ print '<td class="liste_titre">';
|
||||
print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b><br>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="oddeven nohover"><td style="class="nohover">';
|
||||
print '<tr class="oddeven nohover"><td class="nohover">';
|
||||
|
||||
print '<table class="centpercent noborderbottom">';
|
||||
|
||||
|
||||
@ -38,8 +38,8 @@ $nbsecondsold = GETPOSTINT('nbsecondsold');
|
||||
|
||||
// Define filelog to discard it from purge
|
||||
$filelog = '';
|
||||
if (!empty($conf->syslog->enabled)) {
|
||||
$filelog = $conf->global->SYSLOG_FILE;
|
||||
if (isModEnabled('syslog')) {
|
||||
$filelog = getDolGlobalString('SYSLOG_FILE');
|
||||
$filelog = preg_replace('/DOL_DATA_ROOT/i', DOL_DATA_ROOT, $filelog);
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ print '<table class="border centpercent">';
|
||||
|
||||
print '<tr class="border"><td style="padding: 4px">';
|
||||
|
||||
if (!empty($conf->syslog->enabled)) {
|
||||
if (isModEnabled('syslog')) {
|
||||
print '<input type="radio" name="choice" id="choicelogfile" value="logfile"';
|
||||
print ($choice && $choice == 'logfile') ? ' checked' : '';
|
||||
$filelogparam = $filelog;
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2022 SuperAdmin <test@dolibarr.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -23,39 +22,7 @@
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res = 0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
||||
}
|
||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
|
||||
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
|
||||
$i--; $j--;
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
|
||||
$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
|
||||
$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
|
||||
}
|
||||
// Try main.inc.php using relative path
|
||||
if (!$res && file_exists("../main.inc.php")) {
|
||||
$res = @include "../main.inc.php";
|
||||
}
|
||||
if (!$res && file_exists("../../main.inc.php")) {
|
||||
$res = @include "../../main.inc.php";
|
||||
}
|
||||
if (!$res && file_exists("../../../main.inc.php")) {
|
||||
$res = @include "../../../main.inc.php";
|
||||
}
|
||||
if (!$res) {
|
||||
die("Include of main fails");
|
||||
}
|
||||
|
||||
global $langs, $user;
|
||||
|
||||
// Libraries
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||
require_once DOL_DOCUMENT_ROOT.'/webhook/lib/webhook.lib.php';
|
||||
|
||||
@ -80,65 +47,27 @@ $label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type = 'myobject';
|
||||
|
||||
$arrayofparameters = array(
|
||||
'WEBHOOK_MYPARAM1'=>array('type'=>'string', 'css'=>'minwidth500' ,'enabled'=>0),
|
||||
//'WEBHOOK_MYPARAM2'=>array('type'=>'textarea','enabled'=>1),
|
||||
//'WEBHOOK_MYPARAM3'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
|
||||
//'WEBHOOK_MYPARAM4'=>array('type'=>'emailtemplate:thirdparty', 'enabled'=>1),
|
||||
//'WEBHOOK_MYPARAM5'=>array('type'=>'yesno', 'enabled'=>1),
|
||||
//'WEBHOOK_MYPARAM5'=>array('type'=>'thirdparty_type', 'enabled'=>1),
|
||||
//'WEBHOOK_MYPARAM6'=>array('type'=>'securekey', 'enabled'=>1),
|
||||
//'WEBHOOK_MYPARAM7'=>array('type'=>'product', 'enabled'=>1),
|
||||
);
|
||||
|
||||
$error = 0;
|
||||
$setupnotempty = 0;
|
||||
|
||||
// Set this to 1 to use the factory to manage constants. Warning, the generated module will be compatible with version v15+ only
|
||||
$useFormSetup = 0;
|
||||
// Convert arrayofparameter into a formSetup object
|
||||
if ($useFormSetup && (float) DOL_VERSION >= 15) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
|
||||
$formSetup = new FormSetup($db);
|
||||
$useFormSetup = 1;
|
||||
|
||||
// you can use the param convertor
|
||||
$formSetup->addItemsFromParamsArray($arrayofparameters);
|
||||
|
||||
// or use the new system see exemple as follow (or use both because you can ;-) )
|
||||
|
||||
/*
|
||||
// Hôte
|
||||
$item = $formSetup->newItem('NO_PARAM_JUST_TEXT');
|
||||
$item->fieldOverride = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'];
|
||||
$item->cssClass = 'minwidth500';
|
||||
|
||||
// Setup conf WEBHOOK_MYPARAM1 as a simple string input
|
||||
$item = $formSetup->newItem('WEBHOOK_MYPARAM1');
|
||||
|
||||
// Setup conf WEBHOOK_MYPARAM1 as a simple textarea input but we replace the text of field title
|
||||
$item = $formSetup->newItem('WEBHOOK_MYPARAM2');
|
||||
$item->nameText = $item->getNameText().' more html text ';
|
||||
|
||||
// Setup conf WEBHOOK_MYPARAM3
|
||||
$item = $formSetup->newItem('WEBHOOK_MYPARAM3');
|
||||
$item->setAsThirdpartyType();
|
||||
|
||||
// Setup conf WEBHOOK_MYPARAM4 : exemple of quick define write style
|
||||
$formSetup->newItem('WEBHOOK_MYPARAM4')->setAsYesNo();
|
||||
|
||||
// Setup conf WEBHOOK_MYPARAM5
|
||||
$formSetup->newItem('WEBHOOK_MYPARAM5')->setAsEmailTemplate('thirdparty');
|
||||
|
||||
// Setup conf WEBHOOK_MYPARAM6
|
||||
$formSetup->newItem('WEBHOOK_MYPARAM6')->setAsSecureKey()->enabled = 0; // disabled
|
||||
|
||||
// Setup conf WEBHOOK_MYPARAM7
|
||||
$formSetup->newItem('WEBHOOK_MYPARAM7')->setAsProduct();
|
||||
*/
|
||||
|
||||
$setupnotempty = count($formSetup->items);
|
||||
if (!class_exists('FormSetup')) {
|
||||
// For retrocompatibility Dolibarr < 16.0
|
||||
if (floatval(DOL_VERSION) < 16.0 && !class_exists('FormSetup')) {
|
||||
require_once __DIR__.'/../backport/v16/core/class/html.formsetup.class.php';
|
||||
} else {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
|
||||
}
|
||||
}
|
||||
|
||||
$formSetup = new FormSetup($db);
|
||||
|
||||
|
||||
$setupnotempty = count($formSetup->items);
|
||||
|
||||
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
@ -179,7 +108,7 @@ if ($action == 'updateMask') {
|
||||
$file = dol_buildpath($reldir."core/modules/webhook/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
|
||||
if (file_exists($file)) {
|
||||
$filefound = 1;
|
||||
$classname = "pdf_".$modele;
|
||||
$classname = "pdf_".$modele."_".strtolower($tmpobjectkey);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -190,7 +119,7 @@ if ($action == 'updateMask') {
|
||||
$module = new $classname($db);
|
||||
|
||||
if ($module->write_file($tmpobject, $langs) > 0) {
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=webhook-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
|
||||
return;
|
||||
} else {
|
||||
setEventMessages($module->error, null, 'errors');
|
||||
@ -266,7 +195,7 @@ print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
|
||||
|
||||
// Configuration header
|
||||
$head = webhookAdminPrepareHead();
|
||||
print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "webhook@webhook");
|
||||
print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "webhook");
|
||||
|
||||
// Setup page goes here
|
||||
echo '<span class="opacitymedium">'.$langs->trans("WebhookSetupPage").'</span><br><br>';
|
||||
|
||||
@ -746,7 +746,7 @@ class Documents extends DolibarrApi
|
||||
if ($fhandle) {
|
||||
$nbofbyteswrote = fwrite($fhandle, $newfilecontent);
|
||||
fclose($fhandle);
|
||||
@chmod($destfiletmp, octdec($conf->global->MAIN_UMASK));
|
||||
dolChmod($destfiletmp);
|
||||
} else {
|
||||
throw new RestException(500, "Failed to open file '".$destfiletmp."' for write");
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id;
|
||||
}
|
||||
|
||||
$permissiontoadd = $user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontoadd = $user->hasRight('asset', 'write'); // Used by the include of actions_addupdatedelete.inc.php
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
|
||||
@ -48,6 +48,7 @@ if (GETPOST('actioncode', 'array')) {
|
||||
} else {
|
||||
$actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
|
||||
}
|
||||
$search_rowid = GETPOST('search_rowid');
|
||||
$search_agenda_label = GETPOST('search_agenda_label');
|
||||
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
@ -81,7 +82,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->asset->multidir_output[$object->entity]."/".$object->id;
|
||||
}
|
||||
|
||||
$permissiontoadd = $user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontoadd = $user->hasRight('asset', 'write'); // Used by the include of actions_addupdatedelete.inc.php
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
@ -125,7 +126,7 @@ $form = new Form($db);
|
||||
if ($object->id > 0) {
|
||||
$title = $langs->trans("Agenda");
|
||||
//if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
|
||||
$help_url = 'EN:Module_Agenda_En';
|
||||
$help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
if (isModEnabled('notification')) {
|
||||
@ -205,6 +206,7 @@ if ($object->id > 0) {
|
||||
// List of all actions
|
||||
$filters = array();
|
||||
$filters['search_agenda_label'] = $search_agenda_label;
|
||||
$filters['search_rowid'] = $search_rowid;
|
||||
|
||||
// TODO Replace this with same code than into list.php
|
||||
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, $object->module);
|
||||
|
||||
@ -69,11 +69,11 @@ if (empty($action) && empty($id) && empty($ref)) {
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
|
||||
|
||||
$permissiontoread = $user->rights->asset->read;
|
||||
$permissiontoadd = $user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = $user->rights->asset->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$permissionnote = $user->rights->asset->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->asset->write; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoread = $user->hasRight('asset', 'read');
|
||||
$permissiontoadd = $user->hasRight('asset', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = $user->hasRight('asset', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$permissionnote = $user->hasRight('asset', 'write'); // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->hasRight('asset', 'write'); // Used by the include of actions_dellink.inc.php
|
||||
$upload_dir = $conf->asset->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
@ -395,8 +395,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$relativepath = $objref.'/'.$objref.'.pdf';
|
||||
$filedir = $conf->asset->dir_output.'/'.$objref;
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
$genallowed = $user->rights->asset->read; // If you can read, you can build the PDF to read content
|
||||
$delallowed = $user->rights->asset->write; // If you can create/edit, you can remove a file on card
|
||||
$genallowed = $user->hasRight('asset', 'read'); // If you can read, you can build the PDF to read content
|
||||
$delallowed = $user->hasRight('asset', 'write'); // If you can create/edit, you can remove a file on card
|
||||
print $formfile->showdocuments('asset:Asset', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
|
||||
}
|
||||
|
||||
|
||||
@ -157,6 +157,11 @@ class Asset extends CommonObject
|
||||
public $status;
|
||||
public $user_cloture_id;
|
||||
|
||||
/**
|
||||
* @var Asset object oldcopy
|
||||
*/
|
||||
public $oldcopy;
|
||||
|
||||
// /**
|
||||
// * @var string Field with ID of parent key if this object has a parent
|
||||
// */
|
||||
|
||||
@ -53,7 +53,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id;
|
||||
}
|
||||
|
||||
$permissiontoadd = $user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontoadd = $user->hasRight('asset', 'write'); // Used by the include of actions_addupdatedelete.inc.php
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
|
||||
@ -51,8 +51,8 @@ if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->asset->multidir_output[$object->entity]."/".$object->id;
|
||||
}
|
||||
|
||||
$permissionnote = $user->rights->asset->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiontoadd = $user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissionnote = $user->hasRight('asset', 'write'); // Used by the include of actions_setnotes.inc.php
|
||||
$permissiontoadd = $user->hasRight('asset', 'write'); // Used by the include of actions_addupdatedelete.inc.php
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
|
||||
@ -142,9 +142,9 @@ if ($object->id) {
|
||||
print dol_get_fiche_end();
|
||||
|
||||
$modulepart = 'asset';
|
||||
$permissiontoadd = $user->rights->asset->write;
|
||||
$permissiontoadd = $user->hasRight('asset', 'write');
|
||||
// $permissiontoadd = 1;
|
||||
$permtoedit = $user->rights->asset->write;
|
||||
$permtoedit = $user->hasRight('asset', 'write');
|
||||
// $permtoedit = 1;
|
||||
$param = '&id=' . $object->id;
|
||||
|
||||
|
||||
@ -120,9 +120,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
$permissiontoread = $user->rights->asset->read;
|
||||
$permissiontoadd = $user->rights->asset->write;
|
||||
$permissiontodelete = $user->rights->asset->delete;
|
||||
$permissiontoread = $user->hasRight('asset', 'read');
|
||||
$permissiontoadd = $user->hasRight('asset', 'write');
|
||||
$permissiontodelete = $user->hasRight('asset', 'delete');
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('asset')) {
|
||||
|
||||
@ -48,7 +48,8 @@ if (GETPOST('actioncode', 'array')) {
|
||||
} else {
|
||||
$actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
|
||||
}
|
||||
$search_agenda_label = GETPOST('search_agenda_label');
|
||||
//$search_rowid = GETPOST('search_rowid');
|
||||
//$search_agenda_label = GETPOST('search_agenda_label');
|
||||
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
@ -127,7 +128,7 @@ $form = new Form($db);
|
||||
if ($object->id > 0) {
|
||||
$title = $langs->trans("Agenda");
|
||||
//if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
|
||||
$help_url = 'EN:Module_Agenda_En';
|
||||
$help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
if (isModEnabled('notification')) {
|
||||
@ -207,6 +208,7 @@ if ($object->id > 0) {
|
||||
// // List of all actions
|
||||
// $filters = array();
|
||||
// $filters['search_agenda_label'] = $search_agenda_label;
|
||||
// $filters['search_rowid'] = $search_rowid;
|
||||
//
|
||||
// // TODO Replace this with same code than into list.php
|
||||
// show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, $object->module);
|
||||
|
||||
@ -51,8 +51,8 @@ if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->asset->multidir_output[$object->entity]."/".$object->id;
|
||||
}
|
||||
|
||||
$permissionnote = $user->rights->asset->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiontoadd = $user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissionnote = $user->hasRight('asset', 'write'); // Used by the include of actions_setnotes.inc.php
|
||||
$permissiontoadd = $user->hasRight('asset', 'write'); // Used by the include of actions_addupdatedelete.inc.php
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
|
||||
@ -52,6 +52,7 @@ if (GETPOST('actioncode', 'array')) {
|
||||
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
|
||||
}
|
||||
|
||||
$search_rowid = GETPOST('search_rowid');
|
||||
$search_agenda_label = GETPOST('search_agenda_label');
|
||||
|
||||
// Load variables for pagination
|
||||
@ -249,6 +250,7 @@ if ($object->id > 0) {
|
||||
// List of all actions
|
||||
$filters = array();
|
||||
$filters['search_agenda_label'] = $search_agenda_label;
|
||||
$filters['search_rowid'] = $search_rowid;
|
||||
|
||||
// TODO Replace this with same code than into list.php
|
||||
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
|
||||
|
||||
@ -87,10 +87,10 @@ $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
$result = restrictedArea($user, 'bom', $object->id, 'bom_bom', '', '', 'rowid', $isdraft);
|
||||
|
||||
// Permissions
|
||||
$permissionnote = $user->rights->bom->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->bom->write; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoadd = $user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$permissionnote = $user->hasRight('bom', 'write'); // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->hasRight('bom', 'write'); // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoadd = $user->hasRight('bom', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = $user->hasRight('bom', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$upload_dir = $conf->bom->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
|
||||
|
||||
@ -768,8 +768,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$relativepath = $objref.'/'.$objref.'.pdf';
|
||||
$filedir = $conf->bom->dir_output.'/'.$objref;
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
$genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content
|
||||
$delallowed = $user->rights->bom->write; // If you can create/edit, you can remove a file on card
|
||||
$genallowed = $user->hasRight('bom', 'read'); // If you can read, you can build the PDF to read content
|
||||
$delallowed = $user->hasRight('bom', 'write'); // If you can create/edit, you can remove a file on card
|
||||
print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
|
||||
|
||||
// Show links to link elements
|
||||
|
||||
@ -85,7 +85,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
restrictedArea($user, 'bom', $object->id, 'bom_bom', '', '', 'rowid', $isdraft);
|
||||
|
||||
$permissiontoadd = $user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
|
||||
$permissiontoadd = $user->hasRight('bom', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
|
||||
|
||||
|
||||
/*
|
||||
@ -148,8 +148,8 @@ if ($object->id) {
|
||||
print dol_get_fiche_end();
|
||||
|
||||
$modulepart = 'bom';
|
||||
$permissiontoadd = $user->rights->bom->write;
|
||||
$permtoedit = $user->rights->bom->write;
|
||||
$permissiontoadd = $user->hasRight('bom', 'write');
|
||||
$permtoedit = $user->hasRight('bom', 'write');
|
||||
$param = '&id='.$object->id;
|
||||
|
||||
//$relativepathwithnofile='bom/' . dol_sanitizeFileName($object->id).'/';
|
||||
|
||||
@ -121,9 +121,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
$permissiontoread = $user->rights->bom->read;
|
||||
$permissiontoadd = $user->rights->bom->write;
|
||||
$permissiontodelete = $user->rights->bom->delete;
|
||||
$permissiontoread = $user->hasRight('bom', 'read');
|
||||
$permissiontoadd = $user->hasRight('bom', 'write');
|
||||
$permissiontodelete = $user->hasRight('bom', 'delete');
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0) {
|
||||
@ -175,8 +175,8 @@ if (empty($reshook)) {
|
||||
// Mass actions
|
||||
$objectclass = 'BOM';
|
||||
$objectlabel = 'BillOfMaterials';
|
||||
$permissiontoread = $user->rights->bom->read;
|
||||
$permissiontodelete = $user->rights->bom->delete;
|
||||
$permissiontoread = $user->hasRight('bom', 'read');
|
||||
$permissiontodelete = $user->hasRight('bom', 'delete');
|
||||
$uploaddir = $conf->bom->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
@ -685,7 +685,7 @@ while ($i < $imaxinloop) {
|
||||
if ($mode == 'kanban') {
|
||||
if ($i == 0) {
|
||||
print '<tr><td colspan="'.$savnbfield.'">';
|
||||
print '<div class="box-flex-container">';
|
||||
print '<div class="box-flex-container kanban">';
|
||||
}
|
||||
// Output kanban
|
||||
print $object->getKanbanView('');
|
||||
|
||||
@ -84,10 +84,10 @@ $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
$result = restrictedArea($user, 'bom', $object->id, 'bom_bom', '', '', 'rowid', $isdraft);
|
||||
|
||||
// Permissions
|
||||
$permissionnote = $user->rights->bom->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->bom->write; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoadd = $user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$permissionnote = $user->hasRight('bom', 'write'); // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->hasRight('bom', 'write'); // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoadd = $user->hasRight('bom', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = $user->hasRight('bom', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$upload_dir = $conf->bom->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
|
||||
|
||||
@ -214,6 +214,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<a id="hide_all" href="#">'.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'</a> ';
|
||||
}
|
||||
print '</td>';
|
||||
if ($action == 'treeview') print '<td class="left">'.$langs->trans('ProducedBy').'</td>';
|
||||
print '<td class="linecolqty right">'.$langs->trans('Quantity').'</td>';
|
||||
print '<td class="linecolstock right">'.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).'</td>';
|
||||
print '<td class="linecoltheoricalstock right">'.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).'</td>';
|
||||
@ -226,13 +227,17 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
foreach ($TChildBom as $fk_bom => $TProduct) {
|
||||
$repeatChar = ' ';
|
||||
if (!empty($TProduct['bom'])) {
|
||||
$prod = new Product($db);
|
||||
$prod->fetch($TProduct['bom']->fk_product);
|
||||
if ($TProduct['parentid'] != $object->id) print '<tr class="sub_bom_lines oddeven" parentid="'.$TProduct['parentid'].'">';
|
||||
else print '<tr class="oddeven">';
|
||||
print '<td class="linecoldescription">'.str_repeat($repeatChar, $TProduct['level']).$TProduct['bom']->getNomUrl(1);
|
||||
if ($action == 'treeview') print '<td class="linecoldescription">'.str_repeat($repeatChar, $TProduct['level']).$prod->getNomUrl(1);
|
||||
else print '<td class="linecoldescription">'.str_repeat($repeatChar, $TProduct['level']).$TProduct['bom']->getNomUrl(1);
|
||||
print ' <a class="collapse_bom" id="collapse-'.$fk_bom.'" href="#">';
|
||||
print img_picto('', 'folder-open');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
if ($action == 'treeview') print '<td class="left">'.$TProduct['bom']->getNomUrl(1).'</td>';
|
||||
print '<td class="linecolqty right">'.$TProduct['qty'].'</td>';
|
||||
print '<td class="linecolstock right"></td>';
|
||||
print '<td class="linecoltheoricalstock right"></td>';
|
||||
@ -247,6 +252,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if ($fk_bom != $object->id) print '<tr class="sub_bom_lines oddeven" parentid="'.$fk_bom.'">';
|
||||
else print '<tr class="oddeven">';
|
||||
print '<td class="linecoldescription">'.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).'</td>';
|
||||
if ($action == 'treeview') print '<td></td>';
|
||||
print '<td class="linecolqty right">'.$TInfos['qty'].'</td>';
|
||||
print '<td class="linecolstock right">'.price2num($prod->stock_reel, 'MS').'</td>';
|
||||
print '<td class="linecoltheoricalstock right">'.$prod->stock_theorique.'</td>';
|
||||
@ -290,20 +296,30 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
$(document).ready(function() {
|
||||
// When clicking on collapse
|
||||
$(".collapse_bom").click(function() {
|
||||
console.log("We click on collapse");
|
||||
var id_bom_line = $(this).attr('id').replace('collapse-', '');
|
||||
console.log($(this).html().indexOf('folder-open'));
|
||||
if($(this).html().indexOf('folder-open') <= 0) {
|
||||
|
||||
function folderManage(element) {
|
||||
var id_bom_line = element.attr('id').replace('collapse-', '');
|
||||
let TSubLines = $('[parentid="'+ id_bom_line +'"]');
|
||||
|
||||
if(element.html().indexOf('folder-open') <= 0) {
|
||||
$('[parentid="'+ id_bom_line +'"]').show();
|
||||
$(this).html('<?php echo dol_escape_js(img_picto('', 'folder-open')); ?>');
|
||||
element.html('<?php echo dol_escape_js(img_picto('', 'folder-open')); ?>');
|
||||
}
|
||||
else {
|
||||
$('[parentid="'+ id_bom_line +'"]').hide();
|
||||
$(this).html('<?php echo dol_escape_js(img_picto('', 'folder')); ?>');
|
||||
for (let i = 0; i < TSubLines.length; i++) {
|
||||
let subBomFolder = $(TSubLines[i]).children('.linecoldescription').children('.collapse_bom');
|
||||
if (subBomFolder.length > 0) {
|
||||
folderManage(subBomFolder);
|
||||
}
|
||||
}
|
||||
TSubLines.hide();
|
||||
element.html('<?php echo dol_escape_js(img_picto('', 'folder')); ?>');
|
||||
}
|
||||
}
|
||||
|
||||
// When clicking on collapse
|
||||
$(".collapse_bom").click(function() {
|
||||
folderManage($(this));
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id;
|
||||
}
|
||||
|
||||
$permissionnote = $user->rights->bom->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissionnote = $user->hasRight('bom', 'write'); // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
|
||||
@ -2,85 +2,8 @@
|
||||
|
||||
## Features
|
||||
|
||||
Description of the module...
|
||||
Provide features to be able to record online booking.
|
||||
|
||||
<!--
|
||||
{imgmd}
|
||||
-->
|
||||
|
||||
Other external modules are available on [Dolistore.com](https://www.dolistore.com).
|
||||
|
||||
## Translations
|
||||
|
||||
Translations can be completed manually by editing files into directories *langs*.
|
||||
|
||||
<!--
|
||||
This module contains also a sample configuration for Transifex, under the hidden directory [.tx](.tx), so it is possible to manage translation using this service.
|
||||
|
||||
For more informations, see the [translator's documentation](https://wiki.dolibarr.org/index.php/Translator_documentation).
|
||||
|
||||
There is a [Transifex project](https://transifex.com/projects/p/dolibarr-module-template) for this module.
|
||||
-->
|
||||
|
||||
<!--
|
||||
|
||||
## Installation
|
||||
|
||||
### From the ZIP file and GUI interface
|
||||
|
||||
If the module is a ready to deploy zip file, so with a name module_xxx-version.zip (like when downloading it from a market place like [Dolistore](https://www.dolistore.com)),
|
||||
go into menu ```Home - Setup - Modules - Deploy external module``` and upload the zip file.
|
||||
|
||||
Note: If this screen tell you that there is no "custom" directory, check that your setup is correct:
|
||||
|
||||
- In your Dolibarr installation directory, edit the ```htdocs/conf/conf.php``` file and check that following lines are not commented:
|
||||
|
||||
```php
|
||||
//$dolibarr_main_url_root_alt ...
|
||||
//$dolibarr_main_document_root_alt ...
|
||||
```
|
||||
|
||||
- Uncomment them if necessary (delete the leading ```//```) and assign a sensible value according to your Dolibarr installation
|
||||
|
||||
For example :
|
||||
|
||||
- UNIX:
|
||||
```php
|
||||
$dolibarr_main_url_root_alt = '/custom';
|
||||
$dolibarr_main_document_root_alt = '/var/www/Dolibarr/htdocs/custom';
|
||||
```
|
||||
|
||||
- Windows:
|
||||
```php
|
||||
$dolibarr_main_url_root_alt = '/custom';
|
||||
$dolibarr_main_document_root_alt = 'C:/My Web Sites/Dolibarr/htdocs/custom';
|
||||
```
|
||||
|
||||
### From a GIT repository
|
||||
|
||||
Clone the repository in ```$dolibarr_main_document_root_alt/bookcal```
|
||||
|
||||
```sh
|
||||
cd ....../custom
|
||||
git clone git@github.com:gitlogin/bookcal.git bookcal
|
||||
```
|
||||
|
||||
### <a name="final_steps"></a>Final steps
|
||||
|
||||
From your browser:
|
||||
|
||||
- Log into Dolibarr as a super-administrator
|
||||
- Go to "Setup" -> "Modules"
|
||||
- You should now be able to find and enable the module
|
||||
|
||||
-->
|
||||
|
||||
## Licenses
|
||||
|
||||
### Main code
|
||||
|
||||
GPLv3 or (at your option) any later version. See file COPYING for more information.
|
||||
|
||||
### Documentation
|
||||
|
||||
All texts and readmes are licensed under GFDL.
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
@ -50,6 +49,8 @@ if (GETPOST('actioncode', 'array')) {
|
||||
} 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));
|
||||
}
|
||||
|
||||
$search_rowid = GETPOST('search_rowid');
|
||||
$search_agenda_label = GETPOST('search_agenda_label');
|
||||
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
@ -138,7 +139,7 @@ $form = new Form($db);
|
||||
if ($object->id > 0) {
|
||||
$title = $langs->trans("Agenda");
|
||||
//if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
|
||||
$help_url = 'EN:Module_Agenda_En';
|
||||
$help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
if (!empty($conf->notification->enabled)) {
|
||||
@ -255,6 +256,7 @@ if ($object->id > 0) {
|
||||
// List of all actions
|
||||
$filters = array();
|
||||
$filters['search_agenda_label'] = $search_agenda_label;
|
||||
$filters['search_rowid'] = $search_rowid;
|
||||
|
||||
// TODO Replace this with same code than into list.php
|
||||
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, $object->module);
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/bookcal/class/availabilities.class.php';
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
@ -639,7 +638,7 @@ while ($i < $imaxinloop) {
|
||||
if ($mode == 'kanban') {
|
||||
if ($i == 0) {
|
||||
print '<tr><td colspan="'.$savnbfield.'">';
|
||||
print '<div class="box-flex-container">';
|
||||
print '<div class="box-flex-container kanban">';
|
||||
}
|
||||
// Output Kanban
|
||||
print $object->getKanbanView('');
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/bookcal/class/availabilities.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_availabilities.lib.php';
|
||||
|
||||
|
||||
@ -26,7 +26,6 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
@ -50,6 +49,8 @@ if (GETPOST('actioncode', 'array')) {
|
||||
} 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));
|
||||
}
|
||||
|
||||
$search_rowid = GETPOST('search_rowid');
|
||||
$search_agenda_label = GETPOST('search_agenda_label');
|
||||
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
@ -138,7 +139,7 @@ $form = new Form($db);
|
||||
if ($object->id > 0) {
|
||||
$title = $langs->trans("Agenda");
|
||||
//if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
|
||||
$help_url = 'EN:Module_Agenda_En';
|
||||
$help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
if (!empty($conf->notification->enabled)) {
|
||||
@ -255,6 +256,7 @@ if ($object->id > 0) {
|
||||
// List of all actions
|
||||
$filters = array();
|
||||
$filters['search_agenda_label'] = $search_agenda_label;
|
||||
$filters['search_rowid'] = $search_rowid;
|
||||
|
||||
// TODO Replace this with same code than into list.php
|
||||
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, $object->module);
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/bookcal/class/booking.class.php';
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
@ -639,7 +638,7 @@ while ($i < $imaxinloop) {
|
||||
if ($mode == 'kanban') {
|
||||
if ($i == 0) {
|
||||
print '<tr><td colspan="'.$savnbfield.'">';
|
||||
print '<div class="box-flex-container">';
|
||||
print '<div class="box-flex-container kanban">';
|
||||
}
|
||||
// Output Kanban
|
||||
print $object->getKanbanView('');
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/bookcal/class/booking.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_booking.lib.php';
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ function printDropdownBookmarksList()
|
||||
|
||||
$authorized_var=array('limit','optioncss','contextpage');
|
||||
$url = $_SERVER["PHP_SELF"];
|
||||
$url_param=array();
|
||||
$url_param = array();
|
||||
if (!empty($_SERVER["QUERY_STRING"])) {
|
||||
if (is_array($_GET)) {
|
||||
foreach ($_GET as $key => $val) {
|
||||
@ -79,7 +79,7 @@ function printDropdownBookmarksList()
|
||||
|
||||
$url .= ($tmpurl ? '?'.$tmpurl : '');
|
||||
if (!empty($url_param)) {
|
||||
$url .= '&'.implode('&', $url_param);
|
||||
$url .= (strpos($url, '?') > 0 ? '&' : '?').implode('&', $url_param);
|
||||
}
|
||||
|
||||
$searchForm = '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
|
||||
@ -102,6 +102,7 @@ function printDropdownBookmarksList()
|
||||
$listbtn .= img_picto('', 'edit', 'class="paddingright opacitymedium"').$langs->trans('EditBookmarks').'</a>';
|
||||
|
||||
$bookmarkList = '';
|
||||
$bookmarkNb = 0;
|
||||
// Menu with list of bookmarks
|
||||
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
|
||||
$sql .= " WHERE (fk_user = ".((int) $user->id)." OR fk_user is NULL OR fk_user = 0)";
|
||||
@ -116,6 +117,7 @@ function printDropdownBookmarksList()
|
||||
$bookmarkList .= dol_escape_htmltag($obj->title);
|
||||
$bookmarkList .= '</a>';
|
||||
$i++;
|
||||
$bookmarkNb++;
|
||||
}
|
||||
$bookmarkList .= '</div>';
|
||||
|
||||
@ -141,6 +143,7 @@ function printDropdownBookmarksList()
|
||||
$searchForm .= dol_escape_htmltag($obj->title);
|
||||
$searchForm .= '</option>';
|
||||
$i++;
|
||||
$bookmarkNb++;
|
||||
}
|
||||
$searchForm .= '</select>';
|
||||
}
|
||||
@ -196,17 +199,16 @@ function printDropdownBookmarksList()
|
||||
<!-- Menu bookmark tools-->
|
||||
<div class="bookmark-footer">
|
||||
'.$newbtn.$listbtn.'
|
||||
<div style="clear:both;"></div>
|
||||
<div class="clearboth"></div>
|
||||
</div>
|
||||
';
|
||||
|
||||
$html .= '
|
||||
<!-- Menu Body -->
|
||||
<div class="bookmark-body dropdown-body">
|
||||
'.$bookmarkList.'
|
||||
<span id="top-bookmark-search-nothing-found" class="hidden-search-result opacitymedium">'.dol_escape_htmltag($langs->trans("NoBookmarkFound")).'</span>
|
||||
</div>
|
||||
';
|
||||
<!-- Menu Body -->
|
||||
<div class="bookmark-body dropdown-body">'.$bookmarkList.'
|
||||
<span id="top-bookmark-search-nothing-found" class="'.($bookmarkNb ? 'hidden-search-result ' : '').'opacitymedium">'.dol_escape_htmltag($langs->trans("NoBookmarkFound")).'</span>
|
||||
</div>
|
||||
';
|
||||
|
||||
$html .= '<!-- script to open/close the popup -->
|
||||
<script>
|
||||
|
||||
@ -29,8 +29,6 @@ require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
|
||||
$langs->loadLangs(array('bookmarks', 'admin'));
|
||||
|
||||
// Get Parameters
|
||||
$id = GETPOST("id", 'int');
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$show_files = GETPOST('show_files', 'int');
|
||||
@ -40,7 +38,9 @@ $toselect = GETPOST('toselect', 'array');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bookmarklist'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$mode = GETPOST('mode', 'aZ09');
|
||||
$mode = GETPOST('mode', 'aZ');
|
||||
|
||||
$id = GETPOST("id", 'int');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
@ -63,10 +63,17 @@ if (!$sortorder) {
|
||||
|
||||
// Initialize Objects
|
||||
$object = new Bookmark($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$arrayfields = array();
|
||||
$hookmanager->initHooks(array('bookmarklist')); // Note that conf->hooks_modules contains array
|
||||
|
||||
if ($id > 0) {
|
||||
$object->fetch($id);
|
||||
}
|
||||
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
// Security check
|
||||
restrictedArea($user, 'bookmark', $object);
|
||||
|
||||
@ -88,18 +95,39 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
|
||||
$massaction = '';
|
||||
}
|
||||
|
||||
if ($action == 'delete' && $permissiontodelete) {
|
||||
$object->fetch($id);
|
||||
$res = $object->delete($user);
|
||||
if ($res > 0) {
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
$parameters = array();
|
||||
$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 (empty($reshook)) {
|
||||
// Selection of new fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
||||
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
|
||||
$massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
$objectclass = 'Bookmark';
|
||||
$objectlabel = 'Bookmark';
|
||||
$uploaddir = $conf->bookmark->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
if ($action == 'delete' && $permissiontodelete) {
|
||||
$object->fetch($id);
|
||||
$res = $object->delete($user);
|
||||
if ($res > 0) {
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -108,16 +136,34 @@ if ($action == 'delete' && $permissiontodelete) {
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
//$help_url = "EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject";
|
||||
$help_url = '';
|
||||
$title = $langs->trans("Bookmarks");
|
||||
$morejs = array();
|
||||
$morecss = array();
|
||||
|
||||
llxHeader('', $title);
|
||||
|
||||
// Build and execute select
|
||||
// --------------------------------------------------------------------
|
||||
$sql = "SELECT b.rowid, b.dateb, b.fk_user, b.url, b.target, b.title, b.favicon, b.position,";
|
||||
$sql .= " u.login, u.lastname, u.firstname";
|
||||
// Add fields from extrafields
|
||||
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." as options_".$key : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bookmark as b LEFT JOIN ".MAIN_DB_PREFIX."user as u ON b.fk_user=u.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as b LEFT JOIN ".MAIN_DB_PREFIX."user as u ON b.fk_user=u.rowid";
|
||||
$sql .= " WHERE 1=1";
|
||||
$sql .= " AND b.entity IN (".getEntity('bookmark').")";
|
||||
if (!$user->admin) {
|
||||
@ -159,7 +205,18 @@ if (!$resql) {
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
|
||||
// Output page
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
llxHeader('', $title);
|
||||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
$param = '';
|
||||
if (!empty($mode)) {
|
||||
$param .= '&mode='.urlencode($mode);
|
||||
}
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
}
|
||||
@ -169,8 +226,12 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
// Add $param from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$param .= $hookmanager->resPrint;
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
@ -198,18 +259,59 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="page_y" value="">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
|
||||
|
||||
$newcardbutton = '';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create&backtopage='.urlencode(DOL_URL_ROOT.'/bookmarks/list.php'), '', $permissiontoadd);
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bookmark', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
// Add code for pre mass action (confirmation or email presend form)
|
||||
$topicmail = "SendBookmarkRef";
|
||||
$modelmail = "bookmark";
|
||||
$objecttmp = new Bookmark($db);
|
||||
$trackid = 'bookmark'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
$moreforfilter .= $hookmanager->resPrint;
|
||||
} else {
|
||||
$moreforfilter = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
if (!empty($moreforfilter)) {
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
|
||||
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
// Fields title search
|
||||
// --------------------------------------------------------------------
|
||||
// TODO
|
||||
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
|
||||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
//print "<td> </td>";
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "b.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "b.title", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Link", $_SERVER["PHP_SELF"], "b.url", "", $param, '', $sortfield, $sortorder);
|
||||
@ -217,102 +319,176 @@ print_liste_field_titre("Target", $_SERVER["PHP_SELF"], "b.target", "", $param,
|
||||
print_liste_field_titre("Visibility", $_SERVER["PHP_SELF"], "u.lastname", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "b.dateb", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("Position", $_SERVER["PHP_SELF"], "b.position", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
while ($i < min($num, $limit)) {
|
||||
$savnbfield = $totalarray['nbfield'];
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
while ($i < $imaxinloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) {
|
||||
break; // Should not happen
|
||||
}
|
||||
|
||||
$object->id = $obj->rowid;
|
||||
$object->ref = $obj->rowid;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Id
|
||||
print '<td class="nowraponall">';
|
||||
print $object->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
$linkintern = 1;
|
||||
if (preg_match('/^http/i', $obj->url)) {
|
||||
$linkintern = 0;
|
||||
}
|
||||
$title = $obj->title;
|
||||
$link = $obj->url;
|
||||
$canedit = $permissiontoadd;
|
||||
$candelete = $permissiontodelete;
|
||||
|
||||
// Title
|
||||
print '<td class="tdoverflowmax200" alt="'.dol_escape_htmltag($title).'">';
|
||||
print dol_escape_htmltag($title);
|
||||
print "</td>\n";
|
||||
|
||||
// Url
|
||||
print '<td class="tdoverflowmax200">';
|
||||
if (empty($linkintern)) {
|
||||
print img_picto('', 'url', 'class="pictofixedwidth"');
|
||||
print '<a class="" href="'.$obj->url.'"'.($obj->target ? ' target="newlink" rel="noopener"' : '').'>';
|
||||
} else {
|
||||
//print img_picto('', 'rightarrow', 'class="pictofixedwidth"');
|
||||
print '<a class="" href="'.$obj->url.'">';
|
||||
}
|
||||
print $link;
|
||||
print '</a>';
|
||||
print "</td>\n";
|
||||
|
||||
// Target
|
||||
print '<td class="center">';
|
||||
if ($obj->target == 0) {
|
||||
print $langs->trans("BookmarkTargetReplaceWindowShort");
|
||||
}
|
||||
if ($obj->target == 1) {
|
||||
print $langs->trans("BookmarkTargetNewWindowShort");
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
// Author
|
||||
print '<td class="center">';
|
||||
if ($obj->fk_user > 0) {
|
||||
if (empty($conf->cache['users'][$obj->fk_user])) {
|
||||
$tmpuser = new User($db);
|
||||
$tmpuser->fetch($obj->fk_user);
|
||||
$conf->cache['users'][$obj->fk_user] = $tmpuser;
|
||||
if ($mode == 'kanban') {
|
||||
if ($i == 0) {
|
||||
print '<tr><td colspan="'.$savnbfield.'">';
|
||||
print '<div class="box-flex-container">';
|
||||
}
|
||||
$tmpuser = $conf->cache['users'][$obj->fk_user];
|
||||
print $tmpuser->getNomUrl(-1);
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans("Everybody").'</span>';
|
||||
if (!$user->admin) {
|
||||
$candelete = false;
|
||||
$canedit = false;
|
||||
// Output Kanban
|
||||
print $object->getKanbanView('');
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
} else {
|
||||
// Show here line of result
|
||||
$j = 0;
|
||||
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
// Date creation
|
||||
print '<td class="center" title="'.dol_escape_htmltag(dol_print_date($db->jdate($obj->dateb), 'dayhour')).'">'.dol_print_date($db->jdate($obj->dateb), 'day')."</td>";
|
||||
// Id
|
||||
print '<td class="nowraponall">';
|
||||
print $object->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
// Position
|
||||
print '<td class="right">'.$obj->position."</td>";
|
||||
$linkintern = 1;
|
||||
if (preg_match('/^http/i', $obj->url)) {
|
||||
$linkintern = 0;
|
||||
}
|
||||
$title = $obj->title;
|
||||
$link = $obj->url;
|
||||
$canedit = $permissiontoadd;
|
||||
$candelete = $permissiontodelete;
|
||||
|
||||
// Actions
|
||||
print '<td class="nowraponall right">';
|
||||
if ($canedit) {
|
||||
print '<a class="editfielda marginleftonly marginrightonly" href="'.DOL_URL_ROOT.'/bookmarks/card.php?action=edit&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit()."</a>";
|
||||
// Title
|
||||
print '<td class="tdoverflowmax200" alt="'.dol_escape_htmltag($title).'">';
|
||||
print dol_escape_htmltag($title);
|
||||
print "</td>\n";
|
||||
|
||||
// Url
|
||||
print '<td class="tdoverflowmax200">';
|
||||
if (empty($linkintern)) {
|
||||
print img_picto('', 'url', 'class="pictofixedwidth"');
|
||||
print '<a class="" href="'.$obj->url.'"'.($obj->target ? ' target="newlink" rel="noopener"' : '').'>';
|
||||
} else {
|
||||
//print img_picto('', 'rightarrow', 'class="pictofixedwidth"');
|
||||
print '<a class="" href="'.$obj->url.'">';
|
||||
}
|
||||
print $link;
|
||||
print '</a>';
|
||||
print "</td>\n";
|
||||
|
||||
// Target
|
||||
print '<td class="center">';
|
||||
if ($obj->target == 0) {
|
||||
print $langs->trans("BookmarkTargetReplaceWindowShort");
|
||||
}
|
||||
if ($obj->target == 1) {
|
||||
print $langs->trans("BookmarkTargetNewWindowShort");
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
// Author
|
||||
print '<td class="center">';
|
||||
if ($obj->fk_user > 0) {
|
||||
if (empty($conf->cache['users'][$obj->fk_user])) {
|
||||
$tmpuser = new User($db);
|
||||
$tmpuser->fetch($obj->fk_user);
|
||||
$conf->cache['users'][$obj->fk_user] = $tmpuser;
|
||||
}
|
||||
$tmpuser = $conf->cache['users'][$obj->fk_user];
|
||||
print $tmpuser->getNomUrl(-1);
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans("Everybody").'</span>';
|
||||
if (!$user->admin) {
|
||||
$candelete = false;
|
||||
$canedit = false;
|
||||
}
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
// Date creation
|
||||
print '<td class="center" title="'.dol_escape_htmltag(dol_print_date($db->jdate($obj->dateb), 'dayhour')).'">'.dol_print_date($db->jdate($obj->dateb), 'day')."</td>";
|
||||
|
||||
// Position
|
||||
print '<td class="right">'.$obj->position."</td>";
|
||||
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
if ($candelete) {
|
||||
print '<a class="marginleftonly marginrightonly" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$obj->rowid.'">'.img_delete().'</a>';
|
||||
}
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
// If no record found
|
||||
if ($num == 0) {
|
||||
$colspan = 1;
|
||||
foreach ($arrayfields as $key => $val) {
|
||||
if (!empty($val['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</div>'."\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -571,7 +571,7 @@ if ($type == Categorie::TYPE_PRODUCT) {
|
||||
// List of customers
|
||||
if ($type == Categorie::TYPE_CUSTOMER) {
|
||||
if ($user->hasRight("societe", "read")) {
|
||||
$permission = $user->rights->societe->creer;
|
||||
$permission = $user->hasRight('societe', 'creer');
|
||||
|
||||
$socs = $object->getObjectsInCateg($type, 0, $limit, $offset);
|
||||
if ($socs < 0) {
|
||||
@ -651,7 +651,7 @@ if ($type == Categorie::TYPE_CUSTOMER) {
|
||||
// List of suppliers
|
||||
if ($type == Categorie::TYPE_SUPPLIER) {
|
||||
if ($user->hasRight("fournisseur", "read")) {
|
||||
$permission = $user->rights->societe->creer;
|
||||
$permission = $user->hasRight('societe', 'creer');
|
||||
|
||||
$socs = $object->getObjectsInCateg($type, 0, $limit, $offset);
|
||||
if ($socs < 0) {
|
||||
@ -816,7 +816,7 @@ if ($type == Categorie::TYPE_MEMBER) {
|
||||
// List of contacts
|
||||
if ($type == Categorie::TYPE_CONTACT) {
|
||||
if ($user->hasRight("societe", "read")) {
|
||||
$permission = $user->rights->societe->creer;
|
||||
$permission = $user->hasRight('societe', 'creer');
|
||||
|
||||
$contacts = $object->getObjectsInCateg($type, 0, $limit, $offset);
|
||||
if (is_numeric($contacts) && $contacts < 0) {
|
||||
|
||||
@ -1114,7 +1114,7 @@ $arrayrecurrulefreq = array(
|
||||
);
|
||||
|
||||
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda|DE:Modul_Terminplanung';
|
||||
llxHeader('', $langs->trans("Agenda"), $help_url);
|
||||
|
||||
if ($action == 'create') {
|
||||
@ -2493,7 +2493,7 @@ if ($id > 0) {
|
||||
|
||||
if ($action != 'edit') {
|
||||
if (empty($conf->global->AGENDA_DISABLE_BUILDDOC)) {
|
||||
print '<div style="clear:both;"></div><div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<div class="clearboth"></div><div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
/*
|
||||
|
||||
@ -1578,9 +1578,10 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
$langs->load('agenda');
|
||||
$datas = [];
|
||||
|
||||
$nofetch = empty($params['nofetch']) ? false : true;
|
||||
$datas = array();
|
||||
$nofetch = !empty($params['nofetch']);
|
||||
|
||||
// Set label of type
|
||||
$labeltype = '';
|
||||
if ($this->type_code) {
|
||||
@ -2278,7 +2279,7 @@ class ActionComm extends CommonObject
|
||||
|
||||
// Create temp file
|
||||
$outputfiletmp = tempnam($conf->agenda->dir_temp, 'tmp'); // Temporary file (allow call of function by different threads
|
||||
@chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK));
|
||||
dolChmod($outputfiletmp);
|
||||
|
||||
// Write file
|
||||
if ($format == 'vcal') {
|
||||
|
||||
@ -109,7 +109,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda|DE:Modul_Terminplanung';
|
||||
|
||||
llxHeader('', $langs->trans("Agenda"), $help_url);
|
||||
|
||||
|
||||
@ -248,7 +248,7 @@ if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
|
||||
llxHeader('', $langs->trans("Agenda"), $help_url);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
@ -62,7 +62,7 @@ $usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object-
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda|DE:Modul_Terminplanung';
|
||||
llxHeader('', $langs->trans("Agenda"), $help_url);
|
||||
|
||||
$object = new ActionComm($db);
|
||||
|
||||
@ -289,7 +289,7 @@ $nav .= ' <input type="submit" name="submitdateselect" class="button" value="'.$
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda|DE:Modul_Terminplanung';
|
||||
$title = $langs->trans("Agenda");
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
|
||||
@ -234,7 +234,7 @@ if ($reshook < 0) {
|
||||
$form = new Form($db);
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
|
||||
llxHeader('', $langs->trans("Agenda"), $help_url);
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
@ -699,7 +699,7 @@ if ($object->id > 0) {
|
||||
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop boxtablenomarginbottom centpercent">';
|
||||
$boxstat .= '<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
|
||||
|
||||
if (isModEnabled("propal") && $user->rights->propal->lire) {
|
||||
if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) {
|
||||
// Box proposals
|
||||
$tmp = $object->getOutstandingProposals();
|
||||
$outstandingOpened = $tmp['opened'];
|
||||
@ -720,7 +720,7 @@ if ($object->id > 0) {
|
||||
}
|
||||
}
|
||||
|
||||
if (isModEnabled('commande') && $user->rights->commande->lire) {
|
||||
if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) {
|
||||
// Box commandes
|
||||
$tmp = $object->getOutstandingOrders();
|
||||
$outstandingOpened = $tmp['opened'];
|
||||
@ -741,7 +741,7 @@ if ($object->id > 0) {
|
||||
}
|
||||
}
|
||||
|
||||
if (isModEnabled('facture') && $user->rights->facture->lire) {
|
||||
if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) {
|
||||
// Box factures
|
||||
$tmp = $object->getOutstandingBills('customer', 0);
|
||||
$outstandingOpened = $tmp['opened'];
|
||||
@ -820,7 +820,7 @@ if ($object->id > 0) {
|
||||
/*
|
||||
* Latest proposals
|
||||
*/
|
||||
if (isModEnabled("propal") && $user->rights->propal->lire) {
|
||||
if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) {
|
||||
$langs->load("propal");
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht";
|
||||
@ -915,7 +915,7 @@ if ($object->id > 0) {
|
||||
/*
|
||||
* Latest orders
|
||||
*/
|
||||
if (isModEnabled('commande') && $user->rights->commande->lire) {
|
||||
if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) {
|
||||
$param ="";
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid";
|
||||
@ -1124,7 +1124,7 @@ if ($object->id > 0) {
|
||||
/*
|
||||
* Latest contracts
|
||||
*/
|
||||
if (isModEnabled('contrat') && $user->rights->contrat->lire) {
|
||||
if (isModEnabled('contrat') && $user->hasRight('contrat', 'lire')) {
|
||||
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut as contract_status, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup, c.entity,";
|
||||
$sql .= " c.last_main_doc, c.model_pdf";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
|
||||
@ -1232,7 +1232,7 @@ if ($object->id > 0) {
|
||||
/*
|
||||
* Latest interventions
|
||||
*/
|
||||
if (isModEnabled('ficheinter') && $user->rights->ficheinter->lire) {
|
||||
if (isModEnabled('ficheinter') && $user->hasRight('ficheinter', 'lire')) {
|
||||
$sql = "SELECT s.nom, s.rowid, f.rowid as id, f.ref, f.fk_statut, f.duree as duration, f.datei as startdate, f.entity";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f";
|
||||
$sql .= " WHERE f.fk_soc = s.rowid";
|
||||
@ -1318,7 +1318,7 @@ if ($object->id > 0) {
|
||||
/*
|
||||
* Latest invoices templates
|
||||
*/
|
||||
if (isModEnabled('facture') && $user->rights->facture->lire) {
|
||||
if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) {
|
||||
$sql = 'SELECT f.rowid as id, f.titre as ref';
|
||||
$sql .= ', f.total_ht';
|
||||
$sql .= ', f.total_tva';
|
||||
@ -1413,7 +1413,7 @@ if ($object->id > 0) {
|
||||
/*
|
||||
* Latest invoices
|
||||
*/
|
||||
if (isModEnabled('facture') && $user->rights->facture->lire) {
|
||||
if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) {
|
||||
$sql = 'SELECT f.rowid as facid, f.ref, f.type';
|
||||
$sql .= ', f.total_ht';
|
||||
$sql .= ', f.total_tva';
|
||||
@ -1539,7 +1539,7 @@ if ($object->id > 0) {
|
||||
}
|
||||
|
||||
print '</div></div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
@ -1557,12 +1557,12 @@ if ($object->id > 0) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("ThirdPartyIsClosed").'</a></div>';
|
||||
}
|
||||
|
||||
if (isModEnabled("propal") && $user->rights->propal->creer && $object->status == 1) {
|
||||
if (isModEnabled("propal") && $user->hasRight('propal', 'creer') && $object->status == 1) {
|
||||
$langs->load("propal");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddProp").'</a></div>';
|
||||
}
|
||||
|
||||
if (isModEnabled('commande') && $user->rights->commande->creer && $object->status == 1) {
|
||||
if (isModEnabled('commande') && $user->hasRight('commande', 'creer') && $object->status == 1) {
|
||||
$langs->load("orders");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddOrder").'</a></div>';
|
||||
}
|
||||
@ -1572,7 +1572,7 @@ if ($object->id > 0) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddContract").'</a></div>';
|
||||
}
|
||||
|
||||
if (isModEnabled('ficheinter') && $user->rights->ficheinter->creer && $object->status == 1) {
|
||||
if (isModEnabled('ficheinter') && $user->hasRight('ficheinter', 'creer') && $object->status == 1) {
|
||||
$langs->load("fichinter");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddIntervention").'</a></div>';
|
||||
}
|
||||
|
||||
@ -163,7 +163,7 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if ($i >= $max) {
|
||||
$othernb += 1;
|
||||
$othernb++;
|
||||
$i++;
|
||||
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
|
||||
continue;
|
||||
@ -321,7 +321,7 @@ if (isModEnabled('supplier_proposal') && $user->hasRight("supplier_proposal", "l
|
||||
* Draft sales orders
|
||||
*/
|
||||
|
||||
if (isModEnabled('commande') && $user->rights->commande->lire) {
|
||||
if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) {
|
||||
$sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.total_tva, c.total_ttc, c.fk_statut as status";
|
||||
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
|
||||
$sql .= ", s.code_client, s.code_compta, s.client";
|
||||
@ -868,7 +868,7 @@ if (isModEnabled('contrat') && $user->hasRight("contrat", "lire") && 0) { // TOD
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">'.$staticcontrat->getNomUrl(1).'</td>';
|
||||
print '<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
|
||||
print '<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1, 'customer').'</td>';
|
||||
print '<td class="right">'.$staticcontrat->LibStatut($obj->statut, 3).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -971,7 +971,7 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
|
||||
print '</table>';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
|
||||
print '<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1, 'customer').'</td>';
|
||||
$datem = $db->jdate($obj->dp);
|
||||
print '<td class="center tddate" title="'.dol_escape_htmltag($langs->trans("Date").': '.dol_print_date($datem, 'day', 'tzserver')).'">';
|
||||
print dol_print_date($datem, 'day', 'tzserver');
|
||||
@ -1008,7 +1008,7 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
|
||||
/*
|
||||
* Opened (validated) order
|
||||
*/
|
||||
if (isModEnabled('commande') && $user->rights->commande->lire) {
|
||||
if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) {
|
||||
$sql = "SELECT c.rowid as commandeid, c.total_ttc, c.total_ht, c.total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed";
|
||||
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
|
||||
$sql .= ", s.code_client, s.code_compta, s.client";
|
||||
@ -1091,7 +1091,7 @@ if (isModEnabled('commande') && $user->rights->commande->lire) {
|
||||
print '</table>';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
|
||||
print '<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1, 'customer').'</td>';
|
||||
$datem = $db->jdate($obj->dv);
|
||||
print '<td class="center tddate" title="'.dol_escape_htmltag($langs->trans("DateValue").': '.dol_print_date($datem, 'day', 'tzserver')).'">';
|
||||
print dol_print_date($datem, 'day', 'tzserver');
|
||||
|
||||
@ -49,8 +49,9 @@ $confirm = GETPOST('confirm', 'alpha');
|
||||
$urlfrom = GETPOST('urlfrom');
|
||||
|
||||
$object = new Mailing($db);
|
||||
|
||||
$result = $object->fetch($id);
|
||||
if ($id > 0) {
|
||||
$result = $object->fetch($id);
|
||||
}
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
@ -98,6 +99,32 @@ if ($reshook < 0) {
|
||||
}
|
||||
|
||||
if (empty($reshook)) {
|
||||
$error = 0;
|
||||
|
||||
$backurlforlist = DOL_URL_ROOT.'/comm/mailing/list.php';
|
||||
|
||||
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
|
||||
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
|
||||
$backtopage = $backurlforlist;
|
||||
} else {
|
||||
$backtopage = DOL_URL_ROOT.'/comm/mailing/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($cancel) {
|
||||
/*var_dump($cancel);var_dump($backtopage);var_dump($backtopageforcancel);exit;*/
|
||||
if (!empty($backtopageforcancel)) {
|
||||
header("Location: ".$backtopageforcancel);
|
||||
exit;
|
||||
} elseif (!empty($backtopage)) {
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
// Action clone object
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes') {
|
||||
if (!GETPOST("clone_content", 'alpha') && !GETPOST("clone_receivers", 'alpha')) {
|
||||
@ -673,7 +700,7 @@ if (empty($reshook)) {
|
||||
|
||||
// Action of delete confirmation
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes') {
|
||||
if ($object->delete($object->id)) {
|
||||
if ($object->delete($user)) {
|
||||
$url = (!empty($urlfrom) ? $urlfrom : 'list.php');
|
||||
header("Location: ".$url);
|
||||
exit;
|
||||
|
||||
@ -560,6 +560,7 @@ if ($object->fetch($id) >= 0) {
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="limit" value="'.$limit.'">';
|
||||
print '<input type="hidden" name="page_y" value="">';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
@ -556,15 +556,14 @@ class Mailing extends CommonObject
|
||||
/**
|
||||
* Delete emailing
|
||||
*
|
||||
* @param int $rowid Id if emailing to delete
|
||||
* @param User $user User that delete
|
||||
* @param int $notrigger Disable triggers
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
public function delete($rowid, $notrigger = 0)
|
||||
public function delete($user, $notrigger = 0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (!$notrigger) {
|
||||
@ -576,7 +575,7 @@ class Mailing extends CommonObject
|
||||
|
||||
if (!$error) {
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "mailing";
|
||||
$sql .= " WHERE rowid = " . ((int) $rowid);
|
||||
$sql .= " WHERE rowid = " . ((int) $this->id);
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -726,6 +725,36 @@ class Mailing extends CommonObject
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* getTooltipContentArray
|
||||
*
|
||||
* @param array $params ex option, infologin
|
||||
* @since v18
|
||||
* @return array
|
||||
*/
|
||||
public function getTooltipContentArray($params)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$nofetch = !empty($params['nofetch']);
|
||||
$langs->load('mails');
|
||||
|
||||
$datas = array();
|
||||
$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("ShowEMailing").'</u>';
|
||||
if (isset($this->statut)) {
|
||||
$datas['picto'] .= ' '.$this->getLibStatut(5);
|
||||
}
|
||||
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
if (isset($this->title)) {
|
||||
$datas['title'] .= '<br><b>'.$langs->trans('MailTitle').':</b> '.$this->title;
|
||||
}
|
||||
if (isset($this->sujet)) {
|
||||
$datas['subject'] .= '<br><b>'.$langs->trans('MailTopic').':</b> '.$this->sujet;
|
||||
}
|
||||
|
||||
return $datas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a link to the object card (with optionally the picto)
|
||||
*
|
||||
@ -747,11 +776,20 @@ class Mailing extends CommonObject
|
||||
}
|
||||
|
||||
$result = '';
|
||||
$companylink = '';
|
||||
|
||||
$label = '<u>'.$langs->trans("ShowEMailing").'</u>';
|
||||
$label .= '<br>';
|
||||
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
$params = [
|
||||
'id' => $this->id,
|
||||
'objecttype' => $this->element,
|
||||
'option' => $option,
|
||||
'nofetch' => 1,
|
||||
];
|
||||
$classfortooltip = 'classfortooltip';
|
||||
$dataparams = '';
|
||||
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
|
||||
$classfortooltip = 'classforajaxtooltip';
|
||||
$dataparams = ' data-params='.json_encode($params);
|
||||
// $label = $langs->trans('Loading');
|
||||
}
|
||||
$label = implode($this->getTooltipContentArray($params));
|
||||
|
||||
$url = DOL_URL_ROOT.'/comm/mailing/card.php?id='.$this->id;
|
||||
|
||||
@ -772,8 +810,8 @@ class Mailing extends CommonObject
|
||||
$label = $langs->trans("ShowEMailing");
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||
$linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
|
||||
} else {
|
||||
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||
}
|
||||
@ -784,7 +822,7 @@ class Mailing extends CommonObject
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) {
|
||||
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
|
||||
}
|
||||
if ($withpicto != 2) {
|
||||
$result .= $this->ref;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2005-2023 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -30,21 +30,46 @@ require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
|
||||
$langs->load('mails');
|
||||
|
||||
// Get Parameters
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
|
||||
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
||||
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
|
||||
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
||||
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
|
||||
|
||||
// Pagination
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
|
||||
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
// If $page is not defined, or '' or -1 or if we click on clear filters
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
// Search Fields
|
||||
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
$search_ref = GETPOST("search_ref", "alpha") ? GETPOST("search_ref", "alpha") : GETPOST("sref", "alpha");
|
||||
$filteremail = GETPOST('filteremail', 'alpha');
|
||||
|
||||
// Initialize technical objects
|
||||
$object = new Mailing($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
|
||||
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
|
||||
// Default sort order (if not yet defined by previous GETPOST)
|
||||
if (!$sortorder) {
|
||||
$sortorder = "DESC";
|
||||
}
|
||||
@ -52,28 +77,15 @@ if (!$sortfield) {
|
||||
$sortfield = "m.date_creat";
|
||||
}
|
||||
|
||||
// Search Fields
|
||||
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
$search_ref = GETPOST("search_ref", "alpha") ? GETPOST("search_ref", "alpha") : GETPOST("sref", "alpha");
|
||||
$filteremail = GETPOST('filteremail', 'alpha');
|
||||
|
||||
// Initialize objects
|
||||
$object = new Mailing($db);
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('mailinglist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'm.titre'=>'Ref',
|
||||
);
|
||||
|
||||
$permissiontoread = $user->hasRight('mailing', 'lire');
|
||||
$permissiontoadd = $user->hasRight('mailing', 'creer');
|
||||
$permissiontodelete = $user->hasRight('mailing', 'delete');
|
||||
|
||||
// Security check
|
||||
if (!$user->rights->mailing->lire || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) {
|
||||
accessforbidden();
|
||||
@ -81,13 +93,13 @@ if (!$user->rights->mailing->lire || (empty($conf->global->EXTERNAL_USERS_ARE_AU
|
||||
//$result = restrictedArea($user, 'mailing');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
@ -120,13 +132,10 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
/*$objectclass='MyObject';
|
||||
$objectlabel='MyObject';
|
||||
$permissiontoread = $user->rights->mymodule->read;
|
||||
$permissiontodelete = $user->rights->mymodule->delete;
|
||||
$uploaddir = $conf->mymodule->dir_output;
|
||||
$objectclass = 'Mailing';
|
||||
$objectlabel = 'Mailing';
|
||||
$uploaddir = $conf->mailing->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -134,15 +143,23 @@ if (empty($reshook)) {
|
||||
* View
|
||||
*/
|
||||
|
||||
// Page Header
|
||||
$help_url = 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
|
||||
llxHeader('', $langs->trans("Mailing"), $help_url);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$help_url = 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
|
||||
$title = $langs->trans("Mailing");
|
||||
$morejs = array();
|
||||
$morecss = array();
|
||||
|
||||
// Build and execute select
|
||||
// --------------------------------------------------------------------
|
||||
if ($filteremail) {
|
||||
$sql = "SELECT m.rowid, m.titre as title, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi,";
|
||||
$sql .= " mc.statut as sendstatut";
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
||||
$sql .= " WHERE m.rowid = mc.fk_mailing AND m.entity = ".$conf->entity;
|
||||
$sql .= " AND mc.email = '".$db->escape($filteremail)."'";
|
||||
@ -160,6 +177,9 @@ if ($filteremail) {
|
||||
}
|
||||
} else {
|
||||
$sql = "SELECT m.rowid, m.titre as title, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi";
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
|
||||
$sql .= " WHERE m.entity = ".$conf->entity;
|
||||
if ($search_ref) {
|
||||
@ -175,176 +195,381 @@ if ($filteremail) {
|
||||
$sortfield = "m.rowid";
|
||||
}
|
||||
}
|
||||
if ($search_all) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
}
|
||||
//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
//print $sql;
|
||||
// Complete request and execute it with limit
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
dol_syslog("comm/mailing/list.php", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$title = $langs->trans("EMailings");
|
||||
if ($filteremail) {
|
||||
$title .= ' ('.$langs->trans("SentTo", $filteremail).')';
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
header("Location: ".dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// Output page
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
$title = $langs->trans("EMailings");
|
||||
if ($filteremail) {
|
||||
$title .= ' ('.$langs->trans("SentTo", $filteremail).')';
|
||||
}
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
$param = "&search_all=".urlencode($search_all);
|
||||
if (!empty($mode)) {
|
||||
$param .= '&mode='.urlencode($mode);
|
||||
}
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
}
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
if ($filteremail) {
|
||||
$param .= '&filteremail='.urlencode($filteremail);
|
||||
}
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
// Add $param from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$param .= $hookmanager->resPrint;
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
//'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
|
||||
//'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
|
||||
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
);
|
||||
if (!empty($permissiontodelete)) {
|
||||
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
}
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
|
||||
$arrayofmassactions = array();
|
||||
}
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
}
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="page_y" value="">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
|
||||
$newcardbutton = '';
|
||||
if ($user->rights->mailing->creer) {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewMailing'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/mailing/card.php?action=create');
|
||||
}
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_email', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
// Add code for pre mass action (confirmation or email presend form)
|
||||
$topicmail = "SendMailingRef";
|
||||
$modelmail = "mailing";
|
||||
$objecttmp = new Mailing($db);
|
||||
$trackid = 'mailing'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($search_all) {
|
||||
$setupstring = '';
|
||||
foreach ($fieldstosearchall as $key => $val) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
$setupstring .= $key."=".$val.";";
|
||||
}
|
||||
print '<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
|
||||
}
|
||||
|
||||
$newcardbutton = '';
|
||||
if ($user->rights->mailing->creer) {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewMailing'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/mailing/card.php?action=create');
|
||||
}
|
||||
$moreforfilter = '';
|
||||
|
||||
$i = 0;
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
$moreforfilter .= $hookmanager->resPrint;
|
||||
} else {
|
||||
$moreforfilter = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
$param = "&search_all=".urlencode($search_all);
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
}
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
if ($filteremail) {
|
||||
$param .= '&filteremail='.urlencode($filteremail);
|
||||
}
|
||||
if (!empty($moreforfilter)) {
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
$parameters = array('type'=>$type);
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
}
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
|
||||
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_email', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
print '</td>';
|
||||
// Title
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat maxwidth100 maxwidth50onsmartphone" name="search_all" value="'.dol_escape_htmltag($search_all).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
if (!$filteremail) {
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
// Fields title search
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre_filter">';
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre maxwidthsearch center">';
|
||||
$searchpicto = $form->showFilterButtons('left');
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "m.rowid", $param, "", "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "m.titre", $param, "", "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "m.date_creat", $param, "", 'align="center"', $sortfield, $sortorder);
|
||||
if (!$filteremail) {
|
||||
print_liste_field_titre("NbOfEMails", $_SERVER["PHP_SELF"], "m.nbemail", $param, "", 'align="center"', $sortfield, $sortorder);
|
||||
}
|
||||
if (!$filteremail) {
|
||||
print_liste_field_titre("DateLastSend", $_SERVER["PHP_SELF"], "m.date_envoi", $param, "", 'align="center"', $sortfield, $sortorder);
|
||||
} else {
|
||||
print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, "", 'align="center"', $sortfield, $sortorder);
|
||||
}
|
||||
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], ($filteremail ? "mc.statut" : "m.statut"), $param, "", 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', 'class="right"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$email = new Mailing($db);
|
||||
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$email->id = $obj->rowid;
|
||||
$email->ref = $obj->rowid;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td>';
|
||||
print $email->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
// Title
|
||||
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->title).'">'.dol_escape_htmltag($obj->title).'</td>';
|
||||
|
||||
// Date creation
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($obj->datec), 'day');
|
||||
print '</td>';
|
||||
|
||||
// Nb of email
|
||||
if (!$filteremail) {
|
||||
print '<td class="center nowraponall">';
|
||||
$nbemail = $obj->nbemail;
|
||||
/*if ($obj->statut != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
|
||||
{
|
||||
$text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
|
||||
print $form->textwithpicto($nbemail,$text,1,'warning');
|
||||
}
|
||||
else
|
||||
{
|
||||
print $nbemail;
|
||||
}*/
|
||||
print $nbemail;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Last send
|
||||
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->date_envoi), 'day').'</td>';
|
||||
print '</td>';
|
||||
|
||||
// Status
|
||||
print '<td class="nowrap right">';
|
||||
if ($filteremail) {
|
||||
print $email::libStatutDest($obj->sendstatut, 2);
|
||||
} else {
|
||||
print $email->LibStatut($obj->statut, 5);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
if (empty($num)) {
|
||||
$colspan = 6;
|
||||
if (!$filteremail) {
|
||||
$colspan++;
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
$db->free($resql);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
print '</td>';
|
||||
// Title
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat maxwidth100 maxwidth50onsmartphone" name="search_all" value="'.dol_escape_htmltag($search_all).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
if (!$filteremail) {
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre center maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
|
||||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "m.rowid", $param, "", "", $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "m.titre", $param, "", "", $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "m.date_creat", $param, "", 'align="center"', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
if (!$filteremail) {
|
||||
print_liste_field_titre("NbOfEMails", $_SERVER["PHP_SELF"], "m.nbemail", $param, "", 'align="center"', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$filteremail) {
|
||||
print_liste_field_titre("DateLastSend", $_SERVER["PHP_SELF"], "m.date_envoi", $param, "", 'align="center"', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
} else {
|
||||
print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, "", 'align="center"', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], ($filteremail ? "mc.statut" : "m.statut"), $param, "", '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
|
||||
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$savnbfield = $totalarray['nbfield'];
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
while ($i < $imaxinloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) {
|
||||
break; // Should not happen
|
||||
}
|
||||
|
||||
$object->id = $obj->rowid;
|
||||
$object->ref = $obj->rowid;
|
||||
|
||||
// Show here line of result
|
||||
$j = 0;
|
||||
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
print '<td>';
|
||||
print $object->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
// Title
|
||||
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->title).'">'.dol_escape_htmltag($obj->title).'</td>';
|
||||
|
||||
// Date creation
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($obj->datec), 'day');
|
||||
print '</td>';
|
||||
|
||||
// Nb of email
|
||||
if (!$filteremail) {
|
||||
print '<td class="center nowraponall">';
|
||||
$nbemail = $obj->nbemail;
|
||||
/*if ($obj->statut != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
|
||||
{
|
||||
$text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
|
||||
print $form->textwithpicto($nbemail,$text,1,'warning');
|
||||
}
|
||||
else
|
||||
{
|
||||
print $nbemail;
|
||||
}*/
|
||||
print $nbemail;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Last send
|
||||
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->date_envoi), 'day').'</td>';
|
||||
print '</td>';
|
||||
|
||||
// Status
|
||||
print '<td class="nowrap center">';
|
||||
if ($filteremail) {
|
||||
print $object::libStatutDest($obj->sendstatut, 2);
|
||||
} else {
|
||||
print $object->LibStatut($obj->statut, 5);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
print '</tr>'."\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
// If no record found
|
||||
if (empty($num)) {
|
||||
$colspan = 6;
|
||||
if (!$filteremail) {
|
||||
$colspan++;
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</div>'."\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2023 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2022 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
@ -789,7 +789,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'import_lines_from_object'
|
||||
&& $user->rights->propal->creer
|
||||
&& $user->hasRight('propal', 'creer')
|
||||
&& $object->statut == Propal::STATUS_DRAFT
|
||||
) {
|
||||
// add lines from objectlinked
|
||||
@ -914,6 +914,37 @@ if (empty($reshook)) {
|
||||
foreach ($object->lines as $line) {
|
||||
$result = $object->updateline($line->id, $line->subprice, $line->qty, $remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
}
|
||||
} elseif ($action == 'addline' && GETPOST('submitforallmargins', 'alpha') && GETPOST('marginforalllines') !== '' && $usercancreate) {
|
||||
// Define margin
|
||||
$margin_rate = (GETPOST('marginforalllines') ? GETPOST('marginforalllines') : 0);
|
||||
foreach ($object->lines as &$line) {
|
||||
$subprice = price2num($line->pa_ht * (1 + $margin_rate/100), 'MU');
|
||||
$prod = new Product($db);
|
||||
$prod->fetch($line->fk_product);
|
||||
if ($prod->price_min > $subprice) {
|
||||
$price_subprice = price($subprice, 0, $outlangs, 1, -1, -1, 'auto');
|
||||
$price_price_min = price($prod->price_min, 0, $outlangs, 1, -1, -1, 'auto');
|
||||
setEventMessages($prod->ref.' - '.$prod->label.' ('.$price_subprice.' < '.$price_price_min.' '.strtolower($langs->trans("MinPrice")).')'."\n", null, 'warnings');
|
||||
}
|
||||
// Manage $line->subprice and $line->multicurrency_subprice
|
||||
$multicurrency_subprice = $subprice * $line->multicurrency_subprice / $line->subprice;
|
||||
// Update DB
|
||||
$result = $object->updateline($line->id, $subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_rate, $line->localtax2_rate, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $multicurrency_subprice);
|
||||
// Update $object with new margin info
|
||||
$line->price = $subprice;
|
||||
$line->marge_tx = $margin_rate;
|
||||
$line->marque_tx = $margin_rate * $line->pa_ht / $subprice;
|
||||
$line->total_ht = $line->qty * $subprice;
|
||||
$line->total_tva = $line->tva_tx * $line->qty * $subprice;
|
||||
$line->total_ttc = (1 + $line->tva_tx) * $line->qty * $subprice;
|
||||
// Manage $line->subprice and $line->multicurrency_subprice
|
||||
$line->multicurrency_total_ht = $line->qty * $subprice * $line->multicurrency_subprice / $line->subprice;
|
||||
$line->multicurrency_total_tva = $line->tva_tx * $line->qty * $subprice * $line->multicurrency_subprice / $line->subprice;
|
||||
$line->multicurrency_total_ttc = (1 + $line->tva_tx) * $line->qty * $subprice * $line->multicurrency_subprice / $line->subprice;
|
||||
// Used previous $line->subprice and $line->multicurrency_subprice above, now they can be set to their new values
|
||||
$line->subprice = $subprice;
|
||||
$line->multicurrency_subprice = $multicurrency_subprice;
|
||||
}
|
||||
} elseif ($action == 'addline' && $usercancreate) { // Add line
|
||||
// Set if we used free entry or predefined product
|
||||
$predef = '';
|
||||
|
||||
@ -3795,7 +3795,7 @@ class Propal extends CommonObject
|
||||
}
|
||||
|
||||
$linkclose = '';
|
||||
if (empty($notooltip) && $user->rights->propal->lire) {
|
||||
if (empty($notooltip) && $user->hasRight('propal', 'lire')) {
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
$label = $langs->trans("Proposal");
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
|
||||
@ -76,7 +76,7 @@ $usercancreate = $user->hasRight("propal", "creer");
|
||||
* Add a new contact
|
||||
*/
|
||||
|
||||
if ($action == 'addcontact' && $user->rights->propal->creer) {
|
||||
if ($action == 'addcontact' && $user->hasRight('propal', 'creer')) {
|
||||
if ($object->id > 0) {
|
||||
$contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
|
||||
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
|
||||
@ -94,12 +94,12 @@ if ($action == 'addcontact' && $user->rights->propal->creer) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'swapstatut' && $user->rights->propal->creer) {
|
||||
} elseif ($action == 'swapstatut' && $user->hasRight('propal', 'creer')) {
|
||||
// Toggle the status of a contact
|
||||
if ($object->id > 0) {
|
||||
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
|
||||
}
|
||||
} elseif ($action == 'deletecontact' && $user->rights->propal->creer) {
|
||||
} elseif ($action == 'deletecontact' && $user->hasRight('propal', 'creer')) {
|
||||
// Deletes a contact
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
|
||||
@ -227,7 +227,7 @@ if ($resql) {
|
||||
/*
|
||||
* Open (validated) proposals
|
||||
*/
|
||||
if (isModEnabled("propal") && $user->rights->propal->lire) {
|
||||
if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) {
|
||||
$sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, s.email, s.code_compta";
|
||||
$sql .= ", p.rowid as propalid, p.entity, p.total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
|
||||
@ -109,8 +109,7 @@ $search_date_endyear = GETPOST('search_date_endyear', 'int');
|
||||
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
|
||||
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
|
||||
$search_date_end_startday = GETPOST('search_date_end_startday', 'int');
|
||||
$search_date_end_startmonth = GETPOST('se$sql .= $db->plimit($limit + 1, $offset);
|
||||
arch_date_end_startmonth', 'int');
|
||||
$search_date_end_startmonth = GETPOST('search_date_end_startmonth', 'int');
|
||||
$search_date_end_startyear = GETPOST('search_date_end_startyear', 'int');
|
||||
$search_date_end_endday = GETPOST('search_date_end_endday', 'int');
|
||||
$search_date_end_endmonth = GETPOST('search_date_end_endmonth', 'int');
|
||||
@ -1718,7 +1717,7 @@ if ($resql) {
|
||||
if ($mode == 'kanban') {
|
||||
if ($i == 0) {
|
||||
print '<tr><td colspan="12">';
|
||||
print '<div class="box-flex-container">';
|
||||
print '<div class="box-flex-container kanban">';
|
||||
}
|
||||
// Output Kanban
|
||||
$userstatic->fetch($obj->fk_user_author);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user