Merge branch 'develop' into Add_param_color_button_action

This commit is contained in:
Anthony Berton 2022-01-26 15:12:16 +01:00 committed by GitHub
commit 49efba7ded
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 387 additions and 280 deletions

View File

@ -237,7 +237,7 @@ if ($action != 'export_csv') {
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) { if (empty($reshook)) {
$button = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />'; $button = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';

View File

@ -766,7 +766,7 @@ if (count($filter)) {
} }
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) { if (empty($reshook)) {
// Button re-export // Button re-export
if (!empty($conf->global->ACCOUNTING_REEXPORT)) { if (!empty($conf->global->ACCOUNTING_REEXPORT)) {

View File

@ -473,7 +473,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) { if (empty($reshook)) {
$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param); $newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));

View File

@ -473,7 +473,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) { if (empty($reshook)) {
$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param); $newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly')); $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));

View File

@ -41,6 +41,8 @@ $langs->loadLangs(array('admin', 'other', 'agenda', 'users'));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$param = GETPOST('param', 'alpha'); $param = GETPOST('param', 'alpha');
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');

View File

@ -36,6 +36,8 @@ $langs->loadLangs(array("admin", "other", "agenda"));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$param = GETPOST('param', 'alpha'); $param = GETPOST('param', 'alpha');
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$scandir = GETPOST('scandir', 'alpha'); $scandir = GETPOST('scandir', 'alpha');

View File

@ -36,6 +36,7 @@ if (!$user->admin) {
} }
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
/* /*

View File

@ -36,6 +36,8 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type = 'bom'; $type = 'bom';

View File

@ -46,6 +46,8 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type = 'order'; $type = 'order';

View File

@ -37,6 +37,8 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type = 'contract'; $type = 'contract';

View File

@ -43,6 +43,8 @@ if (!$user->admin) {
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type = 'delivery'; $type = 'delivery';

View File

@ -41,6 +41,8 @@ $backtopage = GETPOST('backtopage', 'alpha');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type = 'myobject'; $type = 'myobject';

View File

@ -43,6 +43,8 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type = 'shipping'; $type = 'shipping';

View File

@ -43,6 +43,8 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type = 'expensereport'; $type = 'expensereport';

View File

@ -42,6 +42,8 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type = 'invoice'; $type = 'invoice';

View File

@ -51,6 +51,8 @@ $backtopage = GETPOST('backtopage', 'alpha');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type = 'invoice'; $type = 'invoice';

View File

@ -43,6 +43,8 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type = 'ficheinter'; $type = 'ficheinter';

View File

@ -39,6 +39,8 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type = 'contract'; $type = 'contract';

View File

@ -50,6 +50,8 @@ $backtopage = GETPOST('backtopage', 'alpha');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type = 'myobject'; $type = 'myobject';

View File

@ -41,6 +41,8 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
/* /*
* Actions * Actions

View File

@ -37,8 +37,9 @@ $langs->loadLangs(array("admin", "knowledgemanagement"));
// Parameters // Parameters
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type = 'knowledgemanagement'; $type = 'knowledgemanagement';

View File

@ -37,6 +37,8 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type = 'mrp'; $type = 'mrp';

View File

@ -43,6 +43,8 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type = 'propal'; $type = 'propal';

View File

@ -36,6 +36,8 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type = 'reception'; $type = 'reception';

View File

@ -43,6 +43,8 @@ if (!$user->admin) {
$type = GETPOST('type', 'alpha'); $type = GETPOST('type', 'alpha');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');

View File

@ -37,6 +37,8 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha'); $scandir = GETPOST('scandir', 'alpha');
$type = 'supplier_payment'; $type = 'supplier_payment';

View File

@ -38,6 +38,8 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type = 'supplier_proposal'; $type = 'supplier_proposal';

View File

@ -38,6 +38,8 @@ if (!$user->admin) {
// Parameters // Parameters
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha'); $scandir = GETPOST('scandir', 'alpha');
$type = 'ticket'; $type = 'ticket';

View File

@ -43,9 +43,11 @@ $extrafields = new ExtraFields($db);
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha'); $scandir = GETPOST('scandir', 'alpha');
$type = 'user'; $type = 'user';

View File

@ -42,6 +42,8 @@ $extrafields = new ExtraFields($db);
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$type = 'group'; $type = 'group';
/* /*

View File

@ -36,6 +36,7 @@ $langs->loadLangs(array("admin", "workstation"));
// Parameters // Parameters
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');

View File

@ -2269,7 +2269,10 @@ abstract class CommonObject
*/ */
public function setPaymentMethods($id) public function setPaymentMethods($id)
{ {
$error = 0; $notrigger = 0;
dol_syslog(get_class($this).'::setPaymentMethods('.$id.')'); dol_syslog(get_class($this).'::setPaymentMethods('.$id.')');
if ($this->statut >= 0 || $this->element == 'societe') { if ($this->statut >= 0 || $this->element == 'societe') {
// TODO uniformize field name // TODO uniformize field name
$fieldname = 'fk_mode_reglement'; $fieldname = 'fk_mode_reglement';
@ -2296,6 +2299,15 @@ abstract class CommonObject
if (get_class($this) == 'Fournisseur') { if (get_class($this) == 'Fournisseur') {
$this->mode_reglement_supplier_id = $id; $this->mode_reglement_supplier_id = $id;
} }
// Triggers
if (!$error && !$notrigger) {
// Call triggers
$result = $this->call_trigger(strtoupper(get_class($this)).'_MODIFY', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
return 1; return 1;
} else { } else {
dol_syslog(get_class($this).'::setPaymentMethods Error '.$this->db->error()); dol_syslog(get_class($this).'::setPaymentMethods Error '.$this->db->error());

View File

@ -783,7 +783,7 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
// keep lines feed // keep lines feed
} }
break; break;
case 'alphawithlgt': // No " and no ../ but we keep balanced < > tags with no special chars inside. Can be used for email string like "Name <email>" case 'alphawithlgt': // No " and no ../ but we keep balanced < > tags with no special chars inside. Can be used for email string like "Name <email>". Less secured than 'alphanohtml'
if (!is_array($out)) { if (!is_array($out)) {
$out = trim($out); $out = trim($out);
do { do {
@ -1666,7 +1666,11 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
$limittitle = 30; $limittitle = 30;
$out .= '<a class="tabTitle">'; $out .= '<a class="tabTitle">';
if ($picto) { if ($picto) {
$out .= img_picto($title, ($pictoisfullpath ? '' : 'object_').$picto, '', $pictoisfullpath, 0, 0, '', 'imgTabTitle').' '; $noprefix = $pictoisfullpath;
if (strpos($picto, 'fontawesome_') !== false) {
$noprefix = 1;
}
$out .= img_picto($title, ($noprefix ? '' : 'object_').$picto, '', $pictoisfullpath, 0, 0, '', 'imgTabTitle').' ';
} }
$out .= '<span class="tabTitleText">'.dol_escape_htmltag(dol_trunc($title, $limittitle)).'</span>'; $out .= '<span class="tabTitleText">'.dol_escape_htmltag(dol_trunc($title, $limittitle)).'</span>';
$out .= '</a>'; $out .= '</a>';
@ -2021,10 +2025,14 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
$width = 14; $width = 14;
$cssclass = 'photorefcenter'; $cssclass = 'photorefcenter';
$picto = $object->picto; $picto = $object->picto;
$prefix = 'object_';
if ($object->element == 'project' && !$object->public) { if ($object->element == 'project' && !$object->public) {
$picto = 'project'; // instead of projectpub $picto = 'project'; // instead of projectpub
} }
$nophoto = img_picto('No photo', 'object_'.$picto); if (strpos($picto, 'fontawesome_') !== false) {
$prefix = '';
}
$nophoto = img_picto('No photo', $prefix.$picto);
} }
$morehtmlleft .= '<!-- No photo to show -->'; $morehtmlleft .= '<!-- No photo to show -->';
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">'; $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
@ -3609,6 +3617,7 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img * Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img * Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1) * Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
* Example: fontawesome_envelope-open-text_fas_red_1em if you want to use fontaweseome icons: fontawesome_<icon-name>_<style>_<color>_<size> (only icon-name is mandatory)
* @param string $moreatt Add more attribute on img tag (For example 'class="pictofixedwidth"') * @param string $moreatt Add more attribute on img tag (For example 'class="pictofixedwidth"')
* @param boolean|int $pictoisfullpath If true or 1, image path is a full path * @param boolean|int $pictoisfullpath If true or 1, image path is a full path
* @param int $srconly Return only content of the src attribute of img. * @param int $srconly Return only content of the src attribute of img.
@ -3640,6 +3649,40 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
} }
} else { } else {
$pictowithouttext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto); $pictowithouttext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto);
if (strpos($pictowithouttext, 'fontawesome_') !== false) {
$pictowithouttext = explode('_', $pictowithouttext);
$marginleftonlyshort = 0;
$fakey = 'fa-'.$pictowithouttext[1];
$fa = $pictowithouttext[2] ? $pictowithouttext[2] : 'fa';
$facolor = $pictowithouttext[3] ? $pictowithouttext[3] : '';
$fasize = $pictowithouttext[4] ? $pictowithouttext[4] : '';
// This snippet only needed since function img_edit accepts only one additional parameter: no separate one for css only.
// class/style need to be extracted to avoid duplicate class/style validation errors when $moreatt is added to the end of the attributes.
$morestyle = '';
$reg = array();
if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) {
$morecss .= ($morecss ? ' ' : '').$reg[1];
$moreatt = str_replace('class="'.$reg[1].'"', '', $moreatt);
}
if (preg_match('/style="([^"]+)"/', $moreatt, $reg)) {
$morestyle = $reg[1];
$moreatt = str_replace('style="'.$reg[1].'"', '', $moreatt);
}
$moreatt = trim($moreatt);
$enabledisablehtml = '<span class="'.$fa.' '.$fakey.($marginleftonlyshort ? ($marginleftonlyshort == 1 ? ' marginleftonlyshort' : ' marginleftonly') : '');
$enabledisablehtml .= ($morecss ? ' '.$morecss : '').'" style="'.($fasize ? ('font-size: '.$fasize.';') : '').($facolor ? (' color: '.$facolor.';') : '').($morestyle ? ' '.$morestyle : '').'"'.(($notitle || empty($titlealt)) ? '' : ' title="'.dol_escape_htmltag($titlealt).'"').($moreatt ? ' '.$moreatt : '').'>';
/*if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$enabledisablehtml .= $titlealt;
}*/
$enabledisablehtml .= '</span>';
return $enabledisablehtml;
}
$pictowithouttext = str_replace('object_', '', $pictowithouttext); $pictowithouttext = str_replace('object_', '', $pictowithouttext);
if (empty($srconly) && in_array($pictowithouttext, array( if (empty($srconly) && in_array($pictowithouttext, array(
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected', '1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',

View File

@ -178,7 +178,10 @@ class doc_generic_proposal_odt extends ModelePDFPropales
$texte .= '<div id="div_'.get_class($this).'" class="hiddenx">'; $texte .= '<div id="div_'.get_class($this).'" class="hiddenx">';
// Show list of found files // Show list of found files
foreach ($listoffiles as $file) { foreach ($listoffiles as $file) {
$texte .= '- '.$file['name'].' <a href="'.DOL_URL_ROOT.'/document.php?modulepart=doctemplates&file=proposals/'.urlencode(basename($file['name'])).'">'.img_picto('', 'listlight').'</a><br>'; $texte .= '- '.$file['name'];
$texte .= ' <a href="'.DOL_URL_ROOT.'/document.php?modulepart=doctemplates&file=proposals/'.urlencode(basename($file['name'])).'">'.img_picto('', 'listlight').'</a>';
$texte .= ' &nbsp; <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?modulepart=doctemplates&keyforuploaddir=PROPALE_ADDON_PDF_ODT_PATH&action=deletefile&token='.newToken().'&file='.urlencode(basename($file['name'])).'">'.img_picto('', 'delete').'</a>';
$texte .= '<br>';
} }
$texte .= '</div>'; $texte .= '</div>';

View File

@ -97,23 +97,20 @@ class Segment implements IteratorAggregate, Countable
// Search all tags fou into condition to complete $tmpvars, so we will proceed all tests even if not defined // Search all tags fou into condition to complete $tmpvars, so we will proceed all tests even if not defined
$reg='@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU'; $reg='@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU';
$matches = array();
preg_match_all($reg, $this->xml, $matches, PREG_SET_ORDER); preg_match_all($reg, $this->xml, $matches, PREG_SET_ORDER);
//var_dump($tmpvars);exit; //var_dump($tmpvars);exit;
foreach($matches as $match) // For each match, if there is no entry into this->vars, we add it foreach ($matches as $match) { // For each match, if there is no entry into this->vars, we add it
{ if (! empty($match[1]) && ! isset($tmpvars[$match[1]])) {
if (! empty($match[1]) && ! isset($tmpvars[$match[1]]))
{
$tmpvars[$match[1]] = ''; // Not defined, so we set it to '', we just need entry into this->vars for next loop $tmpvars[$match[1]] = ''; // Not defined, so we set it to '', we just need entry into this->vars for next loop
} }
} }
// Conditionals substitution // Conditionals substitution
// Note: must be done before static substitution, else the variable will be replaced by its value and the conditional won't work anymore // Note: must be done before static substitution, else the variable will be replaced by its value and the conditional won't work anymore
foreach($tmpvars as $key => $value) foreach ($tmpvars as $key => $value) {
{
// If value is true (not 0 nor false nor null nor empty string) // If value is true (not 0 nor false nor null nor empty string)
if ($value) if ($value) {
{
// Remove the IF tag // Remove the IF tag
$this->xml = str_replace('[!-- IF '.$key.' --]', '', $this->xml); $this->xml = str_replace('[!-- IF '.$key.' --]', '', $this->xml);
// Remove everything between the ELSE tag (if it exists) and the ENDIF tag // Remove everything between the ELSE tag (if it exists) and the ENDIF tag
@ -121,12 +118,11 @@ class Segment implements IteratorAggregate, Countable
$this->xml = preg_replace($reg, '', $this->xml); $this->xml = preg_replace($reg, '', $this->xml);
} }
// Else the value is false, then two cases: no ELSE and we're done, or there is at least one place where there is an ELSE clause, then we replace it // Else the value is false, then two cases: no ELSE and we're done, or there is at least one place where there is an ELSE clause, then we replace it
else else {
{
// Find all conditional blocks for this variable: from IF to ELSE and to ENDIF // Find all conditional blocks for this variable: from IF to ELSE and to ENDIF
$reg = '@\[!--\sIF\s' . $key . '\s--\](.*)(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy $reg = '@\[!--\sIF\s' . $key . '\s--\](.*)(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
preg_match_all($reg, $this->xml, $matches, PREG_SET_ORDER); preg_match_all($reg, $this->xml, $matches, PREG_SET_ORDER);
foreach($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause foreach ($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause
if (!empty($match[3])) $this->xml = str_replace($match[0], $match[3], $this->xml); if (!empty($match[3])) $this->xml = str_replace($match[0], $match[3], $this->xml);
} }
// Cleanup the other conditional blocks (all the others where there were no ELSE clause, we can just remove them altogether) // Cleanup the other conditional blocks (all the others where there were no ELSE clause, we can just remove them altogether)
@ -227,16 +223,17 @@ class Segment implements IteratorAggregate, Countable
*/ */
public function setVars($key, $value, $encode = true, $charset = 'ISO-8859') public function setVars($key, $value, $encode = true, $charset = 'ISO-8859')
{ {
if (strpos($this->xml, $this->odf->getConfig('DELIMITER_LEFT') . $key . $this->odf->getConfig('DELIMITER_RIGHT')) === false) { $tag = $this->odf->getConfig('DELIMITER_LEFT') . $key . $this->odf->getConfig('DELIMITER_RIGHT');
if (strpos($this->xml, $tag) === false) {
//throw new SegmentException("var $key not found in {$this->getName()}"); //throw new SegmentException("var $key not found in {$this->getName()}");
} }
$tag = $this->odf->getConfig('DELIMITER_LEFT') . $key . $this->odf->getConfig('DELIMITER_RIGHT');
$this->vars[$tag] = $this->odf->convertVarToOdf($value, $encode, $charset); $this->vars[$tag] = $this->odf->convertVarToOdf($value, $encode, $charset);
return $this; return $this;
} }
/** /**
* Assign a template variable as a picture * Assign a template variable as a picture
* *
@ -308,4 +305,3 @@ IMG;
return $this->xmlParsed; return $this->xmlParsed;
} }
} }

View File

@ -122,7 +122,8 @@ class Odf
} }
/** /**
* Assing a template variable * Assing a template variable into ->vars.
* For example, key is {object_date} and value is '2021-01-01'
* *
* @param string $key Name of the variable within the template * @param string $key Name of the variable within the template
* @param string $value Replacement value * @param string $value Replacement value
@ -134,6 +135,7 @@ class Odf
public function setVars($key, $value, $encode = true, $charset = 'ISO-8859') public function setVars($key, $value, $encode = true, $charset = 'ISO-8859')
{ {
$tag = $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT']; $tag = $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT'];
// TODO Warning string may be: // TODO Warning string may be:
// <text:span text:style-name="T13">{</text:span><text:span text:style-name="T12">aaa</text:span><text:span text:style-name="T13">}</text:span> // <text:span text:style-name="T13">{</text:span><text:span text:style-name="T12">aaa</text:span><text:span text:style-name="T13">}</text:span>
// instead of {aaa} so we should enhance this function. // instead of {aaa} so we should enhance this function.