From e24027fb1ea9547860e43cfa73832602cbc5a6b6 Mon Sep 17 00:00:00 2001 From: bahfir abbes Date: Mon, 3 Aug 2020 18:44:07 +0100 Subject: [PATCH 001/122] fix: restore autofill lost functionality --- htdocs/expedition/card.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 929e7ecafd0..0db066717ca 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1042,6 +1042,7 @@ if ($action == 'create') while ($i < $numAsked) { print 'jQuery("#qtyl'.$i.'").val(jQuery("#qtyasked'.$i.'").val() - jQuery("#qtydelivered'.$i.'").val());'."\n"; + if (!empty($conf->productbatch->enabled)) print 'jQuery("#qtyl'.$i.'_'.$i.'").val(jQuery("#qtyasked'.$i.'").val() - jQuery("#qtydelivered'.$i.'").val());'."\n"; $i++; } print '}); @@ -1050,6 +1051,7 @@ if ($action == 'create') while ($i < $numAsked) { print 'jQuery("#qtyl'.$i.'").val(0);'."\n"; + if (!empty($conf->productbatch->enabled)) print 'jQuery("#qtyl'.$i.'_'.$i.'").val(0);'."\n"; $i++; } print '}); @@ -1070,11 +1072,8 @@ if ($action == 'create') print ''.$langs->trans("QtyOrdered").''; print ''.$langs->trans("QtyShipped").''; print ''.$langs->trans("QtyToShip"); - if (empty($conf->productbatch->enabled)) - { - print '
('.$langs->trans("Fill").''; - print ' / '.$langs->trans("Reset").')'; - } + print '
('.$langs->trans("Fill").''; + print ' / '.$langs->trans("Reset").')'; print ''; if (!empty($conf->stock->enabled)) { From 6e1702c1a5c40e486bc8dfa3af757bbd23a92b4d Mon Sep 17 00:00:00 2001 From: John Botella Date: Mon, 17 Aug 2020 15:00:31 +0200 Subject: [PATCH 002/122] Fix infinite fetch object linked loop --- htdocs/core/lib/pdf.lib.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 1d9d218f7af..3c6bf0765ed 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2127,8 +2127,13 @@ function pdf_getLinkedObjects($object,$outputlangs) // We concat this record info into fields xxx_value. title is overwrote. if (empty($object->linkedObjects['commande']) && $object->element != 'commande') // There is not already a link to order and object is not the order, so we show also info with order { - $elementobject->fetchObjectLinked(); - if (! empty($elementobject->linkedObjects['commande'])) $order = reset($elementobject->linkedObjects['commande']); + $elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); + if (! empty($elementobject->linkedObjectsIds['commande'])){ + dol_include_once('/commande/commande.class.php'); + $order = new Commande($object->db); + $ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande'])); + if ($ret < 1){ $order=null; } + } } if (! is_object($order)) { From fbd4323dd82e959e2132f35ab99441c591bb79e2 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 19 Aug 2020 06:01:10 +0200 Subject: [PATCH 003/122] Fix Accountancy - Show label account in page already bind --- .../class/accountingaccount.class.php | 2 +- htdocs/accountancy/customer/lines.php | 43 +++++++++++-------- htdocs/accountancy/expensereport/lines.php | 29 +++++++------ htdocs/accountancy/supplier/lines.php | 40 ++++++++--------- 4 files changed, 60 insertions(+), 54 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index bcd17793db1..27d4fd115ea 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -488,7 +488,7 @@ class AccountingAccount extends CommonObject { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $label = $langs->trans("ShowAccoutingAccount"); + $label = $langs->trans("ShowAccountingAccount"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 45b0c909016..c45e7b27b0a 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -64,9 +65,9 @@ $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page < 0) $page = 0; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$offset = $limit * $page; if (!$sortfield) $sortfield = "f.datef, f.ref, fd.rowid"; if (!$sortorder) { @@ -91,7 +92,7 @@ $formaccounting = new FormAccounting($db); // Purge search criteria 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 { - $search_societe=''; + $search_societe = ''; $search_lineid = ''; $search_ref = ''; $search_invoice = ''; @@ -175,7 +176,8 @@ print ''; + + +// Part to create +if ($action == 'create') +{ + print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("RecruitmentCandidature")), '', 'object_'.$object->picto); + + print '
'; + print ''; + print ''; + if ($backtopage) print ''; + if ($backtopageforcancel) print ''; + + dol_fiche_head(array(), ''); + + // Set some default values + //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; + + print ''."\n"; + + // Common attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; + + print '
'."\n"; + + dol_fiche_end(); + + print '
'; + print ''; + print '  '; + print ''; // Cancel for create does not post form if we don't know the backtopage + print '
'; + + print '
'; + + //dol_set_focus('input[name="ref"]'); +} + +// Part to edit record +if (($id || $ref) && $action == 'edit') +{ + print load_fiche_titre($langs->trans("RecruitmentCandidature"), '', 'object_'.$object->picto); + + print '
'; + print ''; + print ''; + print ''; + if ($backtopage) print ''; + if ($backtopageforcancel) print ''; + + dol_fiche_head(); + + print ''."\n"; + + // Common attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; + + print '
'; + + dol_fiche_end(); + + print '
'; + print '   '; + print '
'; + + print '
'; +} + +// Part to show record +if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) +{ + $res = $object->fetch_optionals(); + + $head = recruitmentcandidaturePrepareHead($object); + dol_fiche_head($head, 'card', $langs->trans("RecruitmentCandidature"), -1, $object->picto); + + $formconfirm = ''; + + // Confirmation to delete + if ($action == 'delete') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteRecruitmentCandidature'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); + } + // Confirmation to delete line + if ($action == 'deleteline') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); + } + // Clone confirmation + if ($action == 'clone') { + // Create an array for form + $formquestion = array(); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + } + + // Confirmation of action xxxx + if ($action == 'xxx') + { + $formquestion = array(); + /* + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) + ); + */ + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); + } + + // Call Hook formConfirm + $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; + + // Print form confirm + print $formconfirm; + + + // Object card + // ------------------------------------------------------------ + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref = '
'; + /* + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref .= '
'.$langs->trans('Project') . ' '; + if ($permissiontoadd) + { + //if ($action != 'classify') $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' '; + $morehtmlref .= ' : '; + if ($action == 'classify') { + //$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= ''; + $morehtmlref .= '
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ': '.$proj->getNomUrl(); + } else { + $morehtmlref .= ''; + } + } + }*/ + $morehtmlref .= '
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + print ''."\n"; + + // Common attributes + //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field + //unset($object->fields['fk_project']); // Hide field already shown in banner + //unset($object->fields['fk_soc']); // Hide field already shown in banner + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + + // Other attributes. Fields from hook formObjectOptions and Extrafields. + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + + print '
'; + print '
'; + print '
'; + + print '
'; + + dol_fiche_end(); + + + /* + * Lines + */ + + if (!empty($object->table_element_line)) + { + // Show object lines + $result = $object->getLinesArray(); + + print '
+ + + + + '; + + if (!empty($conf->use_javascript_ajax) && $object->status == 0) { + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; + } + + print '
'; + if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) + { + print ''; + } + + if (!empty($object->lines)) + { + $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1); + } + + // Form to add new line + if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') + { + if ($action != 'editline') + { + // Add products/services form + $object->formAddObjectLine(1, $mysoc, $soc); + + $parameters = array(); + $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + } + } + + if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) + { + print '
'; + } + print '
'; + + print "
\n"; + } + + + // Buttons for actions + + if ($action != 'presend' && $action != 'editline') { + print '
'."\n"; + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + + if (empty($reshook)) + { + // Send + if (empty($user->socid)) { + print ''.$langs->trans('SendMail').''."\n"; + } + + // Back to draft + if ($object->status == $object::STATUS_VALIDATED) + { + if ($permissiontoadd) + { + print ''.$langs->trans("SetToDraft").''; + } + } + + // Modify + if ($permissiontoadd) + { + print ''.$langs->trans("Modify").''."\n"; + } else { + print ''.$langs->trans('Modify').''."\n"; + } + + // Validate + if ($object->status == $object::STATUS_DRAFT) + { + if ($permissiontoadd) + { + if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) + { + print ''.$langs->trans("Validate").''; + } else { + $langs->load("errors"); + print ''.$langs->trans("Validate").''; + } + } + } + + // Refuse - Decline + if ($object->status >= $object::STATUS_DRAFT && $object->status < $object::STATUS_CANCELED) + { + if ($permissiontoadd) + { + print ''.$langs->trans("Decline").''; + } + } + + // Clone + if ($permissiontoadd) + { + print ''.$langs->trans("ToClone").''."\n"; + } + + /* + if ($permissiontoadd) + { + if ($object->status == $object::STATUS_ENABLED) + { + print ''.$langs->trans("Disable").''."\n"; + } + else + { + print ''.$langs->trans("Enable").''."\n"; + } + } + if ($permissiontoadd) + { + if ($object->status == $object::STATUS_VALIDATED) + { + print ''.$langs->trans("Cancel").''."\n"; + } + else + { + print ''.$langs->trans("Re-Open").''."\n"; + } + } + */ + + // Delete (need delete permission, or if draft, just need create/modify permission) + if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) + { + print ''.$langs->trans('Delete').''."\n"; + } else { + print ''.$langs->trans('Delete').''."\n"; + } + } + print '
'."\n"; + } + + + // Select mail models is same action as presend + if (GETPOST('modelselected')) { + $action = 'presend'; + } + + if ($action != 'presend') + { + print '
'; + print ''; // ancre + + $includedocgeneration = 1; + + // Documents + if ($includedocgeneration) { + $objref = dol_sanitizeFileName($object->ref); + $relativepath = $objref . '/' . $objref . '.pdf'; + $filedir = $conf->recruitment->dir_output.'/'.$object->element.'/'.$objref; + $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; + $genallowed = $user->rights->recruitment->recruitmentcandidature->read; // If you can read, you can build the PDF to read content + $delallowed = $user->rights->recruitment->recruitmentcandidature->write; // If you can create/edit, you can remove a file on card + print $formfile->showdocuments('recruitment:RecruitmentCandidature', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); + } + + // Show links to link elements + $linktoelem = $form->showLinkToObjectBlock($object, null, array('recruitmentcandidature')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + + + print '
'; + + $MAXEVENT = 10; + + $morehtmlright = ''; + $morehtmlright .= $langs->trans("SeeAll"); + $morehtmlright .= ''; + + // List of actions on element + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, $object->element.'@recruitment', (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlright); + + print '
'; + } + + //Select mail models is same action as presend + if (GETPOST('modelselected')) $action = 'presend'; + + // Presend form + $modelmail = 'recruitmentcandidature'; + $defaulttopic = 'InformationMessage'; + $diroutput = $conf->recruitment->dir_output; + $trackid = 'recruitmentcandidature'.$object->id; + + include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php new file mode 100644 index 00000000000..62610ad96d8 --- /dev/null +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -0,0 +1,601 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file recruitmentcandidature_list.php + * \ingroup recruitment + * \brief List page for recruitmentcandidature + */ + +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs +//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters +//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters +//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). +//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) +//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data +//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu +//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php +//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library +//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) +//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value +//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler +//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', '1'); // The main.inc.php does not make a redirect if not logged, instead show simple error message +//if (! defined("XFRAMEOPTIONS_ALLOWALL")) define('XFRAMEOPTIONS_ALLOWALL', '1'); // Do not add the HTTP header 'X-Frame-Options: SAMEORIGIN' but 'X-Frame-Options: ALLOWALL' + +// 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"); + +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'; + +// load recruitment libraries +require_once __DIR__.'/class/recruitmentcandidature.class.php'; + +// for other modules +//dol_include_once('/othermodule/class/otherobject.class.php'); + +// Load translation files required by the page +$langs->loadLangs(array("recruitment@recruitment", "other")); + +$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', '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') : 'recruitmentcandidaturelist'; // 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') + +$id = GETPOST('id', 'int'); + +// Load variable for pagination +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST('sortfield', 'alpha'); +$sortorder = GETPOST('sortorder', 'alpha'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; + +// Initialize technical objects +$object = new RecruitmentCandidature($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction = $conf->recruitment->dir_output.'/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('recruitmentcandidaturelist')); // Note that conf->hooks_modules contains array + +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); +//$extrafields->fetch_name_optionals_label($object->table_element_line); + +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); + +// Default sort order (if not yet defined by previous GETPOST) +if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. +if (!$sortorder) $sortorder = "ASC"; + +// Initialize array of search criterias +$search_all = GETPOST('search_all', 'alphanohtml') ? trim(GETPOST('search_all', 'alphanohtml')) : trim(GETPOST('sall', 'alphanohtml')); +$search = array(); +foreach ($object->fields as $key => $val) +{ + if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha'); +} + +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array(); +foreach ($object->fields as $key => $val) +{ + if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label']; +} + +// Definition of fields for list +$arrayfields = array(); +foreach ($object->fields as $key => $val) +{ + // If $val['visible']==0, then we never show the field + if (!empty($val['visible'])) { + $visible = dol_eval($val['visible'], 1); + $arrayfields['t.'.$key] = array( + 'label'=>$val['label'], + 'checked'=>(($visible < 0) ? 0 : 1), + 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), + 'position'=>$val['position'] + ); + } +} +// Extra fields +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) +{ + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) + { + if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) { + $arrayfields["ef.".$key] = array( + 'label'=>$extrafields->attributes[$object->table_element]['label'][$key], + 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), + 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], + 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]) + ); + } + } +} +$object->fields = dol_sort_array($object->fields, 'position'); +$arrayfields = dol_sort_array($arrayfields, 'position'); + +$permissiontoread = $user->rights->recruitment->recruitmentjobposition->read; +$permissiontoadd = $user->rights->recruitment->recruitmentjobposition->write; +$permissiontodelete = $user->rights->recruitment->recruitmentjobposition->delete; + +// Security check +if (empty($conf->recruitment->enabled)) accessforbidden('Module not enabled'); +$socid = 0; +if ($user->socid > 0) // Protection if external user +{ + //$socid = $user->socid; + accessforbidden(); +} +//$result = restrictedArea($user, 'recruitment', $id, ''); +//if (!$permissiontoread) accessforbidden(); + + + +/* + * Actions + */ + +if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } + +$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'; + + // Purge search criteria + 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 + { + foreach ($object->fields as $key => $val) + { + $search[$key] = ''; + } + $toselect = ''; + $search_array_options = array(); + } + 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 = 'RecruitmentCandidature'; + $objectlabel = 'RecruitmentCandidature'; + $uploaddir = $conf->recruitment->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; +} + + + +/* + * View + */ + +$form = new Form($db); + +$now = dol_now(); + +//$help_url="EN:Module_RecruitmentCandidature|FR:Module_RecruitmentCandidature_FR|ES:Módulo_RecruitmentCandidature"; +$help_url = ''; +$title = $langs->trans('ListOfCandidatures'); + + +// Build and execute select +// -------------------------------------------------------------------- +$sql = 'SELECT '; +foreach ($object->fields as $key => $val) +{ + $sql .= 't.'.$key.', '; +} +// 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); +$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; +if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($object->element).")"; +else $sql .= " WHERE 1 = 1"; +foreach ($search as $key => $val) +{ + if ($key == 'status' && $search[$key] == -1) continue; + $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); + if (strpos($object->fields[$key]['type'], 'integer:') === 0) { + if ($search[$key] == '-1') $search[$key] = ''; + $mode_search = 2; + } + if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); +} +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); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + +/* If a group by is required +$sql.= " GROUP BY "; +foreach($object->fields as $key => $val) +{ + $sql.='t.'.$key.', '; +} +// 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.', ' : ''); +} +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql=preg_replace('/,\s*$/','', $sql); +*/ + +$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); + if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0 + { + $page = 0; + $offset = 0; + } +} +// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. +if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) +{ + $num = $nbtotalofrecords; +} else { + if ($limit) $sql .= $db->plimit($limit + 1, $offset); + + $resql = $db->query($sql); + if (!$resql) + { + dol_print_error($db); + exit; + } + + $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('/recruitment/recruitmentcandidature_card.php', 1).'?id='.$id); + exit; +} + + +// Output page +// -------------------------------------------------------------------- + +llxHeader('', $title, $help_url); + +// Example : Adding jquery code +print ''; + +$arrayofselected = is_array($toselect) ? $toselect : array(); + +$param = ''; +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); +if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); +foreach ($search as $key => $val) +{ + if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey); + else $param .= '&search_'.$key.'='.urlencode($search[$key]); +} +if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); +// Add $param from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + +// List of mass actions available +$arrayofmassactions = array( + //'validate'=>$langs->trans("Validate"), + //'generate_doc'=>$langs->trans("ReGeneratePDF"), + //'builddoc'=>$langs->trans("PDFMerge"), + //'presend'=>$langs->trans("SendByMail"), +); +if ($permissiontodelete) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); + +print '
'."\n"; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +//print ''; +print ''; + +$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/recruitment/recruitmentcandidature_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); + +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); + +// Add code for pre mass action (confirmation or email presend form) +$topicmail = "SendRecruitmentCandidatureRef"; +$modelmail = "recruitmentcandidature"; +$objecttmp = new RecruitmentCandidature($db); +$trackid = 'xxxx'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + +if ($search_all) +{ + foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); + print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; +} + +$moreforfilter = ''; +/*$moreforfilter.='
'; +$moreforfilter.= $langs->trans('MyFilter') . ': '; +$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 '
'; + print $moreforfilter; + print '
'; +} + +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table +print ''."\n"; + + +// Fields title search +// -------------------------------------------------------------------- +print ''; +foreach ($object->fields as $key => $val) +{ + $cssforfield = (empty($val['css']) ? '' : $val['css']); + if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; + elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right'; + if (!empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + } +} +// 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); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +// Action column +print ''; +print ''."\n"; + + +// Fields title label +// -------------------------------------------------------------------- +print ''; +foreach ($object->fields as $key => $val) +{ + $cssforfield = (empty($val['css']) ? '' : $val['css']); + if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; + elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right'; + if (!empty($arrayfields['t.'.$key]['checked'])) + { + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; + } +} +// 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); +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +// Action column +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +print ''."\n"; + + +// Detect if we need a fetch on each output line +$needToFetchEachLine = 0; +if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) +{ + foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) + { + if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object + } +} + + +// Loop on record +// -------------------------------------------------------------------- +$i = 0; +$totalarray = array(); +while ($i < ($limit ? min($num, $limit) : $num)) +{ + $obj = $db->fetch_object($resql); + if (empty($obj)) break; // Should not happen + + // Store properties in $object + $object->setVarsFromFetchObj($obj); + + // Show here line of result + print ''; + foreach ($object->fields as $key => $val) + { + $cssforfield = (empty($val['css']) ? '' : $val['css']); + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; + elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; + + if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield .= ($cssforfield ? ' ' : '').'right'; + //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; + + if (!empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + if ($key == 'status') print $object->getLibStatut(5); + else print $object->showOutputField($val, $key, $object->$key, ''); + print ''; + if (!$i) $totalarray['nbfield']++; + if (!empty($val['isameasure'])) + { + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + $totalarray['val']['t.'.$key] += $object->$key; + } + } + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + print ''; + if (!$i) $totalarray['nbfield']++; + + print ''."\n"; + + $i++; +} + +// 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 ''; +} + + +$db->free($resql); + +$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print '
'; + if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); + elseif (strpos($val['type'], 'integer:') === 0) { + print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); + } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ''; + print ''; +$searchpicto = $form->showFilterButtons(); +print $searchpicto; +print '
'; + 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 ''; + } + print '
'.$langs->trans("NoRecordFound").'
'."\n"; +print '
'."\n"; + +print '
'."\n"; + +if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) +{ + $hidegeneratedfilelistifempty = 1; + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0; + + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + $formfile = new FormFile($db); + + // Show list of available documents + $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource .= str_replace('&', '&', $param); + + $filedir = $diroutputmassaction; + $genallowed = $permissiontoread; + $delallowed = $permissiontoadd; + + print $formfile->showdocuments('massfilesarea_recruitment', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); +} + +// End of page +llxFooter(); +$db->close(); From b6af9470428bdb997fa74821d4ea720a49f43636 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Aug 2020 13:06:54 +0200 Subject: [PATCH 032/122] Fix phpcs --- htdocs/fichinter/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index dd49ebda3ab..5359d64fbca 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -609,7 +609,7 @@ if (empty($reshook)) } $object->fetch_thirdparty(); - $desc = GETPOST('np_desc','alpha'); + $desc = GETPOST('np_desc', 'alpha'); $date_inter = dol_mktime(GETPOST('dihour', 'int'), GETPOST('dimin', 'int'), 0, GETPOST('dimonth', 'int'), GETPOST('diday', 'int'), GETPOST('diyear', 'int')); $duration = convertTime2Seconds(GETPOST('durationhour', 'int'), GETPOST('durationmin', 'int')); From 1b22de5652087dce19603ca7421ce5ccbec9dd42 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Aug 2020 13:22:49 +0200 Subject: [PATCH 033/122] Fix phpcs --- .../core/modules/modEmailCollector.class.php | 1 - .../doc/doc_generic_stock_odt.modules.php | 2 +- .../class/emailcollector.class.php | 20 +++++++------------ 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/htdocs/core/modules/modEmailCollector.class.php b/htdocs/core/modules/modEmailCollector.class.php index 44309e20d81..ad18968ed8d 100644 --- a/htdocs/core/modules/modEmailCollector.class.php +++ b/htdocs/core/modules/modEmailCollector.class.php @@ -310,7 +310,6 @@ class modEmailCollector extends DolibarrModules $tmpresql = $this->db->query($tmpsql); if ($tmpresql) { if ($this->db->num_rows($tmpresql) == 0) { - $descriptionA1 = 'This collector will scan your mailbox "Sent" directory to find emails that was sent as an answer of a Ticket (Module Ticket must be enabled) directly from your email browser instead of from Dolibarr. If such an email is found, the event of answer is recorded into Dolibarr.'; $sqlforexampleA1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)"; diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index 478197d2c2b..ed92840a091 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -163,7 +163,7 @@ class doc_generic_stock_odt extends ModelePDFStock //$texte.=$nbofiles?'':''; $texte .= ''; } - + if ($nbofiles) { $texte .= ''; diff --git a/htdocs/recruitment/recruitmentjobposition_document.php b/htdocs/recruitment/recruitmentjobposition_document.php index b549c22d632..e34f5193bd1 100644 --- a/htdocs/recruitment/recruitmentjobposition_document.php +++ b/htdocs/recruitment/recruitmentjobposition_document.php @@ -77,7 +77,6 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals -//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->recruitment->multidir_output[$object->entity?$object->entity:$conf->entity] . "/recruitmentjobposition/" . dol_sanitizeFileName($object->id); if ($id > 0 || !empty($ref)) $upload_dir = $conf->recruitment->multidir_output[$object->entity ? $object->entity : $conf->entity]."/recruitmentjobposition/".dol_sanitizeFileName($object->ref); // Security check - Protection if external user @@ -190,10 +189,8 @@ if ($object->id) dol_fiche_end(); $modulepart = 'recruitment'; - //$permission = $user->rights->recruitment->recruitmentjobposition->write; - $permission = 1; - //$permtoedit = $user->rights->recruitment->recruitmentjobposition->write; - $permtoedit = 1; + $permission = $user->rights->recruitment->recruitmentjobposition->write; + $permtoedit = $user->rights->recruitment->recruitmentjobposition->write; $param = '&id='.$object->id; //$relativepathwithnofile='recruitmentjobposition/' . dol_sanitizeFileName($object->id).'/'; diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 85c27a29b7e..d6c3a18261e 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -58,8 +58,6 @@ $linkback = ''; print load_fiche_titre($transAreaType, $linkback, 'companies'); -//print ''; -//print '
'; print '
'; @@ -220,7 +218,6 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA print '
'; } -//print '
'; print '
'; @@ -331,7 +328,6 @@ if ($result) dol_print_error($db); } -//print '
'; print ''; $parameters = array('user' => $user); From 03af14294a16d058a74cca94da65f888af26caf3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Aug 2020 15:29:19 +0200 Subject: [PATCH 044/122] Standardize code. Debug module HRM --- htdocs/core/class/html.form.class.php | 2 +- htdocs/hrm/admin/admin_establishment.php | 28 ++++---- htdocs/hrm/admin/admin_hrm.php | 4 +- htdocs/hrm/class/establishment.class.php | 66 +++++++++++++------ htdocs/hrm/establishment/card.php | 32 ++++----- .../install/mysql/migration/12.0.0-13.0.0.sql | 4 +- 6 files changed, 82 insertions(+), 54 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 31898025c94..5567813db79 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5772,7 +5772,7 @@ class Form * @param int $disabled 1=Html component is disabled * @param string $selected_input_value Value of preselected input text (for use with ajax) * @return string Return HTML string - * @see selectForFormsList() select_thirdparty + * @see selectForFormsList() select_thirdparty() */ public function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $disabled = 0, $selected_input_value = '') { diff --git a/htdocs/hrm/admin/admin_establishment.php b/htdocs/hrm/admin/admin_establishment.php index a260941ab0d..6661be2c754 100644 --- a/htdocs/hrm/admin/admin_establishment.php +++ b/htdocs/hrm/admin/admin_establishment.php @@ -51,11 +51,14 @@ foreach ($tmpstatus2label as $key => $val) $status2label[$key] = $langs->trans($ * View */ +$form = new Form($db); +$establishmenttmp = new Establishment($db); + llxHeader('', $langs->trans("Establishments")); $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; -$sortorder = GETPOST("sortorder"); -$sortfield = GETPOST("sortfield"); +$sortorder = GETPOST("sortorder", 'alpha'); +$sortfield = GETPOST("sortfield", 'alpha'); if (!$sortorder) $sortorder = "DESC"; if (!$sortfield) $sortfield = "e.rowid"; @@ -68,11 +71,6 @@ $pageprev = $page - 1; $pagenext = $page + 1; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; -$form = new Form($db); -$establishmenttmp = new Establishment($db); - -dol_htmloutput_mesg($mesg); - // Subheader $linkback = '
'.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("HRMSetup"), $linkback); @@ -81,7 +79,7 @@ print load_fiche_titre($langs->trans("HRMSetup"), $linkback); $head = hrm_admin_prepare_head(); dol_fiche_head($head, 'establishments', $langs->trans("HRM"), -1, "user"); -$sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.status"; +$sql = "SELECT e.rowid, e.label, e.address, e.zip, e.town, e.status"; $sql .= " FROM ".MAIN_DB_PREFIX."establishment as e"; $sql .= " WHERE e.entity IN (".getEntity('establishment').')'; $sql .= $db->order($sortfield, $sortorder); @@ -96,7 +94,8 @@ if ($result) // Load attribute_label print ''; print ''; - print_liste_field_titre("Name", $_SERVER["PHP_SELF"], "e.name", "", "", "", $sortfield, $sortorder); + print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "e.ref", "", "", "", $sortfield, $sortorder); + print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "e.label", "", "", "", $sortfield, $sortorder); print_liste_field_titre("Address", $_SERVER["PHP_SELF"], "e.address", "", "", "", $sortfield, $sortorder); print_liste_field_titre("Zipcode", $_SERVER["PHP_SELF"], "e.zip", "", "", "", $sortfield, $sortorder); print_liste_field_titre("Town", $_SERVER["PHP_SELF"], "e.town", "", "", "", $sortfield, $sortorder); @@ -112,16 +111,17 @@ if ($result) $obj = $db->fetch_object($result); $establishmentstatic->id = $obj->rowid; - $establishmentstatic->name = $obj->name; + $establishmentstatic->ref = $obj->ref; + $establishmentstatic->label = $obj->label; $establishmentstatic->status = $obj->status; print ''; print ''; - print ''; + print ''; + print ''; print ''; print ''; - print ''; @@ -130,7 +130,7 @@ if ($result) $i++; } } else { - print ''; + print ''; } print '
'.$establishmentstatic->getNomUrl(1).''.$obj->address.''.$obj->label.''.$obj->address.''.$obj->zip.''.$obj->town.''; print $establishmentstatic->getLibStatut(5); print '
'.$langs->trans("None").'
'.$langs->trans("None").'
'; @@ -142,7 +142,7 @@ dol_fiche_end(); // Buttons print ''; // End of page diff --git a/htdocs/hrm/admin/admin_hrm.php b/htdocs/hrm/admin/admin_hrm.php index c839e7c4cd4..dcf4fe8bbec 100644 --- a/htdocs/hrm/admin/admin_hrm.php +++ b/htdocs/hrm/admin/admin_hrm.php @@ -34,7 +34,7 @@ $action = GETPOST('action', 'alpha'); // Other parameters HRM_* $list = array( - 'HRM_EMAIL_EXTERNAL_SERVICE' // To prevent your public accountant for example +// 'HRM_EMAIL_EXTERNAL_SERVICE' // To prevent your public accountant for example ); /* @@ -82,7 +82,7 @@ dol_fiche_head($head, 'parameters', $langs->trans("HRM"), -1, "user"); print ''; print ''; -print ''; +print ''; print "\n"; foreach ($list as $key) { diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index 2bbe374d1d0..6a4fca3516a 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -75,7 +75,7 @@ class Establishment extends CommonObject */ public $rowid; - public $name; + public $label; /** * @var string Address @@ -97,11 +97,31 @@ class Establishment extends CommonObject public $country_id; - public $statuts = array(); - public $statuts_short = array(); - const STATUS_OPEN = 0; - const STATUS_CLOSED = 1; + const STATUS_OPEN = 1; + const STATUS_CLOSED = 0; + + + public $fields=array( + 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>15, 'index'=>1), + 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20), + 'label' =>array('type'=>'varchar(128)', 'label'=>'Label', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>1, 'position'=>22), + 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>25), + 'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-1, 'position'=>30), + 'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>35), + 'fk_state' =>array('type'=>'integer', 'label'=>'Fkstate', 'enabled'=>1, 'visible'=>-1, 'position'=>40), + 'fk_country' =>array('type'=>'integer', 'label'=>'Fkcountry', 'enabled'=>1, 'visible'=>-1, 'position'=>45), + 'profid1' =>array('type'=>'varchar(20)', 'label'=>'Profid1', 'enabled'=>1, 'visible'=>-1, 'position'=>50), + 'profid2' =>array('type'=>'varchar(20)', 'label'=>'Profid2', 'enabled'=>1, 'visible'=>-1, 'position'=>55), + 'profid3' =>array('type'=>'varchar(20)', 'label'=>'Profid3', 'enabled'=>1, 'visible'=>-1, 'position'=>60), + 'phone' =>array('type'=>'varchar(20)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>-1, 'position'=>65), + 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fkuserauthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70), + 'fk_user_mod' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fkusermod', 'enabled'=>1, 'visible'=>-1, 'position'=>75), + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>80), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>85), + 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'position'=>500), + ); /** @@ -112,9 +132,6 @@ class Establishment extends CommonObject public function __construct($db) { $this->db = $db; - - $this->statuts_short = array(0 => 'Closed', 1 => 'Open'); - $this->statuts = array(0 => 'Closed', 1 => 'Open'); } /** @@ -128,7 +145,6 @@ class Establishment extends CommonObject global $conf, $langs; $error = 0; - $ret = 0; $now = dol_now(); // Clean parameters @@ -137,11 +153,13 @@ class Establishment extends CommonObject $this->town = ($this->town > 0 ? $this->town : $this->town); $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); + if (empty($this->ref)) $this->ref = '(PROV)'; + $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."establishment ("; $sql .= "ref"; - $sql .= ", name"; + $sql .= ", label"; $sql .= ", address"; $sql .= ", zip"; $sql .= ", town"; @@ -152,7 +170,8 @@ class Establishment extends CommonObject $sql .= ", fk_user_author"; $sql .= ", fk_user_mod"; $sql .= ") VALUES ("; - $sql .= " '".$this->db->escape($this->name)."'"; + $sql .= "'".$this->db->escape($this->ref)."'"; + $sql .= ", '".$this->db->escape($this->label)."'"; $sql .= ", '".$this->db->escape($this->address)."'"; $sql .= ", '".$this->db->escape($this->zip)."'"; $sql .= ", '".$this->db->escape($this->town)."'"; @@ -184,6 +203,12 @@ class Establishment extends CommonObject $this->db->rollback(); return -1 * $error; } else { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'establishment'); + + $sql = 'UPDATE '.MAIN_DB_PREFIX."establishment SET ref = '".$this->db->escape($this->id)."'"; + $sql .= " WHERE rowid = ".$this->id; + $this->db->query($sql); + $this->db->commit(); return $this->id; } @@ -200,7 +225,7 @@ class Establishment extends CommonObject global $langs; // Check parameters - if (empty($this->name)) + if (empty($this->label)) { $this->error = 'ErrorBadParameter'; return -1; @@ -209,7 +234,8 @@ class Establishment extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."establishment"; - $sql .= " SET ref = '".$this->db->escape($this->ref)."', name = '".$this->db->escape($this->name)."'"; + $sql .= " SET ref = '".$this->db->escape($this->ref)."'"; + $sql .= ", label = '".$this->db->escape($this->label)."'"; $sql .= ", address = '".$this->db->escape($this->address)."'"; $sql .= ", zip = '".$this->db->escape($this->zip)."'"; $sql .= ", town = '".$this->db->escape($this->town)."'"; @@ -239,7 +265,7 @@ class Establishment extends CommonObject */ public function fetch($id) { - $sql = "SELECT e.rowid, e.ref, e.name, e.address, e.zip, e.town, e.status, e.fk_country as country_id, e.entity,"; + $sql = "SELECT e.rowid, e.ref, e.label, e.address, e.zip, e.town, e.status, e.fk_country as country_id, e.entity,"; $sql .= ' c.code as country_code, c.label as country'; $sql .= " FROM ".MAIN_DB_PREFIX."establishment as e"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON e.fk_country = c.rowid'; @@ -253,7 +279,7 @@ class Establishment extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->ref; - $this->name = $obj->name; + $this->label = $obj->label; $this->address = $obj->address; $this->zip = $obj->zip; $this->town = $obj->town; @@ -329,7 +355,7 @@ class Establishment extends CommonObject } $statusType = 'status'.$status; - //if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; + if ($status == self::STATUS_OPEN) $statusType = 'status4'; if ($status == self::STATUS_CLOSED) $statusType = 'status6'; return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); @@ -397,11 +423,12 @@ class Establishment extends CommonObject $picto = 'building'; - $label = $langs->trans("Show").': '.$this->name; + $label = ''.$langs->trans("Establishment").''; + $label .= '
'.$langs->trans("Label").': '.$this->label; if ($withpicto) $result .= ($link.img_object($label, $picto).$linkend); if ($withpicto && $withpicto != 2) $result .= ' '; - if ($withpicto != 2) $result .= $link.$this->name.$linkend; + if ($withpicto != 2) $result .= $link.$this->label.$linkend; return $result; } @@ -432,6 +459,7 @@ class Establishment extends CommonObject public function initAsSpecimen() { $this->id = 0; - $this->ref = 'DEP-AAA'; + $this->ref = '0'; + $this->label = 'Department AAA'; } } diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php index c7784d42fb2..55751784630 100644 --- a/htdocs/hrm/establishment/card.php +++ b/htdocs/hrm/establishment/card.php @@ -72,10 +72,10 @@ if ($action == 'confirm_delete' && $confirm == "yes") { $error = 0; - $object->name = GETPOST('name', 'alpha'); - if (empty($object->name)) + $object->label = GETPOST('label', 'alpha'); + if (empty($object->label)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); $error++; } @@ -114,15 +114,15 @@ elseif ($action == 'update') $error = 0; if (!$cancel) { - $name = GETPOST('name', 'alpha'); + $name = GETPOST('label', 'alpha'); if (empty($name)) { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Name')), null, 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Label')), null, 'errors'); $error++; } if (empty($error)) { - $object->name = GETPOST('name', 'alpha'); + $object->label = GETPOST('label', 'alphanohtml'); $object->address = GETPOST('address', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha'); $object->town = GETPOST('town', 'alpha'); @@ -173,8 +173,8 @@ if ($action == 'create') // Name print ''; - print ''; - print ''; + print ''; + print ''; print ''; // Entity @@ -192,7 +192,7 @@ if ($action == 'create') print ''; print ''; print ''; print ''; @@ -273,13 +273,13 @@ if (($id || $ref) && $action == 'edit') // Ref print ""; - print ''; // Name - print ''; // Entity @@ -294,7 +294,7 @@ if (($id || $ref) && $action == 'edit') // Address print ''; print ''; // Zipcode / Town @@ -369,8 +369,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Name print ''; - print ''; - print ''; + print ''; + print ''; print ''; // Entity @@ -390,7 +390,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Zipcode print ''; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 40eaa96a0fc..4611c47ae37 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -60,10 +60,10 @@ ALTER TABLE llx_commande MODIFY COLUMN date_livraison DATETIME; ALTER TABLE llx_website ADD COLUMN position integer DEFAULT 0; ALTER TABLE llx_establishment ADD COLUMN ref varchar(30); -ALTER TABLE llx_establishment ADD COLUMN name varchar(128); +ALTER TABLE llx_establishment ADD COLUMN label varchar(128); UPDATE llx_establishment SET ref = rowid WHERE ref IS NULL; ALTER TABLE llx_establishment MODIFY COLUMN ref varchar(30) NOT NULL; -ALTER TABLE llx_establishment MODIFY COLUMN name varchar(128); +ALTER TABLE llx_establishment MODIFY COLUMN label varchar(128); INSERT INTO llx_const (name, entity, value, type, visible) VALUES ('PRODUCT_PRICE_BASE_TYPE', 0, 'HT', 'string', 0); From e9346298b2a2617df8577651036fa7db9aee2b92 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Aug 2020 15:48:42 +0200 Subject: [PATCH 045/122] trans --- htdocs/hrm/admin/admin_establishment.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/hrm/admin/admin_establishment.php b/htdocs/hrm/admin/admin_establishment.php index 6661be2c754..b5156a08f53 100644 --- a/htdocs/hrm/admin/admin_establishment.php +++ b/htdocs/hrm/admin/admin_establishment.php @@ -40,6 +40,7 @@ static $tmpstatus2label = array( $status2label = array(''); foreach ($tmpstatus2label as $key => $val) $status2label[$key] = $langs->trans($val); + /* * Actions */ @@ -97,7 +98,7 @@ if ($result) print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "e.ref", "", "", "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "e.label", "", "", "", $sortfield, $sortorder); print_liste_field_titre("Address", $_SERVER["PHP_SELF"], "e.address", "", "", "", $sortfield, $sortorder); - print_liste_field_titre("Zipcode", $_SERVER["PHP_SELF"], "e.zip", "", "", "", $sortfield, $sortorder); + print_liste_field_titre("Zip", $_SERVER["PHP_SELF"], "e.zip", "", "", "", $sortfield, $sortorder); print_liste_field_titre("Town", $_SERVER["PHP_SELF"], "e.town", "", "", "", $sortfield, $sortorder); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "e.status", "", "", '', $sortfield, $sortorder, 'right '); print "\n"; From d9cbd8f998c2d62a571231181e0bdd31a0c87ed8 Mon Sep 17 00:00:00 2001 From: "jove@bisquerra.com" Date: Sat, 22 Aug 2020 18:28:15 +0200 Subject: [PATCH 046/122] NEW: Print payment method and change in TakePOS --- .../compta/paiement/class/paiement.class.php | 7 +++- htdocs/core/class/dolreceiptprinter.class.php | 31 +++++++++++++- .../install/mysql/migration/12.0.0-13.0.0.sql | 2 + htdocs/install/mysql/tables/llx_paiement.sql | 3 +- htdocs/langs/en_US/cashdesk.lang | 1 + htdocs/takepos/admin/receipt.php | 8 ++++ htdocs/takepos/invoice.php | 1 + htdocs/takepos/pay.php | 3 +- htdocs/takepos/receipt.php | 41 +++++++++++++++++++ 9 files changed, 92 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 5e01454dd75..38ad5637767 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -9,6 +9,7 @@ * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018 Thibault FOUCART * Copyright (C) 2018 Frédéric France + * Copyright (C) 2020 Andreu Bisquerra Gaya * * 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 @@ -72,6 +73,8 @@ class Paiement extends CommonObject public $multicurrency_amount; // Total amount of payment (in the currency of the bank account) public $amounts = array(); // array: invoice ID => amount for that invoice (in the main currency)> public $multicurrency_amounts = array(); // array: invoice ID => amount for that invoice (in the invoice's currency)> + + public $takepos_change = 0; // Excess received in TakePOS cash payment public $author; public $paiementid; // Type of payment. Id saved into fields fk_paiement on llx_paiement @@ -288,8 +291,8 @@ class Paiement extends CommonObject $num_payment = ($this->num_payment ? $this->num_payment : $this->num_paiement); $note = ($this->note_public ? $this->note_public : $this->note); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, ext_payment_id, ext_payment_site, fk_user_creat)"; - $sql .= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$this->db->escape($num_payment)."', '".$this->db->escape($note)."', ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").", ".$user->id.")"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, ext_payment_id, ext_payment_site, fk_user_creat, takepos_change)"; + $sql .= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$this->db->escape($num_payment)."', '".$this->db->escape($note)."', ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").", ".$user->id.", ".$this->takepos_change.")"; $resql = $this->db->query($sql); if ($resql) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 3234b1900f2..08cf0297e15 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -186,7 +186,7 @@ class dolReceiptPrinter extends Printer 'dol_value_month' => 'DOL_VALUE_MONTH', 'dol_value_day' => 'DOL_VALUE_DAY', 'dol_value_day_letters' => 'DOL_VALUE_DAY', - //'dol_print_payment', + 'dol_print_payment' => 'DOL_PRINT_PAYMENT', 'dol_print_logo' => 'DOL_PRINT_LOGO', 'dol_print_logo_old' => 'DOL_PRINT_LOGO_OLD', 'dol_value_object_id' => 'InvoiceID', @@ -775,6 +775,35 @@ class dolReceiptPrinter extends Printer } } break; + case 'DOL_PRINT_PAYMENT': + $sql = "SELECT p.takepos_change as takepos_change, p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,"; + $sql .= " cp.code"; + $sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; + $sql .= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".$object->id; + $sql .= " ORDER BY p.datep"; + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $row = $this->db->fetch_object($resql); + $spacestoadd = $nbcharactbyline - strlen($langs->transnoentitiesnoconv("PaymentTypeShort".$row->code)) - 12; + $spaces = str_repeat(' ', $spacestoadd); + $amount_payment=($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount; + if ($row->code == "LIQ") $amount_payment = $amount_payment + $row->takepos_change; // Show amount with excess received if is cash payment + $this->printer->text($spaces.$langs->transnoentitiesnoconv("PaymentTypeShort".$row->code).' '.str_pad(price($amount_payment), 10, ' ', STR_PAD_LEFT)."\n"); + if ($row->code == "LIQ" && $row->takepos_change>0) // Print change only in cash payments + { + $spacestoadd = $nbcharactbyline - strlen($langs->trans("Change")) - 12; + $spaces = str_repeat(' ', $spacestoadd); + $this->printer->text($spaces.$langs->trans("Change").' '.str_pad(price($row->takepos_change), 10, ' ', STR_PAD_LEFT)."\n"); + } + $i++; + } + } + break; default: $this->printer->text($vals[$tplline]['tag']); $this->printer->text($vals[$tplline]['value']); diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index d25f5c2975d..7870e051b1c 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -256,3 +256,5 @@ ALTER TABLE llx_projet ADD COLUMN email_msgid varchar(255); ALTER TABLE llx_ticket ADD COLUMN email_msgid varchar(255); ALTER TABLE llx_actioncomm ADD COLUMN reply_to varchar(255); +ALTER TABLE llx_paiement ADD takepos_change DOUBLE(24,8) DEFAULT 0 AFTER fk_export_compta; + diff --git a/htdocs/install/mysql/tables/llx_paiement.sql b/htdocs/install/mysql/tables/llx_paiement.sql index d0cfd727d95..9e6df8f1a4d 100644 --- a/htdocs/install/mysql/tables/llx_paiement.sql +++ b/htdocs/install/mysql/tables/llx_paiement.sql @@ -37,5 +37,6 @@ create table llx_paiement fk_user_creat integer, -- utilisateur qui a cree l'info fk_user_modif integer, -- utilisateur qui a modifie l'info statut smallint DEFAULT 0 NOT NULL, -- Satut, 0 ou 1, 1 n'est plus supprimable - fk_export_compta integer DEFAULT 0 NOT NULL -- fk_export_compta 0 pas exporte + fk_export_compta integer DEFAULT 0 NOT NULL, -- fk_export_compta 0 pas exporte + takepos_change double(24,8) DEFAULT 0 -- Excess received in TakePOS cash payment )ENGINE=innodb; diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 094c70ca687..40691eb70e7 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -121,3 +121,4 @@ GiftReceiptButton=Add a "Gift receipt" button GiftReceipt=Gift receipt ModuleReceiptPrinterMustBeEnabled=Module Receipt printer must have been enabled first AllowDelayedPayment=Allow delayed payment +PrintPaymentMethodOnReceipts=Print payment method on tickets|receipts \ No newline at end of file diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 252781ec635..c17787c0ea1 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -48,6 +48,7 @@ if (GETPOST('action', 'alpha') == 'set') $res = dolibarr_set_const($db, "TAKEPOS_SHOW_CUSTOMER", GETPOST('TAKEPOS_SHOW_CUSTOMER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_PRINT_PAYMENT_METHOD", GETPOST('TAKEPOS_PRINT_PAYMENT_METHOD', 'alpha'), 'chaine', 0, '', $conf->entity); dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); @@ -216,6 +217,13 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "browser" || $conf->global->TAKEPOS_P print '\n"; + + // Print payment method + print '\n"; } // Auto print tickets diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index d4274d90444..20bf23cc215 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -241,6 +241,7 @@ if ($action == 'valid' && $user->rights->facture->creer) $payment->datepaye = $now; $payment->fk_account = $bankaccount; $payment->amounts[$invoice->id] = $amountofpayment; + if ($pay == 'cash') $payment->takepos_change = price2num(GETPOST('excess', 'alpha')); // If user has not used change control, add total invoice payment // Or if user has used change control and the amount of payment is higher than remain to pay, add the remain to pay diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 0a1c60a5a57..f63aec61289 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -186,11 +186,12 @@ else print "var received=0;"; var invoiceid = 0 ? $invoiceid : 0); ?>; var accountid = $("#selectaccountid").val(); var amountpayed = $("#change1").val(); + var excess = $("#change2").val(); if (amountpayed > total_ttc; ?>) { amountpayed = total_ttc; ?>; } console.log("We click on the payment mode to pay amount = "+amountpayed); - parent.$("#poslines").load("invoice.php?place=&action=valid&pay="+payment+"&amount="+amountpayed+"&invoiceid="+invoiceid+"&accountid="+accountid, function() { + parent.$("#poslines").load("invoice.php?place=&action=valid&pay="+payment+"&amount="+amountpayed+"&excess="+excess+"&invoiceid="+invoiceid+"&accountid="+accountid, function() { if (amountpayed > || amountpayed == || amountpayed==0 ) parent.$.colorbox.close(); else location.reload(); }); diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 99000c278de..a03cb24d373 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -181,6 +181,47 @@ if ($conf->global->TAKEPOS_SHOW_CUSTOMER) +global->TAKEPOS_PRINT_PAYMENT_METHOD) { + $sql = "SELECT p.takepos_change as takepos_change, p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,"; + $sql .= " cp.code"; + $sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; + $sql .= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".$facid; + $sql .= " ORDER BY p.datep"; + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) { + $row = $db->fetch_object($resql); + echo ''; + echo ''; + echo ''; + echo ''; + if ($row->code == "LIQ" && $row->takepos_change>0) // Print change only in cash payments + { + echo ''; + echo ''; + echo ''; + echo ''; + } + $i++; + } + } +} +?>
'.$langs->trans('Journaux').''.$langs->trans('Parameters').'
'.$form->editfieldkey('Name', 'name', '', $object, 0, 'string', '', 1).''.$form->editfieldkey('Label', 'label', '', $object, 0, 'string', '', 1).'
'.$form->editfieldkey('Address', 'address', '', $object, 0).''; - print ''; + print ''; print '
'.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print $object->id; print '
'.$form->editfieldkey('Name', 'name', '', $object, 0, 'string', '', 1).''; - print ''; + print '
'.$form->editfieldkey('Label', 'label', '', $object, 0, 'string', '', 1).''; + print ''; print '
'.$form->editfieldkey('Address', 'address', '', $object, 0).''; - print ''; + print ''; print '
'.$langs->trans("Name").''.$object->name.''.$langs->trans("Label").''.$object->label.'
'.$langs->trans("Zipcode").''.$langs->trans("Zip").''.$object->zip.'
'; print $form->selectyesno("TAKEPOS_SHOW_CUSTOMER", $conf->global->TAKEPOS_SHOW_CUSTOMER, 1); print "
'; + print $langs->trans('PrintPaymentMethodOnReceipts'); + print ''; + print $form->selectyesno("TAKEPOS_PRINT_PAYMENT_METHOD", $conf->global->TAKEPOS_PRINT_PAYMENT_METHOD, 1); + print "
trans("TotalTTC").''.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency)."\n"; ?>
'; + echo $langs->transnoentitiesnoconv("PaymentTypeShort".$row->code); + echo ''; + $amount_payment=($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount; + if ($row->code == "LIQ") $amount_payment = $amount_payment + $row->takepos_change; // Show amount with excess received if is cash payment + echo price($amount_payment, 1, '', 1, - 1, - 1, $conf->currency); + echo '
'; + echo $langs->trans("Change"); + echo ''; + echo price($row->takepos_change, 1, '', 1, - 1, - 1, $conf->currency); + echo '

From e8c8cb53cb581ce28af96393bb4147a0f0c78bde Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sat, 22 Aug 2020 18:45:54 +0200 Subject: [PATCH 047/122] Fix travis --- htdocs/takepos/admin/receipt.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index c17787c0ea1..5679f861a29 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -217,7 +217,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "browser" || $conf->global->TAKEPOS_P print ''; print $form->selectyesno("TAKEPOS_SHOW_CUSTOMER", $conf->global->TAKEPOS_SHOW_CUSTOMER, 1); print "\n"; - + // Print payment method print ''; print $langs->trans('PrintPaymentMethodOnReceipts'); From e36eb42568f6de45222d3ed27b2583d21dc2ee97 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sat, 22 Aug 2020 18:46:39 +0200 Subject: [PATCH 048/122] Fix travis --- htdocs/compta/paiement/class/paiement.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 38ad5637767..ab12405748b 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -73,7 +73,7 @@ class Paiement extends CommonObject public $multicurrency_amount; // Total amount of payment (in the currency of the bank account) public $amounts = array(); // array: invoice ID => amount for that invoice (in the main currency)> public $multicurrency_amounts = array(); // array: invoice ID => amount for that invoice (in the invoice's currency)> - + public $takepos_change = 0; // Excess received in TakePOS cash payment public $author; From a265bec7caedb094d1c44fdf65725d3dbe166a99 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 02:38:56 +0200 Subject: [PATCH 049/122] NEW Events in agenda for contact FIX Saving contacts of an events --- htdocs/admin/agenda.php | 3 +- htdocs/comm/action/card.php | 3 +- htdocs/comm/action/class/actioncomm.class.php | 15 ++++++-- htdocs/contact/card.php | 23 ++++++++++++ htdocs/core/actions_sendmails.inc.php | 35 +++++++++++-------- htdocs/core/class/html.formactions.class.php | 2 +- ...terface_50_modAgenda_ActionsAuto.class.php | 35 ++++++++++++++----- htdocs/cron/list.php | 6 ++-- .../mysql/data/llx_c_action_trigger.sql | 4 +++ .../install/mysql/migration/12.0.0-13.0.0.sql | 4 +++ htdocs/langs/en_US/agenda.lang | 2 ++ htdocs/langs/en_US/errors.lang | 1 + 12 files changed, 101 insertions(+), 32 deletions(-) diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 382f242b7e7..1a29595a9ab 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -165,6 +165,7 @@ if (!empty($triggers)) if ($module == 'member') $module = 'adherent'; if ($module == 'project') $module = 'projet'; if ($module == 'proposal_supplier') $module = 'supplier_proposal'; + if ($module == 'contact') $module = 'societe'; // If 'element' value is myobject@mymodule instead of mymodule $tmparray = explode('@', $module); @@ -172,7 +173,7 @@ if (!empty($triggers)) $module = $tmparray[1]; } - //print 'module='.$module.'
'; + //print 'module='.$module.' code='.$trigger['code'].'
'; if (!empty($conf->$module->enabled)) { // Discard special case: If option FICHINTER_CLASSIFY_BILLED is not set, we discard both trigger FICHINTER_CLASSIFY_BILLED and FICHINTER_CLASSIFY_UNBILLED diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 72ffd2b6bba..eb723013f81 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -248,7 +248,7 @@ if (empty($reshook) && $action == 'add') if (!$error) { // Initialisation objet actioncomm - $object->priority = GETPOST("priority") ?GETPOST("priority") : 0; + $object->priority = GETPOST("priority") ? GETPOST("priority") : 0; $object->fulldayevent = (!empty($fulldayevent) ? 1 : 0); $object->location = GETPOST("location"); $object->label = trim(GETPOST('label')); @@ -1706,6 +1706,7 @@ if ($id > 0) } print ''; } + // Categories if ($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 4fb80592adf..1e860217d03 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -492,7 +492,7 @@ class ActionComm extends CommonObject $sql .= ((isset($this->socid) && $this->socid > 0) ? $this->socid : "null").", "; $sql .= ((isset($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : "null").", "; $sql .= " '".$this->db->escape($this->note_private)."', "; - $sql .= ((isset($this->contact_id) && $this->contact_id > 0) ? $this->contact_id : "null").", "; + $sql .= ((isset($this->contact_id) && $this->contact_id > 0) ? $this->contact_id : "null").", "; // deprecated, use ->socpeopleassigned $sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", "; $sql .= ($userownerid > 0 ? $userownerid : "null").", "; $sql .= ($userdoneid > 0 ? $userdoneid : "null").", "; @@ -1141,8 +1141,17 @@ class ActionComm extends CommonObject if (!empty($socid)) $sql .= " AND a.fk_soc = ".$socid; if (!empty($elementtype)) { - if ($elementtype == 'project') $sql .= ' AND a.fk_project = '.$fk_element; - else $sql .= " AND a.fk_element = ".(int) $fk_element." AND a.elementtype = '".$elementtype."'"; + if ($elementtype == 'project') { + $sql .= ' AND a.fk_project = '.$fk_element; + } + elseif ($elementtype == 'contact') { + $sql .= ' AND a.id IN'; + $sql .= " (SELECT fk_actioncomm FROM ".MAIN_DB_PREFIX."actioncomm_resources WHERE"; + $sql .= " element_type = 'socpeople' AND fk_element = ".$fk_element.')'; + } + else { + $sql .= " AND a.fk_element = ".(int) $fk_element." AND a.elementtype = '".$elementtype."'"; + } } if (!empty($filter)) $sql .= $filter; if ($sortorder && $sortfield) $sql .= $db->order($sortfield, $sortorder); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index eeb51e65442..97ae42c3122 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1527,6 +1527,29 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print "
"; + //Select mail models is same action as presend + if (GETPOST('modelselected')) { + $action = 'presend'; + } + + if ($action != 'presend') + { + print '
'; + + print '
'; + + $MAXEVENT = 10; + + $morehtmlright = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/contact/agenda.php?id='.$object->id); + + // List of actions on element + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, 'contact', $object->socid, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for thirdparty + + print '
'; + } + // Presend form $modelmail = 'contact'; $defaulttopic = 'Information'; diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index bc38d9839af..4cfa0531a08 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -114,12 +114,11 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST $result = $object->fetch($id); $sendtosocid = 0; // Id of related thirdparty - if (method_exists($object, "fetch_thirdparty") && !in_array($object->element, array('societe', 'member', 'user', 'expensereport', 'contact'))) + if (method_exists($object, "fetch_thirdparty") && !in_array($object->element, array('member', 'user', 'expensereport', 'societe', 'contact'))) { - $result = $object->fetch_thirdparty(); - if ($object->element == 'user' && $result == 0) $result = 1; // Even if not found, we consider ok + $resultthirdparty = $object->fetch_thirdparty(); $thirdparty = $object->thirdparty; - $sendtosocid = $thirdparty->id; + if (is_object($thirdparty)) $sendtosocid = $thirdparty->id; } elseif ($object->element == 'member' || $object->element == 'user') { $thirdparty = $object; @@ -133,11 +132,15 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST } elseif ($object->element == 'societe') { $thirdparty = $object; - if ($thirdparty->id > 0) $sendtosocid = $thirdparty->id; + if (is_object($thirdparty) && $thirdparty->id > 0) $sendtosocid = $thirdparty->id; } elseif ($object->element == 'contact') { $contact = $object; - if ($contact->id > 0) $sendtosocid = $contact->fetch_thirdparty()->id; + if ($contact->id > 0) { + $contact->fetch_thirdparty(); + $thirdparty = $contact->thirdparty; + if (is_object($thirdparty) && $thirdparty->id > 0) $sendtosocid = $thirdparty->id; + } } else dol_print_error('', "Use actions_sendmails.in.php for an element/object '".$object->element."' that is not supported"); if (is_object($hookmanager)) @@ -145,7 +148,9 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST $parameters = array(); $reshook = $hookmanager->executeHooks('initSendToSocid', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks } - } else $thirdparty = $mysoc; + } else { + $thirdparty = $mysoc; + } if ($result > 0) { @@ -170,23 +175,24 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST // Recipients are provided into free text $tmparray[] = trim($_POST['sendto']); } + if (count($receiver) > 0) { + // Recipient was provided from combo list foreach ($receiver as $key=>$val) { - // Recipient was provided from combo list - if ($val == 'thirdparty') // Key selected means currentthird party (may be usd for current member or current user too) + if ($val == 'thirdparty') // Key selected means current third party ('thirdparty' may be used for current member or current user too) { $tmparray[] = dol_string_nospecial($thirdparty->getFullName($langs), ' ', array(",")).' <'.$thirdparty->email.'>'; } - // Recipient was provided from combo list elseif ($val == 'contact') // Key selected means current contact { $tmparray[] = dol_string_nospecial($contact->getFullName($langs), ' ', array(",")).' <'.$contact->email.'>'; + $sendtoid[] = $contact->id; } elseif ($val) // $val is the Id of a contact { $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); - $sendtoid[] = $val; + $sendtoid[] = ((int) $val); } } } @@ -232,10 +238,11 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST elseif ($val == 'contact') // Key selected means current contact { $tmparray[] = dol_string_nospecial($contact->name, ' ', array(",")).' <'.$contact->email.'>'; + //$sendtoid[] = $contact->id; TODO Add also id of contact in CC ? } elseif ($val) // $val is the Id of a contact { $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); - //$sendtoid[] = $val; TODO Add also id of contact in CC ? + //$sendtoid[] = ((int) $val); TODO Add also id of contact in CC ? } } } @@ -415,7 +422,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST if (empty($actiontypecode)) $actiontypecode = 'AC_OTH_AUTO'; // Event insert into agenda automatically $object->socid = $sendtosocid; // To link to a company - $object->sendtoid = $sendtoid; // To link to contact addresses. This is an array. + $object->sendtoid = $sendtoid; // To link to contact-addresses. This is an array. $object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) $object->actionmsg = $actionmsg; // Long text (@todo Replace this with $message, we already have details of email in dedicated properties) $object->actionmsg2 = $actionmsg2; // Short text ($langs->transnoentities('MailSentBy')...); @@ -486,7 +493,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST $action = 'presend'; } } else { - $langs->load("other"); + $langs->load("errors"); setEventMessages($langs->trans('ErrorFailedToReadObject', $object->element), null, 'errors'); dol_syslog('Failed to read data of object id='.$object->id.' element='.$object->element); $action = 'presend'; diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 9baec43790c..4ec8e29c966 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -157,7 +157,7 @@ class FormActions * Show list of actions for element * * @param Object $object Object - * @param string $typeelement 'invoice','propal','order','invoice_supplier','order_supplier','fichinter' + * @param string $typeelement 'invoice', 'propal', 'order', 'invoice_supplier', 'order_supplier', 'fichinter' * @param int $socid Socid of user * @param int $forceshowtitle Show title even if there is no actions to show * @param string $morecss More css on table diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 1d70938e87c..0874698456f 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -56,7 +56,7 @@ class InterfaceActionsAuto extends DolibarrTriggers * $object->actiontypecode (translation action code: AC_OTH, ...) * $object->actionmsg (note, long text) * $object->actionmsg2 (label, short text) - * $object->sendtoid (id of contact or array of ids) + * $object->sendtoid (id of contact or array of ids of contacts) * $object->socid (id of thirdparty) * $object->fk_project * $object->fk_element @@ -71,7 +71,7 @@ class InterfaceActionsAuto extends DolibarrTriggers */ public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { - if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing + if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing $key = 'MAIN_AGENDA_ACTIONAUTO_'.$action; @@ -92,7 +92,6 @@ class InterfaceActionsAuto extends DolibarrTriggers if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("NewCompanyToDolibarr", $object->name); $object->actionmsg = $langs->transnoentities("NewCompanyToDolibarr", $object->name); - if (!empty($object->prefix)) $object->actionmsg .= " (".$object->prefix.")"; $object->sendtoid = 0; $object->socid = $object->id; @@ -105,7 +104,17 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - } elseif ($action == 'CONTRACT_VALIDATE') + } elseif ($action == 'CONTACT_CREATE') + { + // Load translation files required by the page + $langs->loadLangs(array("agenda", "other", "companies")); + + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("CONTACT_CREATEInDolibarr", $object->getFullName($langs)); + $object->actionmsg = $langs->transnoentities("CONTACT_CREATEInDolibarr", $object->getFullName($langs)); + + $object->sendtoid = array($object->id => $object->id); + $object->socid = $object->socid; + } elseif ($action == 'CONTRACT_VALIDATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "contracts")); @@ -769,8 +778,9 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = 0; } // TODO Merge all previous cases into this generic one - else // $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, ... + else // $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, CONTACT_SENTBYMAIL, ... { + // Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function). // Note that these key can be set in agenda setup, only if defined into c_action_trigger // Load translation files required by the page @@ -779,7 +789,9 @@ class InterfaceActionsAuto extends DolibarrTriggers if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities($action."InDolibarr", $object->ref); if (empty($object->actionmsg)) $object->actionmsg = $langs->transnoentities($action."InDolibarr", $object->ref); - $object->sendtoid = 0; + if (! isset($object->sendtoid) || ! is_array($object->sendtoid)) { + $object->sendtoid = 0; + } } $object->actionmsg = $langs->transnoentities("Author").': '.$user->login."\n".$object->actionmsg; @@ -797,12 +809,12 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = dol_concatdesc($object->actionmsg, "\n".$langs->transnoentities("AttachedFiles").': '.$attachs); } } - require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $contactforaction = new Contact($this->db); $societeforaction = new Societe($this->db); // Set contactforaction if there is only 1 contact. + if (is_array($object->sendtoid)) { if (count($object->sendtoid) == 1) $contactforaction->fetch(reset($object->sendtoid)); @@ -838,7 +850,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $actioncomm->durationp = 0; $actioncomm->percentage = -1; // Not applicable $actioncomm->socid = $societeforaction->id; - $actioncomm->contact_id = $contactforaction->id; + $actioncomm->contact_id = $contactforaction->id; // deprecated, use ->socpeopleassigned instead $actioncomm->authorid = $user->id; // User saving action $actioncomm->userownerid = $user->id; // Owner of action // Fields defined when action is an email (content should be into object->actionmsg to be added into note, subject into object->actionms2 to be added into label) @@ -852,7 +864,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $actioncomm->errors_to = $object->errors_to; // Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table - // for such objects because there is already a dedicated field into table llx_actioncomm. + // for such objects because there is already a dedicated field into table llx_actioncomm or llx_actioncomm_resources. if (!in_array($elementtype, array('societe', 'contact', 'project'))) { $actioncomm->fk_element = $elementid; @@ -865,6 +877,11 @@ class InterfaceActionsAuto extends DolibarrTriggers if (property_exists($object, 'sendtouserid') && is_array($object->sendtouserid) && count($object->sendtouserid) > 0) { $actioncomm->userassigned = $object->sendtouserid; } + if (property_exists($object, 'sendtoid') && is_array($object->sendtoid) && count($object->sendtoid) > 0) { + foreach($object->sendtoid as $val) { + $actioncomm->socpeopleassigned[$val] = $val; + } + } $ret = $actioncomm->create($user); // User creating action diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 45c938da7bf..4b70b229ae1 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -347,7 +347,7 @@ if (!empty($conf->global->CRON_WARNING_DELAY_HOURS)) $text .= $langs->trans("War print info_admin($text); print '
'; -$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +//$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = ''; //$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); @@ -432,11 +432,11 @@ if ($num > 0) print ''; // Label - print ''; + print ''; if (!empty($obj->label)) { $object->ref = $langs->trans($obj->label); - print $object->getNomUrl(0, '', 1); + print ''.$object->getNomUrl(0, '', 1).''; $object->ref = $obj->rowid; } else { //print $langs->trans('CronNone'); diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index dee1200389c..d54ac24a203 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -128,7 +128,11 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_PRODUCED','MO produced','Executed when a MO is produced','bom',661); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_DELETE','MO deleted','Executed when a MO is deleted','bom',662); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_CREATE','Contact address created','Executed when a contact is created','contact',50); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact adress card','contact',51); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',52); -- actions not enabled by default : they are excluded when we enable the module Agenda (except TASK_...) insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_CREATE','Task created','Executed when a project task is created','project',150); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_MODIFY','Task modified','Executed when a project task is modified','project',151); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_DELETE','Task deleted','Executed when a project task is deleted','project',152); + diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 4611c47ae37..d82bf2200ac 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -260,3 +260,7 @@ ALTER TABLE llx_projet ADD COLUMN email_msgid varchar(255); ALTER TABLE llx_ticket ADD COLUMN email_msgid varchar(255); ALTER TABLE llx_actioncomm ADD COLUMN reply_to varchar(255); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_CREATE','Contact address created','Executed when a contact is created','contact',50); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact adress card','contact',51); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',52); + diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 976b3f7acf2..d048a758996 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -86,6 +86,8 @@ ProposalDeleted=Proposal deleted OrderDeleted=Order deleted InvoiceDeleted=Invoice deleted DraftInvoiceDeleted=Draft invoice deleted +CONTACT_CREATEInDolibarr=Contact %s created +CONTACT_DELETEInDolibarr=Contact %s deleted PRODUCT_CREATEInDolibarr=Product %s created PRODUCT_MODIFYInDolibarr=Product %s modified PRODUCT_DELETEInDolibarr=Product %s deleted diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 62f028b45e4..13a4581fc38 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -242,6 +242,7 @@ ErrorTooManyDifferentValueForSelectedGroupBy=Found too many different value (mor ErrorReplaceStringEmpty=Error, the string to replace into is empty ErrorProductNeedBatchNumber=Error, product '%s' need a lot/serial number ErrorProductDoesNotNeedBatchNumber=Error, product '%s' does not accept a lot/serial number +ErrorFailedToReadObject=Error, failed to read object of type %s # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. From f56b7c53303ddb2a614edd0c5533fc59da99d0fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 02:45:19 +0200 Subject: [PATCH 050/122] Removed one useless column --- htdocs/cron/list.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 4b70b229ae1..7f048ac17f1 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -358,7 +358,7 @@ print ''; print ''; print ''; print ''; print ''; print ''; @@ -371,7 +371,6 @@ print ''; print ''; print ''; print ''; -print ''; print ''; print ''; print ''; print ''; - - print ''; // Date start last run print ''; // Duration From bf28201685a65d70f82be93bf816d6e4d08f76aa Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 23 Aug 2020 07:13:43 +0200 Subject: [PATCH 051/122] Fix Missing language key --- htdocs/core/class/infobox.class.php | 4 ++-- htdocs/langs/en_US/boxes.lang | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index de00ea85e6f..ffba924b1ea 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -41,7 +41,7 @@ class InfoBox { return array( 0 => 'Home', - 27 => 'Accountancy Home' + 27 => 'AccountancyHome' ); } else @@ -74,7 +74,7 @@ class InfoBox 24 => 'expensereportindex', 25 => 'mailingindex', 26 => 'opensurveyindex', - 27 => 'Accountancy Home' + 27 => 'AccountancyHome' ); } } diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index bd62684421a..2405bfd5e64 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -100,3 +100,5 @@ SuspenseAccountNotDefined=Suspense account isn't defined BoxLastCustomerShipments=Last customer shipments BoxTitleLastCustomerShipments=Latest %s customer shipments NoRecordedShipments=No recorded customer shipment +# Pages +AccountancyHome=Accountancy From 46a6161323ee1a105c16d8dd873c4d8eecb1cd74 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 13:30:05 +0200 Subject: [PATCH 052/122] Trans --- htdocs/langs/en_US/stocks.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index ce128bc5c91..81163e8d4b0 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -238,5 +238,5 @@ StockAtDatePastDesc=You can view here the stock (real stock) at a given date in StockAtDateFutureDesc=You can view here the stock (virtual stock) at a given date in future CurrentStock=Current stock InventoryRealQtyHelp=Set value to 0 to reset qty
Keep field empty, or remove line, to keep unchanged -UpdateByScaningProductBarcode=Update by scaning product barcode -UpdateByScaningLot=Update by scaning lot +UpdateByScaningProductBarcode=Update by scan (product barcode) +UpdateByScaningLot=Update by scan (lot|Serial barcode) From ca2a34a4c91f4129fd2e27b1767a739ef88d4554 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 15:15:47 +0200 Subject: [PATCH 053/122] Standardize code: Rename fields date_m into tms. All timestamp fields are now name "tms". --- htdocs/core/lib/files.lib.php | 13 +++++++++++-- htdocs/ecm/class/ecmdirectory.class.php | 2 +- htdocs/ecm/class/ecmfiles.class.php | 8 ++++---- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 6 ++++-- htdocs/install/pgsql/functions/functions.sql | 15 +++++++-------- 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 39fcb84996e..596a38346ae 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -223,8 +223,8 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s { global $conf, $db; - $sql = " SELECT rowid, label, entity, filename, filepath, fullpath_orig, keywords, cover, gen_or_uploaded, extraparams, date_c, date_m, fk_user_c, fk_user_m,"; - $sql .= " acl, position, share"; + $sql = " SELECT rowid, label, entity, filename, filepath, fullpath_orig, keywords, cover, gen_or_uploaded, extraparams,"; + $sql .= " date_c, tms as date_m, fk_user_c, fk_user_m, acl, position, share"; if ($mode) $sql .= ", description"; $sql .= " FROM ".MAIN_DB_PREFIX."ecm_files"; $sql .= " WHERE filepath = '".$db->escape($path)."'"; @@ -2764,9 +2764,17 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, // If modulepart=module_temp Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/temp // If modulepart=module_user Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/iduser // If modulepart=module Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart + // If modulepart=module-abc Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart else { + //var_dump($modulepart); + //var_dump($original_file); if (preg_match('/^specimen/i', $original_file)) $accessallowed = 1; // If link to a file called specimen. Test must be done before changing $original_file int full path. if ($fuser->admin) $accessallowed = 1; // If user is admin + $tmpmodulepart = explode('-', $modulepart); + if (! empty($tmpmodulepart[1])) { + $modulepart = $tmpmodulepart[0]; + $original_file = $tmpmodulepart[1].'/'.$original_file; + } // Define $accessallowed $reg = array(); @@ -2822,6 +2830,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, if ($partofdirinoriginalfile && ($fuser->rights->$modulepart->$partofdirinoriginalfile->{$lire} || $fuser->rights->$modulepart->$partofdirinoriginalfile->{$read})) $accessallowed = 1; if ($fuser->rights->$modulepart->{$lire} || $fuser->rights->$modulepart->{$read}) $accessallowed = 1; $original_file = $conf->$modulepart->dir_output.'/'.$original_file; + //var_dump($original_file); } // For modules who wants to manage different levels of permissions for documents diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 9c09ee0f534..8799af86017 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -321,7 +321,7 @@ class EcmDirectory // extends CommonObject $sql .= " t.fk_user_c,"; $sql .= " t.fk_user_m,"; $sql .= " t.date_c as date_c,"; - $sql .= " t.date_m as date_m"; + $sql .= " t.tms as date_m"; $sql .= " FROM ".MAIN_DB_PREFIX."ecm_directories as t"; $sql .= " WHERE t.rowid = ".$id; diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 17717ca4f2a..bb800b81fc2 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -235,7 +235,7 @@ class EcmFiles extends CommonObject $sql .= 'gen_or_uploaded,'; $sql .= 'extraparams,'; $sql .= 'date_c,'; - $sql .= 'date_m,'; + $sql .= 'tms,'; $sql .= 'fk_user_c,'; $sql .= 'fk_user_m,'; $sql .= 'acl,'; @@ -333,7 +333,7 @@ class EcmFiles extends CommonObject $sql .= " t.gen_or_uploaded,"; $sql .= " t.extraparams,"; $sql .= " t.date_c,"; - $sql .= " t.date_m,"; + $sql .= " t.tms as date_m,"; $sql .= " t.fk_user_c,"; $sql .= " t.fk_user_m,"; $sql .= " t.acl,"; @@ -455,7 +455,7 @@ class EcmFiles extends CommonObject $sql .= " t.gen_or_uploaded,"; $sql .= " t.extraparams,"; $sql .= " t.date_c,"; - $sql .= " t.date_m,"; + $sql .= " t.tms as date_m,"; $sql .= " t.fk_user_c,"; $sql .= " t.fk_user_m,"; $sql .= " t.acl,"; @@ -612,7 +612,7 @@ class EcmFiles extends CommonObject $sql .= ' gen_or_uploaded = '.(isset($this->gen_or_uploaded) ? "'".$this->db->escape($this->gen_or_uploaded)."'" : "null").','; $sql .= ' extraparams = '.(isset($this->extraparams) ? "'".$this->db->escape($this->extraparams)."'" : "null").','; $sql .= ' date_c = '.(!isset($this->date_c) || dol_strlen($this->date_c) != 0 ? "'".$this->db->idate($this->date_c)."'" : 'null').','; - //$sql .= ' date_m = '.(! isset($this->date_m) || dol_strlen($this->date_m) != 0 ? "'".$this->db->idate($this->date_m)."'" : 'null').','; // Field automatically updated + //$sql .= ' tms = '.(! isset($this->date_m) || dol_strlen($this->date_m) != 0 ? "'".$this->db->idate($this->date_m)."'" : 'null').','; // Field automatically updated $sql .= ' fk_user_m = '.($this->fk_user_m > 0 ? $this->fk_user_m : $user->id).','; $sql .= ' acl = '.(isset($this->acl) ? "'".$this->db->escape($this->acl)."'" : "null").','; $sql .= ' src_object_id = '.($this->src_object_id > 0 ? $this->src_object_id : "null").','; diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index d82bf2200ac..728ee987c3d 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -178,8 +178,6 @@ ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_rec ALTER TABLE llx_recruitment_recruitmentcandidature ADD CONSTRAINT llx_recruitment_recruitmentcandidature_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_recruitmentcandidature_status (status); - - create table llx_recruitment_recruitmentcandidature_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, @@ -190,6 +188,7 @@ create table llx_recruitment_recruitmentcandidature_extrafields ALTER TABLE llx_recruitment_recruitmentcandidature_extrafields ADD INDEX idx_fk_object(fk_object); +ALTER TABLE llx_recruitment_recruitmentcandidature ADD UNIQUE INDEX uk_recruitmentcandidature_email_msgid(email_msgid); @@ -264,3 +263,6 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact adress card','contact',51); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',52); +ALTER TABLE llx_ecm_directories CHANGE COLUMN date_md tms timestamp; +ALTER TABLE llx_ecm_files CHANGE COLUMN date_md tms timestamp; + diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 22c122a1164..309343b7789 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -102,6 +102,8 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_cronjob FOR EACH ROW CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_deplacement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directories FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_files FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_element_resources FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_emailcollector_emailcollector FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_emailcollector_emailcollectoraction FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); @@ -150,6 +152,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product_customer_pri CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product_fournisseur_price FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product_price FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product_price_by_qty FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product_stock FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_projet FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_projet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); @@ -161,6 +164,10 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_propal_extrafields F CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_propal_merge_pdf_product FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_propaldet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_resource FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentjobposition FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentjobposition_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentcandidature FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentcandidature_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe_address FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); @@ -178,13 +185,5 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user FOR EACH ROW EX CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_usergroup FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_usergroup_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product_price_by_qty FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website_page FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); - - --- Add triggers for timestamp fields named date_m -CREATE OR REPLACE FUNCTION update_modified_column_date_m() RETURNS TRIGGER AS $$ BEGIN NEW.date_m = now(); RETURN NEW; END; $$ LANGUAGE plpgsql; -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directories FOR EACH ROW EXECUTE PROCEDURE update_modified_column_date_m(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_files FOR EACH ROW EXECUTE PROCEDURE update_modified_column_date_m(); From 34d2d9a7c62c33e8b0a9ba45a37a5db399c6d4ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 15:16:52 +0200 Subject: [PATCH 054/122] Look and feel v13 --- htdocs/core/lib/functions.lib.php | 4 +- .../core/modules/modSocialNetworks.class.php | 2 +- htdocs/document.php | 1 + htdocs/ecm/file_card.php | 2 +- htdocs/langs/en_US/mrp.lang | 1 + htdocs/langs/en_US/zapier.lang | 1 + htdocs/theme/eldy/main_menu_fa_icons.inc.php | 2 +- htdocs/theme/md/btn.inc.php | 9 ++++ htdocs/theme/md/info-box.inc.php | 3 ++ htdocs/theme/md/main_menu_fa_icons.inc.php | 53 +++++++++++++++++++ 10 files changed, 73 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3afb5ea6dd3..4fe5f961133 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3026,12 +3026,12 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'object_lot', 'object_mrp', 'object_payment', 'object_product', 'object_propal', 'object_other', 'object_paragraph', 'object_poll', 'object_printer', 'object_project', 'object_projectpub', 'object_propal', 'object_resource', 'object_rss', 'object_projecttask', 'object_recruitmentjobposition', 'object_recruitmentcandidature', - 'object_shipment', 'object_supplier_invoice', 'object_supplier_invoicea', 'object_supplier_invoiced', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock', + 'object_shipment', 'object_share-alt', 'object_supplier_invoice', 'object_supplier_invoicea', 'object_supplier_invoiced', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock', 'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member', 'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'object_website', 'off', 'on', 'order', 'paiment', 'play', 'playdisabled', 'poll', 'printer', 'product', 'propal', 'projecttask', 'stock', 'resize', 'service', 'stats', 'trip', - 'setup', 'sign-out', 'split', 'stripe-s', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench', + 'setup', 'share-alt', 'sign-out', 'split', 'stripe-s', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'home', 'hrm', 'companies', 'products', 'commercial', 'invoicing', 'pencil-ruler', 'preview', 'project', 'projectpub', 'supplier_invoice', 'members', 'ticket', 'generic', diff --git a/htdocs/core/modules/modSocialNetworks.class.php b/htdocs/core/modules/modSocialNetworks.class.php index 67be8eef281..3e97fd26519 100644 --- a/htdocs/core/modules/modSocialNetworks.class.php +++ b/htdocs/core/modules/modSocialNetworks.class.php @@ -56,7 +56,7 @@ class modSocialNetworks extends DolibarrModules // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Name of image file used for this module. - $this->picto = 'email'; + $this->picto = 'share-alt'; // Data directories to create when module is enabled $this->dirs = array(); diff --git a/htdocs/document.php b/htdocs/document.php index 3afa7d252cf..99d9e1a29e2 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -173,6 +173,7 @@ $check_access = dol_check_secure_access_document($modulepart, $original_file, $e $accessallowed = $check_access['accessallowed']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; $fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name +//var_dump($fullpath_original_file);exit; if (!empty($hashp)) { diff --git a/htdocs/ecm/file_card.php b/htdocs/ecm/file_card.php index 144f9fe6bae..7839198d913 100644 --- a/htdocs/ecm/file_card.php +++ b/htdocs/ecm/file_card.php @@ -284,7 +284,7 @@ dol_banner_tab($object, '', $linkback, 0, '', '', $s); print '
'; print '
'; -print '
 '; -print ''; +print ''; print '       '; print $form->selectarray('search_status', array('0'=>$langs->trans("Disabled"), '1'=>$langs->trans("Enabled")), $search_status, 1); print ''; @@ -388,7 +387,6 @@ print_liste_field_titre("CronTask", '', '', "", $param, '', $sortfield, $sortord print_liste_field_titre("CronFrequency", '', "", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("CronDtStart", $_SERVER["PHP_SELF"], "t.datestart", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("CronDtEnd", $_SERVER["PHP_SELF"], "t.dateend", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre("CronMaxRun", $_SERVER["PHP_SELF"], "t.maxrun", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre("CronNbRun", $_SERVER["PHP_SELF"], "t.nbrun", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre("CronDtLastLaunch", $_SERVER["PHP_SELF"], "t.datelastrun", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder); @@ -476,24 +474,21 @@ if ($num > 0) print ''; - if (!empty($obj->datestart)) {print dol_print_date($db->jdate($obj->datestart), 'dayhour'); } + if (!empty($obj->datestart)) { print dol_print_date($db->jdate($obj->datestart), 'dayhour'); } print ''; - if (!empty($obj->dateend)) {print dol_print_date($db->jdate($obj->dateend), 'dayhour'); } + if (!empty($obj->dateend)) { print dol_print_date($db->jdate($obj->dateend), 'dayhour'); } print ''; - if (!empty($obj->maxrun)) {print $obj->maxrun; } - print ''; - if (!empty($obj->nbrun)) {print $obj->nbrun; } else {print '0'; } + if (!empty($obj->nbrun)) { print $obj->nbrun; } else {print '0'; } + if (!empty($obj->maxrun)) { print ' / '.$obj->maxrun.''; } print ''; - if (!empty($datelastrun)) {print dol_print_date($datelastrun, 'dayhoursec'); } + if (!empty($datelastrun)) { print dol_print_date($datelastrun, 'dayhoursec'); } print '
'; +print '
'; print ''; diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index faa8eb60cf4..74877a97297 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -1,5 +1,6 @@ Mrp=Manufacturing Orders MO=Manufacturing Order +MOs=Manufacturing orders MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/en_US/zapier.lang b/htdocs/langs/en_US/zapier.lang index 6d6eda71313..c688a0c307f 100644 --- a/htdocs/langs/en_US/zapier.lang +++ b/htdocs/langs/en_US/zapier.lang @@ -26,3 +26,4 @@ ModuleZapierForDolibarrDesc = Zapier for Dolibarr module # Admin page # ZapierForDolibarrSetup = Setup of Zapier for Dolibarr +ZapierDescription=Interface with Zapier \ No newline at end of file diff --git a/htdocs/theme/eldy/main_menu_fa_icons.inc.php b/htdocs/theme/eldy/main_menu_fa_icons.inc.php index 2286f19e355..e89fdeec39f 100644 --- a/htdocs/theme/eldy/main_menu_fa_icons.inc.php +++ b/htdocs/theme/eldy/main_menu_fa_icons.inc.php @@ -149,7 +149,7 @@ div.mainmenu.generic4::before { opacity: 0.7; color: #440; } -.fa-at, .fa-external-link-alt { +.fa-at, .fa-external-link-alt, .fa-share-alt { opacity: 0.7; color: #304; } diff --git a/htdocs/theme/md/btn.inc.php b/htdocs/theme/md/btn.inc.php index 06999ae8de8..7331c169246 100644 --- a/htdocs/theme/md/btn.inc.php +++ b/htdocs/theme/md/btn.inc.php @@ -167,6 +167,10 @@ a.butAction:hover, a.butActionNew:hover, a.butActionDelete:hover { TITLE BUTTON */ +div.pagination li:first-child a.btnTitle { + margin-left: 10px; +} + .btnTitle, a.btnTitle { display: inline-block; padding: 6px 12px; @@ -196,6 +200,11 @@ TITLE BUTTON background-color: #fbfbfb; } +a.btnTitle.btnTitleSelected { + border: 1px solid #ccc; + border-radius: 3px; +} + .btnTitle > .btnTitle-icon{ } diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index 926e59aef51..1297a99bf99 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -283,6 +283,9 @@ a.info-box-text-a i.fa.fa-exclamation-triangle { font-weight: bold; margin-bottom: 6px; } +.info-box-title { + width: calc(100% - 20px); +} .info-box-text{ font-size: 0.92em; } diff --git a/htdocs/theme/md/main_menu_fa_icons.inc.php b/htdocs/theme/md/main_menu_fa_icons.inc.php index a1e9b4d6449..2bca6430d0b 100644 --- a/htdocs/theme/md/main_menu_fa_icons.inc.php +++ b/htdocs/theme/md/main_menu_fa_icons.inc.php @@ -42,3 +42,56 @@ div.mainmenu.generic3::before { div.mainmenu.generic4::before { content: "\f249"; } + +/* Define color of some picto */ + +.fa-phone, .fa-mobile-alt, .fa-fax { + opacity: 0.7; + color: #440; +} +.fa-at, .fa-external-link-alt, .fa-share-alt { + opacity: 0.7; + color: #304; +} +.fa-trash { + color: #666; +} +.fa-trash:hover:before { + color: #800; +} +.fa-play { + color: #444; +} +.fa-unlink { + color: #555; +} + +/* Define square Dolibarr logo in pure CSS */ + +.fa-dolibarr-css{ + color: #235481; + background: currentColor; + height: 150px; + width: 150px; + position: relative; +} +.fa-dolibarr-css:before{ + content: ''; + position: absolute; + left: 19%; + top: 17%; + width: 25%; + height: 25%; + border: solid 30px white; + border-radius: 0% 200% 200% 0% / 0% 180% 180% 0%; +} +.fa-dolibarr-css:after{ + content: ''; + position: absolute; + left: 19%; + top: 17%; + width: 5px; + height: 25%; + border-bottom: solid 60px currentColor; + margin-left: 30px; +} From 3fe0ffe7e2488efc8115f008b48f1e3dfd31ccce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 15:18:31 +0200 Subject: [PATCH 055/122] Add unique index on email_msgid of candidatures --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 2 ++ .../tables/llx_recruitment_recruitmentcandidature.key.sql | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 728ee987c3d..a6b178eeca5 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -248,6 +248,8 @@ create table llx_c_recruitment_origin )ENGINE=innodb; +ALTER TABLE llx_recruitment_recruitmentcandidature ADD UNIQUE INDEX uk_recruitmentcandidature_email_msgid(email_msgid); + ALTER TABLE llx_product MODIFY COLUMN seuil_stock_alerte float; ALTER TABLE llx_product MODIFY COLUMN desiredstock float; diff --git a/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature.key.sql b/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature.key.sql index 8f92832c2a3..93fb231dc35 100644 --- a/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature.key.sql +++ b/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature.key.sql @@ -21,7 +21,7 @@ ALTER TABLE llx_recruitment_recruitmentcandidature ADD CONSTRAINT llx_recruitmen ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_recruitmentcandidature_status (status); -- END MODULEBUILDER INDEXES ---ALTER TABLE llx_mymodule_myobject ADD UNIQUE INDEX uk_mymodule_myobject_fieldxy(fieldx, fieldy); +ALTER TABLE llx_recruitment_recruitmentcandidature ADD UNIQUE INDEX uk_recruitmentcandidature_email_msgid(email_msgid); ---ALTER TABLE llx_mymodule_myobject ADD CONSTRAINT llx_mymodule_myobject_fk_field FOREIGN KEY (fk_field) REFERENCES llx_mymodule_myotherobject(rowid); +--ALTER TABLE llx_recruitment_recruitmentcandidature ADD CONSTRAINT llx_mymodule_myobject_fk_field FOREIGN KEY (fk_field) REFERENCES llx_mymodule_myotherobject(rowid); From a4c34c2bc5df221042cabe837047a07e37f447ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 15:19:03 +0200 Subject: [PATCH 056/122] NEW Add Manufacturing Orders into the automatic ECM --- htdocs/core/ajax/ajaxdirpreview.php | 39 +++++++++++++---------- htdocs/core/class/html.formfile.class.php | 29 +++++++++++++++-- htdocs/ecm/index_auto.php | 4 ++- 3 files changed, 51 insertions(+), 21 deletions(-) diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index e2a7ae83326..54a0cbef2a1 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -180,41 +180,46 @@ if ($type == 'directory') $sorting = (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC); // Right area. If module is defined here, we are in automatic ecm. - $automodules = array('company', 'invoice', 'invoice_supplier', 'propal', 'supplier_proposal', 'order', 'order_supplier', 'contract', 'product', 'tax', 'project', 'fichinter', 'user', 'expensereport', 'holiday', 'banque'); + $automodules = array( + 'company', + 'invoice', + 'invoice_supplier', + 'propal', + 'supplier_proposal', + 'order', + 'order_supplier', + 'contract', + 'product', + 'tax', + 'project', + 'fichinter', + 'user', + 'expensereport', + 'holiday', + 'recruitment-recruitmentcandidature', + 'banque', + 'mrp-mo' + ); // TODO change for multicompany sharing - // Auto area for suppliers invoices if ($module == 'company') $upload_dir = $conf->societe->dir_output; - // Auto area for suppliers invoices elseif ($module == 'invoice') $upload_dir = $conf->facture->dir_output; - // Auto area for suppliers invoices elseif ($module == 'invoice_supplier') $upload_dir = $conf->fournisseur->facture->dir_output; - // Auto area for customers proposal elseif ($module == 'propal') $upload_dir = $conf->propal->dir_output; - // Auto area for suppliers proposal elseif ($module == 'supplier_proposal') $upload_dir = $conf->supplier_proposal->dir_output; - // Auto area for customers orders elseif ($module == 'order') $upload_dir = $conf->commande->dir_output; - // Auto area for suppliers orders elseif ($module == 'order_supplier') $upload_dir = $conf->fournisseur->commande->dir_output; - // Auto area for suppliers invoices elseif ($module == 'contract') $upload_dir = $conf->contrat->dir_output; - // Auto area for products elseif ($module == 'product') $upload_dir = $conf->product->dir_output; - // Auto area for suppliers invoices elseif ($module == 'tax') $upload_dir = $conf->tax->dir_output; - // Auto area for projects elseif ($module == 'project') $upload_dir = $conf->projet->dir_output; - // Auto area for interventions elseif ($module == 'fichinter') $upload_dir = $conf->ficheinter->dir_output; - // Auto area for users elseif ($module == 'user') $upload_dir = $conf->user->dir_output; - // Auto area for expense report elseif ($module == 'expensereport') $upload_dir = $conf->expensereport->dir_output; - // Auto area for holiday elseif ($module == 'holiday') $upload_dir = $conf->holiday->dir_output; - // Auto area for holiday + elseif ($module == 'recruitment-recruitmentcandidature') $upload_dir = $conf->recruitment->dir_output.'/recruitmentcandidature'; elseif ($module == 'banque') $upload_dir = $conf->bank->dir_output; + elseif ($module == 'mrp-mo') $upload_dir = $conf->mrp->dir_output.'/mo'; // Automatic list if (in_array($module, $automodules)) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index cc1ceaff70f..31b16b7fb65 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1526,10 +1526,18 @@ class FormFile { include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; $object_instance = new Holiday($this->db); + } elseif ($modulepart == 'recruitment-recruitmentcandidature') + { + include_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; + $object_instance = new RecruitmentCandidature($this->db); } elseif ($modulepart == 'banque') { include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $object_instance = new Account($this->db); + } elseif ($modulepart == 'mrp-mo') + { + include_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; + $object_instance = new Mo($this->db); } foreach ($filearray as $key => $file) @@ -1546,9 +1554,24 @@ class FormFile $id = 0; $ref = ''; $label = ''; // To show ref or specific information according to view to show (defined by $module) - if ($modulepart == 'company' || $modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id = (isset($reg[1]) ? $reg[1] : ''); } elseif ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : ''); if (is_numeric($ref)) { $id = $ref; $ref = ''; } } // $ref may be also id with old supplier invoices - elseif ($modulepart == 'user' || $modulepart == 'holiday') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id = (isset($reg[1]) ? $reg[1] : ''); } elseif (in_array($modulepart, array('invoice', 'propal', 'supplier_proposal', 'order', 'order_supplier', 'contract', 'product', 'project', 'fichinter', 'expensereport', 'banque'))) - { + $reg = array(); + if ($modulepart == 'company' || $modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id = (isset($reg[1]) ? $reg[1] : ''); } + elseif ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : ''); if (is_numeric($ref)) { $id = $ref; $ref = ''; } } // $ref may be also id with old supplier invoices + elseif ($modulepart == 'user' || $modulepart == 'holiday') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id = (isset($reg[1]) ? $reg[1] : ''); } + elseif (in_array($modulepart, array( + 'invoice', + 'propal', + 'supplier_proposal', + 'order', + 'order_supplier', + 'contract', + 'product', + 'project', + 'fichinter', + 'expensereport', + 'recruitment-recruitmentcandidature', + 'mrp-mo', + 'banque'))) { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : ''); } else { //print 'Error: Value for modulepart = '.$modulepart.' is not yet implemented in function list_of_autoecmfiles'."\n"; diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index c9a8e1dc551..05d454b8198 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -315,7 +315,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) if (!empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); } if (!empty($conf->commande->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } if (!empty($conf->facture->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } - if (!empty($conf->supplier_proposal->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'supplier_proposal', 'test'=>$conf->supplier_proposal->enabled, 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBySupplierProposals")); } + if (!empty($conf->supplier_proposal->enabled)) { $langs->load("supplier_proposal"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'supplier_proposal', 'test'=>$conf->supplier_proposal->enabled, 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBySupplierProposals")); } if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } if (!empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBySocialContributions")); } @@ -324,6 +324,8 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) if (!empty($conf->expensereport->enabled)) { $langs->load("trips"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsByExpenseReports")); } if (!empty($conf->holiday->enabled)) { $langs->load("holiday"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'holiday', 'test'=>$conf->holiday->enabled, 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsByHolidays")); } if (!empty($conf->banque->enabled)) { $langs->load("banks"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsByBankAccount")); } + if (!empty($conf->mrp->enabled)) { $langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsByMO")); } + if (!empty($conf->recruitment->enabled)) { $langs->load("recruitment"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'recruitment-recruitmentcandidature', 'test'=>$conf->recruitment->enabled, 'label'=>$langs->trans("Candidatures"), 'desc'=>$langs->trans("ECMDocsByCandidature")); } $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsByUsers")); } From 9b7691c8d2459717e1ea7f82f95ca1386cb810bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 18:04:02 +0200 Subject: [PATCH 057/122] Update admin.lang --- htdocs/langs/en_US/admin.lang | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 341164ee2c7..72c741c9056 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -839,10 +839,10 @@ Permission532=Create/modify services Permission534=Delete services Permission536=See/manage hidden services Permission538=Export services -Permission561=Read bank transfer payment orders -Permission562=Create/modify a bank transfer payment order -Permission563=Send/Transmit bank transfer payment order -Permission564=Record Debits/Rejects of bank transfer payment order +Permission561=Read payment orders by credit transfer +Permission562=Create/modify payment order by credit transfer +Permission563=Send/Transmit payment order by credit transfer +Permission564=Record Debits/Rejections of credit transfer Permission650=Read Bills of Materials Permission651=Create/Update Bills of Materials Permission652=Delete Bills of Materials From bd7261a449ba55f62090da56f86235dae468c5b2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 18:04:52 +0200 Subject: [PATCH 058/122] Debug recruitment module --- htdocs/core/class/commonobject.class.php | 4 +- .../class/emailcollector.class.php | 561 +++++++++--------- htdocs/projet/class/project.class.php | 22 +- .../class/recruitmentcandidature.class.php | 13 +- .../recruitmentcandidature_agenda.php | 2 +- .../recruitmentjobposition_agenda.php | 2 +- htdocs/ticket/class/ticket.class.php | 19 +- 7 files changed, 322 insertions(+), 301 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5857631a2f8..be4b48be401 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7763,11 +7763,11 @@ abstract class CommonObject $sql = 'SELECT '.$fieldlist; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element; - if (!empty($id)) $sql .= ' WHERE rowid = '.$id; + if (!empty($id)) $sql .= ' WHERE rowid = '.$id; elseif (!empty($ref)) $sql .= " WHERE ref = ".$this->quote($ref, $this->fields['ref']); else $sql .= ' WHERE 1 = 1'; // usage with empty id and empty ref is very rare if (empty($id) && isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' AND entity IN ('.getEntity($this->table_element).')'; - if ($morewhere) $sql .= $morewhere; + if ($morewhere) $sql .= $morewhere; $sql .= ' LIMIT 1'; // This is a fetch, to be sure to get only one record $res = $this->db->query($sql); diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 74a3644544a..ad76c21dcff 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1574,7 +1574,7 @@ class EmailCollector extends CommonObject elseif ($operation['type'] == 'recordevent') { $alreadycreated = 0; - // TODO Check if $msg ID already in database for $conf->entity + // TODO Check if $msgid already in database for $conf->entity if (!$alreadycreated) { @@ -1650,318 +1650,329 @@ class EmailCollector extends CommonObject } } } - // Create event + // Create project / lead elseif ($operation['type'] == 'project') { - $projecttocreate = new Project($this->db); - if ($thirdpartystatic->id > 0) - { - $projecttocreate->socid = $thirdpartystatic->id; - if ($thirdpartyfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Third party found from '.$thirdpartyfoundby); - } - if ($contactstatic->id > 0) - { - $projecttocreate->contact_id = $contactstatic->id; - if ($contactfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Contact/address found from '.$contactfoundby); - } + $projecttocreate = new Project($this->db); - $description = $descriptiontitle; - $description = dol_concatdesc($description, "-----"); - $description = dol_concatdesc($description, $descriptionmeta); - $description = dol_concatdesc($description, "-----"); - $description = dol_concatdesc($description, $messagetext); + $alreadycreated = $projecttocreate->fetch(0, '', $msgid); + if ($alreadycreated == 0) + { + if ($thirdpartystatic->id > 0) + { + $projecttocreate->socid = $thirdpartystatic->id; + if ($thirdpartyfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Third party found from '.$thirdpartyfoundby); + } + if ($contactstatic->id > 0) + { + $projecttocreate->contact_id = $contactstatic->id; + if ($contactfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Contact/address found from '.$contactfoundby); + } - $descriptionfull = $description; - $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); - $descriptionfull = dol_concatdesc($descriptionfull, $header); + $description = $descriptiontitle; + $description = dol_concatdesc($description, "-----"); + $description = dol_concatdesc($description, $descriptionmeta); + $description = dol_concatdesc($description, "-----"); + $description = dol_concatdesc($description, $messagetext); - $id_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'rowid'); - $percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent'); + $descriptionfull = $description; + $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); + $descriptionfull = dol_concatdesc($descriptionfull, $header); - $projecttocreate->title = $subject; - $projecttocreate->date_start = $date; - $projecttocreate->date_end = ''; - $projecttocreate->opp_status = $id_opp_status; - $projecttocreate->opp_percent = $percent_opp_status; - $projecttocreate->description = dol_concatdesc(dolGetFirstLineOfText(dol_string_nohtmltag($description, 2), 10), '...'.$langs->transnoentities("SeePrivateNote").'...'); - $projecttocreate->note_private = $descriptionfull; - $projecttocreate->entity = $conf->entity; - $projecttocreate->email_msgid = $msgid; + $id_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'rowid'); + $percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent'); - // Overwrite values with values extracted from source email. - // This may overwrite any $projecttocreate->xxx properties. - $savesocid = $projecttocreate->socid; - $errorforthisaction = $this->overwritePropertiesOfObject($projecttocreate, $operation['actionparam'], $messagetext, $subject, $header); + $projecttocreate->title = $subject; + $projecttocreate->date_start = $date; + $projecttocreate->date_end = ''; + $projecttocreate->opp_status = $id_opp_status; + $projecttocreate->opp_percent = $percent_opp_status; + $projecttocreate->description = dol_concatdesc(dolGetFirstLineOfText(dol_string_nohtmltag($description, 2), 10), '...'.$langs->transnoentities("SeePrivateNote").'...'); + $projecttocreate->note_private = $descriptionfull; + $projecttocreate->entity = $conf->entity; + $projecttocreate->email_msgid = $msgid; - // Set project ref if not yet defined - if (empty($projecttocreate->ref)) - { - // Get next project Ref - $defaultref = ''; - $modele = empty($conf->global->PROJECT_ADDON) ? 'mod_project_simple' : $conf->global->PROJECT_ADDON; + // Overwrite values with values extracted from source email. + // This may overwrite any $projecttocreate->xxx properties. + $savesocid = $projecttocreate->socid; + $errorforthisaction = $this->overwritePropertiesOfObject($projecttocreate, $operation['actionparam'], $messagetext, $subject, $header); - // Search template files - $file = ''; $classname = ''; $filefound = 0; $reldir = ''; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) - { - $file = dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0); - if (file_exists($file)) - { - $filefound = 1; - $classname = $modele; - break; - } - } + // Set project ref if not yet defined + if (empty($projecttocreate->ref)) + { + // Get next Ref + $defaultref = ''; + $modele = empty($conf->global->PROJECT_ADDON) ? 'mod_project_simple' : $conf->global->PROJECT_ADDON; - if ($filefound) - { - $result = dol_include_once($reldir."core/modules/project/".$modele.'.php'); - $modProject = new $classname; + // Search template files + $file = ''; $classname = ''; $filefound = 0; $reldir = ''; + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + foreach ($dirmodels as $reldir) + { + $file = dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0); + if (file_exists($file)) + { + $filefound = 1; + $classname = $modele; + break; + } + } - if ($savesocid > 0) - { - if ($savesocid != $projecttocreate->socid) - { - $errorforactions++; - setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$projecttocreate->socid.') by setting socid in operation with a different value', null, 'errors'); - } - } else { - if ($projecttocreate->socid > 0) - { - $thirdpartystatic->fetch($projecttocreate->socid); - } - } + if ($filefound) + { + if ($savesocid > 0) + { + if ($savesocid != $projecttocreate->socid) + { + $errorforactions++; + setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$projecttocreate->socid.') by setting socid in operation with a different value', null, 'errors'); + } + } else { + if ($projecttocreate->socid > 0) + { + $thirdpartystatic->fetch($projecttocreate->socid); + } + } - $defaultref = $modProject->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $projecttocreate); - } - $projecttocreate->ref = $defaultref; - } + $result = dol_include_once($reldir."core/modules/project/".$modele.'.php'); + $modModuleToUseForNextValue = new $classname; + $defaultref = $modModuleToUseForNextValue->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $projecttocreate); + } + $projecttocreate->ref = $defaultref; + } - if ($errorforthisaction) - { - $errorforactions++; - } else { - if (empty($projecttocreate->ref) || (is_numeric($projecttocreate->ref) && $projecttocreate->ref <= 0)) - { - $errorforactions++; - $this->error = 'Failed to create project: Can\'t get a valid value for the field ref with numbering template = '.$modele.', thirdparty id = '.$thirdpartystatic->id; - } else { - // Create project - $result = $projecttocreate->create($user); - if ($result <= 0) - { - $errorforactions++; - $this->error = 'Failed to create project: '.$langs->trans($projecttocreate->error); - $this->errors = $projecttocreate->errors; - } - } - } + if ($errorforthisaction) + { + $errorforactions++; + } else { + if (empty($projecttocreate->ref) || (is_numeric($projecttocreate->ref) && $projecttocreate->ref <= 0)) + { + $errorforactions++; + $this->error = 'Failed to create project: Can\'t get a valid value for the field ref with numbering template = '.$modele.', thirdparty id = '.$thirdpartystatic->id; + } else { + // Create project + $result = $projecttocreate->create($user); + if ($result <= 0) + { + $errorforactions++; + $this->error = 'Failed to create project: '.$langs->trans($projecttocreate->error); + $this->errors = $projecttocreate->errors; + } + } + } + } } - // Create event + // Create ticket elseif ($operation['type'] == 'ticket') { - $tickettocreate = new Ticket($this->db); - if ($thirdpartystatic->id > 0) - { - $tickettocreate->socid = $thirdpartystatic->id; - $tickettocreate->fk_soc = $thirdpartystatic->id; - if ($thirdpartyfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Third party found from '.$thirdpartyfoundby); - } - if ($contactstatic->id > 0) - { - $tickettocreate->contact_id = $contactstatic->id; - if ($contactfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Contact/address found from '.$contactfoundby); - } + $tickettocreate = new Ticket($this->db); - $description = $descriptiontitle; - $description = dol_concatdesc($description, "-----"); - $description = dol_concatdesc($description, $descriptionmeta); - $description = dol_concatdesc($description, "-----"); - $description = dol_concatdesc($description, $messagetext); + $alreadycreated = $tickettocreate->fetch(0, '', '', $msgid); + if ($alreadycreated == 0) + { + if ($thirdpartystatic->id > 0) + { + $tickettocreate->socid = $thirdpartystatic->id; + $tickettocreate->fk_soc = $thirdpartystatic->id; + if ($thirdpartyfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Third party found from '.$thirdpartyfoundby); + } + if ($contactstatic->id > 0) + { + $tickettocreate->contact_id = $contactstatic->id; + if ($contactfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Contact/address found from '.$contactfoundby); + } - $descriptionfull = $description; - $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); - $descriptionfull = dol_concatdesc($descriptionfull, $header); + $description = $descriptiontitle; + $description = dol_concatdesc($description, "-----"); + $description = dol_concatdesc($description, $descriptionmeta); + $description = dol_concatdesc($description, "-----"); + $description = dol_concatdesc($description, $messagetext); - $tickettocreate->subject = $subject; - $tickettocreate->message = $description; - $tickettocreate->type_code = 0; - $tickettocreate->category_code = null; - $tickettocreate->severity_code = null; - $tickettocreate->origin_email = $from; - $tickettocreate->fk_user_create = $user->id; - $tickettocreate->datec = $date; - $tickettocreate->fk_project = $projectstatic->id; - $tickettocreate->notify_tiers_at_create = 0; - $tickettocreate->note_private = $descriptionfull; - $tickettocreate->entity = $conf->entity; - $tickettocreate->email_msgid = $msgid; - //$tickettocreate->fk_contact = $contactstatic->id; + $descriptionfull = $description; + $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); + $descriptionfull = dol_concatdesc($descriptionfull, $header); - // Overwrite values with values extracted from source email. - // This may overwrite any $projecttocreate->xxx properties. - $savesocid = $tickettocreate->socid; - $errorforthisaction = $this->overwritePropertiesOfObject($tickettocreate, $operation['actionparam'], $messagetext, $subject, $header); + $tickettocreate->subject = $subject; + $tickettocreate->message = $description; + $tickettocreate->type_code = 0; + $tickettocreate->category_code = null; + $tickettocreate->severity_code = null; + $tickettocreate->origin_email = $from; + $tickettocreate->fk_user_create = $user->id; + $tickettocreate->datec = $date; + $tickettocreate->fk_project = $projectstatic->id; + $tickettocreate->notify_tiers_at_create = 0; + $tickettocreate->note_private = $descriptionfull; + $tickettocreate->entity = $conf->entity; + $tickettocreate->email_msgid = $msgid; + //$tickettocreate->fk_contact = $contactstatic->id; - // Set ticket ref if not yet defined - if (empty($tickettocreate->ref)) - { - // Get next project Ref - $defaultref = ''; - $modele = empty($conf->global->TICKET_ADDON) ? 'mod_ticket_simple' : $conf->global->TICKET_ADDON; + // Overwrite values with values extracted from source email. + // This may overwrite any $projecttocreate->xxx properties. + $savesocid = $tickettocreate->socid; + $errorforthisaction = $this->overwritePropertiesOfObject($tickettocreate, $operation['actionparam'], $messagetext, $subject, $header); - // Search template files - $file = ''; $classname = ''; $filefound = 0; $reldir = ''; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) - { - $file = dol_buildpath($reldir."core/modules/ticket/".$modele.'.php', 0); - if (file_exists($file)) - { - $filefound = 1; - $classname = $modele; - break; - } - } + // Set ticket ref if not yet defined + if (empty($tickettocreate->ref)) + { + // Get next Ref + $defaultref = ''; + $modele = empty($conf->global->TICKET_ADDON) ? 'mod_ticket_simple' : $conf->global->TICKET_ADDON; - if ($filefound) - { - $result = dol_include_once($reldir."core/modules/ticket/".$modele.'.php'); - $modTicket = new $classname; + // Search template files + $file = ''; $classname = ''; $filefound = 0; $reldir = ''; + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + foreach ($dirmodels as $reldir) + { + $file = dol_buildpath($reldir."core/modules/ticket/".$modele.'.php', 0); + if (file_exists($file)) + { + $filefound = 1; + $classname = $modele; + break; + } + } - if ($savesocid > 0) - { - if ($savesocid != $tickettocreate->socid) - { - $errorforactions++; - setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$tickettocreate->socid.') by setting socid in operation with a different value', null, 'errors'); - } - } else { - if ($tickettocreate->socid > 0) - { - $thirdpartystatic->fetch($tickettocreate->socid); - } - } + if ($filefound) + { + if ($savesocid > 0) + { + if ($savesocid != $tickettocreate->socid) + { + $errorforactions++; + setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$tickettocreate->socid.') by setting socid in operation with a different value', null, 'errors'); + } + } else { + if ($tickettocreate->socid > 0) + { + $thirdpartystatic->fetch($tickettocreate->socid); + } + } - $defaultref = $modTicket->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $tickettocreate); - } - $tickettocreate->ref = $defaultref; - } + $result = dol_include_once($reldir."core/modules/ticket/".$modele.'.php'); + $modModuleToUseForNextValue = new $classname; + $defaultref = $modModuleToUseForNextValue->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $tickettocreate); + } + $tickettocreate->ref = $defaultref; + } - if ($errorforthisaction) - { - $errorforactions++; - } else { - if (is_numeric($tickettocreate->ref) && $tickettocreate->ref <= 0) - { - $errorforactions++; - $this->error = 'Failed to create ticket: Can\'t get a valid value for the field ref with numbering template = '.$modele.', thirdparty id = '.$thirdpartystatic->id; - } else { - // Create project - $result = $tickettocreate->create($user); - if ($result <= 0) - { - $errorforactions++; - $this->error = 'Failed to create ticket: '.$langs->trans($tickettocreate->error); - $this->errors = $tickettocreate->errors; - } - } - } + if ($errorforthisaction) + { + $errorforactions++; + } else { + if (is_numeric($tickettocreate->ref) && $tickettocreate->ref <= 0) + { + $errorforactions++; + $this->error = 'Failed to create ticket: Can\'t get a valid value for the field ref with numbering template = '.$modele.', thirdparty id = '.$thirdpartystatic->id; + } else { + // Create project + $result = $tickettocreate->create($user); + if ($result <= 0) + { + $errorforactions++; + $this->error = 'Failed to create ticket: '.$langs->trans($tickettocreate->error); + $this->errors = $tickettocreate->errors; + } + } + } + } } // Create candidature elseif ($operation['type'] == 'candidature') { $candidaturetocreate = new RecruitmentCandidature($this->db); - $description = $descriptiontitle; - $description = dol_concatdesc($description, "-----"); - $description = dol_concatdesc($description, $descriptionmeta); - $description = dol_concatdesc($description, "-----"); - $description = dol_concatdesc($description, $messagetext); - - $descriptionfull = $description; - $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); - $descriptionfull = dol_concatdesc($descriptionfull, $header); - - $candidaturetocreate->subject = $subject; - $candidaturetocreate->message = $description; - $candidaturetocreate->type_code = 0; - $candidaturetocreate->category_code = null; - $candidaturetocreate->severity_code = null; - $candidaturetocreate->email = $from; - //$candidaturetocreate->lastname = $langs->trans("Anonymous").' - '.$from; - $candidaturetocreate->fk_user_creat = $user->id; - $candidaturetocreate->date_creation = $date; - $candidaturetocreate->fk_project = $projectstatic->id; - $candidaturetocreate->description = $description; - $candidaturetocreate->note_private = $descriptionfull; - $candidaturetocreate->entity = $conf->entity; - $candidaturetocreate->email_msgid = $msgid; - $candidaturetocreate->status = 0; - //$candidaturetocreate->fk_contact = $contactstatic->id; - - // Overwrite values with values extracted from source email. - // This may overwrite any $projecttocreate->xxx properties. - $errorforthisaction = $this->overwritePropertiesOfObject($candidaturetocreate, $operation['actionparam'], $messagetext, $subject, $header); - - // Set candidature ref if not yet defined - /*if (empty($candidaturetocreate->ref)) + $alreadycreated = $candidaturetocreate->fetch(0, '', $msgid); + if ($alreadycreated == 0) { - // Get next project Ref - $defaultref = ''; - $modele = empty($conf->global->CANDIDATURE_ADDON) ? 'mod_candidature_simple' : $conf->global->CANDIDATURE_ADDON; + $description = $descriptiontitle; + $description = dol_concatdesc($description, "-----"); + $description = dol_concatdesc($description, $descriptionmeta); + $description = dol_concatdesc($description, "-----"); + $description = dol_concatdesc($description, $messagetext); - // Search template files - $file = ''; $classname = ''; $filefound = 0; $reldir = ''; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) - { - $file = dol_buildpath($reldir."core/modules/ticket/".$modele.'.php', 0); - if (file_exists($file)) - { - $filefound = 1; - $classname = $modele; - break; - } - } + $descriptionfull = $description; + $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); + $descriptionfull = dol_concatdesc($descriptionfull, $header); - if ($filefound) - { - $result = dol_include_once($reldir."core/modules/ticket/".$modele.'.php'); - $modCandidature = new $classname; + $candidaturetocreate->subject = $subject; + $candidaturetocreate->message = $description; + $candidaturetocreate->type_code = 0; + $candidaturetocreate->category_code = null; + $candidaturetocreate->severity_code = null; + $candidaturetocreate->email = $from; + //$candidaturetocreate->lastname = $langs->trans("Anonymous").' - '.$from; + $candidaturetocreate->fk_user_creat = $user->id; + $candidaturetocreate->date_creation = $date; + $candidaturetocreate->fk_project = $projectstatic->id; + $candidaturetocreate->description = $description; + $candidaturetocreate->note_private = $descriptionfull; + $candidaturetocreate->entity = $conf->entity; + $candidaturetocreate->email_msgid = $msgid; + $candidaturetocreate->status = $candidaturetocreate::STATUS_DRAFT; + //$candidaturetocreate->fk_contact = $contactstatic->id; - if ($savesocid > 0) - { - if ($savesocid != $candidaturetocreate->socid) - { - $errorforactions++; - setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$candidaturetocreate->socid.') by setting socid in operation with a different value', null, 'errors'); - } - } else { - if ($candidaturetocreate->socid > 0) - { - $thirdpartystatic->fetch($candidaturetocreate->socid); - } - } + // Overwrite values with values extracted from source email. + // This may overwrite any $projecttocreate->xxx properties. + $errorforthisaction = $this->overwritePropertiesOfObject($candidaturetocreate, $operation['actionparam'], $messagetext, $subject, $header); - $defaultref = $modCandidature->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $tickettocreate); - } - $candidaturetocreate->ref = $defaultref; - }*/ + // Set candidature ref if not yet defined + /*if (empty($candidaturetocreate->ref)) We do not need this because we create object in draft status + { + // Get next Ref + $defaultref = ''; + $modele = empty($conf->global->CANDIDATURE_ADDON) ? 'mod_candidature_simple' : $conf->global->CANDIDATURE_ADDON; - if ($errorforthisaction) - { - $errorforactions++; - } else { - // Create project - $result = $candidaturetocreate->create($user); - if ($result <= 0) - { - $errorforactions++; - $this->error = 'Failed to create ticket: '.join(', ', $candidaturetocreate->errors); - $this->errors = $candidaturetocreate->errors; - } + // Search template files + $file = ''; $classname = ''; $filefound = 0; $reldir = ''; + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + foreach ($dirmodels as $reldir) + { + $file = dol_buildpath($reldir."core/modules/ticket/".$modele.'.php', 0); + if (file_exists($file)) + { + $filefound = 1; + $classname = $modele; + break; + } + } + + if ($filefound) + { + if ($savesocid > 0) + { + if ($savesocid != $candidaturetocreate->socid) + { + $errorforactions++; + setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$candidaturetocreate->socid.') by setting socid in operation with a different value', null, 'errors'); + } + } else { + if ($candidaturetocreate->socid > 0) + { + $thirdpartystatic->fetch($candidaturetocreate->socid); + } + } + + $result = dol_include_once($reldir."core/modules/ticket/".$modele.'.php'); + $modModuleToUseForNextValue = new $classname; + $defaultref = $modModuleToUseForNextValue->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $tickettocreate); + } + $candidaturetocreate->ref = $defaultref; + }*/ + + if ($errorforthisaction) + { + $errorforactions++; + } else { + // Create project + $result = $candidaturetocreate->create($user); + if ($result <= 0) + { + $errorforactions++; + $this->error = 'Failed to create ticket: '.join(', ', $candidaturetocreate->errors); + $this->errors = $candidaturetocreate->errors; + } + } } } // Create event specific on hook diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 07846951acf..9069899af47 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -469,11 +469,12 @@ class Project extends CommonObject /** * Get object from database * - * @param int $id Id of object to load - * @param string $ref Ref of project - * @return int >0 if OK, 0 if not found, <0 if KO + * @param int $id Id of object to load + * @param string $ref Ref of project + * @param string $email_msgid Email msgid + * @return int >0 if OK, 0 if not found, <0 if KO */ - public function fetch($id, $ref = '') + public function fetch($id, $ref = '', $email_msgid = '') { global $conf; @@ -485,11 +486,14 @@ class Project extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."projet"; if (!empty($id)) { - $sql .= " WHERE rowid=".$id; - } elseif (!empty($ref)) - { - $sql .= " WHERE ref='".$this->db->escape($ref)."'"; - $sql .= " AND entity IN (".getEntity('project').")"; + $sql .= " WHERE rowid = ".$id; + } else { + $sql .= " WHERE entity IN (".getEntity('project').")"; + if (! empty($ref)) { + $sql .= " AND ref = '".$this->db->escape($ref)."'"; + } else { + $sql .= " AND email_msgid = '".$this->db->escape($email_msgid)."'"; + } } dol_syslog(get_class($this)."::fetch", LOG_DEBUG); diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index c312f2fff12..4b18d1803e0 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -333,13 +333,16 @@ class RecruitmentCandidature extends CommonObject /** * Load object in memory from the database * - * @param int $id Id object - * @param string $ref Ref - * @return int <0 if KO, 0 if not found, >0 if OK + * @param int $id Id object + * @param string $ref Ref + * @param string $email_msgid Email msgid + * @return int <0 if KO, 0 if not found, >0 if OK */ - public function fetch($id, $ref = null) + public function fetch($id, $ref = null, $email_msgid = '') { - $result = $this->fetchCommon($id, $ref); + $morewhere = ''; + if ($email_msgid) $morewhere = " AND email_msgid = '".$this->db->escape($email_msgid)."'"; + $result = $this->fetchCommon($id, $ref, $morewhere); if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines(); return $result; } diff --git a/htdocs/recruitment/recruitmentcandidature_agenda.php b/htdocs/recruitment/recruitmentcandidature_agenda.php index c3e922fd321..876a1220735 100644 --- a/htdocs/recruitment/recruitmentcandidature_agenda.php +++ b/htdocs/recruitment/recruitmentcandidature_agenda.php @@ -204,7 +204,7 @@ if ($object->id > 0) $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.$object->element.'&originid='.$object->id; + $out = '&origin='.$object->element.'@recruitment&originid='.$object->id; $permok = $user->rights->agenda->myactions->create; if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { diff --git a/htdocs/recruitment/recruitmentjobposition_agenda.php b/htdocs/recruitment/recruitmentjobposition_agenda.php index d54cec57e9a..a96455a33ff 100644 --- a/htdocs/recruitment/recruitmentjobposition_agenda.php +++ b/htdocs/recruitment/recruitmentjobposition_agenda.php @@ -204,7 +204,7 @@ if ($object->id > 0) $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.$object->element.'&originid='.$object->id; + $out = '&origin='.$object->element.'@recruitment&originid='.$object->id; $permok = $user->rights->agenda->myactions->create; if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index af42daa0193..4e62a92a4c9 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -470,12 +470,13 @@ class Ticket extends CommonObject /** * Load object in memory from the database * - * @param int $id Id object - * @param string $ref Ref - * @param string $track_id Track id, a hash like ref - * @return int <0 if KO, >0 if OK + * @param int $id Id object + * @param string $ref Ref + * @param string $track_id Track id, a hash like ref + * @param string $email_msgid Email msgid + * @return int <0 if KO, >0 if OK */ - public function fetch($id = '', $ref = '', $track_id = '') + public function fetch($id = '', $ref = '', $track_id = '', $email_msgid = '') { global $langs; @@ -520,10 +521,12 @@ class Ticket extends CommonObject $sql .= " WHERE t.rowid = ".$this->db->escape($id); } else { $sql .= " WHERE t.entity IN (".getEntity($this->element, 1).")"; - if ($track_id) { - $sql .= " AND t.track_id = '".$this->db->escape($track_id)."'"; - } elseif ($ref) { + if (! empty($ref)) { $sql .= " AND t.ref = '".$this->db->escape($ref)."'"; + } elseif ($track_id) { + $sql .= " AND t.track_id = '".$this->db->escape($track_id)."'"; + } else { + $sql .= " AND t.email_msgid = '".$this->db->escape($email_msgid)."'"; } } From 6685cc5bc8ab4b74669cfedfacbd9f95872a3044 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 18:07:18 +0200 Subject: [PATCH 059/122] Update admin.lang --- htdocs/langs/en_US/admin.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 72c741c9056..482f89b30e7 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -859,6 +859,7 @@ Permission774=Read all expense reports (even for user not subordinates) Permission775=Approve expense reports Permission776=Pay expense reports Permission777=Read expense reports of everybody +Permission778=Create/modify expense reports of everybody Permission779=Export expense reports Permission1001=Read stocks Permission1002=Create/modify warehouses From 477c3e719d901952826ebf3d5e8000c8fbba7839 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 18:26:42 +0200 Subject: [PATCH 060/122] Fix phpcs --- htdocs/categories/class/api_categories.class.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index e73086fa85d..79cc42c2874 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -242,11 +242,9 @@ class Categories extends DolibarrApi $this->category->$field = $value; } - if ($this->category->update(DolibarrApiAccess::$user) > 0) - { + if ($this->category->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); - } else - { + } else { throw new RestException(500, $this->category->error); } } @@ -779,12 +777,10 @@ class Categories extends DolibarrApi $objects_api = new Products(); } elseif ($type == 'contact') { $objects_api = new Contacts(); - } - elseif ($type == 'project') { + } elseif ($type == 'project') { $objects_api = new Projects(); } - if (is_object($objects_api)) - { + if (is_object($objects_api)) { foreach ($objects as $obj) { $cleaned_objects[] = $objects_api->_cleanObjectDatas($obj); } From 815269db9cd2ebeeaabcb4dfbee2a5ab20f2ce51 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 18:49:19 +0200 Subject: [PATCH 061/122] FIX #14443 --- htdocs/multicurrency/class/multicurrency.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 8acd4430e47..7626db8082a 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -548,7 +548,7 @@ class MultiCurrency extends CommonObject * * @param int $fk_facture id of facture * @param double $amount amount to convert - * @param string $way dolibarr mean the amount is in dolibarr currency + * @param string $way 'dolibarr' mean the amount is in dolibarr currency * @param string $table facture or facture_fourn * @return double amount converted */ @@ -558,8 +558,8 @@ class MultiCurrency extends CommonObject if ($multicurrency_tx) { - if ($way == 'dolibarr') return $amount * $multicurrency_tx; - else return $amount / $multicurrency_tx; + if ($way == 'dolibarr') return price2num($amount * $multicurrency_tx, 'MU'); + else return price2num($amount / $multicurrency_tx, 'MU'); } else return $amount; } From 7eb003c6843a17a1cad2ef57a183bc3dcc326c73 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 19:11:19 +0200 Subject: [PATCH 062/122] Update pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 3c6bf0765ed..c83b7f28ce6 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2129,7 +2129,7 @@ function pdf_getLinkedObjects($object,$outputlangs) { $elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); if (! empty($elementobject->linkedObjectsIds['commande'])){ - dol_include_once('/commande/commande.class.php'); + include_once DOL_DOCUMENT_ROOT.'/commande/commande.class.php'; $order = new Commande($object->db); $ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande'])); if ($ret < 1){ $order=null; } From b44d6744f9b496972491615f9c28ac445ccf6abe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 19:11:40 +0200 Subject: [PATCH 063/122] Update pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index c83b7f28ce6..c0c7c7d0f9b 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2132,7 +2132,7 @@ function pdf_getLinkedObjects($object,$outputlangs) include_once DOL_DOCUMENT_ROOT.'/commande/commande.class.php'; $order = new Commande($object->db); $ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande'])); - if ($ret < 1){ $order=null; } + if ($ret < 1) { $order=null; } } } if (! is_object($order)) From 7a183ea026bc0189f07ac803e006124a07eefe40 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 19:13:30 +0200 Subject: [PATCH 064/122] Update pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index c0c7c7d0f9b..54252923ad6 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2071,7 +2071,7 @@ function pdf_getTotalQty($object,$type,$outputlangs) */ function pdf_getLinkedObjects($object,$outputlangs) { - global $hookmanager; + global $db, $hookmanager; $linkedobjects=array(); @@ -2130,7 +2130,7 @@ function pdf_getLinkedObjects($object,$outputlangs) $elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); if (! empty($elementobject->linkedObjectsIds['commande'])){ include_once DOL_DOCUMENT_ROOT.'/commande/commande.class.php'; - $order = new Commande($object->db); + $order = new Commande($db); $ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande'])); if ($ret < 1) { $order=null; } } From 74eac1d06a1708152b8232be83e897385724eafa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 19:22:01 +0200 Subject: [PATCH 065/122] Fix include regression --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 54252923ad6..6a1ebacdab1 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2129,7 +2129,7 @@ function pdf_getLinkedObjects($object,$outputlangs) { $elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); if (! empty($elementobject->linkedObjectsIds['commande'])){ - include_once DOL_DOCUMENT_ROOT.'/commande/commande.class.php'; + include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $order = new Commande($db); $ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande'])); if ($ret < 1) { $order=null; } From a6f838a6e0dbc604ea7eb5aacfdfd27e977dc494 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 19:51:13 +0200 Subject: [PATCH 066/122] Update card.php --- htdocs/expedition/card.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 0db066717ca..8de5ac787d7 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1072,8 +1072,14 @@ if ($action == 'create') print ''; print ''; print ''; if (!empty($conf->stock->enabled)) { From b600478a5a0bdfa386971201cff80582f771e198 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 22:11:16 +0200 Subject: [PATCH 067/122] Work on recruitment module --- htdocs/admin/mails_templates.php | 1 + htdocs/core/class/html.formmail.class.php | 10 ++++++++-- htdocs/core/lib/functions.lib.php | 16 ++++++++++------ htdocs/core/tpl/card_presend.tpl.php | 12 ++++-------- .../install/mysql/data/llx_c_email_templates.sql | 2 ++ htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 2 ++ htdocs/langs/en_US/recruitment.lang | 5 ++++- .../recruitment/recruitmentcandidature_card.php | 4 ++-- 8 files changed, 33 insertions(+), 19 deletions(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 9e2f443b5a6..bdd9f571123 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -167,6 +167,7 @@ if ($conf->adherent->enabled && $user->rights->adherent->lire) $element if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementList['contract'] = $langs->trans('MailToSendContract'); if ($conf->projet->enabled) $elementList['project'] = $langs->trans('MailToProject'); if ($conf->ticket->enabled && $user->rights->ticket->read) $elementList['ticket_send'] = $langs->trans('MailToTicket'); +if ($conf->recruitment->enabled && $user->rights->recruitment->recruitmentjobposition->read) $elementList['recruitmentcandidature_send'] = $langs->trans('RecruitmentCandidatures'); $elementList['user'] = $langs->trans('MailToUser'); $parameters = array('elementList'=>$elementList); diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index dc14e132e41..aeec45555b2 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -463,7 +463,7 @@ class FormMail extends Form } elseif (!empty($this->param['models']) && in_array($this->param['models'], array( 'propal_send', 'order_send', 'facture_send', 'shipping_send', 'fichinter_send', 'supplier_proposal_send', 'order_supplier_send', - 'invoice_supplier_send', 'thirdparty', 'contract', 'user', 'all' + 'invoice_supplier_send', 'thirdparty', 'contract', 'user', 'recruitmentcandidature_send', 'all' ))) { // If list of template is empty @@ -474,10 +474,11 @@ class FormMail extends Form $out .= ''; $out .= '   '; $out .= ''; + } else { + $out .= ''; } - $out .= '
'.$langs->trans("ECMCreationDate").''; print dol_print_date(dol_filemtime($fullpath), 'dayhour'); print '
'.$langs->trans("QtyOrdered").''.$langs->trans("QtyShipped").''.$langs->trans("QtyToShip"); - print '
('.$langs->trans("Fill").''; - print ' / '.$langs->trans("Reset").')'; + if (empty($conf->productbatch->enabled)) + { + print '
'.$langs->trans("Fill").''; + print ' / '; + } else { + print '
'; + } + print ''.$langs->trans("Reset").''; print '
'."\n"; // Substitution array/string @@ -924,6 +925,8 @@ class FormMail extends Form $this->substit['__ONLINE_PAYMENT_URL__'] = ''; } + $this->substit['__ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__'] = ''; + // Add lines substitution key from each line $lines = ''; $defaultlines = $arraydefaultmessage->content_lines; @@ -946,6 +949,9 @@ class FormMail extends Form if (strpos($defaultmessage, '__ONLINE_PAYMENT_TEXT_AND_URL__') !== false && dol_textishtml($this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__'])) { $atleastonecomponentishtml++; } + if (strpos($defaultmessage, '__ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__') !== false && dol_textishtml($this->substit['__ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__'])) { + $atleastonecomponentishtml++; + } if (dol_textishtml($defaultmessage)) { $atleastonecomponentishtml++; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4fe5f961133..c213fc35d55 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6001,6 +6001,10 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, /*$substitutionarray['__MEMBER_NOTE_PUBLIC__'] = '__MEMBER_NOTE_PUBLIC__'; $substitutionarray['__MEMBER_NOTE_PRIVATE__'] = '__MEMBER_NOTE_PRIVATE__';*/ } + if (!empty($conf->recruitment->enabled)) + { + $substitutionarray['__CANDIDATE_FULLNAME__'] = 'Candidate full name'; + } if (!empty($conf->projet->enabled)) { $substitutionarray['__PROJECT_ID__'] = '__PROJECT_ID__'; @@ -6082,8 +6086,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE_END__'] = dol_print_date($object->last_subscription_date_end, 'dayrfc'); } - if (is_object($object) && $object->element == 'societe') - { + if (is_object($object) && $object->element == 'societe') { $substitutionarray['__THIRDPARTY_ID__'] = (is_object($object) ? $object->id : ''); $substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object) ? $object->name : ''); $substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = (is_object($object) ? $object->name_alias : ''); @@ -6106,8 +6109,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__THIRDPARTY_TVAINTRA__'] = (is_object($object) ? $object->tva_intra : ''); $substitutionarray['__THIRDPARTY_NOTE_PUBLIC__'] = (is_object($object) ?dol_htmlentitiesbr($object->note_public) : ''); $substitutionarray['__THIRDPARTY_NOTE_PRIVATE__'] = (is_object($object) ?dol_htmlentitiesbr($object->note_private) : ''); - } elseif (is_object($object->thirdparty) && $object->thirdparty->id > 0) - { + } elseif (is_object($object->thirdparty) && $object->thirdparty->id > 0) { $substitutionarray['__THIRDPARTY_ID__'] = (is_object($object->thirdparty) ? $object->thirdparty->id : ''); $substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty) ? $object->thirdparty->name : ''); $substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = (is_object($object->thirdparty) ? $object->thirdparty->name_alias : ''); @@ -6128,8 +6130,10 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__THIRDPARTY_IDPROF5__'] = (is_object($object->thirdparty) ? $object->thirdparty->idprof5 : ''); $substitutionarray['__THIRDPARTY_IDPROF6__'] = (is_object($object->thirdparty) ? $object->thirdparty->idprof6 : ''); $substitutionarray['__THIRDPARTY_TVAINTRA__'] = (is_object($object->thirdparty) ? $object->thirdparty->tva_intra : ''); - $substitutionarray['__THIRDPARTY_NOTE_PUBLIC__'] = (is_object($object->thirdparty) ?dol_htmlentitiesbr($object->thirdparty->note_public) : ''); - $substitutionarray['__THIRDPARTY_NOTE_PRIVATE__'] = (is_object($object->thirdparty) ?dol_htmlentitiesbr($object->thirdparty->note_private) : ''); + $substitutionarray['__THIRDPARTY_NOTE_PUBLIC__'] = (is_object($object->thirdparty) ? dol_htmlentitiesbr($object->thirdparty->note_public) : ''); + $substitutionarray['__THIRDPARTY_NOTE_PRIVATE__'] = (is_object($object->thirdparty) ? dol_htmlentitiesbr($object->thirdparty->note_private) : ''); + } elseif (is_object($object) && $object->element == 'recruitmentcandidature') { + $substitutionarray['__CANDIDATE_FULLNAME__'] = $object->getFullName($outputlangs); } if (is_object($object->project) && $object->project->id > 0) diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 93dee2ebda9..3695ec31d37 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -154,21 +154,17 @@ if ($action == 'presend') // Fill list of recipient with email inside <>. $liste = array(); - if ($object->element == 'expensereport') - { + if ($object->element == 'expensereport') { $fuser = new User($db); $fuser->fetch($object->fk_user_author); $liste['thirdparty'] = $fuser->getFullName($outputlangs)." <".$fuser->email.">"; - } elseif ($object->element == 'societe') - { + } elseif ($object->element == 'societe') { foreach ($object->thirdparty_and_contact_email_array(1) as $key => $value) { $liste[$key] = $value; } - } elseif ($object->element == 'contact') - { + } elseif ($object->element == 'contact') { $liste['contact'] = $object->getFullName($outputlangs)." <".$object->email.">"; - } elseif ($object->element == 'user' || $object->element == 'member') - { + } elseif ($object->element == 'user' || $object->element == 'member') { $liste['thirdparty'] = $object->getFullName($outputlangs)." <".$object->email.">"; } else { if (is_object($object->thirdparty)) diff --git a/htdocs/install/mysql/data/llx_c_email_templates.sql b/htdocs/install/mysql/data/llx_c_email_templates.sql index f417804ff93..253ace246e7 100644 --- a/htdocs/install/mysql/data/llx_c_email_templates.sql +++ b/htdocs/install/mysql/data/llx_c_email_templates.sql @@ -30,3 +30,5 @@ INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_u INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnCancelation)' ,50,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasCanceled)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(YourMembershipWasCanceled)__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingAnEMailToMember)' ,60,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(CardContent)__', '__(Hello)__,

\n\n__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civiliyty)__ : __MEMBER_CIVILITY__
\n__(Firstname)__ : __MEMBER_FIRSTNAME__
\n__(Lastname)__ : __MEMBER_LASTNAME__
\n__(Fullname)__ : __MEMBER_FULLNAME__
\n__(Company)__ : __MEMBER_COMPANY__
\n__(Address)__ : __MEMBER_ADDRESS__
\n__(Zip)__ : __MEMBER_ZIP__
\n__(Town)__ : __MEMBER_TOWN__
\n__(Country)__ : __MEMBER_COUNTRY__
\n__(Email)__ : __MEMBER_EMAIL__
\n__(Birthday)__ : __MEMBER_BIRTH__
\n__(Photo)__ : __MEMBER_PHOTO__
\n__(Login)__ : __MEMBER_LOGIN__
\n__(Password)__ : __MEMBER_PASSWORD__
\n__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'$conf->recruitment->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__,

\n\n__(YourCandidatureAnswerMessage)__
__ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); + diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index a6b178eeca5..2961ae82589 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -268,3 +268,5 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value ALTER TABLE llx_ecm_directories CHANGE COLUMN date_md tms timestamp; ALTER TABLE llx_ecm_files CHANGE COLUMN date_md tms timestamp; +INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'$conf->recruitment->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__,

\n\n__(YourCandidatureAnswer)__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); + diff --git a/htdocs/langs/en_US/recruitment.lang b/htdocs/langs/en_US/recruitment.lang index d712207a3cc..73e9a7fa07f 100644 --- a/htdocs/langs/en_US/recruitment.lang +++ b/htdocs/langs/en_US/recruitment.lang @@ -64,4 +64,7 @@ ContractSigned=Contract signed RecruitmentCandidature=Candidature JobPositions=Job positions RecruitmentCandidatures=Candidatures -InterviewToDo=Interview to do \ No newline at end of file +InterviewToDo=Interview to do +AnswerCandidature=Candidature answer +YourCandidature=Your candidature +YourCandidatureAnswerMessage=Thanks you for your candidature.
... diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index a5e6d4050b0..90fce79bfb0 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -464,7 +464,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { // Send if (empty($user->socid)) { - print ''.$langs->trans('SendMail').''."\n"; + print 'email).'#formmailbeforetitle">'.$langs->trans('SendMail').''."\n"; } // Back to draft @@ -599,7 +599,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (GETPOST('modelselected')) $action = 'presend'; // Presend form - $modelmail = 'recruitmentcandidature'; + $modelmail = 'recruitmentcandidature_send'; $defaulttopic = 'InformationMessage'; $diroutput = $conf->recruitment->dir_output; $trackid = 'recruitmentcandidature'.$object->id; From f010e44a71431006175890ddbbad8a556555ecae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 22:13:06 +0200 Subject: [PATCH 068/122] WIP --- htdocs/core/lib/functions.lib.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c213fc35d55..8631e0e5663 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6132,8 +6132,12 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__THIRDPARTY_TVAINTRA__'] = (is_object($object->thirdparty) ? $object->thirdparty->tva_intra : ''); $substitutionarray['__THIRDPARTY_NOTE_PUBLIC__'] = (is_object($object->thirdparty) ? dol_htmlentitiesbr($object->thirdparty->note_public) : ''); $substitutionarray['__THIRDPARTY_NOTE_PRIVATE__'] = (is_object($object->thirdparty) ? dol_htmlentitiesbr($object->thirdparty->note_private) : ''); - } elseif (is_object($object) && $object->element == 'recruitmentcandidature') { - $substitutionarray['__CANDIDATE_FULLNAME__'] = $object->getFullName($outputlangs); + } + + if (is_object($object) && $object->element == 'recruitmentcandidature') { + if ($object->id > 0) { + $substitutionarray['__CANDIDATE_FULLNAME__'] = $object->getFullName($outputlangs); + } } if (is_object($object->project) && $object->project->id > 0) From a5ab711b27ca81df3328a8c6be3179a4b3eb863b Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 23 Aug 2020 22:22:05 +0200 Subject: [PATCH 069/122] Change variable to pos_change --- htdocs/compta/paiement/class/paiement.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index ab12405748b..4ec28bf2935 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -74,7 +74,7 @@ class Paiement extends CommonObject public $amounts = array(); // array: invoice ID => amount for that invoice (in the main currency)> public $multicurrency_amounts = array(); // array: invoice ID => amount for that invoice (in the invoice's currency)> - public $takepos_change = 0; // Excess received in TakePOS cash payment + public $pos_change = 0; // Excess received in TakePOS cash payment public $author; public $paiementid; // Type of payment. Id saved into fields fk_paiement on llx_paiement @@ -291,8 +291,8 @@ class Paiement extends CommonObject $num_payment = ($this->num_payment ? $this->num_payment : $this->num_paiement); $note = ($this->note_public ? $this->note_public : $this->note); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, ext_payment_id, ext_payment_site, fk_user_creat, takepos_change)"; - $sql .= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$this->db->escape($num_payment)."', '".$this->db->escape($note)."', ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").", ".$user->id.", ".$this->takepos_change.")"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, ext_payment_id, ext_payment_site, fk_user_creat, pos_change)"; + $sql .= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$this->db->escape($num_payment)."', '".$this->db->escape($note)."', ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").", ".$user->id.", ".$this->pos_change.")"; $resql = $this->db->query($sql); if ($resql) From f9913be7198f3af28325ccc90f4f27761bfcf795 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 23 Aug 2020 22:24:46 +0200 Subject: [PATCH 070/122] Change variable to pos_change --- htdocs/core/class/dolreceiptprinter.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 08cf0297e15..b7929e6a159 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -776,7 +776,7 @@ class dolReceiptPrinter extends Printer } break; case 'DOL_PRINT_PAYMENT': - $sql = "SELECT p.takepos_change as takepos_change, p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,"; + $sql = "SELECT p.pos_change as pos_change, p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,"; $sql .= " cp.code"; $sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; @@ -792,13 +792,13 @@ class dolReceiptPrinter extends Printer $spacestoadd = $nbcharactbyline - strlen($langs->transnoentitiesnoconv("PaymentTypeShort".$row->code)) - 12; $spaces = str_repeat(' ', $spacestoadd); $amount_payment=($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount; - if ($row->code == "LIQ") $amount_payment = $amount_payment + $row->takepos_change; // Show amount with excess received if is cash payment + if ($row->code == "LIQ") $amount_payment = $amount_payment + $row->pos_change; // Show amount with excess received if is cash payment $this->printer->text($spaces.$langs->transnoentitiesnoconv("PaymentTypeShort".$row->code).' '.str_pad(price($amount_payment), 10, ' ', STR_PAD_LEFT)."\n"); - if ($row->code == "LIQ" && $row->takepos_change>0) // Print change only in cash payments + if ($row->code == "LIQ" && $row->pos_change>0) // Print change only in cash payments { $spacestoadd = $nbcharactbyline - strlen($langs->trans("Change")) - 12; $spaces = str_repeat(' ', $spacestoadd); - $this->printer->text($spaces.$langs->trans("Change").' '.str_pad(price($row->takepos_change), 10, ' ', STR_PAD_LEFT)."\n"); + $this->printer->text($spaces.$langs->trans("Change").' '.str_pad(price($row->pos_change), 10, ' ', STR_PAD_LEFT)."\n"); } $i++; } From ec2479a41aaee7bde7433cfd603321ede4f8bace Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 23 Aug 2020 22:26:22 +0200 Subject: [PATCH 071/122] Update 12.0.0-13.0.0.sql --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 7870e051b1c..02231edfc6e 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -256,5 +256,5 @@ ALTER TABLE llx_projet ADD COLUMN email_msgid varchar(255); ALTER TABLE llx_ticket ADD COLUMN email_msgid varchar(255); ALTER TABLE llx_actioncomm ADD COLUMN reply_to varchar(255); -ALTER TABLE llx_paiement ADD takepos_change DOUBLE(24,8) DEFAULT 0 AFTER fk_export_compta; +ALTER TABLE llx_paiement ADD pos_change DOUBLE(24,8) DEFAULT 0 AFTER fk_export_compta; From e032ddc035ac1f2655fae87c5e81d410c427536e Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 23 Aug 2020 22:27:18 +0200 Subject: [PATCH 072/122] Change variable to pos_change --- htdocs/install/mysql/tables/llx_paiement.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_paiement.sql b/htdocs/install/mysql/tables/llx_paiement.sql index 9e6df8f1a4d..d19d38312a4 100644 --- a/htdocs/install/mysql/tables/llx_paiement.sql +++ b/htdocs/install/mysql/tables/llx_paiement.sql @@ -38,5 +38,5 @@ create table llx_paiement fk_user_modif integer, -- utilisateur qui a modifie l'info statut smallint DEFAULT 0 NOT NULL, -- Satut, 0 ou 1, 1 n'est plus supprimable fk_export_compta integer DEFAULT 0 NOT NULL, -- fk_export_compta 0 pas exporte - takepos_change double(24,8) DEFAULT 0 -- Excess received in TakePOS cash payment + pos_change double(24,8) DEFAULT 0 -- Excess received in TakePOS cash payment )ENGINE=innodb; From 8f933c324a34f2368ab222bc7a51acfd18ca0238 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 23 Aug 2020 22:28:26 +0200 Subject: [PATCH 073/122] Change variable to pos_change --- htdocs/takepos/invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 20bf23cc215..a25c809b551 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -241,7 +241,7 @@ if ($action == 'valid' && $user->rights->facture->creer) $payment->datepaye = $now; $payment->fk_account = $bankaccount; $payment->amounts[$invoice->id] = $amountofpayment; - if ($pay == 'cash') $payment->takepos_change = price2num(GETPOST('excess', 'alpha')); + if ($pay == 'cash') $payment->pos_change = price2num(GETPOST('excess', 'alpha')); // If user has not used change control, add total invoice payment // Or if user has used change control and the amount of payment is higher than remain to pay, add the remain to pay From 915aa56a958c4a3e0b6aea622c1ef8015af20358 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 23 Aug 2020 22:29:55 +0200 Subject: [PATCH 074/122] Change variable to pos_change --- htdocs/takepos/receipt.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index a03cb24d373..c7ca395a316 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -183,7 +183,7 @@ if ($conf->global->TAKEPOS_SHOW_CUSTOMER) global->TAKEPOS_PRINT_PAYMENT_METHOD) { - $sql = "SELECT p.takepos_change as takepos_change, p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,"; + $sql = "SELECT p.pos_change as pos_change, p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,"; $sql .= " cp.code"; $sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; @@ -202,18 +202,18 @@ if ($conf->global->TAKEPOS_PRINT_PAYMENT_METHOD) { echo ''; echo ''; echo ''; - if ($row->code == "LIQ" && $row->takepos_change>0) // Print change only in cash payments + if ($row->code == "LIQ" && $row->pos_change>0) // Print change only in cash payments { echo ''; echo ''; echo ''; echo ''; } From 633f03e8533808c7b1bc0c81e8b5f25a0c666a24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Aug 2020 00:09:04 +0200 Subject: [PATCH 075/122] Add extrafields for recruitment --- .../admin/candidature_extrafields.php | 108 ++++++++++++++++++ .../admin/jobposition_extrafields.php | 108 ++++++++++++++++++ htdocs/recruitment/lib/recruitment.lib.php | 10 ++ 3 files changed, 226 insertions(+) create mode 100644 htdocs/recruitment/admin/candidature_extrafields.php create mode 100644 htdocs/recruitment/admin/jobposition_extrafields.php diff --git a/htdocs/recruitment/admin/candidature_extrafields.php b/htdocs/recruitment/admin/candidature_extrafields.php new file mode 100644 index 00000000000..fb0eac86b5d --- /dev/null +++ b/htdocs/recruitment/admin/candidature_extrafields.php @@ -0,0 +1,108 @@ + + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/recruitement/admin/candidature_extrafields.php + * \ingroup recruitment + * \brief Page to setup extra fields of Candidature + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array('recruitement', 'admin')); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label = ExtraFields::$type2label; +$type2label = array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val); + +$action = GETPOST('action', 'alpha'); +$attrname = GETPOST('attrname', 'alpha'); +$elementtype = 'recruitment_recruitmentcandidature'; + +if (!$user->admin) accessforbidden(); + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + + +llxHeader('', $langs->trans("RecruitmentSetup"), $help_url); + + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("RecruitmentSetup"), $linkback, 'title_setup'); + + +$head = recruitmentAdminPrepareHead(); + +dol_fiche_head($head, 'candidature_extrafields', '', -1, ''); + +require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; + +dol_fiche_end(); + + +// Buttons +if ($action != 'create' && $action != 'edit') +{ + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; +} + + +/* + * Creation of an optional field + */ +if ($action == 'create') +{ + print '
'; + print load_fiche_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* + * Edition of an optional field + */ +if ($action == 'edit' && !empty($attrname)) +{ + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/recruitment/admin/jobposition_extrafields.php b/htdocs/recruitment/admin/jobposition_extrafields.php new file mode 100644 index 00000000000..a0e9fd9283d --- /dev/null +++ b/htdocs/recruitment/admin/jobposition_extrafields.php @@ -0,0 +1,108 @@ + + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/recruitement/admin/jobposition_extrafields.php + * \ingroup recruitment + * \brief Page to setup extra fields of Candidature + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array('recruitement', 'admin')); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label = ExtraFields::$type2label; +$type2label = array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val); + +$action = GETPOST('action', 'alpha'); +$attrname = GETPOST('attrname', 'alpha'); +$elementtype = 'recruitment_recruitmentjobposition'; + +if (!$user->admin) accessforbidden(); + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + + +llxHeader('', $langs->trans("RecruitmentSetup"), $help_url); + + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("RecruitmentSetup"), $linkback, 'title_setup'); + + +$head = recruitmentAdminPrepareHead(); + +dol_fiche_head($head, 'jobposition_extrafields', '', -1, ''); + +require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; + +dol_fiche_end(); + + +// Buttons +if ($action != 'create' && $action != 'edit') +{ + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; +} + + +/* + * Creation of an optional field + */ +if ($action == 'create') +{ + print '
'; + print load_fiche_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* + * Edition of an optional field + */ +if ($action == 'edit' && !empty($attrname)) +{ + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/recruitment/lib/recruitment.lib.php b/htdocs/recruitment/lib/recruitment.lib.php index a8e7c3abdd0..97e8895344e 100644 --- a/htdocs/recruitment/lib/recruitment.lib.php +++ b/htdocs/recruitment/lib/recruitment.lib.php @@ -50,6 +50,16 @@ function recruitmentAdminPrepareHead() $head[$h][2] = 'publicurl'; $h++; + $head[$h][0] = dol_buildpath("/recruitment/admin/jobposition_extrafields.php", 1); + $head[$h][1] = $langs->trans("ExtrafieldsJobPosition"); + $head[$h][2] = 'jobposition_extrafields'; + $h++; + + $head[$h][0] = dol_buildpath("/recruitment/admin/candidature_extrafields.php", 1); + $head[$h][1] = $langs->trans("ExtrafieldsCandidature"); + $head[$h][2] = 'candidature_extrafields'; + $h++; + // Show more tabs from modules // Entries must be declared in modules descriptor with line //$this->tabs = array( From 689fa752bf56031f3b9d0ffb94ccd09bf9407dce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Aug 2020 00:23:18 +0200 Subject: [PATCH 076/122] Implement action "Decline" --- htdocs/recruitment/recruitmentcandidature_card.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 90fce79bfb0..464218268b8 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -163,6 +163,12 @@ if (empty($reshook)) { $object->setProject(GETPOST('projectid', 'int')); } + if ($action == 'confirm_decline' && $confirm == 'yes' && $permissiontoadd) { + $result = $object->setStatut($object::STATUS_REFUSED, null, '', 'RECRUITMENTCANDIDATURE_DECLINE'); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + } // Actions to send emails $triggersendname = 'RECRUITMENTCANDIDATURE_SENTBYMAIL'; From 14a4cae95b92ba50d3daf37677b9b0e514e881ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Aug 2020 00:31:25 +0200 Subject: [PATCH 077/122] Fix --- htdocs/recruitment/recruitmentcandidature_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 464218268b8..730d8fb884a 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -506,7 +506,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Refuse - Decline - if ($object->status >= $object::STATUS_DRAFT && $object->status < $object::STATUS_CANCELED) + if ($object->status >= $object::STATUS_VALIDATED && $object->status < $object::STATUS_CANCELED) { if ($permissiontoadd) { From 5aac080e6136027a0545412c660d05350ffe64e9 Mon Sep 17 00:00:00 2001 From: StephaneLesage Date: Mon, 24 Aug 2020 01:01:35 +0200 Subject: [PATCH 078/122] NEW Third-Party Import new fields: mother company,outstanding debt limit,bank account,incoterms --- htdocs/core/modules/modSociete.class.php | 72 ++++++++++++++++++------ 1 file changed, 56 insertions(+), 16 deletions(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 4b422348bee..1ed4ee2cb73 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -261,13 +261,15 @@ class modSociete extends DolibarrModules $this->export_icon[$r] = 'company'; $this->export_permission[$r] = array(array("societe", "export")); $this->export_fields_array[$r] = array( - 's.rowid'=>"Id", 's.nom'=>"Name", 's.name_alias'=>"AliasNameShort", 's.status'=>"Status", 's.client'=>"Customer", 's.fournisseur'=>"Supplier", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", + 's.rowid'=>"Id", 's.nom'=>"Name", 's.name_alias'=>"AliasNameShort", 'ps.nom'=>"ParentCompany", + 's.status'=>"Status", 's.client'=>"Customer", 's.fournisseur'=>"Supplier", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_client'=>"CustomerCode", 's.code_fournisseur'=>"SupplierCode", 's.code_compta'=>"AccountancyCode", 's.code_compta_fournisseur'=>"SupplierAccountancyCode", - 's.address'=>"Address", 's.zip'=>"Zip", 's.town'=>"Town", 'd.nom'=>'State', 'r.nom' => 'Region', 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax", + 's.address'=>"Address", 's.zip'=>"Zip", 's.town'=>"Town", 'd.nom'=>'State', 'r.nom'=>'Region', 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email", 's.default_lang'=>"DefaultLang", 's.siren'=>"ProfId1", 's.siret'=>"ProfId2", 's.ape'=>"ProfId3", 's.idprof4'=>"ProfId4", 's.idprof5'=>"ProfId5", 's.idprof6'=>"ProfId6", 's.tva_intra'=>"VATIntraShort", 's.capital'=>"Capital", 's.note_private'=>"NotePrivate", 's.note_public'=>"NotePublic", 't.libelle'=>"ThirdPartyType", 'ce.code'=>"Staff", "cfj.libelle"=>"JuridicalStatus", 's.fk_prospectlevel'=>'ProspectLevel', - 'st.code'=>'ProspectStatus', 'payterm.libelle'=>'PaymentConditions', 'paymode.libelle'=>'PaymentMode' + 'st.code'=>'ProspectStatus', 'payterm.libelle'=>'PaymentConditions', 'paymode.libelle'=>'PaymentMode', + 's.outstanding_limit'=>'OutstandingBill', 'pbacc.ref'=>'PaymentBankAccount', 'incoterm.code'=>'IncotermLabel' ); if (!empty($conf->global->SOCIETE_USEPREFIX)) $this->export_fields_array[$r]['s.prefix'] = 'Prefix'; if (!empty($conf->global->PRODUIT_MULTIPRICES)) $this->export_fields_array[$r]['s.price_level'] = 'PriceLevel'; @@ -280,6 +282,7 @@ class modSociete extends DolibarrModules $keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_fields_array[$r] += array('u.login'=>'SaleRepresentativeLogin', 'u.firstname'=>'SaleRepresentativeFirstname', 'u.lastname'=>'SaleRepresentativeLastname'); + //$this->export_TypeFields_array[$r]=array( // 's.rowid'=>"List:societe:nom",'s.nom'=>"Text",'s.status'=>"Text",'s.client'=>"Boolean",'s.fournisseur'=>"Boolean",'s.datec'=>"Date",'s.tms'=>"Date", // 's.code_client'=>"Text",'s.code_fournisseur'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label", @@ -289,15 +292,17 @@ class modSociete extends DolibarrModules // 's.fk_stcomm'=>'List:c_stcomm:libelle:code','d.nom'=>'List:c_departements:nom:rowid' //); $this->export_TypeFields_array[$r] = array( - 's.rowid'=>"Numeric", 's.nom'=>"Text", 's.name_alias'=>"Text", 's.status'=>"Numeric", 's.client'=>"Numeric", 's.fournisseur'=>"Boolean", 's.datec'=>"Date", 's.tms'=>"Date", - 's.code_client'=>"Text", 's.code_fournisseur'=>"Text", 's.code_compta'=>"Text", 's.code_compta_fournisseur'=>"Text", 's.address'=>"Text", 's.zip'=>"Text", - 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text", 's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text", - 's.default_lang'=>"Text", 's.siret'=>"Text", 's.siren'=>"Text", 's.ape'=>"Text", 's.idprof4'=>"Text", 's.idprof5'=>"Text", 's.idprof6'=>"Text", - 's.tva_intra'=>"Text", 's.capital'=>"Numeric", 's.note_private'=>"Text", 's.note_public'=>"Text", 't.libelle'=>"Text", - 'ce.code'=>"List:c_effectif:libelle:code", "cfj.libelle"=>"Text", 's.fk_prospectlevel'=>'List:c_prospectlevel:label:code', - 'st.code'=>'List:c_stcomm:libelle:code', 'd.nom'=>'Text', 'r.nom' => 'Text', 'u.login'=>'Text', 'u.firstname'=>'Text', 'u.lastname'=>'Text', 'payterm.libelle'=>'Text', - 'paymode.libelle'=>'Text', 's.entity'=>'Numeric', - 's.price_level'=>'Numeric' + 's.rowid'=>"Numeric", 's.nom'=>"Text", 's.name_alias'=>"Text", 'ps.nom'=>"Text", + 's.status'=>"Numeric", 's.client'=>"Numeric", 's.fournisseur'=>"Boolean", 's.datec'=>"Date", 's.tms'=>"Date", + 's.code_client'=>"Text", 's.code_fournisseur'=>"Text", 's.code_compta'=>"Text", 's.code_compta_fournisseur'=>"Text", + 's.address'=>"Text", 's.zip'=>"Text",'s.town'=>"Text", 'd.nom'=>'Text', 'r.nom'=>'Text', 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text", 's.phone'=>"Text", 's.fax'=>"Text", + 's.url'=>"Text", 's.email'=>"Text", 's.default_lang'=>"Text", 's.siret'=>"Text", 's.siren'=>"Text", 's.ape'=>"Text", 's.idprof4'=>"Text", + 's.idprof5'=>"Text", 's.idprof6'=>"Text", 's.tva_intra'=>"Text", 's.capital'=>"Numeric", 's.note_private'=>"Text", 's.note_public'=>"Text", + 't.libelle'=>"Text", 'ce.code'=>"List:c_effectif:libelle:code", "cfj.libelle"=>"Text", 's.fk_prospectlevel'=>'List:c_prospectlevel:label:code', + 'st.code'=>'List:c_stcomm:libelle:code', 'payterm.libelle'=>'Text', 'paymode.libelle'=>'Text', + 's.outstanding_limit'=>'Numeric', 'pbacc.ref'=>'Text', 'incoterm.code'=>'Text', + 'u.login'=>'Text', 'u.firstname'=>'Text', 'u.lastname'=>'Text', + 's.entity'=>'Numeric', 's.price_level'=>'Numeric' ); $this->export_entities_array[$r] = array('u.login'=>'user', 'u.firstname'=>'user', 'u.lastname'=>'user'); // We define here only fields that use another picto @@ -305,16 +310,19 @@ class modSociete extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as ps ON s.parent = ps.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid'; - $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_regions as r ON r.code_region = d.fk_region AND r.fk_pays = s.fk_pays'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_regions as r ON r.code_region = d.fk_region AND r.fk_pays = s.fk_pays'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_stcomm as st ON s.fk_stcomm = st.id'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON sc.fk_user = u.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as payterm ON s.cond_reglement = payterm.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as paymode ON s.mode_reglement = paymode.id'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as pbacc ON s.fk_account = pbacc.rowid'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as incoterm ON s.fk_incoterms = incoterm.rowid'; $this->export_sql_end[$r] .= ' WHERE s.entity IN ('.getEntity('societe').')'; if (is_object($user) && empty($user->rights->societe->client->voir)) { $this->export_sql_end[$r] .= ' AND (sc.fk_user = '.$user->id.' '; @@ -334,7 +342,7 @@ class modSociete extends DolibarrModules $this->export_fields_array[$r] = array( 'c.rowid'=>"IdContact", 'c.civility'=>"CivilityCode", 'c.lastname'=>'Lastname', 'c.firstname'=>'Firstname', 'c.poste'=>'PostOrFunction', 'c.datec'=>"DateCreation", 'c.tms'=>"DateLastModification", 'c.priv'=>"ContactPrivate", 'c.address'=>"Address", 'c.zip'=>"Zip", 'c.town'=>"Town", - 'd.nom'=>'State', 'r.nom' => 'Region', 'co.label'=>"Country", 'co.code'=>"CountryCode", 'c.phone'=>"Phone", 'c.fax'=>"Fax", 'c.phone_mobile'=>"Mobile", 'c.email'=>"EMail", + 'd.nom'=>'State', 'r.nom'=>'Region', 'co.label'=>"Country", 'co.code'=>"CountryCode", 'c.phone'=>"Phone", 'c.fax'=>"Fax", 'c.phone_mobile'=>"Mobile", 'c.email'=>"EMail", 'c.statut'=>"Status", 's.rowid'=>"IdCompany", 's.nom'=>"CompanyName", 's.status'=>"Status", 's.code_client'=>"CustomerCode", 's.code_fournisseur'=>"SupplierCode", 's.code_compta'=>"AccountancyCode", 's.code_compta_fournisseur'=>"SupplierAccountancyCode", @@ -345,7 +353,7 @@ class modSociete extends DolibarrModules $this->export_examplevalues_array[$r] = array('s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)', 's.fournisseur'=>'0 (not a supplier) or 1 (supplier)'); $this->export_TypeFields_array[$r] = array( 'c.civility'=>"List:c_civility:label:code", 'c.lastname'=>'Text', 'c.firstname'=>'Text', 'c.poste'=>'Text', 'c.datec'=>"Date", 'c.priv'=>"Boolean", - 'c.address'=>"Text", 'c.zip'=>"Text", 'c.town'=>"Text", 'd.nom'=>'Text', 'r.nom' => 'Text', 'co.label'=>"List:c_country:label:rowid", 'co.code'=>"Text", 'c.phone'=>"Text", + 'c.address'=>"Text", 'c.zip'=>"Text", 'c.town'=>"Text", 'd.nom'=>'Text', 'r.nom'=>'Text', 'co.label'=>"List:c_country:label:rowid", 'co.code'=>"Text", 'c.phone'=>"Text", 'c.fax'=>"Text", 'c.email'=>"Text", 'c.statut'=>"Status", 's.rowid'=>"List:societe:nom::thirdparty", 's.nom'=>"Text", 's.status'=>"Status", 's.code_client'=>"Text", 's.code_fournisseur'=>"Text", @@ -376,7 +384,7 @@ class modSociete extends DolibarrModules $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extrasoc ON s.rowid = extrasoc.fk_object'; if (is_object($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON c.fk_departement = d.rowid'; - $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_regions as r ON r.code_region = d.fk_region AND r.fk_pays = c.fk_pays'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_regions as r ON r.code_region = d.fk_region AND r.fk_pays = c.fk_pays'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON c.fk_pays = co.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = c.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id'; @@ -409,6 +417,7 @@ class modSociete extends DolibarrModules $this->import_fields_array[$r] = array(//field order as per structure of table llx_societe 's.nom' => "Name*", 's.name_alias' => "AliasNameShort", + 's.parent' => "ParentCompany", 's.status' => "Status", 's.code_client' => "CustomerCode", 's.code_fournisseur' => "SupplierCode", @@ -445,6 +454,9 @@ class modSociete extends DolibarrModules 's.cond_reglement' => "PaymentTermsCustomer", 's.mode_reglement_supplier' => 'PaymentTypeSupplier', 's.cond_reglement_supplier' => "PaymentTermsSupplier", + 's.outstanding_limit'=>'OutstandingBill', + 's.fk_account'=>'PaymentBankAccount', + 's.fk_incoterms'=>'IncotermLabel', 's.tva_assuj' => 'VATIsUsed', 's.barcode' => 'BarCode', 's.default_lang' => 'DefaultLanguage', @@ -498,6 +510,29 @@ class modSociete extends DolibarrModules ), 's.capital' => array('rule' => 'numeric'), 's.fk_stcomm' => array('rule' => 'zeroifnull'), + 's.parent' => array( + 'rule' => 'fetchidfromref', + 'file' => '/societe/class/societe.class.php', + 'class' => 'Societe', + 'method' => 'fetch', + 'element' => 'ThirdParty' + ), + 's.outstanding_limit' => array('rule' => 'numeric'), + 's.fk_account' => array( + 'rule' => 'fetchidfromcodeid', + 'classfile' => '/compta/bank/class/account.class.php', + 'class' => 'Account', + 'method' => 'fetch', + 'element' => 'BankAccount' +// ), +// TODO +// 's.fk_incoterms' => array( +// 'rule' => 'fetchidfromcodeid', +// 'classfile' => '/core/class/cincoterm.class.php', +// 'class' => 'Cincoterm', +// 'method' => 'fetch', +// 'dict' => 'IncotermLabel' + ) ); //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); $this->import_regex_array[$r] = array(//field order as per structure of table llx_societe @@ -509,6 +544,7 @@ class modSociete extends DolibarrModules 's.cond_reglement' => 'rowid@'.MAIN_DB_PREFIX.'c_payment_term', 's.mode_reglement_supplier' => 'id@'.MAIN_DB_PREFIX.'c_paiement', 's.cond_reglement_supplier' => 'rowid@'.MAIN_DB_PREFIX.'c_payment_term', + 's.fk_incoterms' => 'rowid@'.MAIN_DB_PREFIX.'c_incoterms', 's.tva_assuj' => '^[0|1]', 's.fk_multicurrency' => '^[0|1]', 's.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$', @@ -518,6 +554,7 @@ class modSociete extends DolibarrModules $this->import_examplevalues_array[$r] = array(//field order as per structure of table llx_societe 's.nom' => "TPBigCompany", 's.name_alias' => "Alias for TPBigCompany", + 's.parent' => "TPMotherCompany", 's.status' => "0 (closed) / 1 (active)", 's.code_client' => 'eg. CU01-0001 / empty / "auto"', 's.code_fournisseur' => 'eg. SU01-0001 / empty / "auto"', @@ -554,6 +591,9 @@ class modSociete extends DolibarrModules 's.cond_reglement' => '1/2/3...matches field "rowid" in table "'.MAIN_DB_PREFIX.'c_payment_term"', 's.mode_reglement_supplier' => '1/2/3...matches field "id" in table "'.MAIN_DB_PREFIX.'c_paiement"', 's.cond_reglement_supplier' => '1/2/3...matches field "rowid" in table "'.MAIN_DB_PREFIX.'c_payment_term"', + 's.outstanding_limit' => "5000", + 's.fk_account' => "rowid or ref", + 's.fk_incoterms' => '1/2/3...matches field "rowid" in table "'.MAIN_DB_PREFIX.'c_incoterms"', 's.tva_assuj' => '0 (VAT not used) / 1 (VAT used)', 's.barcode' => '123456789', 's.default_lang' => 'en_US / es_ES etc...matches a language directory in htdocs/langs/', From 721b1275fffa60e9e16f76020edc491a220447c5 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 23 Aug 2020 23:20:07 +0000 Subject: [PATCH 079/122] Fixing style errors. --- htdocs/core/modules/modSociete.class.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 1ed4ee2cb73..6ce1088aa2f 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -261,7 +261,7 @@ class modSociete extends DolibarrModules $this->export_icon[$r] = 'company'; $this->export_permission[$r] = array(array("societe", "export")); $this->export_fields_array[$r] = array( - 's.rowid'=>"Id", 's.nom'=>"Name", 's.name_alias'=>"AliasNameShort", 'ps.nom'=>"ParentCompany", + 's.rowid'=>"Id", 's.nom'=>"Name", 's.name_alias'=>"AliasNameShort", 'ps.nom'=>"ParentCompany", 's.status'=>"Status", 's.client'=>"Customer", 's.fournisseur'=>"Supplier", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_client'=>"CustomerCode", 's.code_fournisseur'=>"SupplierCode", 's.code_compta'=>"AccountancyCode", 's.code_compta_fournisseur'=>"SupplierAccountancyCode", 's.address'=>"Address", 's.zip'=>"Zip", 's.town'=>"Town", 'd.nom'=>'State', 'r.nom'=>'Region', 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax", @@ -292,7 +292,7 @@ class modSociete extends DolibarrModules // 's.fk_stcomm'=>'List:c_stcomm:libelle:code','d.nom'=>'List:c_departements:nom:rowid' //); $this->export_TypeFields_array[$r] = array( - 's.rowid'=>"Numeric", 's.nom'=>"Text", 's.name_alias'=>"Text", 'ps.nom'=>"Text", + 's.rowid'=>"Numeric", 's.nom'=>"Text", 's.name_alias'=>"Text", 'ps.nom'=>"Text", 's.status'=>"Numeric", 's.client'=>"Numeric", 's.fournisseur'=>"Boolean", 's.datec'=>"Date", 's.tms'=>"Date", 's.code_client'=>"Text", 's.code_fournisseur'=>"Text", 's.code_compta'=>"Text", 's.code_compta_fournisseur'=>"Text", 's.address'=>"Text", 's.zip'=>"Text",'s.town'=>"Text", 'd.nom'=>'Text', 'r.nom'=>'Text', 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text", 's.phone'=>"Text", 's.fax'=>"Text", @@ -417,7 +417,7 @@ class modSociete extends DolibarrModules $this->import_fields_array[$r] = array(//field order as per structure of table llx_societe 's.nom' => "Name*", 's.name_alias' => "AliasNameShort", - 's.parent' => "ParentCompany", + 's.parent' => "ParentCompany", 's.status' => "Status", 's.code_client' => "CustomerCode", 's.code_fournisseur' => "SupplierCode", @@ -524,15 +524,15 @@ class modSociete extends DolibarrModules 'class' => 'Account', 'method' => 'fetch', 'element' => 'BankAccount' -// ), -// TODO -// 's.fk_incoterms' => array( -// 'rule' => 'fetchidfromcodeid', -// 'classfile' => '/core/class/cincoterm.class.php', -// 'class' => 'Cincoterm', -// 'method' => 'fetch', -// 'dict' => 'IncotermLabel' - ) + // ), + // TODO + // 's.fk_incoterms' => array( + // 'rule' => 'fetchidfromcodeid', + // 'classfile' => '/core/class/cincoterm.class.php', + // 'class' => 'Cincoterm', + // 'method' => 'fetch', + // 'dict' => 'IncotermLabel' + ) ); //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); $this->import_regex_array[$r] = array(//field order as per structure of table llx_societe From eebe8883771b8cf93775f003691ef77c9d050b84 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 24 Aug 2020 09:47:37 +0200 Subject: [PATCH 080/122] Some fix on assets --- htdocs/asset/class/asset.class.php | 2 +- htdocs/asset/list.php | 2 +- htdocs/asset/type.php | 23 +++++++++-------------- htdocs/core/lib/asset.lib.php | 4 ++-- htdocs/core/menus/init_menu_auguria.sql | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/core/modules/modAsset.class.php | 8 ++++---- 7 files changed, 19 insertions(+), 24 deletions(-) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 3c29fe6e7ce..945d893dab7 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -331,7 +331,7 @@ class Asset extends CommonObject $label .= '
'; $label .= ''.$langs->trans('Ref').': '.$this->ref; - $url = dol_buildpath('/assets/card.php', 1).'?id='.$this->id; + $url = dol_buildpath('/asset/card.php', 1).'?id='.$this->id; if ($option != 'nolink') { diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index 0f6624f1254..549e2fc0d25 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -271,7 +271,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ { $obj = $db->fetch_object($resql); $id = $obj->rowid; - header("Location: ".DOL_URL_ROOT.'/assets/card.php?id='.$id); + header("Location: ".DOL_URL_ROOT.'/asset/card.php?id='.$id); exit; } diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php index a2c6bab3f90..eebc85fc099 100644 --- a/htdocs/asset/type.php +++ b/htdocs/asset/type.php @@ -77,6 +77,7 @@ 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('assettypecard', 'globalcard')); +$permissiontoadd = $user->rights->asset->setup_advance; /* * Actions @@ -211,14 +212,6 @@ if (!$rowid && $action != 'create' && $action != 'edit') $param = ''; - $newcardbutton = ''; - if ($user->rights->asset->configurer) - { - $newcardbutton = ''.$langs->trans('NewAssetType').''; - $newcardbutton .= ''; - $newcardbutton .= ''; - } - print '
'; if ($optioncss != '') print ''; print ''; @@ -228,6 +221,8 @@ if (!$rowid && $action != 'create' && $action != 'edit') print ''; print ''; + $newcardbutton = dolGetButtonTitle($langs->trans('NewAssetType'), '', 'fa fa-plus-circle', dol_buildpath('/asset/type.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); + print_barre_liste($langs->trans("AssetsTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'accountancy', 0, $newcardbutton, '', $limit); $moreforfilter = ''; @@ -238,9 +233,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') print '
'; print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print "\n"; @@ -267,7 +262,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') $accountingaccount = new AccountingAccount($db); $accountingaccount->fetch('', $objp->accountancy_code_asset, 1); - print $accountingaccount->getNomUrl(0, 0, 0, '', 0); + print $accountingaccount->getNomUrl(0, 1, 1, '', 0); } else { print $objp->accountancy_code_asset; } @@ -279,7 +274,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') $accountingaccount2 = new AccountingAccount($db); $accountingaccount2->fetch('', $objp->accountancy_code_depreciation_asset, 1); - print $accountingaccount2->getNomUrl(0, 0, 0, '', 0); + print $accountingaccount2->getNomUrl(0, 1, 1, '', 0); } else { print $objp->accountancy_code_depreciation_asset; } @@ -291,7 +286,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') $accountingaccount3 = new AccountingAccount($db); $accountingaccount3->fetch('', $objp->accountancy_code_depreciation_expense, 1); - print $accountingaccount3->getNomUrl(0, 0, 0, '', 0); + print $accountingaccount3->getNomUrl(0, 1, 1, '', 0); } else { print $objp->accountancy_code_depreciation_expense; } diff --git a/htdocs/core/lib/asset.lib.php b/htdocs/core/lib/asset.lib.php index 1b58784f6e8..5fddf4f1c46 100644 --- a/htdocs/core/lib/asset.lib.php +++ b/htdocs/core/lib/asset.lib.php @@ -88,10 +88,10 @@ function asset_prepare_head(Asset $object) // Show more tabs from modules // Entries must be declared in modules descriptor with line //$this->tabs = array( - // 'entity:+tabname:Title:@assets:/assets/mypage.php?id=__ID__' + // 'entity:+tabname:Title:@assets:/asset/mypage.php?id=__ID__' //); // to add new tab //$this->tabs = array( - // 'entity:-tabname:Title:@assets:/assets/mypage.php?id=__ID__' + // 'entity:-tabname:Title:@assets:/asset/mypage.php?id=__ID__' //); // to remove a tab complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets'); diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index ec75b35073c..a9f876f10cd 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -316,7 +316,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3001__+MAX_llx_menu__, 'asset', '', 3000__+MAX_llx_menu__, '/asset/card.php?mainmenu=accountancy&leftmenu=asset&action=create', 'MenuNewAsset', 2, 'assets', '$user->rights->asset->write', '', 0, 21, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3003__+MAX_llx_menu__, 'asset', '', 3000__+MAX_llx_menu__, '/asset/list.php?mainmenu=accountancy&leftmenu=asset', 'MenuListAssets', 2, 'assets', '$user->rights->asset->read', '', 0, 22, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3004__+MAX_llx_menu__, 'asset', 'asset_type', 3000__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy&leftmenu=asset', 'MenuTypeAssets', 2, 'assets', '$user->rights->asset->read', '', 0, 23, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3005__+MAX_llx_menu__, 'asset', '', 3004__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy&action=create', 'MenuNewTypeAssets', 3, 'assets', '$user->rights->asset->configurer', '', 0, 24, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3005__+MAX_llx_menu__, 'asset', '', 3004__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy&action=create', 'MenuNewTypeAssets', 3, 'assets', '$user->rights->asset->setup_advance', '', 0, 24, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3006__+MAX_llx_menu__, 'asset', '', 3004__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy', 'MenuListTypeAssets', 3, 'assets', '$user->rights->asset->read', '', 0, 25, __ENTITY__); -- Check deposit insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1711__+MAX_llx_menu__, 'accountancy', 'checks', 14__+MAX_llx_menu__, '/compta/paiement/cheque/index.php?mainmenu=bank&leftmenu=checks', 'MenuChequeDeposits', 0, 'bills', '$user->rights->banque->lire', '', 2, 9, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 65be4ba0e4b..db1da8c79fd 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1446,7 +1446,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->rights->asset->read); $newmenu->add("/asset/type.php?leftmenu=asset_type", $langs->trans("MenuTypeAssets"), 1, $user->rights->asset->read, '', $mainmenu, 'asset_type'); if ($usemenuhider || empty($leftmenu) || preg_match('/asset_type/', $leftmenu)) { - $newmenu->add("/asset/type.php?leftmenu=asset_type&action=create", $langs->trans("MenuNewTypeAssets"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->setup_advance)); + $newmenu->add("/asset/type.php?leftmenu=asset_type&action=create", $langs->trans("MenuNewTypeAssets"), 2, (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->setup_advance)); $newmenu->add("/asset/type.php?leftmenu=asset_type", $langs->trans("MenuListTypeAssets"), 2, $user->rights->asset->read); } } diff --git a/htdocs/core/modules/modAsset.class.php b/htdocs/core/modules/modAsset.class.php index ebceca2960e..b736bdb4367 100644 --- a/htdocs/core/modules/modAsset.class.php +++ b/htdocs/core/modules/modAsset.class.php @@ -81,7 +81,7 @@ class modAsset extends DolibarrModules // Example: this->dirs = array("/asset/temp","/asset/subdir"); $this->dirs = array(); - // Config pages. Put here list of php page, stored into assets/admin directory, to use to setup module. + // Config pages. Put here list of php page, stored into asset/admin directory, to use to setup module. $this->config_page_url = array("setup.php@asset"); // Dependencies @@ -115,8 +115,8 @@ class modAsset extends DolibarrModules // Array to add new pages in new tabs $this->tabs = array(); // Example: - // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@assets:$user->rights->assets->read:/assets/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 - // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@assets:$user->rights->othermodule->read:/assets/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. + // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@assets:$user->rights->assets->read:/asset/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 + // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@assets:$user->rights->othermodule->read:/asset/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname // // Where objecttype can be @@ -146,7 +146,7 @@ class modAsset extends DolibarrModules // Boxes/Widgets - // Add here list of php file(s) stored in assets/core/boxes that contains class to show a widget. + // Add here list of php file(s) stored in asset/core/boxes that contains class to show a widget. $this->boxes = array( //0=>array('file'=>'assetswidget1.php@asset','note'=>'Widget provided by Assets','enabledbydefaulton'=>'Home'), //1=>array('file'=>'assetswidget2.php@asset','note'=>'Widget provided by Assets'), From 9da49469551848837a3bd52b75a891d020e8188e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 24 Aug 2020 12:26:40 +0200 Subject: [PATCH 081/122] Fix for better code --- htdocs/takepos/pay.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index b2534272ae2..cea50d390aa 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -341,8 +341,7 @@ if ($conf->global->TAKEPOS_ENABLE_SUMUP) { if (!empty($conf->global->$keyforsumupbank)) { print ''; } else { - $langs->load("errors"); - $langs->load("admin"); + $langs->loadLangs(array("errors", "admin"); print ''; } } From ff621cb146506ed6acb2d2c4bb84400bfae73a3f Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 24 Aug 2020 12:27:19 +0200 Subject: [PATCH 082/122] Update pay.php --- htdocs/takepos/pay.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index cea50d390aa..031c3cc8f2d 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -341,7 +341,7 @@ if ($conf->global->TAKEPOS_ENABLE_SUMUP) { if (!empty($conf->global->$keyforsumupbank)) { print ''; } else { - $langs->loadLangs(array("errors", "admin"); + $langs->loadLangs(array("errors", "admin")); print ''; } } From 0e9677fd3417f3f9ef8501814ca594a94b797711 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Mon, 24 Aug 2020 15:59:05 +0200 Subject: [PATCH 083/122] allow default settings for "cond_reglement_id" and "mode_reglement_id" (cherry picked from commit 2e5475d181af2e8ceb6ea220424fd1329e72e342) --- htdocs/comm/propal/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index f275f16ee03..794344fd5f8 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1556,12 +1556,12 @@ if ($action == 'create') // Terms of payment print ''; // Mode of payment print ''; // Bank Account From a60968e95b5d50b8aaff176adfd662b9135514c0 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 24 Aug 2020 14:17:15 +0000 Subject: [PATCH 084/122] Fixing style errors. --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 794344fd5f8..4f2c0de238b 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1556,7 +1556,7 @@ if ($action == 'create') // Terms of payment print ''; // Mode of payment From 05d82a06846a06adcfc34e39cdcd81012ebb01b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Aug 2020 17:07:30 +0200 Subject: [PATCH 085/122] FIX Error management. Do no try to approve PO if validation fails. --- htdocs/fourn/commande/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 19e6f100609..9341bc24c4b 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -854,11 +854,12 @@ if (empty($reshook)) } else { + $error++; setEventMessages($object->error, $object->errors, 'errors'); } // If we have permission, and if we don't need to provide the idwarehouse, we go directly on approved step - if (empty($conf->global->SUPPLIER_ORDER_NO_DIRECT_APPROVE) && $user->rights->fournisseur->commande->approuver && !(!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $object->hasProductsOrServices(1))) + if (!$error && empty($conf->global->SUPPLIER_ORDER_NO_DIRECT_APPROVE) && $user->rights->fournisseur->commande->approuver && !(!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $object->hasProductsOrServices(1))) { $action = 'confirm_approve'; // can make standard or first level approval also if permission is set } From 21633e3d3942f41b3bfa52350029cdce1917e3a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Aug 2020 17:10:27 +0200 Subject: [PATCH 086/122] css --- htdocs/admin/tools/dolibarr_export.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 0361e8cf9bb..b7d69247763 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -147,7 +147,7 @@ print ''; print ''; -print '
'; $amount_payment=($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount; - if ($row->code == "LIQ") $amount_payment = $amount_payment + $row->takepos_change; // Show amount with excess received if is cash payment + if ($row->code == "LIQ") $amount_payment = $amount_payment + $row->pos_change; // Show amount with excess received if is cash payment echo price($amount_payment, 1, '', 1, - 1, - 1, $conf->currency); echo '
'; echo $langs->trans("Change"); echo ''; - echo price($row->takepos_change, 1, '', 1, - 1, - 1, $conf->currency); + echo price($row->pos_change, 1, '', 1, - 1, - 1, $conf->currency); echo '
'.$langs->trans("Ref").''.$langs->trans("Label").''.$langs->trans("AccountancyCodeAsset").''.$langs->trans("AccountancyCodeDepreciationAsset").''.$langs->trans("AccountancyCodeDepreciationExpense").''.$langs->trans("AccountancyCodeAsset").''.$langs->trans("AccountancyCodeDepreciationAsset").''.$langs->trans("AccountancyCodeDepreciationExpense").' 
'.$langs->trans('PaymentConditionsShort').''; - $form->select_conditions_paiements($soc->cond_reglement_id, 'cond_reglement_id', -1, 1); + $form->select_conditions_paiements( empty($soc->cond_reglement_id) ? (GETPOST('cond_reglement_id', 'int') ? GETPOST('cond_reglement_id', 'int') : '' ) : $soc->cond_reglement_id, 'cond_reglement_id', -1, 1); print '
'.$langs->trans('PaymentMode').''; - $form->select_types_paiements($soc->mode_reglement_id, 'mode_reglement_id'); + $form->select_types_paiements(empty($soc->mode_reglement_id) ? (GETPOST('mode_reglement_id', 'int') ? GETPOST('mode_reglement_id', 'int') : '' ) : $soc->mode_reglement_id, 'mode_reglement_id'); print '
'.$langs->trans('PaymentConditionsShort').''; - $form->select_conditions_paiements( empty($soc->cond_reglement_id) ? (GETPOST('cond_reglement_id', 'int') ? GETPOST('cond_reglement_id', 'int') : '' ) : $soc->cond_reglement_id, 'cond_reglement_id', -1, 1); + $form->select_conditions_paiements(empty($soc->cond_reglement_id) ? (GETPOST('cond_reglement_id', 'int') ? GETPOST('cond_reglement_id', 'int') : '' ) : $soc->cond_reglement_id, 'cond_reglement_id', -1, 1); print '
'; print $langs->trans("DatabaseName").' : '.$dolibarr_main_db_name.'
'; print '
'; +print '
'; print ''; print ''; print '
'; From 60d76000d7c1a228eda11930005be35ee43db282 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Aug 2020 17:23:33 +0200 Subject: [PATCH 087/122] Fix bad column name --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 2961ae82589..3ff02c889bc 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -265,8 +265,8 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact adress card','contact',51); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',52); -ALTER TABLE llx_ecm_directories CHANGE COLUMN date_md tms timestamp; -ALTER TABLE llx_ecm_files CHANGE COLUMN date_md tms timestamp; +ALTER TABLE llx_ecm_directories CHANGE COLUMN date_m tms timestamp; +ALTER TABLE llx_ecm_files CHANGE COLUMN date_m tms timestamp; INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'$conf->recruitment->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__,

\n\n__(YourCandidatureAnswer)__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); From 3dfda2ae609c59c8571a52242c952621825f153b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Aug 2020 20:41:27 +0200 Subject: [PATCH 088/122] FIX Emailcollector - decode extracted NEW Rule "email to" accept wildcard * --- .../class/emailcollector.class.php | 122 ++++++++++++------ 1 file changed, 86 insertions(+), 36 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index ad76c21dcff..91b1b697398 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -808,7 +808,12 @@ class EmailCollector extends CommonObject { //var_dump($regforval[count($regforval)-1]);exit; // Overwrite param $tmpproperty - $object->$tmpproperty = isset($regforval[count($regforval) - 1]) ?trim($regforval[count($regforval) - 1]) : null; + $valueextracted = isset($regforval[count($regforval) - 1]) ?trim($regforval[count($regforval) - 1]) : null; + if (strtolower($sourcefield) == 'header') { + $object->$tmpproperty = $this->decodeSMTPSubject($valueextracted); + } else { + $object->$tmpproperty = $valueextracted; + } } else { // Regex not found $object->$tmpproperty = null; @@ -939,7 +944,16 @@ class EmailCollector extends CommonObject { if (empty($rule['status'])) continue; - if ($rule['type'] == 'to') $search .= ($search ? ' ' : '').'TO "'.str_replace('"', '', $rule['rulevalue']).'"'; + if ($rule['type'] == 'to') { + $tmprulevaluearray = explode('*', $rule['rulevalue']); + if (count($tmprulevaluearray) >= 2) { + foreach ($tmprulevaluearray as $tmprulevalue) { + $search .= ($search ? ' ' : '').'TO "'.str_replace('"', '', $tmprulevalue).'"'; + } + } else { + $search .= ($search ? ' ' : '').'TO "'.str_replace('"', '', $rule['rulevalue']).'"'; + } + } if ($rule['type'] == 'bcc') $search .= ($search ? ' ' : '').'BCC'; if ($rule['type'] == 'cc') $search .= ($search ? ' ' : '').'CC'; if ($rule['type'] == 'from') $search .= ($search ? ' ' : '').'FROM "'.str_replace('"', '', $rule['rulevalue']).'"'; @@ -1083,14 +1097,17 @@ class EmailCollector extends CommonObject $header = imap_fetchheader($connection, $imapemail, 0); $header = preg_replace('/\r\n\s+/m', ' ', $header); // When a header line is on several lines, merge lines + /*print $header; + print $header;*/ $matches = array(); preg_match_all('/([^: ]+): (.+?(?:\r\n\s(?:.+?))*)\r\n/m', $header, $matches); $headers = array_combine($matches[1], $matches[2]); - //var_dump($headers); if (!empty($headers['in-reply-to']) && empty($headers['In-Reply-To'])) { $headers['In-Reply-To'] = $headers['in-reply-to']; } if (!empty($headers['references']) && empty($headers['References'])) { $headers['References'] = $headers['references']; } + if (!empty($headers['message-id']) && empty($headers['Message-ID'])) { $headers['Message-ID'] = $headers['message-id']; } + $headers['Subject'] = $this->decodeSMTPSubject($headers['Subject']); dol_syslog("** Process email ".$i." References: ".$headers['References']); @@ -1111,6 +1128,7 @@ class EmailCollector extends CommonObject continue; // Exclude email } } + if ($searchfilterisanswer > 0) { if (empty($headers['In-Reply-To'])) { @@ -1121,8 +1139,16 @@ class EmailCollector extends CommonObject if ($searchfilterisnotanswer > 0) { if (!empty($headers['In-Reply-To'])) { - $nbemailprocessed++; - continue; // Exclude email + // Note: we can have + // Message-ID=A, In-Reply-To=B, References=B and message can BE an answer or NOT (a transfer rewriten) + $isanswer = 0; + if (preg_match('/Re:\s+/i', $headers['Subject'])) $isanswer = 1; + //if ($headers['In-Reply-To'] != $headers['Message-ID'] && empty($headers['References'])) $isanswer = 1; // If in-reply-to differs of message-id, this is a reply + //if ($headers['In-Reply-To'] != $headers['Message-ID'] && !empty($headers['References']) && strpos($headers['References'], $headers['Message-ID']) !== false) $isanswer = 1; + if ($isanswer) { + $nbemailprocessed++; + continue; // Exclude email + } } } @@ -1148,25 +1174,9 @@ class EmailCollector extends CommonObject dol_syslog("msgid=".$overview[0]->message_id." date=".dol_print_date($overview[0]->udate, 'dayrfc', 'gmt')." from=".$overview[0]->from." to=".$overview[0]->to." subject=".$overview[0]->subject); - // Decode $overview[0]->subject according to RFC2047 - // Can use also imap_mime_header_decode($str) - // Can use also mb_decode_mimeheader($str) - // Can use also iconv_mime_decode($str, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8') - if (function_exists('iconv_mime_decode')) { - $overview[0]->subject = iconv_mime_decode($overview[0]->subject, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8'); - } elseif (function_exists('imap_mime_header_decode')) { - $elements = imap_mime_header_decode($overview[0]->subject); - $newstring = ''; - if (!empty($elements)) { - $num = count($elements); - for ($i = 0; $i < $num; $i++) { - $newstring .= ($newstring ? ' ' : '').$elements[$i]->text; - } - $overview[0]->subject = $newstring; - } - } elseif (function_exists('mb_decode_mimeheader')) { - $overview[0]->subject = mb_decode_mimeheader($overview[0]->subject); - } + $overview[0]->subject = $this->decodeSMTPSubject($overview[0]->subject); + $overview[0]->from = $this->decodeSMTPSubject($overview[0]->from); + // Removed emojis $overview[0]->subject = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $overview[0]->subject); @@ -1233,6 +1243,7 @@ class EmailCollector extends CommonObject //exit; $fromstring = $overview[0]->from; + $sender = $overview[0]->sender; $to = $overview[0]->to; $sendtocc = $overview[0]->cc; @@ -1310,9 +1321,11 @@ class EmailCollector extends CommonObject $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); - $objectid = $obj->rowid; - $objectemail = new Ticket($this->db); - $ticketfoundby = $langs->transnoentitiesnoconv("EmailMsgID").' ('.$reg[1].')'; + if ($obj) { + $objectid = $obj->rowid; + $objectemail = new Ticket($this->db); + $ticketfoundby = $langs->transnoentitiesnoconv("EmailMsgID").' ('.$reg[1].')'; + } } else { $errorforemail++; } @@ -1323,9 +1336,11 @@ class EmailCollector extends CommonObject $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); - $objectid = $obj->rowid; - $objectemail = new Project($this->db); - $projectfoundby = $langs->transnoentitiesnoconv("EmailMsgID").' ('.$reg[1].')'; + if ($obj) { + $objectid = $obj->rowid; + $objectemail = new Project($this->db); + $projectfoundby = $langs->transnoentitiesnoconv("EmailMsgID").' ('.$reg[1].')'; + } } else { $errorforemail++; } @@ -1336,9 +1351,11 @@ class EmailCollector extends CommonObject $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); - $objectid = $obj->rowid; - $objectemail = new RecruitmentCandidature($this->db); - $candidaturefoundby = $langs->transnoentitiesnoconv("EmailMsgID").' ('.$reg[1].')'; + if ($obj) { + $objectid = $obj->rowid; + $objectemail = new RecruitmentCandidature($this->db); + $candidaturefoundby = $langs->transnoentitiesnoconv("EmailMsgID").' ('.$reg[1].')'; + } } else { $errorforemail++; } @@ -1498,7 +1515,7 @@ class EmailCollector extends CommonObject { //var_dump($regforval[count($regforval)-1]);exit; // Overwrite param $tmpproperty - $nametouseforthirdparty = isset($regforval[count($regforval) - 1]) ?trim($regforval[count($regforval) - 1]) : null; + $nametouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null; } else { // Regex not found $nametouseforthirdparty = null; @@ -1692,9 +1709,10 @@ class EmailCollector extends CommonObject $projecttocreate->entity = $conf->entity; $projecttocreate->email_msgid = $msgid; + $savesocid = $projecttocreate->socid; + // Overwrite values with values extracted from source email. // This may overwrite any $projecttocreate->xxx properties. - $savesocid = $projecttocreate->socid; $errorforthisaction = $this->overwritePropertiesOfObject($projecttocreate, $operation['actionparam'], $messagetext, $subject, $header); // Set project ref if not yet defined @@ -1807,9 +1825,10 @@ class EmailCollector extends CommonObject $tickettocreate->email_msgid = $msgid; //$tickettocreate->fk_contact = $contactstatic->id; + $savesocid = $tickettocreate->socid; + // Overwrite values with values extracted from source email. // This may overwrite any $projecttocreate->xxx properties. - $savesocid = $tickettocreate->socid; $errorforthisaction = $this->overwritePropertiesOfObject($tickettocreate, $operation['actionparam'], $messagetext, $subject, $header); // Set ticket ref if not yet defined @@ -2255,4 +2274,35 @@ class EmailCollector extends CommonObject } return $convertedString; } + + /** + * Decode a subject string + * + * @param string $subject Subject + * @return string Decoded subject + */ + protected function decodeSMTPSubject($subject) + { + // Decode $overview[0]->subject according to RFC2047 + // Can use also imap_mime_header_decode($str) + // Can use also mb_decode_mimeheader($str) + // Can use also iconv_mime_decode($str, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8') + if (function_exists('iconv_mime_decode')) { + $subject = iconv_mime_decode($subject, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8'); + } elseif (function_exists('imap_mime_header_decode')) { + $elements = imap_mime_header_decode($subject); + $newstring = ''; + if (!empty($elements)) { + $num = count($elements); + for ($i = 0; $i < $num; $i++) { + $newstring .= ($newstring ? ' ' : '').$elements[$i]->text; + } + $subject = $newstring; + } + } elseif (function_exists('mb_decode_mimeheader')) { + $subject = mb_decode_mimeheader($subject); + } + + return $subject; + } } From f9eccce26c600943cc9a1e5f9335ffa0a8ddb76e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Aug 2020 20:43:38 +0200 Subject: [PATCH 089/122] Fix phpcs --- .../triggers/interface_50_modAgenda_ActionsAuto.class.php | 3 +-- htdocs/expedition/card.php | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 0874698456f..b9de189b996 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -780,7 +780,6 @@ class InterfaceActionsAuto extends DolibarrTriggers // TODO Merge all previous cases into this generic one else // $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, CONTACT_SENTBYMAIL, ... { - // Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function). // Note that these key can be set in agenda setup, only if defined into c_action_trigger // Load translation files required by the page @@ -878,7 +877,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $actioncomm->userassigned = $object->sendtouserid; } if (property_exists($object, 'sendtoid') && is_array($object->sendtoid) && count($object->sendtoid) > 0) { - foreach($object->sendtoid as $val) { + foreach ($object->sendtoid as $val) { $actioncomm->socpeopleassigned[$val] = $val; } } diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 8de5ac787d7..85f2089555e 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1074,8 +1074,8 @@ if ($action == 'create') print '
'.$langs->trans("QtyToShip"); if (empty($conf->productbatch->enabled)) { - print '
'.$langs->trans("Fill").''; - print ' / '; + print '
'.$langs->trans("Fill").''; + print ' / '; } else { print '
'; } From 8c9f6db85669256feb9823723889a160e2546aa0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Aug 2020 02:27:32 +0200 Subject: [PATCH 090/122] Label in popup --- htdocs/recruitment/class/recruitmentjobposition.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 62a144c8520..b32d8d7ba43 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -701,6 +701,7 @@ class RecruitmentJobPosition extends CommonObject $label = ''.$langs->trans("PositionToBeFilled").''; $label .= '
'; $label .= ''.$langs->trans('Ref').': '.$this->ref; + $label .= ''.$langs->trans('Label').': '.$this->label; if (isset($this->status)) { $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5); } From 7b5b3cf8a2638ef1286778c6f47c1464602b149a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Aug 2020 02:28:08 +0200 Subject: [PATCH 091/122] Add br --- htdocs/recruitment/class/recruitmentjobposition.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index b32d8d7ba43..3a0daa3eebf 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -701,7 +701,7 @@ class RecruitmentJobPosition extends CommonObject $label = ''.$langs->trans("PositionToBeFilled").''; $label .= '
'; $label .= ''.$langs->trans('Ref').': '.$this->ref; - $label .= ''.$langs->trans('Label').': '.$this->label; + $label .= '
'.$langs->trans('Label').': '.$this->label; if (isset($this->status)) { $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5); } From c2e98c7c904f3f4e046ee5874d0eaf9a42f0aea8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Aug 2020 03:31:31 +0200 Subject: [PATCH 092/122] tooltip --- htdocs/recruitment/class/recruitmentcandidature.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index 4b18d1803e0..b6f7bdd1215 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -706,6 +706,8 @@ class RecruitmentCandidature extends CommonObject $label = ''.$langs->trans("RecruitmentCandidature").''; $label .= '
'; $label .= ''.$langs->trans('Ref').': '.$this->ref; + $label .= '
'.$langs->trans('Email').': '.$this->email; + $label .= '
'.$langs->trans('Fullname').': '.$this->getFullName($langs); if (isset($this->status)) { $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5); } From 4c851884e54e82c3bdcf6dce87d357003153d077 Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Tue, 25 Aug 2020 12:16:44 +0200 Subject: [PATCH 093/122] Address feedback --- htdocs/comm/action/index.php | 2 +- htdocs/user/class/user.class.php | 40 ++++++++++++++++++++++++-------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index e5ab1c02902..8327aedf9ce 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1062,7 +1062,7 @@ if (count($listofextcals)) $event->ref = $event->id; $userId = $userstatic->findUserIdByEmail($namecal); - if(!empty($userId)) + if (!empty($userId) && $userId > 0) { $event->userassigned[$userId] = $userId; $event->percentage = -1; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 6d278e635fa..42d2f8705fb 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3240,42 +3240,62 @@ class User extends CommonObject /** * Cache the SQL results of the function "findUserIdByEmail($email)" - * + * + * NOTE: findUserIdByEmailCache[...] === -1 means not found in database + * * @var array */ private $findUserIdByEmailCache; /** - * Find a user by the given e-mail or part of a e-mail and return its user id when found + * Find a user by the given e-mail and return it's user id when found * - * @param string $email The full e-mail or a part of a e-mail - * @return int|null The id of the user when found, otherwise null + * NOTE: + * Use AGENDA_DISABLE_EXACT_USER_EMAIL_COMPARE_FOR_EXTERNAL_CALENDAR + * to disable exact e-mail search + * + * @param string $email The full e-mail (or a part of a e-mail) + * @return int <0 = user was not found, >0 = The id of the user */ public function findUserIdByEmail($email) { - if($this->findUserIdByEmailCache[$email]) + if ($this->findUserIdByEmailCache[$email]) { return $this->findUserIdByEmailCache[$email]; } + $this->findUserIdByEmailCache[$email] = -1; + + global $conf; + $sql = 'SELECT rowid'; $sql .= ' FROM '.MAIN_DB_PREFIX.'user'; - $sql .= ' WHERE email LIKE "%'.$email.'%"'; + + if (!empty($conf->global->AGENDA_DISABLE_EXACT_USER_EMAIL_COMPARE_FOR_EXTERNAL_CALENDAR)) + { + $sql .= ' WHERE email LIKE "%'.$email.'%"'; + } + else + { + $sql .= ' WHERE email = "'.$email.'"'; + } + + $sql .= ' LIMIT 1'; $resql = $this->db->query($sql); if (!$resql) { - return 0; + return -1; } $obj = $this->db->fetch_object($resql); if (!$obj) { - return 0; + return -1; } - $this->findUserIdByEmailCache[$email] = (int)$obj->rowid; + $this->findUserIdByEmailCache[$email] = (int) $obj->rowid; - return (int)$obj->rowid; + return $this->findUserIdByEmailCache[$email]; } } From 2cbb4081fe88a565c1a4d559e10229059c300f24 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 25 Aug 2020 10:20:48 +0000 Subject: [PATCH 094/122] Fixing style errors. --- htdocs/user/class/user.class.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 42d2f8705fb..30300ff7d91 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3240,9 +3240,9 @@ class User extends CommonObject /** * Cache the SQL results of the function "findUserIdByEmail($email)" - * + * * NOTE: findUserIdByEmailCache[...] === -1 means not found in database - * + * * @var array */ private $findUserIdByEmailCache; @@ -3270,13 +3270,12 @@ class User extends CommonObject $sql = 'SELECT rowid'; $sql .= ' FROM '.MAIN_DB_PREFIX.'user'; - + if (!empty($conf->global->AGENDA_DISABLE_EXACT_USER_EMAIL_COMPARE_FOR_EXTERNAL_CALENDAR)) { $sql .= ' WHERE email LIKE "%'.$email.'%"'; } - else - { + else { $sql .= ' WHERE email = "'.$email.'"'; } From 7c39543c7266231497c9dfcdd0024f1d54ca4f8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Aug 2020 12:47:38 +0200 Subject: [PATCH 095/122] Support trigger in module recruitment Enhance generic code of automatic recording events --- ...terface_50_modAgenda_ActionsAuto.class.php | 39 +++++++++++++------ .../class/fournisseur.commande.class.php | 2 +- .../mysql/data/llx_c_action_trigger.sql | 20 +++++++--- .../install/mysql/migration/12.0.0-13.0.0.sql | 10 +++++ .../mysql/tables/llx_c_action_trigger.sql | 2 +- htdocs/langs/en_US/main.lang | 6 ++- .../template/class/myobject.class.php | 5 +++ .../modulebuilder/template/myobject_card.php | 4 +- .../class/recruitmentcandidature.class.php | 9 ++++- .../class/recruitmentjobposition.class.php | 7 +++- .../recruitmentcandidature_card.php | 10 ++--- 11 files changed, 83 insertions(+), 31 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index b9de189b996..c2843716cea 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -59,10 +59,11 @@ class InterfaceActionsAuto extends DolibarrTriggers * $object->sendtoid (id of contact or array of ids of contacts) * $object->socid (id of thirdparty) * $object->fk_project - * $object->fk_element - * $object->elementtype + * $object->fk_element (ID of object to link action event to) + * $object->elementtype (->element of object to link action to) + * $object->module (if defined, elementtype in llx_actioncomm will be elementtype@module) * - * @param string $action Event action code + * @param string $action Event action code ('CONTRACT_MODIFY', 'RECRUITMENTCANDIDATURE_MODIFIY', ...) * @param Object $object Object * @param User $user Object user * @param Translate $langs Object langs @@ -74,6 +75,7 @@ class InterfaceActionsAuto extends DolibarrTriggers if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing $key = 'MAIN_AGENDA_ACTIONAUTO_'.$action; + //var_dump($action.' - '.$conf->global->$key);exit; // Do not log events not enabled for this action if (empty($conf->global->$key)) { @@ -778,15 +780,29 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = 0; } // TODO Merge all previous cases into this generic one - else // $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, CONTACT_SENTBYMAIL, ... + else // $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, CONTACT_SENTBYMAIL, RECRUITMENTCANDIDATURE_MODIFY, ... { // Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function). // Note that these key can be set in agenda setup, only if defined into c_action_trigger // Load translation files required by the page - $langs->loadLangs(array("agenda", "other")); - - if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities($action."InDolibarr", $object->ref); - if (empty($object->actionmsg)) $object->actionmsg = $langs->transnoentities($action."InDolibarr", $object->ref); + if (empty($object->actionmsg2)) { + if ($langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref)) != $action."InDolibarr") { // specific translation key + $langs->loadLangs(array("agenda", "other")); + $object->actionmsg2 = $langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref)); + } else { // generic translation key + $tmp = explode('_', $action); + $object->actionmsg2 = $langs->transnoentities($tmp[count($tmp)-1]."InDolibarr", ($object->newref ? $object->newref : $object->ref)); + } + } + if (empty($object->actionmsg)) { + if ($langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref)) != $action."InDolibarr") { // specific translation key + $langs->loadLangs(array("agenda", "other")); + $object->actionmsg = $langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref)); + } else { // generic translation key + $tmp = explode('_', $action); + $object->actionmsg = $langs->transnoentities($tmp[count($tmp)-1]."InDolibarr", ($object->newref ? $object->newref : $object->ref)); + } + } if (! isset($object->sendtoid) || ! is_array($object->sendtoid)) { $object->sendtoid = 0; @@ -827,14 +843,15 @@ class InterfaceActionsAuto extends DolibarrTriggers $projectid = isset($object->fk_project) ? $object->fk_project : 0; if ($object->element == 'project') $projectid = $object->id; - $elementid = $object->id; + $elementid = $object->id; // id of object $elementtype = $object->element; + $elementmodule = $object->module; if ($object->element == 'subscription') { $elementid = $object->fk_adherent; $elementtype = 'member'; } - //var_dump($societeforaction);var_dump($contactforaction);exit; + //var_dump($societeforaction);var_dump($contactforaction);var_dump($elementid);var_dump($elementtype);exit; // Insertion action require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; @@ -867,7 +884,7 @@ class InterfaceActionsAuto extends DolibarrTriggers if (!in_array($elementtype, array('societe', 'contact', 'project'))) { $actioncomm->fk_element = $elementid; - $actioncomm->elementtype = $elementtype; + $actioncomm->elementtype = $elementtype.($elementmodule ? '@'.$elementmodule : ''); } if (property_exists($object, 'attachedfiles') && is_array($object->attachedfiles) && count($object->attachedfiles) > 0) { diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 4657b49899d..28c0b86d765 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -768,7 +768,7 @@ class CommandeFournisseur extends CommonOrder global $langs, $conf, $user; $result = ''; - $label = ''.$langs->trans("ShowOrder").''; + $label = ''.$langs->trans("PurchaseOrder").''; if (!empty($this->ref)) $label .= '
'.$langs->trans('Ref').': '.$this->ref; if (!empty($this->ref_supplier)) diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index d54ac24a203..eeca137dbc0 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -124,13 +124,23 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_CLOSE','BOM disabled','Executed when a BOM is disabled','bom',652); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_REOPEN','BOM reopen','Executed when a BOM is re-open','bom',653); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_DELETE','BOM deleted','Executed when a BOM deleted','bom',654); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_VALIDATE','MO validated','Executed when a MO is validated','bom',660); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_PRODUCED','MO produced','Executed when a MO is produced','bom',661); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_DELETE','MO deleted','Executed when a MO is deleted','bom',662); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_VALIDATE','MO validated','Executed when a MO is validated','mrp',660); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_PRODUCED','MO produced','Executed when a MO is produced','mrp',661); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_DELETE','MO deleted','Executed when a MO is deleted','mrp',662); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_CANCEL','MO canceled','Executed when a MO is canceled','mrp',663); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_CREATE','Contact address created','Executed when a contact is created','contact',50); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact adress card','contact',51); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact address record','contact',51); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',52); + +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_CREATE','Job created','Executed when a job is created','recruitment',7500); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_MODIFY','Job modified','Executed when a job is modified','recruitment',7502); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_SENTBYMAIL','Mails sent from job record','Executed when you send email from job record','recruitment',7504); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_DELETE','Job deleted','Executed when a job is deleted','recruitment',7506); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_CREATE','Candidature created','Executed when a candidature is created','recruitment',7510); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_MODIFY','Candidature modified','Executed when a candidature is modified','recruitment',7512); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_SENTBYMAIL','Mails sent from candidature record','Executed when you send email from candidature record','recruitment',7514); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_DELETE','Candidature deleted','Executed when a candidature is deleted','recruitment',7516); + -- actions not enabled by default : they are excluded when we enable the module Agenda (except TASK_...) insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_CREATE','Task created','Executed when a project task is created','project',150); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_MODIFY','Task modified','Executed when a project task is modified','project',151); diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 3ff02c889bc..108dc94f485 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -270,3 +270,13 @@ ALTER TABLE llx_ecm_files CHANGE COLUMN date_m tms timestamp; INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'$conf->recruitment->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__,

\n\n__(YourCandidatureAnswer)__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +ALTER TABLE llx_c_action_trigger MODIFY COLUMN code varchar(64) NOT NULL; + +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_CREATE','Job created','Executed when a job is created','recruitment',7500); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_MODIFY','Job modified','Executed when a job is modified','recruitment',7502); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_SENTBYMAIL','Mails sent from job record','Executed when you send email from job record','recruitment',7504); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_DELETE','Job deleted','Executed when a job is deleted','recruitment',7506); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_CREATE','Candidature created','Executed when a candidature is created','recruitment',7510); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_MODIFY','Candidature modified','Executed when a candidature is modified','recruitment',7512); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_SENTBYMAIL','Mails sent from candidature record','Executed when you send email from candidature record','recruitment',7514); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_DELETE','Candidature deleted','Executed when a candidature is deleted','recruitment',7516); diff --git a/htdocs/install/mysql/tables/llx_c_action_trigger.sql b/htdocs/install/mysql/tables/llx_c_action_trigger.sql index c29f13b9fd4..8f7450d0fe9 100644 --- a/htdocs/install/mysql/tables/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/tables/llx_c_action_trigger.sql @@ -23,7 +23,7 @@ create table llx_c_action_trigger ( rowid integer AUTO_INCREMENT PRIMARY KEY, elementtype varchar(64) NOT NULL, - code varchar(32) NOT NULL, + code varchar(64) NOT NULL, label varchar(128) NOT NULL, description varchar(255), rang integer DEFAULT 0 diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 1466b6389a9..186272da1b6 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1077,4 +1077,8 @@ AmountMustBePositive=Amount must be positive ByStatus=By status InformationMessage=Information ASAP=As Soon As Possible - \ No newline at end of file +CREATEInDolibarr=Record %s create +MODIFYInDolibarr=Record %s modified +DELETEInDolibarr=Record %s deleted +VALIDATEInDolibarr=Record %s validated +APPROVEDInDolibarr=Record %s approved diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 5a2e27e6bc6..3a64bc557ea 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -32,6 +32,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; */ class MyObject extends CommonObject { + /** + * @var string ID of module. + */ + public $module = 'mymodule'; + /** * @var string ID to identify managed object. */ diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index a85f84a50ba..dfa79e499bc 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -157,7 +157,7 @@ if (empty($reshook)) if ($action == 'set_thirdparty' && $permissiontoadd) { - $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, 'MYOBJECT_MODIFY'); + $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname); } if ($action == 'classin' && $permissiontoadd) { @@ -165,7 +165,7 @@ if (empty($reshook)) } // Actions to send emails - $triggersendname = 'MYOBJECT_SENTBYMAIL'; + $triggersendname = 'MYMODULE_MYOBJECT_SENTBYMAIL'; $autocopy = 'MAIN_MAIL_AUTOCOPY_MYOBJECT_TO'; $trackid = 'myobject'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index b6f7bdd1215..0be25758617 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -1,6 +1,5 @@ - * Copyright (C) ---Put here your own copyright and developer email--- +/* Copyright (C) 2020 Laurent Destailleur * * 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 @@ -32,6 +31,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; */ class RecruitmentCandidature extends CommonObject { + /** + * @var string ID of module. + */ + public $module = 'recruitment'; + /** * @var string ID to identify managed object. */ @@ -61,6 +65,7 @@ class RecruitmentCandidature extends CommonObject const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; + //const STATUS_INTERVIEW_SCHEDULED = 2; const STATUS_CONTRACT_PROPOSED = 3; const STATUS_CONTRACT_SIGNED = 5; const STATUS_REFUSED = 8; diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 3a0daa3eebf..d6a8c62e000 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2020 Laurent Destailleur * * 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 @@ -31,6 +31,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; */ class RecruitmentJobPosition extends CommonObject { + /** + * @var string ID of module. + */ + public $module = 'recruitment'; + /** * @var string ID to identify managed object */ diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 730d8fb884a..49587f76b09 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -138,7 +138,7 @@ if (empty($reshook)) else $backtopage = dol_buildpath('/recruitment/recruitmentcandidature_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); } } - $triggermodname = 'RECRUITMENT_RECRUITMENTCANDIDATURE_MODIFY'; // Name of trigger action code to execute when we modify record + $triggermodname = 'RECRUITMENTCANDIDATURE_MODIFY'; // Name of trigger action code to execute when we modify record // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; @@ -155,16 +155,12 @@ if (empty($reshook)) // Action to build doc include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; - if ($action == 'set_thirdparty' && $permissiontoadd) - { - $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, 'RECRUITMENTCANDIDATURE_MODIFY'); - } if ($action == 'classin' && $permissiontoadd) { $object->setProject(GETPOST('projectid', 'int')); } if ($action == 'confirm_decline' && $confirm == 'yes' && $permissiontoadd) { - $result = $object->setStatut($object::STATUS_REFUSED, null, '', 'RECRUITMENTCANDIDATURE_DECLINE'); + $result = $object->setStatut($object::STATUS_REFUSED, null, '', $triggermodname); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -506,7 +502,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Refuse - Decline - if ($object->status >= $object::STATUS_VALIDATED && $object->status < $object::STATUS_CANCELED) + if ($object->status >= $object::STATUS_VALIDATED && $object->status < $object::STATUS_REFUSED) { if ($permissiontoadd) { From 6f1a51139c12a03ca58d35f28a555f558308c4eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Aug 2020 12:48:56 +0200 Subject: [PATCH 096/122] Fix load lang --- .../triggers/interface_50_modAgenda_ActionsAuto.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index c2843716cea..cd7b0c8afb0 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -786,8 +786,8 @@ class InterfaceActionsAuto extends DolibarrTriggers // Note that these key can be set in agenda setup, only if defined into c_action_trigger // Load translation files required by the page if (empty($object->actionmsg2)) { + $langs->loadLangs(array("agenda", "other")); if ($langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref)) != $action."InDolibarr") { // specific translation key - $langs->loadLangs(array("agenda", "other")); $object->actionmsg2 = $langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref)); } else { // generic translation key $tmp = explode('_', $action); @@ -795,8 +795,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } } if (empty($object->actionmsg)) { + $langs->loadLangs(array("agenda", "other")); if ($langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref)) != $action."InDolibarr") { // specific translation key - $langs->loadLangs(array("agenda", "other")); $object->actionmsg = $langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref)); } else { // generic translation key $tmp = explode('_', $action); From 458bc66327bb0369b6dfbeb8d7e87ecc0e54c735 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 25 Aug 2020 17:25:34 +0200 Subject: [PATCH 097/122] Update list.php --- htdocs/commande/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 300736dc69b..cb63f14ab63 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -210,6 +210,7 @@ if (empty($reshook)) $search_total_ht = ''; $search_total_vat = ''; $search_total_ttc = ''; + $search_warehouse = ''; $search_multicurrency_code = ''; $search_multicurrency_tx = ''; $search_multicurrency_montant_ht = ''; From 23bb67873fa2ddd9f5cedae6f83bd1fd93652bb0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Aug 2020 19:40:17 +0200 Subject: [PATCH 098/122] NEW Can edit the list of sending email profiles. --- htdocs/admin/mails_senderprofile_list.php | 46 +++++++++++++++---- htdocs/admin/mails_templates.php | 10 ++-- .../core/class/emailsenderprofile.class.php | 38 +++++---------- 3 files changed, 55 insertions(+), 39 deletions(-) diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index bf841a03abe..89f9e23fdca 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -43,6 +43,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $id = GETPOST('id', 'int'); +$rowid = GETPOST('rowid', 'alpha'); // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; @@ -122,6 +123,10 @@ $permissiontoread = $user->admin; $permissiontoadd = $user->admin; $permissiontodelete = $user->admin; +if ($id > 0) { + $object->fetch($id); +} + /* * Actions @@ -191,7 +196,6 @@ $now = dol_now(); $help_url = ''; $title = $langs->trans("EMailsSetup"); - llxHeader('', $title); $linkback = ''; @@ -230,7 +234,7 @@ foreach ($search as $key => $val) { if ($key == 'status' && $search[$key] == -1) continue; $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if (strpos($object->fields[$key]['type'], 'integer:') === 0) { + if (strpos($object->fields[$key]['type'], 'integer:') === 0 || $key == 'active') { if ($search[$key] == '-1') $search[$key] = ''; $mode_search = 2; } @@ -347,15 +351,41 @@ print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; +print ''; print ''; $newcardbutton = ''; if ($action != 'create') { $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $_SERVER['PHP_SELF'].'?action=create', '', $permissiontoadd); + + if ($action == 'edit') { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'.$langs->trans("Label").'
'.$langs->trans("Email").'
'.$langs->trans("Signature").''; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor('signature', (GETPOSTISSET('signature') ? GETPOST('signature', 'restricthtml') : $object->signature), '', 138, 'dolibarr_notes', 'In', true, true, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4, '90%'); + print $doleditor->Create(1); + print '
'.$langs->trans("User").''; + print $form->select_dolusers((GETPOSTISSET('private') ? GETPOST('private', 'int') : $object->private), 'private', 1, null, 0, ($user->admin ? '' : $user->id)); + print '
'.$langs->trans("Position").'
'.$langs->trans("Status").''; + print $form->selectarray('active', $object->fields['active']['arrayofkeyval'], (GETPOSTISSET('active') ? GETPOST('active', 'int') : $object->active), 0, 0, 0, '', 1); + print '
'; + print '
'; + print '
'; + print ''; + print '   '; + print ''; + print '
'; + } } else { /*print ''; if ($optioncss != '') print ''; @@ -367,7 +397,7 @@ if ($action != 'create') { print ''; */ print ''; - print ''; + print ''; print ''; print ''; if (!$i) $totalarray['nbfield']++; @@ -550,14 +580,14 @@ while ($i < ($limit ? min($num, $limit) : $num)) print $hookmanager->resPrint; // Action column print '"; - print ''; From 9268955256825d9059727b0f22409dcfb71828b7 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 26 Aug 2020 09:40:20 +0200 Subject: [PATCH 100/122] FIX set sales representatives on create company card --- htdocs/societe/card.php | 2 +- htdocs/societe/class/societe.class.php | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index d2f27419e76..401f7b2175b 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -539,7 +539,7 @@ if (empty($reshook)) // Links with users $salesreps = GETPOST('commercial', 'array'); - $result = $object->setSalesRep($salesreps); + $result = $object->setSalesRep($salesreps, true); if ($result < 0) { $error++; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 918674ba23a..30511855e91 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -4133,9 +4133,10 @@ class Societe extends CommonObject * Sets sales representatives of the thirdparty * * @param int[]|int $salesrep User ID or array of user IDs + * @param bool $onlyAdd Only add (no delete before) * @return int <0 if KO, >0 if OK */ - public function setSalesRep($salesrep) + public function setSalesRep($salesrep, $onlyAdd = false) { global $user; @@ -4144,16 +4145,18 @@ class Societe extends CommonObject $salesrep = array($salesrep); } - // Get current users - $existing = $this->getSalesRepresentatives($user, 1); - // Diff - if (is_array($existing)) { - $to_del = array_diff($existing, $salesrep); - $to_add = array_diff($salesrep, $existing); - } else { - $to_del = array(); // Nothing to delete - $to_add = $salesrep; + $to_del = array(); // Nothing to delete + $to_add = $salesrep; + if ($onlyAdd === false) { + // Get current users + $existing = $this->getSalesRepresentatives($user, 1); + + // Diff + if (is_array($existing)) { + $to_del = array_diff($existing, $salesrep); + $to_add = array_diff($salesrep, $existing); + } } $error = 0; From 9b3f13458fc1d95e92d01142dbd0b4abe76e9bbe Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Wed, 26 Aug 2020 16:02:31 +0200 Subject: [PATCH 101/122] FIX: missing entity check --- htdocs/compta/prelevement/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 936fbebcf6e..9b9e8e08ce5 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -180,6 +180,7 @@ print '
'; $limit=5; $sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; +$sql.= " WHERE entity IN (" . getEntity('prelevement') . ")"; $sql.= " ORDER BY datec DESC"; $sql.= $db->plimit($limit); From 243f59b9e90820e23cebf7a3f21cfcad2d102e15 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 26 Aug 2020 17:09:45 +0200 Subject: [PATCH 102/122] FIX Missing transaction on PO actions --- htdocs/fourn/commande/card.php | 79 +++++++++++++++++++++++++++++----- htdocs/fourn/facture/card.php | 4 +- 2 files changed, 71 insertions(+), 12 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 9341bc24c4b..3fb7ae18cbc 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -653,7 +653,9 @@ if (empty($reshook)) */ if ($action == 'updateline' && $user->rights->fournisseur->commande->creer && !GETPOST('cancel', 'alpha')) { - $vat_rate = (GETPOST('tva_tx') ?GETPOST('tva_tx') : 0); + $db->begin(); + + $vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); if ($lineid) { @@ -783,9 +785,13 @@ if (empty($reshook)) $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) dol_print_error($db, $result); } + + $db->commit(); } else { + $db->rollback(); + dol_print_error($db, $object->error); exit; } @@ -794,6 +800,8 @@ if (empty($reshook)) // Remove a product line if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->fournisseur->commande->creer) { + $db->begin(); + $result = $object->deleteline($lineid); if ($result > 0) { @@ -812,16 +820,23 @@ if (empty($reshook)) $ret = $object->fetch($object->id); // Reload to get new records $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; } else { + $error++; setEventMessages($object->error, $object->errors, 'errors'); - /* Fix bug 1485 : Reset action to avoid asking again confirmation on failure */ + // Reset action to avoid asking again confirmation on failure $action = ''; } + + if (!$error) { + $db->commit(); + + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } else { + $db->rollback(); + } } // Validate @@ -830,6 +845,8 @@ if (empty($reshook)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->supplier_order_advance->validate))) ) { + $db->begin(); + $object->date_commande = dol_now(); $result = $object->valid($user); if ($result >= 0) @@ -849,7 +866,10 @@ if (empty($reshook)) $ret = $object->fetch($id); // Reload to get new records $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result < 0) dol_print_error($db, $result); + if ($result < 0) { + $error++; + dol_print_error($db, $result); + } } } else @@ -863,10 +883,18 @@ if (empty($reshook)) { $action = 'confirm_approve'; // can make standard or first level approval also if permission is set } + + if (! $error) { + $db->commit(); + } else { + $db->rollback(); + } } if (($action == 'confirm_approve' || $action == 'confirm_approve2') && $confirm == 'yes' && $user->rights->fournisseur->commande->approuver) { + $db->begin(); + $idwarehouse = GETPOST('idwarehouse', 'int'); $qualified_for_stock_change = 0; @@ -906,14 +934,22 @@ if (empty($reshook)) } $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); - exit; } else { + $error++; setEventMessages($object->error, $object->errors, 'errors'); } } + + if (!$error) { + $db->commit(); + + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); + exit; + } else { + $db->rollback(); + } } if ($action == 'confirm_refuse' && $confirm == 'yes' && $user->rights->fournisseur->commande->approuver) @@ -942,6 +978,8 @@ if (empty($reshook)) if ($action == 'confirm_commande' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander) { + $db->begin(); + $result = $object->commande($user, GETPOST("datecommande"), GETPOST("methode", 'int'), GETPOST('comment', 'alphanohtml')); if ($result > 0) { @@ -958,13 +996,21 @@ if (empty($reshook)) $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } $action = ''; - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); - exit; } else { + $error++; setEventMessages($object->error, $object->errors, 'errors'); } + + if (!$error) { + $db->commit(); + + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); + exit; + } else { + $db->rollback(); + } } @@ -1014,6 +1060,8 @@ if (empty($reshook)) // Set status of reception (complete, partial, ...) if ($action == 'livraison' && $user->rights->fournisseur->commande->receptionner) { + $db->begin(); + if (GETPOST("type") != '') { $date_liv = dol_mktime(GETPOST('rehour'), GETPOST('remin'), GETPOST('resec'), GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); @@ -1027,17 +1075,26 @@ if (empty($reshook)) } elseif ($result == -3) { + $error++; setEventMessages($object->error, $object->errors, 'errors'); } else { + $error++; setEventMessages($object->error, $object->errors, 'errors'); } } else { + $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Delivery")), null, 'errors'); } + + if (! $error) { + $db->commit(); + } else { + $db->rollback(); + } } if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander) @@ -1971,7 +2028,7 @@ elseif (!empty($object->id)) $morehtmlref .= ''; $morehtmlref .= ''; $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500'); $morehtmlref .= ''; $morehtmlref .= ''; } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 10cf8ee1b6f..6e502b88ac0 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1827,7 +1827,9 @@ if ($action == 'create') print '
'; // Ref supplier - print ''; + print ''; print ''; print '
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'.$langs->trans("Email").'
'.$langs->trans("Signature").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -531,7 +561,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) if (!empty($arrayfields['t.'.$key]['checked'])) { print ''; - if ($key == 'status') print $object->getLibStatut(5); + if ($key == 'status' || $key == 'active') print $object->getLibStatut(5); else print $object->showOutputField($val, $key, $object->$key, ''); print ''; - $url = $_SERVER["PHP_SELF"].'?action=list&id='.$obj->rowid; + $url = $_SERVER["PHP_SELF"].'?id='.$obj->rowid; if ($limit) $url .= '&limit='.urlencode($limit); if ($page) $url .= '&page='.urlencode($page); if ($sortfield) $url .= '&sortfield='.urlencode($sortfield); if ($sortorder) $url .= '&page='.urlencode($sortorder); - //print ''.img_edit().''; + print ''.img_edit().''; //print '   '; - print ''.img_delete().'   '; + print ''.img_delete().'   '; 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; diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index bdd9f571123..83c8f583450 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -45,7 +45,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; // Load translation files required by the page $langs->loadLangs(array("errors", "admin", "mails", "languages")); -$action = GETPOST('action', 'alpha') ?GETPOST('action', 'alpha') : 'view'; +$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $id = GETPOST('id', 'int'); @@ -410,13 +410,15 @@ if (empty($reshook)) $form = new Form($db); $formadmin = new FormAdmin($db); -llxHeader(); +$help_url = ''; +$title = $langs->trans("EMailsSetup"); + +llxHeader('', $title); -$titre = $langs->trans("EMailsSetup"); $linkback = ''; $titlepicto = 'title_setup'; -print load_fiche_titre($titre, $linkback, $titlepicto); +print load_fiche_titre($title, $linkback, $titlepicto); $head = email_admin_prepare_head(); diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index 25a0d2a25c5..7cf18ae4801 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -95,13 +95,12 @@ class EmailSenderProfile extends CommonObject 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>1), 'email' => array('type'=>'varchar(255)', 'label'=>'Email', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1), - //'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), 'private' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'User', 'visible'=>-1, 'enabled'=>1, 'position'=>50, 'default'=>'0', 'notnull'=>1), 'signature' => array('type'=>'text', 'label'=>'Signature', 'visible'=>3, 'enabled'=>1, 'position'=>400, 'notnull'=>-1, 'index'=>1,), 'position' => array('type'=>'integer', 'label'=>'Position', 'visible'=>1, 'enabled'=>1, 'position'=>405, 'notnull'=>-1, 'index'=>1,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), - 'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'default'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1, 'arrayofkeyval'=>array(0=>'Disabled', 1=>'Enabled')), + 'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'default'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0=>'Disabled', 1=>'Enabled')), ); /** @@ -331,7 +330,7 @@ class EmailSenderProfile extends CommonObject */ public function getLibStatut($mode = 0) { - return $this->LibStatut($this->status, $mode); + return $this->LibStatut($this->active, $mode); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -346,31 +345,16 @@ class EmailSenderProfile extends CommonObject { global $langs; - if ($mode == 0 || $mode == 1) - { - if ($status == 1) return $langs->trans('Enabled'); - elseif ($status == 0) return $langs->trans('Disabled'); - } elseif ($mode == 2) - { - if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); - elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); - } elseif ($mode == 3) - { - if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4'); - elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5'); - } elseif ($mode == 4) - { - if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); - elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); - } elseif ($mode == 5) - { - if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); - elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); - } elseif ($mode == 6) - { - if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); - elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); + if ($status == 1) { + $label = $labelshort = $langs->trans('Enabled'); + } else { + $label = $labelshort = $langs->trans('Disabled'); } + + $statusType = 'status'.$status; + if ($status == self::STATUS_ENABLED) $statusType = 'status4'; + + return dolGetStatus($label, $labelshort, '', $statusType, $mode); } /** From 0adf267f668e322adda4abf6948c3e67e2ccc817 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 25 Aug 2020 21:31:04 +0200 Subject: [PATCH 099/122] Fix Accountancy Listbyaccount Error missing formfile->getDocumentsLink --- htdocs/accountancy/bookkeeping/listbyaccount.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 25f664d955e..5a1056f8d50 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -2,8 +2,8 @@ /* Copyright (C) 2016 Neil Orley * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2018 Alexandre Spangaro - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2013-2020 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * 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 @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -293,6 +294,7 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri */ $formaccounting = new FormAccounting($db); +$formfile = new FormFile($db); $formother = new FormOther($db); $form = new Form($db); @@ -551,7 +553,7 @@ while ($i < min($num, $limit)) // Show the break account print "
'; + print ''; if ($line->numero_compte != "" && $line->numero_compte != '-1') print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte); else print ''.$langs->trans("Unknown").''; print '
'.$langs->trans('RefSupplier').'
'.$langs->trans('RefSupplier').'id > 0) print ' autofocus'; + print '>
'.$langs->trans('Type').''; From 236d2862afa725f91bd752ed3811e7d67e508cdd Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 26 Aug 2020 21:56:50 +0200 Subject: [PATCH 103/122] Fix install table --- ..._attribute_combination_price_level.key.sql | 21 +++++++++++++++++++ ...duct_attribute_combination_price_level.sql | 1 - 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 htdocs/install/mysql/tables/llx_product_attribute_combination_price_level.key.sql diff --git a/htdocs/install/mysql/tables/llx_product_attribute_combination_price_level.key.sql b/htdocs/install/mysql/tables/llx_product_attribute_combination_price_level.key.sql new file mode 100644 index 00000000000..4c191193754 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_product_attribute_combination_price_level.key.sql @@ -0,0 +1,21 @@ +-- ============================================================================ +-- Copyright (C) 2020 John BOTELLA +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + + +ALTER TABLE llx_product_attribute_combination_price_level ADD UNIQUE( fk_product_attribute_combination, fk_price_level); + diff --git a/htdocs/install/mysql/tables/llx_product_attribute_combination_price_level.sql b/htdocs/install/mysql/tables/llx_product_attribute_combination_price_level.sql index ae068b71ed0..70086f82068 100644 --- a/htdocs/install/mysql/tables/llx_product_attribute_combination_price_level.sql +++ b/htdocs/install/mysql/tables/llx_product_attribute_combination_price_level.sql @@ -25,4 +25,3 @@ CREATE TABLE llx_product_attribute_combination_price_level variation_price_percentage INTEGER NULL )ENGINE=innodb; -ALTER TABLE llx_product_attribute_combination_price_level ADD UNIQUE( fk_product_attribute_combination, fk_price_level); From 4127fded2af685a7858ac6a3e989e2034834cdfb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Aug 2020 03:14:55 +0200 Subject: [PATCH 104/122] WIP --- .../lib/recruitment_recruitmentcandidature.lib.php | 5 +++++ htdocs/recruitment/recruitmentcandidature_card.php | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php b/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php index 44eb0bafe7c..63cd5ce0d7b 100644 --- a/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php +++ b/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php @@ -41,6 +41,11 @@ function recruitmentCandidaturePrepareHead($object) $head[$h][2] = 'card'; $h++; + $head[$h][0] = dol_buildpath("/recruitment/recruitmentrating_card.php", 1).'?id='.$object->id; + $head[$h][1] = $langs->trans("Rating"); + $head[$h][2] = 'rating'; + $h++; + if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) { $nbNote = 0; diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 49587f76b09..2cde35c85e6 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -1,6 +1,5 @@ - * Copyright (C) ---Put here your own copyright and developer email--- +/* Copyright (C) 2020 Laurent Destailleur * * 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 From aa8ec1cd9c5c037e97e937e315a69af33bd2fc0d Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Thu, 27 Aug 2020 09:32:00 +0200 Subject: [PATCH 105/122] Fix empty ref in contract list tool tip --- htdocs/contrat/services_list.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 38aae136b39..7279ab98781 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -199,7 +199,7 @@ $now = dol_now(); $form = new Form($db); -$sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut,"; +$sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut, c.ref_customer, c.ref_supplier,"; $sql .= " s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur,"; $sql .= " cd.rowid, cd.description, cd.statut,"; $sql .= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.entity as pentity,"; @@ -564,6 +564,8 @@ while ($i < min($num, $limit)) $contractstatic->id = $obj->cid; $contractstatic->ref = $obj->ref ? $obj->ref : $obj->cid; + $contractstatic->ref_customer = $obj->ref_customer; + $contractstatic->ref_supplier = $obj->ref_supplier; $companystatic->id = $obj->socid; $companystatic->name = $obj->name; From c2590433fe3cbddcdb1dca125ab34c8c9b933cba Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Thu, 27 Aug 2020 10:11:18 +0200 Subject: [PATCH 106/122] Show ref in contract form on interventions --- htdocs/core/class/html.formcontract.class.php | 19 ++++++++++++++++--- htdocs/fichinter/card.php | 4 ++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index 6dce90d372b..860bcc2ca67 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -58,9 +58,10 @@ class FormContract * @param string $htmlname Nom de la zone html * @param int $maxlength Maximum length of label * @param int $showempty Show empty line + * @param int $showRef Show customer and supplier reference on each contract (when found) * @return int Nbr of project if OK, <0 if KO */ - public function select_contract($socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1) + public function select_contract($socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0) { // phpcs:enable global $db, $user, $conf, $langs; @@ -70,6 +71,10 @@ class FormContract // Search all contacts $sql = 'SELECT c.rowid, c.ref, c.fk_soc, c.statut'; + if($showRef) + { + $sql .= ', c.ref_customer, c.ref_supplier'; + } $sql .= ' FROM '.MAIN_DB_PREFIX.'contrat as c'; $sql .= " WHERE c.entity = ".$conf->entity; //if ($contratListId) $sql.= " AND c.rowid IN (".$contratListId.")"; @@ -105,6 +110,13 @@ class FormContract // Do nothing } else { $labeltoshow = dol_trunc($obj->ref, 18); + + if($showRef) + { + if($obj->ref_customer) $labeltoshow = $labeltoshow." - ".$obj->ref_customer; + if($obj->ref_supplier) $labeltoshow = $labeltoshow." - ".$obj->ref_supplier; + } + //if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')'; //else $labeltoshow.=' ('.$langs->trans("Private").')'; if (!empty($selected) && $selected == $obj->rowid && $obj->statut > 0) @@ -166,9 +178,10 @@ class FormContract * @param string $htmlname Nom de la zone html * @param int $maxlength Maximum length of label * @param int $showempty Show empty line + * @param int $showRef Show customer and supplier reference on each contract (when found) * @return int Nbr of project if OK, <0 if KO */ - public function formSelectContract($page, $socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1) + public function formSelectContract($page, $socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0) { global $langs; @@ -176,7 +189,7 @@ class FormContract print '
'; print ''; print ''; - $this->select_contract($socid, $selected, $htmlname, $maxlength, $showempty); + $this->select_contract($socid, $selected, $htmlname, $maxlength, $showempty, $showRef); print ''; print '
'; } diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index a4fa1fff132..5925bb079a2 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -906,7 +906,7 @@ if ($action == 'create') { $langs->load("contracts"); print '
'.$langs->trans("Contract").''; - $numcontrat = $formcontract->select_contract($soc->id, GETPOST('contratid', 'int'), 'contratid', 0, 1); + $numcontrat = $formcontract->select_contract($soc->id, GETPOST('contratid', 'int'), 'contratid', 0, 1, 1); if ($numcontrat == 0) { print '   '; @@ -1238,7 +1238,7 @@ if ($action == 'create') if ($action == 'contrat') { $formcontract = new Formcontract($db); - $formcontract->formSelectContract($_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, $object->fk_contrat, 'contratid', 0, 1); + $formcontract->formSelectContract($_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, $object->fk_contrat, 'contratid', 0, 1, 1); } else { if ($object->fk_contrat) { From 8ff24282d9f3e02884a06c59db05b1bfb4e3e63a Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 27 Aug 2020 08:16:32 +0000 Subject: [PATCH 107/122] Fixing style errors. --- htdocs/core/class/html.formcontract.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index 860bcc2ca67..c0ea71ee6f8 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -71,7 +71,7 @@ class FormContract // Search all contacts $sql = 'SELECT c.rowid, c.ref, c.fk_soc, c.statut'; - if($showRef) + if ($showRef) { $sql .= ', c.ref_customer, c.ref_supplier'; } @@ -111,10 +111,10 @@ class FormContract } else { $labeltoshow = dol_trunc($obj->ref, 18); - if($showRef) + if ($showRef) { - if($obj->ref_customer) $labeltoshow = $labeltoshow." - ".$obj->ref_customer; - if($obj->ref_supplier) $labeltoshow = $labeltoshow." - ".$obj->ref_supplier; + if ($obj->ref_customer) $labeltoshow = $labeltoshow." - ".$obj->ref_customer; + if ($obj->ref_supplier) $labeltoshow = $labeltoshow." - ".$obj->ref_supplier; } //if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')'; From 180a49601b56f9410228845c9da716a3ca573f28 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Aug 2020 11:01:41 +0200 Subject: [PATCH 108/122] Use CSS to define size of logo on public pages. --- htdocs/core/lib/ticket.lib.php | 6 +----- htdocs/opensurvey/fonctions.php | 4 ---- htdocs/public/members/new.php | 5 ----- htdocs/public/onlinesign/newonlinesign.php | 4 ---- htdocs/public/payment/newpayment.php | 4 ---- htdocs/public/payment/paymentko.php | 4 ---- htdocs/public/payment/paymentok.php | 4 ---- htdocs/public/recruitment/view.php | 4 ---- htdocs/theme/eldy/global.inc.php | 4 ++++ htdocs/theme/md/style.css.php | 3 +++ 10 files changed, 8 insertions(+), 34 deletions(-) diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 8c6f154c840..d47bfb2cab2 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -211,9 +211,9 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers print ''; + print '
'; // Define urllogo - $width = 0; if (!empty($conf->global->TICKET_SHOW_COMPANY_LOGO) || !empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC)) { // Print logo if (!empty($conf->global->TICKET_SHOW_COMPANY_LOGO)) @@ -222,17 +222,14 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $ if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); - $width = 150; } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$mysoc->logo); - $width = 150; } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; } } } - print '
'; // Output html code for logo if ($urllogo || !empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC)) { @@ -241,7 +238,6 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $ if ($urllogo) { print ''; print ''; print ''; } diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index 635fc3ceb5c..7be560cca28 100644 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -90,7 +90,6 @@ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $ print "\n"; // Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo) - $width = 0; // Define logo and logosmall $logosmall = $mysoc->logo_small; $logo = $mysoc->logo; @@ -102,12 +101,10 @@ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $ { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); - $width = 150; } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); - $width = 150; } // Output html code for logo @@ -116,7 +113,6 @@ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $ print '
'; print '
'; print ''; print '
'; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 7eb45f008e6..501fccc6ed3 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -100,21 +100,17 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ print ''; // Define urllogo - $width = 0; $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png'; if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); - $width = 150; } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); - $width = 150; } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; - $width = 150; } print '
'; @@ -124,7 +120,6 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ print '
'; print '
'; print ''; print '
'; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index d29d441c611..8c248734175 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -156,7 +156,6 @@ print ''."\n"; print ''."\n"; // Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo) -$width = 0; // Define logo and logosmall $logosmall = $mysoc->logo_small; $logo = $mysoc->logo; @@ -171,12 +170,10 @@ if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumb { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); - $width = 150; } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); - $width = 150; } // Output html code for logo if ($urllogo) @@ -184,7 +181,6 @@ if ($urllogo) print '
'; print '
'; print ''; print '
'; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index b2931d4cc26..f7f632459d4 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -747,7 +747,6 @@ print "\n"; // Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo) -$width = 0; // Define logo and logosmall $logosmall = $mysoc->logo_small; $logo = $mysoc->logo; @@ -762,12 +761,10 @@ if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumb { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); - $width = 150; } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); - $width = 150; } // Output html code for logo @@ -776,7 +773,6 @@ if ($urllogo) print '
'; print '
'; print ''; print '
'; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index 4b87cf45b03..8f69fe02c9b 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -207,7 +207,6 @@ print ''."\n"; print '
'."\n"; // Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo) -$width = 0; // Define logo and logosmall $logosmall = $mysoc->logo_small; $logo = $mysoc->logo; @@ -222,12 +221,10 @@ if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumb { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); - $width = 150; } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); - $width = 150; } // Output html code for logo @@ -236,7 +233,6 @@ if ($urllogo) print '
'; print '
'; print ''; print '
'; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index b316e7c68a8..5132cb65092 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -147,7 +147,6 @@ print '
'."\n"; // Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo) -$width = 0; // Define logo and logosmall $logosmall = $mysoc->logo_small; $logo = $mysoc->logo; @@ -162,12 +161,10 @@ if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumb { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); - $width = 150; } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); - $width = 150; } // Output html code for logo @@ -176,7 +173,6 @@ if ($urllogo) print '
'; print '
'; print ''; print '
'; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index 2b07d303aa9..04af0f5ad0f 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -182,7 +182,6 @@ print ''."\n"; print '
'."\n"; // Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo) -$width = 0; // Define logo and logosmall $logosmall = $mysoc->logo_small; $logo = $mysoc->logo; @@ -197,12 +196,10 @@ if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumb { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); - $width = 150; } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); - $width = 150; } // Output html code for logo if ($urllogo) @@ -210,7 +207,6 @@ if ($urllogo) print '
'; print '
'; print ''; print '
'; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 972221079c9..01e2194e992 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -319,6 +319,10 @@ input.buttonpaymentstripe { background-repeat: no-repeat; background-position: 8px 11px; } +.logopublicpayment #dolpaymentlogo { + max-height: 100px; +} + a.buttonticket { padding-left: 5px; padding-right: 5px; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index fb9f0239d10..48f0c70375e 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -452,6 +452,9 @@ input.buttonpaymentstripe { background-repeat: no-repeat; background-position: 8px 7px; } +.logopublicpayment #dolpaymentlogo { + max-height: 100px; +} a.buttonticket { padding-left: 5px; padding-right: 5px; From 2abdfe08d7ddabeb309916862a64faf83813c00b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Aug 2020 18:27:05 +0200 Subject: [PATCH 109/122] FIX Email collector decode subject FIX Cloning email collector clone also rules and operations --- htdocs/admin/emailcollector_card.php | 8 +- .../class/emailcollector.class.php | 102 +++++++++++++++--- .../class/emailcollectorfilter.class.php | 2 +- 3 files changed, 94 insertions(+), 18 deletions(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 2c1e0948e01..fb08286e0a3 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -660,12 +660,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { + // Edit print ''; // Clone print ''; - print ''; + // Collect now + if (count($object->actions) > 0) { + print ''; + } else { + print ''; + } print ''; } diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 91b1b697398..8c8e0daeb26 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -246,7 +246,36 @@ class EmailCollector extends CommonObject */ public function create(User $user, $notrigger = false) { - return $this->createCommon($user, $notrigger); + $id = $this->createCommon($user, $notrigger); + + if (is_array($this->filters) && count($this->filters)) { + $emailcollectorfilter = new EmailCollectorFilter($this->db); + + foreach($this->filters as $filter) { + $emailcollectorfilter->type = $filter['type']; + $emailcollectorfilter->rulevalue = $filter['rulevalue']; + $emailcollectorfilter->fk_emailcollector = $this->id; + $emailcollectorfilter->status = $filter['status']; + + $emailcollectorfilter->create($user); + } + } + + if (is_array($this->filters) && count($this->filters)) { + $emailcollectoroperation = new EmailCollectorAction($this->db); + + foreach($this->actions as $operation) { + $emailcollectoroperation->type = $operation['type']; + $emailcollectoroperation->actionparam = $operation['actionparam']; + $emailcollectoroperation->fk_emailcollector = $this->id; + $emailcollectoroperation->status = $operation['status']; + $emailcollectoroperation->position = $operation['position']; + + $emailcollectoroperation->create($user); + } + } + + return $id; } /** @@ -269,6 +298,10 @@ class EmailCollector extends CommonObject // Load source object $object->fetchCommon($fromid); + + $object->fetchFilters(); // Rules + $object->fetchActions(); // Operations + // Reset some properties unset($object->id); unset($object->fk_user_creat); @@ -295,7 +328,7 @@ class EmailCollector extends CommonObject // Create clone $object->context['createfromclone'] = 'createfromclone'; - $result = $object->createCommon($user); + $result = $object->create($user); if ($result < 0) { $error++; $this->error = $object->error; @@ -605,6 +638,7 @@ class EmailCollector extends CommonObject * Fetch filters * * @return int <0 if KO, >0 if OK + * @see fetchActions() */ public function fetchFilters() { @@ -636,6 +670,7 @@ class EmailCollector extends CommonObject * Fetch actions * * @return int <0 if KO, >0 if OK + * @see fetchFilters() */ public function fetchActions() { @@ -1085,7 +1120,7 @@ class EmailCollector extends CommonObject dol_syslog("Start of loop on email", LOG_INFO, 1); - $i = 0; + $iforemailloop = 0; foreach ($arrayofemail as $imapemail) { if ($nbemailprocessed > 1000) @@ -1093,7 +1128,7 @@ class EmailCollector extends CommonObject break; // Do not process more than 1000 email per launch (this is a different protection than maxnbcollectedpercollect } - $i++; + $iforemailloop++; $header = imap_fetchheader($connection, $imapemail, 0); $header = preg_replace('/\r\n\s+/m', ' ', $header); // When a header line is on several lines, merge lines @@ -1107,9 +1142,12 @@ class EmailCollector extends CommonObject if (!empty($headers['in-reply-to']) && empty($headers['In-Reply-To'])) { $headers['In-Reply-To'] = $headers['in-reply-to']; } if (!empty($headers['references']) && empty($headers['References'])) { $headers['References'] = $headers['references']; } if (!empty($headers['message-id']) && empty($headers['Message-ID'])) { $headers['Message-ID'] = $headers['message-id']; } + $headers['Subject'] = $this->decodeSMTPSubject($headers['Subject']); - dol_syslog("** Process email ".$i." References: ".$headers['References']); + + dol_syslog("** Process email ".$iforemailloop." References: ".$headers['References']); + //print "Process mail ".$iforemailloop." Subject: ".dol_escape_htmltag($headers['Subject'])." References: ".dol_escape_htmltag($headers['References'])." In-Reply-To: ".dol_escape_htmltag($headers['In-Reply-To'])."
\n"; // If there is a filter on trackid if ($searchfilterdoltrackid > 0) @@ -1135,6 +1173,17 @@ class EmailCollector extends CommonObject $nbemailprocessed++; continue; // Exclude email } + // Note: we can have + // Message-ID=A, In-Reply-To=B, References=B and message can BE an answer or NOT (a transfer rewriten) + $isanswer = 0; + if (preg_match('/Re\s*:\s+/i', $headers['Subject'])) $isanswer = 1; + //if ($headers['In-Reply-To'] != $headers['Message-ID'] && empty($headers['References'])) $isanswer = 1; // If in-reply-to differs of message-id, this is a reply + //if ($headers['In-Reply-To'] != $headers['Message-ID'] && !empty($headers['References']) && strpos($headers['References'], $headers['Message-ID']) !== false) $isanswer = 1; + + if (!$isanswer) { + $nbemailprocessed++; + continue; // Exclude email + } } if ($searchfilterisnotanswer > 0) { if (!empty($headers['In-Reply-To'])) @@ -1142,7 +1191,7 @@ class EmailCollector extends CommonObject // Note: we can have // Message-ID=A, In-Reply-To=B, References=B and message can BE an answer or NOT (a transfer rewriten) $isanswer = 0; - if (preg_match('/Re:\s+/i', $headers['Subject'])) $isanswer = 1; + if (preg_match('/Re\s*:\s+/i', $headers['Subject'])) $isanswer = 1; //if ($headers['In-Reply-To'] != $headers['Message-ID'] && empty($headers['References'])) $isanswer = 1; // If in-reply-to differs of message-id, this is a reply //if ($headers['In-Reply-To'] != $headers['Message-ID'] && !empty($headers['References']) && strpos($headers['References'], $headers['Message-ID']) !== false) $isanswer = 1; if ($isanswer) { @@ -1152,6 +1201,7 @@ class EmailCollector extends CommonObject } } + //print "Process mail ".$iforemailloop." Subject: ".dol_escape_htmltag($headers['Subject'])." selected
\n"; $thirdpartystatic = new Societe($this->db); $contactstatic = new Contact($this->db); @@ -1277,10 +1327,12 @@ class EmailCollector extends CommonObject $reg = array(); if (!empty($headers['References'])) { - $arrayofreferences = preg_split('/\s+/', $headers['References']); + $arrayofreferences = preg_split('/(,|\s+)/', $headers['References']); + //var_dump($headers['References']); + //var_dump($arrayofreferences); foreach ($arrayofreferences as $reference) { - //print "Process reference ".dol_escape_htmltag($reference)."
\n"; + //print "Process mail ".$iforemailloop." email_msgid ".$msgid.", date ".dol_print_date($date, 'dayhour').", subject ".$subject.", reference ".dol_escape_htmltag($reference)."
\n"; if (preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $reference, $reg)) { // This is a Dolibarr reference $trackid = $reg[1].$reg[2]; @@ -1459,6 +1511,7 @@ class EmailCollector extends CommonObject // Make Operation dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id); + dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type); $actioncode = 'EMAIL_IN'; // If we scan the Sent box, we use the code for out email @@ -1646,7 +1699,11 @@ class EmailCollector extends CommonObject if (!in_array($fk_element_type, array('societe', 'contact', 'project', 'user'))) { $actioncomm->fk_element = $fk_element_id; + $actioncomm->elementid = $fk_element_id; $actioncomm->elementtype = $fk_element_type; + if (is_object($objectemail) && $objectemail->module) { + $actioncomm->elementtype .= '@'.$objectemail->module; + } } //$actioncomm->extraparams = $extraparams; @@ -1654,6 +1711,13 @@ class EmailCollector extends CommonObject // Overwrite values with values extracted from source email $errorforthisaction = $this->overwritePropertiesOfObject($actioncomm, $operation['actionparam'], $messagetext, $subject, $header); + /*var_dump($fk_element_id); + var_dump($fk_element_type); + var_dump($alreadycreated); + var_dump($operation['type']); + var_dump($actioncomm); + exit;*/ + if ($errorforthisaction) { $errorforactions++; @@ -2276,10 +2340,14 @@ class EmailCollector extends CommonObject } /** - * Decode a subject string + * Decode a subject string according to RFC2047 + * Example: '=?Windows-1252?Q?RE=A0:_ABC?=' => 'RE : ABC...' + * Example: '=?UTF-8?Q?A=C3=A9B?=' => 'AéB' + * Example: '=?UTF-8?B?2KLYstmF2KfbjNi0?=' => + * Example: '=?utf-8?B?UkU6IG1vZHVsZSBkb2xpYmFyciBnZXN0aW9ubmFpcmUgZGUgZmljaGllcnMg?= =?utf-8?B?UsOpZsOpcmVuY2UgZGUgbGEgY29tbWFuZGUgVFVHRURJSklSIOKAkyBwYXNz?= =?utf-8?B?w6llIGxlIDIyLzA0LzIwMjA=?=' * * @param string $subject Subject - * @return string Decoded subject + * @return string Decoded subject (in UTF-8) */ protected function decodeSMTPSubject($subject) { @@ -2287,20 +2355,22 @@ class EmailCollector extends CommonObject // Can use also imap_mime_header_decode($str) // Can use also mb_decode_mimeheader($str) // Can use also iconv_mime_decode($str, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8') - if (function_exists('iconv_mime_decode')) { - $subject = iconv_mime_decode($subject, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8'); - } elseif (function_exists('imap_mime_header_decode')) { + if (function_exists('imap_mime_header_decode') && function_exists('iconv_mime_decode')) { $elements = imap_mime_header_decode($subject); + //var_dump($elements); $newstring = ''; if (!empty($elements)) { $num = count($elements); for ($i = 0; $i < $num; $i++) { - $newstring .= ($newstring ? ' ' : '').$elements[$i]->text; + $stringinutf8 = (in_array(strtoupper($elements[$i]->charset), array('default', 'UTF-8')) ? $elements[$i]->text : iconv_mime_decode($elements[$i]->text, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, $elements[$i]->charset)); + $newstring .= $stringinutf8; } $subject = $newstring; } - } elseif (function_exists('mb_decode_mimeheader')) { - $subject = mb_decode_mimeheader($subject); + } elseif (!function_exists('mb_decode_mimeheader')) { + $subject = mb_decode_mimeheader($subject); + } elseif (function_exists('iconv_mime_decode')) { + $subject = iconv_mime_decode($subject, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8'); } return $subject; diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php index 5982b5ffd20..40c8a91d235 100644 --- a/htdocs/emailcollector/class/emailcollectorfilter.class.php +++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php @@ -169,7 +169,7 @@ class EmailCollectorFilter extends CommonObject { $langs->load("errors"); $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("SearchString")); - return -1; + return -2; } return $this->createCommon($user, $notrigger); From 0309510ab88c286bdd6ec253341127241c025327 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Aug 2020 18:50:08 +0200 Subject: [PATCH 110/122] Fix avoid duplicate event recorded from email collector --- htdocs/comm/action/card.php | 2 +- htdocs/comm/action/class/actioncomm.class.php | 19 +++++++++++-------- .../class/emailcollector.class.php | 9 ++++----- htdocs/projet/class/project.class.php | 5 ++++- htdocs/theme/eldy/global.inc.php | 4 +++- 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index eb723013f81..6d9bb13e2c1 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1782,7 +1782,7 @@ if ($id > 0) } // Description - print '
'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 1e860217d03..2d371f80be5 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -666,12 +666,13 @@ class ActionComm extends CommonObject /** * Load object from database * - * @param int $id Id of action to get - * @param string $ref Ref of action to get - * @param string $ref_ext Ref ext to get - * @return int <0 if KO, >0 if OK + * @param int $id Id of action to get + * @param string $ref Ref of action to get + * @param string $ref_ext Ref ext to get + * @param string $email_msgid Email msgid + * @return int <0 if KO, >0 if OK */ - public function fetch($id, $ref = '', $ref_ext = '') + public function fetch($id, $ref = '', $ref_ext = '', $email_msgid = '') { global $langs; @@ -692,6 +693,7 @@ class ActionComm extends CommonObject $sql .= " a.fk_contact, a.percent as percentage,"; $sql .= " a.fk_element as elementid, a.elementtype,"; $sql .= " a.priority, a.fulldayevent, a.location, a.transparency,"; + $sql .= " a.email_msgid, a.email_subject, a.email_from, a.email_to, a.email_tocc, a.email_tobcc, a.errors_to,"; $sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label, c.color as type_color, c.picto as type_picto,"; $sql .= " s.nom as socname,"; $sql .= " u.firstname, u.lastname as lastname"; @@ -700,9 +702,10 @@ class ActionComm extends CommonObject $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; $sql .= " WHERE "; - if ($ref) $sql .= " a.id=".$ref; // No field ref, we use id - elseif ($ref_ext) $sql .= " a.ref_ext='".$this->db->escape($ref_ext)."'"; - else $sql .= " a.id=".$id; + if ($ref) $sql .= " a.id = ".((int) $ref); // No field ref, we use id + elseif ($ref_ext) $sql .= " a.ref_ext = '".$this->db->escape($ref_ext)."'"; + elseif ($email_msgid) $sql .= " a.email_msgid = '".$this->db->escape($email_msgid)."'"; + else $sql .= " a.id = ".((int) $id); dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 8c8e0daeb26..a62b58c1c2b 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1643,10 +1643,10 @@ class EmailCollector extends CommonObject // Create event elseif ($operation['type'] == 'recordevent') { - $alreadycreated = 0; - // TODO Check if $msgid already in database for $conf->entity + $actioncomm = new ActionComm($this->db); - if (!$alreadycreated) + $alreadycreated = $actioncomm->fetch(0, '', '', $msgid); + if ($alreadycreated == 0) { if ($projectstatic->id > 0) { @@ -1672,7 +1672,6 @@ class EmailCollector extends CommonObject $descriptionfull = dol_concatdesc($descriptionfull, $header); // Insert record of emails sent - $actioncomm = new ActionComm($this->db); $actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) $actioncomm->code = 'AC_'.$actioncode; $actioncomm->label = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from; @@ -1736,7 +1735,7 @@ class EmailCollector extends CommonObject { $projecttocreate = new Project($this->db); - $alreadycreated = $projecttocreate->fetch(0, '', $msgid); + $alreadycreated = $projecttocreate->fetch(0, '', '', $msgid); if ($alreadycreated == 0) { if ($thirdpartystatic->id > 0) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 9069899af47..2c5f0a1ddb8 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -471,10 +471,11 @@ class Project extends CommonObject * * @param int $id Id of object to load * @param string $ref Ref of project + * @param string $ref_ext Ref ext of project * @param string $email_msgid Email msgid * @return int >0 if OK, 0 if not found, <0 if KO */ - public function fetch($id, $ref = '', $email_msgid = '') + public function fetch($id, $ref = '', $ref_ext = '', $email_msgid = '') { global $conf; @@ -491,6 +492,8 @@ class Project extends CommonObject $sql .= " WHERE entity IN (".getEntity('project').")"; if (! empty($ref)) { $sql .= " AND ref = '".$this->db->escape($ref)."'"; + } elseif (! empty($ref_ext)) { + $sql .= " AND ref_ext = '".$this->db->escape($ref_ext)."'"; } else { $sql .= " AND email_msgid = '".$this->db->escape($email_msgid)."'"; } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 01e2194e992..f0340291ee8 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3321,7 +3321,9 @@ table.hidepaginationprevious .paginationprevious { table.hidepaginationnext .paginationnext { display: none; } - +.tabBar .arearef .pagination.paginationref { + max-width: calc(30%); +} /* Set the color for hover lines */ From 8b95aa63eba2d76d9d3387a69fa5b7a1b8c9897d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Aug 2020 18:59:36 +0200 Subject: [PATCH 111/122] Trans --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index fbbdf81ff93..1daec4b0001 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1992,7 +1992,7 @@ ImportSetup=Setup of module Import InstanceUniqueID=Unique ID of the instance SmallerThan=Smaller than LargerThan=Larger than -IfTrackingIDFoundEventWillBeLinked=Note that If a tracking ID is found into incoming email, the event will be automatically linked to the related objects. +IfTrackingIDFoundEventWillBeLinked=Note that If a tracking ID of an object is found into incoming email, or if the email is an answer of an email aready collected and linked to an object, the event will be automatically linked to the known related object too. WithGMailYouCanCreateADedicatedPassword=With a GMail account, if you enabled the 2 steps validation, it is recommanded to create a dedicated second password for the application instead of using your own account passsword from https://myaccount.google.com/. EmailCollectorTargetDir=It may be a desired behaviour to move the email into another tag/directory when it was processed successfully. Just set name of directory here to use this feature (Do NOT use special characters in name). Note that you must also use a read/write login account. EmailCollectorLoadThirdPartyHelp=You can use this action to use the email content to find and load an existing thirdparty in your database. The found (or created) thirdparty will be used for following actions that need it. In the parameter field you can use for example 'EXTRACT:BODY:Name:\s([^\s]*)' if you want to extract the name of the thirdparty from a string 'Name: name to find' found into the body. From a80950dfa4afd7def42143fe1f0b946f3c9af45a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Aug 2020 19:41:32 +0200 Subject: [PATCH 112/122] Fix regression --- htdocs/emailcollector/class/emailcollector.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index a62b58c1c2b..c8af89ba97e 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1225,6 +1225,7 @@ class EmailCollector extends CommonObject dol_syslog("msgid=".$overview[0]->message_id." date=".dol_print_date($overview[0]->udate, 'dayrfc', 'gmt')." from=".$overview[0]->from." to=".$overview[0]->to." subject=".$overview[0]->subject); $overview[0]->subject = $this->decodeSMTPSubject($overview[0]->subject); + $overview[0]->from = $this->decodeSMTPSubject($overview[0]->from); // Removed emojis @@ -1314,6 +1315,7 @@ class EmailCollector extends CommonObject } $fk_element_id = 0; $fk_element_type = ''; + $contactid = 0; $thirdpartyid = 0; $projectid = 0; $ticketid = 0; // Analyze TrackId in field References. For example: @@ -2356,12 +2358,11 @@ class EmailCollector extends CommonObject // Can use also iconv_mime_decode($str, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8') if (function_exists('imap_mime_header_decode') && function_exists('iconv_mime_decode')) { $elements = imap_mime_header_decode($subject); - //var_dump($elements); $newstring = ''; if (!empty($elements)) { $num = count($elements); for ($i = 0; $i < $num; $i++) { - $stringinutf8 = (in_array(strtoupper($elements[$i]->charset), array('default', 'UTF-8')) ? $elements[$i]->text : iconv_mime_decode($elements[$i]->text, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, $elements[$i]->charset)); + $stringinutf8 = (in_array(strtoupper($elements[$i]->charset), array('DEFAULT', 'UTF-8')) ? $elements[$i]->text : iconv_mime_decode($elements[$i]->text, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, $elements[$i]->charset)); $newstring .= $stringinutf8; } $subject = $newstring; From 6715eaee095f713a48910a9ef9c6ce3776a987e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Aug 2020 19:44:17 +0200 Subject: [PATCH 113/122] Update html.formcontract.class.php --- htdocs/core/class/html.formcontract.class.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index c0ea71ee6f8..d4ce1cbb0fe 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -70,11 +70,8 @@ class FormContract if (!empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) $hideunselectables = true; // Search all contacts - $sql = 'SELECT c.rowid, c.ref, c.fk_soc, c.statut'; - if ($showRef) - { - $sql .= ', c.ref_customer, c.ref_supplier'; - } + $sql = 'SELECT c.rowid, c.ref, c.fk_soc, c.statut,'; + $sql .= ' c.ref_customer, c.ref_supplier'; $sql .= ' FROM '.MAIN_DB_PREFIX.'contrat as c'; $sql .= " WHERE c.entity = ".$conf->entity; //if ($contratListId) $sql.= " AND c.rowid IN (".$contratListId.")"; From 741489fdc080e288d9c1833ddad788f6e6ab356e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Aug 2020 19:52:05 +0200 Subject: [PATCH 114/122] FIX #14564 --- htdocs/admin/stock.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 0df5deea2f2..090a72327d8 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -498,6 +498,12 @@ if ($virtualdiffersfromphysical) print '
'; } +print '
'; + + +print ''; +print ''; +print ''; /* @@ -648,9 +654,15 @@ foreach ($dirmodels as $reldir) print '
'.$langs->trans("Description").''; + print '
'.$langs->trans("Description").''; print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_private)); print '
'; +print ''; + // Other +print '
'; +print ''; +print ''; + print load_fiche_titre($langs->trans("Other"), '', ''); print ''; From 3b4508b44fb3e6547d24779b284fab01dccfd67a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Aug 2020 19:59:46 +0200 Subject: [PATCH 115/122] Update paiement.class.php --- htdocs/compta/paiement/class/paiement.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 4ec28bf2935..c7dd83ee253 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -292,7 +292,7 @@ class Paiement extends CommonObject $note = ($this->note_public ? $this->note_public : $this->note); $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, ext_payment_id, ext_payment_site, fk_user_creat, pos_change)"; - $sql .= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$this->db->escape($num_payment)."', '".$this->db->escape($note)."', ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").", ".$user->id.", ".$this->pos_change.")"; + $sql .= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$this->db->escape($num_payment)."', '".$this->db->escape($note)."', ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").", ".$user->id.", ".((int) $this->pos_change).")"; $resql = $this->db->query($sql); if ($resql) From 7730569dff1e66e364a0166ac9711b27456f0596 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Aug 2020 21:00:01 +0200 Subject: [PATCH 116/122] Update card.php --- htdocs/comm/propal/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 4f2c0de238b..cf3dac232fc 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1556,12 +1556,12 @@ if ($action == 'create') // Terms of payment print ''; // Mode of payment print ''; // Bank Account From f997d11761480f32bb0d6c6258622b63add3c7f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Aug 2020 21:02:01 +0200 Subject: [PATCH 117/122] Update card.php --- htdocs/comm/propal/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index cf3dac232fc..cd4432707cd 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1556,12 +1556,12 @@ if ($action == 'create') // Terms of payment print ''; // Mode of payment print ''; // Bank Account From fe4acf4e4ed19399fb92f6d9a82e9b89b9e804ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Aug 2020 21:18:40 +0200 Subject: [PATCH 118/122] NEW Add focus when editing on product/stock/product.php Close #14548 --- htdocs/core/class/html.form.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5567813db79..c8a38dd0ea6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -199,12 +199,12 @@ class Form if (preg_match('/^(string|safehtmlstring|email)/', $typeofdata)) { $tmp = explode(':', $typeofdata); - $ret .= ''; + $ret .= ''; } elseif (preg_match('/^(numeric|amount)/', $typeofdata)) { $tmp = explode(':', $typeofdata); $valuetoshow = price2num($editvalue ? $editvalue : $value); - $ret .= ''; + $ret .= ''; } elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) // if wysiwyg is enabled $typeofdata = 'ckeditor' { $tmp = explode(':', $typeofdata); @@ -217,7 +217,7 @@ class Form } $valuetoshow = ($editvalue ? $editvalue : $value); - $ret .= '
'.$langs->trans('PaymentConditionsShort').''; - $form->select_conditions_paiements(empty($soc->cond_reglement_id) ? (GETPOST('cond_reglement_id', 'int') ? GETPOST('cond_reglement_id', 'int') : '' ) : $soc->cond_reglement_id, 'cond_reglement_id', -1, 1); + $form->select_conditions_paiements(empty($soc->cond_reglement_id) ? (GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : '') : $soc->cond_reglement_id, 'cond_reglement_id', -1, 1); print '
'.$langs->trans('PaymentMode').''; - $form->select_types_paiements(empty($soc->mode_reglement_id) ? (GETPOST('mode_reglement_id', 'int') ? GETPOST('mode_reglement_id', 'int') : '' ) : $soc->mode_reglement_id, 'mode_reglement_id'); + $form->select_types_paiements(empty($soc->mode_reglement_id) ? (GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id', 'int') : '') : $soc->mode_reglement_id, 'mode_reglement_id'); print '
'.$langs->trans('PaymentConditionsShort').''; - $form->select_conditions_paiements(empty($soc->cond_reglement_id) ? (GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : '') : $soc->cond_reglement_id, 'cond_reglement_id', -1, 1); + $form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id), 'cond_reglement_id', -1, 1); print '
'.$langs->trans('PaymentMode').''; - $form->select_types_paiements(empty($soc->mode_reglement_id) ? (GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id', 'int') : '') : $soc->mode_reglement_id, 'mode_reglement_id'); + $form->select_types_paiements((GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id), 'mode_reglement_id'); print '