From f85b129cbc3d190ba220e5a46ad97c95301aaa0e Mon Sep 17 00:00:00 2001 From: Faustin Date: Sun, 9 Oct 2022 15:16:58 +0200 Subject: [PATCH 001/176] =?UTF-8?q?NEW=C2=A0#22527:=20can=20now=20view=20a?= =?UTF-8?q?ctions=20in=20messaging=20list=20for=20projets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/lib/functions.lib.php | 717 ++++++++++++++++++++++++++++++ htdocs/core/lib/ticket.lib.php | 716 ----------------------------- htdocs/projet/info.php | 34 +- htdocs/projet/messaging.php | 221 +++++++++ htdocs/ticket/card.php | 2 +- htdocs/ticket/messaging.php | 2 +- 6 files changed, 968 insertions(+), 724 deletions(-) create mode 100644 htdocs/projet/messaging.php diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d771c75ba48..b9ebe2b35e7 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11259,3 +11259,720 @@ function dolForgeCriteriaCallback($matches) return $db->escape($operand).' '.$db->escape($operator)." ".$tmpescaped; } + + + +/** + * Get timeline icon + * @param ActionComm $actionstatic actioncomm + * @param array $histo histo + * @param int $key key + * @return string + */ +function getTimelineIcon($actionstatic, &$histo, $key) +{ + global $conf, $langs; + $out = ''."\n"; + $iconClass = 'fa fa-comments'; + $img_picto = ''; + $colorClass = ''; + $pictoTitle = ''; + + if ($histo[$key]['percent'] == -1) { + $colorClass = 'timeline-icon-not-applicble'; + $pictoTitle = $langs->trans('StatusNotApplicable'); + } elseif ($histo[$key]['percent'] == 0) { + $colorClass = 'timeline-icon-todo'; + $pictoTitle = $langs->trans('StatusActionToDo').' (0%)'; + } elseif ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100) { + $colorClass = 'timeline-icon-in-progress'; + $pictoTitle = $langs->trans('StatusActionInProcess').' ('.$histo[$key]['percent'].'%)'; + } elseif ($histo[$key]['percent'] >= 100) { + $colorClass = 'timeline-icon-done'; + $pictoTitle = $langs->trans('StatusActionDone').' (100%)'; + } + + if ($actionstatic->code == 'AC_TICKET_CREATE') { + $iconClass = 'fa fa-ticket'; + } elseif ($actionstatic->code == 'AC_TICKET_MODIFY') { + $iconClass = 'fa fa-pencilxxx'; + } elseif ($actionstatic->code == 'TICKET_MSG') { + $iconClass = 'fa fa-comments'; + } elseif ($actionstatic->code == 'TICKET_MSG_PRIVATE') { + $iconClass = 'fa fa-mask'; + } elseif (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { + if ($actionstatic->type_picto) { + $img_picto = img_picto('', $actionstatic->type_picto); + } else { + if ($actionstatic->type_code == 'AC_RDV') { + $iconClass = 'fa fa-handshake'; + } elseif ($actionstatic->type_code == 'AC_TEL') { + $iconClass = 'fa fa-phone'; + } elseif ($actionstatic->type_code == 'AC_FAX') { + $iconClass = 'fa fa-fax'; + } elseif ($actionstatic->type_code == 'AC_EMAIL') { + $iconClass = 'fa fa-envelope'; + } elseif ($actionstatic->type_code == 'AC_INT') { + $iconClass = 'fa fa-shipping-fast'; + } elseif ($actionstatic->type_code == 'AC_OTH_AUTO') { + $iconClass = 'fa fa-robot'; + } elseif (!preg_match('/_AUTO/', $actionstatic->type_code)) { + $iconClass = 'fa fa-robot'; + } + } + } + + $out .= ''.$img_picto.''."\n"; + return $out; +} + +/** + * getActionCommEcmList + * + * @param ActionComm $object Object ActionComm + * @return array Array of documents in index table + */ +function getActionCommEcmList($object) +{ + global $conf, $db; + + $documents = array(); + + $sql = 'SELECT ecm.rowid as id, ecm.src_object_type, ecm.src_object_id, ecm.filepath, ecm.filename'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'ecm_files ecm'; + $sql .= " WHERE ecm.filepath = 'agenda/".((int) $object->id)."'"; + //$sql.= " ecm.src_object_type = '".$db->escape($object->element)."' AND ecm.src_object_id = ".((int) $object->id); // Old version didn't add object_type during upload + $sql .= ' ORDER BY ecm.position ASC'; + + $resql = $db->query($sql); + if ($resql) { + if ($db->num_rows($resql)) { + while ($obj = $db->fetch_object($resql)) { + $documents[$obj->id] = $obj; + } + } + } + + return $documents; +} + + +/** + * Show html area with actions in messaging format. + * Note: Global parameter $param must be defined. + * + * @param Conf $conf Object conf + * @param Translate $langs Object langs + * @param DoliDB $db Object db + * @param mixed $filterobj Filter on object Adherent|Societe|Project|Product|CommandeFournisseur|Dolresource|Ticket|... to list events linked to an object + * @param Contact $objcon Filter on object contact to filter events on a contact + * @param int $noprint Return string but does not output it + * @param string $actioncode Filter on actioncode + * @param string $donetodo Filter on event 'done' or 'todo' or ''=nofilter (all). + * @param array $filters Filter on other fields + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @return string|void Return html part or void if noprint is 1 + */ +function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $noprint = 0, $actioncode = '', $donetodo = 'done', $filters = array(), $sortfield = 'a.datep,a.id', $sortorder = 'DESC') +{ + global $user, $conf; + global $form; + + global $param, $massactionbutton; + + dol_include_once('/comm/action/class/actioncomm.class.php'); + + // Check parameters + if (!is_object($filterobj) && !is_object($objcon)) { + dol_print_error('', 'BadParameter'); + } + + $histo = array(); + $numaction = 0; + $now = dol_now(); + + $sortfield_list = explode(',', $sortfield); + $sortfield_label_list = array('a.id' => 'id', 'a.datep' => 'dp', 'a.percent' => 'percent'); + $sortfield_new_list = array(); + foreach ($sortfield_list as $sortfield_value) { + $sortfield_new_list[] = $sortfield_label_list[trim($sortfield_value)]; + } + $sortfield_new = implode(',', $sortfield_new_list); + + if (isModEnabled('agenda')) { + // Search histo on actioncomm + if (is_object($objcon) && $objcon->id > 0) { + $sql = "SELECT DISTINCT a.id, a.label as label,"; + } else { + $sql = "SELECT a.id, a.label as label,"; + } + $sql .= " a.datep as dp,"; + $sql .= " a.note as message,"; + $sql .= " a.datep2 as dp2,"; + $sql .= " a.percent as percent, 'action' as type,"; + $sql .= " a.fk_element, a.elementtype,"; + $sql .= " a.fk_contact,"; + $sql .= " c.code as acode, c.libelle as alabel, c.picto as apicto,"; + $sql .= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; + if (is_object($filterobj) && get_class($filterobj) == 'Societe') { + $sql .= ", sp.lastname, sp.firstname"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') { + $sql .= ", m.lastname, m.firstname"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') { + $sql .= ", o.ref"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'Product') { + $sql .= ", o.ref"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') { + $sql .= ", o.ref"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') { + $sql .= ", o.ref"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') { + $sql .= ", o.ref"; + } + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id"; + + $force_filter_contact = false; + if (is_object($objcon) && $objcon->id > 0) { + $force_filter_contact = true; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as r ON a.id = r.fk_actioncomm"; + $sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".((int) $objcon->id); + } + + if (is_object($filterobj) && get_class($filterobj) == 'Societe') { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') { + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as er"; + $sql .= " ON er.resource_type = 'dolresource'"; + $sql .= " AND er.element_id = a.id"; + $sql .= " AND er.resource_id = ".((int) $filterobj->id); + } elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') { + $sql .= ", ".MAIN_DB_PREFIX."adherent as m"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') { + $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as o"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'Product') { + $sql .= ", ".MAIN_DB_PREFIX."product as o"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') { + $sql .= ", ".MAIN_DB_PREFIX."ticket as o"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') { + $sql .= ", ".MAIN_DB_PREFIX."bom_bom as o"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') { + $sql .= ", ".MAIN_DB_PREFIX."contrat as o"; + } + + $sql .= " WHERE a.entity IN (".getEntity('agenda').")"; + if ($force_filter_contact === false) { + if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) { + $sql .= " AND a.fk_soc = ".((int) $filterobj->id); + } elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) { + $sql .= " AND a.fk_project = ".((int) $filterobj->id); + } elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') { + $sql .= " AND a.fk_element = m.rowid AND a.elementtype = 'member'"; + if ($filterobj->id) { + $sql .= " AND a.fk_element = ".((int) $filterobj->id); + } + } elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') { + $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'"; + if ($filterobj->id) { + $sql .= " AND a.fk_element = ".((int) $filterobj->id); + } + } elseif (is_object($filterobj) && get_class($filterobj) == 'Product') { + $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'product'"; + if ($filterobj->id) { + $sql .= " AND a.fk_element = ".((int) $filterobj->id); + } + } elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') { + $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'"; + if ($filterobj->id) { + $sql .= " AND a.fk_element = ".((int) $filterobj->id); + } + } elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') { + $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'bom'"; + if ($filterobj->id) { + $sql .= " AND a.fk_element = ".((int) $filterobj->id); + } + } elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') { + $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'contract'"; + if ($filterobj->id) { + $sql .= " AND a.fk_element = ".((int) $filterobj->id); + } + } + } + + // Condition on actioncode + if (!empty($actioncode)) { + if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { + if ($actioncode == 'AC_NON_AUTO') { + $sql .= " AND c.type != 'systemauto'"; + } elseif ($actioncode == 'AC_ALL_AUTO') { + $sql .= " AND c.type = 'systemauto'"; + } else { + if ($actioncode == 'AC_OTH') { + $sql .= " AND c.type != 'systemauto'"; + } elseif ($actioncode == 'AC_OTH_AUTO') { + $sql .= " AND c.type = 'systemauto'"; + } + } + } else { + if ($actioncode == 'AC_NON_AUTO') { + $sql .= " AND c.type != 'systemauto'"; + } elseif ($actioncode == 'AC_ALL_AUTO') { + $sql .= " AND c.type = 'systemauto'"; + } else { + $sql .= " AND c.code = '".$db->escape($actioncode)."'"; + } + } + } + if ($donetodo == 'todo') { + $sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; + } elseif ($donetodo == 'done') { + $sql .= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; + } + if (is_array($filters) && $filters['search_agenda_label']) { + $sql .= natural_search('a.label', $filters['search_agenda_label']); + } + } + + // Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing. + if (isModEnabled('mailing') && !empty($objcon->email) + && (empty($actioncode) || $actioncode == 'AC_OTH_AUTO' || $actioncode == 'AC_EMAILING')) { + $langs->load("mails"); + + $sql2 = "SELECT m.rowid as id, m.titre as label, mc.date_envoi as dp, mc.date_envoi as dp2, '100' as percent, 'mailing' as type"; + $sql2 .= ", null as fk_element, '' as elementtype, null as contact_id"; + $sql2 .= ", 'AC_EMAILING' as acode, '' as alabel, '' as apicto"; + $sql2 .= ", u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; // User that valid action + if (is_object($filterobj) && get_class($filterobj) == 'Societe') { + $sql2 .= ", '' as lastname, '' as firstname"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') { + $sql2 .= ", '' as lastname, '' as firstname"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') { + $sql2 .= ", '' as ref"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'Product') { + $sql2 .= ", '' as ref"; + } elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') { + $sql2 .= ", '' as ref"; + } + $sql2 .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."user as u"; + $sql2 .= " WHERE mc.email = '".$db->escape($objcon->email)."'"; // Search is done on email. + $sql2 .= " AND mc.statut = 1"; + $sql2 .= " AND u.rowid = m.fk_user_valid"; + $sql2 .= " AND mc.fk_mailing=m.rowid"; + } + + if (!empty($sql) && !empty($sql2)) { + $sql = $sql." UNION ".$sql2; + } elseif (empty($sql) && !empty($sql2)) { + $sql = $sql2; + } + + // TODO Add limit in nb of results + if ($sql) { // May not be defined if module Agenda is not enabled and mailing module disabled too + $sql .= $db->order($sortfield_new, $sortorder); + + dol_syslog("function.lib::show_actions_messaging", LOG_DEBUG); + $resql = $db->query($sql); + if ($resql) { + $i = 0; + $num = $db->num_rows($resql); + + while ($i < $num) { + $obj = $db->fetch_object($resql); + + if ($obj->type == 'action') { + $contactaction = new ActionComm($db); + $contactaction->id = $obj->id; + $result = $contactaction->fetchResources(); + if ($result < 0) { + dol_print_error($db); + setEventMessage("actions.lib::show_actions_messaging Error fetch ressource", 'errors'); + } + + //if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; + //elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; + $tododone = ''; + if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) { + $tododone = 'todo'; + } + + $histo[$numaction] = array( + 'type'=>$obj->type, + 'tododone'=>$tododone, + 'id'=>$obj->id, + 'datestart'=>$db->jdate($obj->dp), + 'dateend'=>$db->jdate($obj->dp2), + 'note'=>$obj->label, + 'message'=>$obj->message, + 'percent'=>$obj->percent, + + 'userid'=>$obj->user_id, + 'login'=>$obj->user_login, + 'userfirstname'=>$obj->user_firstname, + 'userlastname'=>$obj->user_lastname, + 'userphoto'=>$obj->user_photo, + + 'contact_id'=>$obj->fk_contact, + 'socpeopleassigned' => $contactaction->socpeopleassigned, + 'lastname'=>$obj->lastname, + 'firstname'=>$obj->firstname, + 'fk_element'=>$obj->fk_element, + 'elementtype'=>$obj->elementtype, + // Type of event + 'acode'=>$obj->acode, + 'alabel'=>$obj->alabel, + 'libelle'=>$obj->alabel, // deprecated + 'apicto'=>$obj->apicto + ); + } else { + $histo[$numaction] = array( + 'type'=>$obj->type, + 'tododone'=>'done', + 'id'=>$obj->id, + 'datestart'=>$db->jdate($obj->dp), + 'dateend'=>$db->jdate($obj->dp2), + 'note'=>$obj->label, + 'message'=>$obj->message, + 'percent'=>$obj->percent, + 'acode'=>$obj->acode, + + 'userid'=>$obj->user_id, + 'login'=>$obj->user_login, + 'userfirstname'=>$obj->user_firstname, + 'userlastname'=>$obj->user_lastname, + 'userphoto'=>$obj->user_photo + ); + } + + $numaction++; + $i++; + } + } else { + dol_print_error($db); + } + } + + // Set $out to sow events + $out = ''; + + if (!isModEnabled('agenda')) { + $langs->loadLangs(array("admin", "errors")); + $out = info_admin($langs->trans("WarningModuleXDisabledSoYouMayMissEventHere", $langs->transnoentitiesnoconv("Module2400Name")), 0, 0, 'warning'); + } + + if (isModEnabled('agenda') || (isModEnabled('mailing') && !empty($objcon->email))) { + $delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60; + + require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; + + $formactions = new FormActions($db); + + $actionstatic = new ActionComm($db); + $userstatic = new User($db); + $contactstatic = new Contact($db); + $userGetNomUrlCache = array(); + + $out .= '
'; + $out .= '
'; + $out .= ''; + + if ($objcon && get_class($objcon) == 'Contact' && + (is_null($filterobj) || get_class($filterobj) == 'Societe')) { + $out .= ''; + } else { + $out .= ''; + } + if ($filterobj && get_class($filterobj) == 'Societe') { + $out .= ''; + } + + $out .= "\n"; + + $out .= '
'; + $out .= ''; + + $out .= ''; + + $out .= getTitleFieldOfList('Date', 0, $_SERVER["PHP_SELF"], 'a.datep', '', $param, '', $sortfield, $sortorder, '')."\n"; + + $out .= ''; + if ($donetodo) { + $out .= ''; + } + $out .= ''; + $out .= ''; + + $out .= ''; + $out .= ''; + + + $out .= '
'.$langs->trans("Search").' : '; + $out .= ''; + //$out .= img_picto($langs->trans("Type"), 'type'); + $out .= $formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1, 0, 0, 1, 'minwidth200imp'); + $out .= ''; + $out .= ''; + $out .= ''; + $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); + $out .= $searchpicto; + $out .= '
'; + + $out .= ''; + $out .= '
'; + + $out .= "\n"; + + $out .= '\n"; + + if (empty($histo)) { + $out .= ''.$langs->trans("NoRecordFound").''; + } + } + + if ($noprint) { + return $out; + } else { + print $out; + } +} diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 9223c1c4dd8..5d0d691228e 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -268,719 +268,3 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $ print '
'; } - - - -/** - * Show html area with actions for ticket messaging. - * Note: Global parameter $param must be defined. - * - * @param Conf $conf Object conf - * @param Translate $langs Object langs - * @param DoliDB $db Object db - * @param mixed $filterobj Filter on object Adherent|Societe|Project|Product|CommandeFournisseur|Dolresource|Ticket|... to list events linked to an object - * @param Contact $objcon Filter on object contact to filter events on a contact - * @param int $noprint Return string but does not output it - * @param string $actioncode Filter on actioncode - * @param string $donetodo Filter on event 'done' or 'todo' or ''=nofilter (all). - * @param array $filters Filter on other fields - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @return string|void Return html part or void if noprint is 1 - */ -function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $noprint = 0, $actioncode = '', $donetodo = 'done', $filters = array(), $sortfield = 'a.datep,a.id', $sortorder = 'DESC') -{ - global $user, $conf; - global $form; - - global $param, $massactionbutton; - - dol_include_once('/comm/action/class/actioncomm.class.php'); - - // Check parameters - if (!is_object($filterobj) && !is_object($objcon)) { - dol_print_error('', 'BadParameter'); - } - - $histo = array(); - $numaction = 0; - $now = dol_now(); - - $sortfield_list = explode(',', $sortfield); - $sortfield_label_list = array('a.id' => 'id', 'a.datep' => 'dp', 'a.percent' => 'percent'); - $sortfield_new_list = array(); - foreach ($sortfield_list as $sortfield_value) { - $sortfield_new_list[] = $sortfield_label_list[trim($sortfield_value)]; - } - $sortfield_new = implode(',', $sortfield_new_list); - - if (isModEnabled('agenda')) { - // Search histo on actioncomm - if (is_object($objcon) && $objcon->id > 0) { - $sql = "SELECT DISTINCT a.id, a.label as label,"; - } else { - $sql = "SELECT a.id, a.label as label,"; - } - $sql .= " a.datep as dp,"; - $sql .= " a.note as message,"; - $sql .= " a.datep2 as dp2,"; - $sql .= " a.percent as percent, 'action' as type,"; - $sql .= " a.fk_element, a.elementtype,"; - $sql .= " a.fk_contact,"; - $sql .= " c.code as acode, c.libelle as alabel, c.picto as apicto,"; - $sql .= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; - if (is_object($filterobj) && get_class($filterobj) == 'Societe') { - $sql .= ", sp.lastname, sp.firstname"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') { - $sql .= ", m.lastname, m.firstname"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') { - $sql .= ", o.ref"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'Product') { - $sql .= ", o.ref"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') { - $sql .= ", o.ref"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') { - $sql .= ", o.ref"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') { - $sql .= ", o.ref"; - } - $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id"; - - $force_filter_contact = false; - if (is_object($objcon) && $objcon->id > 0) { - $force_filter_contact = true; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as r ON a.id = r.fk_actioncomm"; - $sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".((int) $objcon->id); - } - - if (is_object($filterobj) && get_class($filterobj) == 'Societe') { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') { - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as er"; - $sql .= " ON er.resource_type = 'dolresource'"; - $sql .= " AND er.element_id = a.id"; - $sql .= " AND er.resource_id = ".((int) $filterobj->id); - } elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') { - $sql .= ", ".MAIN_DB_PREFIX."adherent as m"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') { - $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as o"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'Product') { - $sql .= ", ".MAIN_DB_PREFIX."product as o"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') { - $sql .= ", ".MAIN_DB_PREFIX."ticket as o"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') { - $sql .= ", ".MAIN_DB_PREFIX."bom_bom as o"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') { - $sql .= ", ".MAIN_DB_PREFIX."contrat as o"; - } - - $sql .= " WHERE a.entity IN (".getEntity('agenda').")"; - if ($force_filter_contact === false) { - if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) { - $sql .= " AND a.fk_soc = ".((int) $filterobj->id); - } elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) { - $sql .= " AND a.fk_project = ".((int) $filterobj->id); - } elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') { - $sql .= " AND a.fk_element = m.rowid AND a.elementtype = 'member'"; - if ($filterobj->id) { - $sql .= " AND a.fk_element = ".((int) $filterobj->id); - } - } elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') { - $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'"; - if ($filterobj->id) { - $sql .= " AND a.fk_element = ".((int) $filterobj->id); - } - } elseif (is_object($filterobj) && get_class($filterobj) == 'Product') { - $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'product'"; - if ($filterobj->id) { - $sql .= " AND a.fk_element = ".((int) $filterobj->id); - } - } elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') { - $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'"; - if ($filterobj->id) { - $sql .= " AND a.fk_element = ".((int) $filterobj->id); - } - } elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') { - $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'bom'"; - if ($filterobj->id) { - $sql .= " AND a.fk_element = ".((int) $filterobj->id); - } - } elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') { - $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'contract'"; - if ($filterobj->id) { - $sql .= " AND a.fk_element = ".((int) $filterobj->id); - } - } - } - - // Condition on actioncode - if (!empty($actioncode)) { - if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - if ($actioncode == 'AC_NON_AUTO') { - $sql .= " AND c.type != 'systemauto'"; - } elseif ($actioncode == 'AC_ALL_AUTO') { - $sql .= " AND c.type = 'systemauto'"; - } else { - if ($actioncode == 'AC_OTH') { - $sql .= " AND c.type != 'systemauto'"; - } elseif ($actioncode == 'AC_OTH_AUTO') { - $sql .= " AND c.type = 'systemauto'"; - } - } - } else { - if ($actioncode == 'AC_NON_AUTO') { - $sql .= " AND c.type != 'systemauto'"; - } elseif ($actioncode == 'AC_ALL_AUTO') { - $sql .= " AND c.type = 'systemauto'"; - } else { - $sql .= " AND c.code = '".$db->escape($actioncode)."'"; - } - } - } - if ($donetodo == 'todo') { - $sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; - } elseif ($donetodo == 'done') { - $sql .= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; - } - if (is_array($filters) && $filters['search_agenda_label']) { - $sql .= natural_search('a.label', $filters['search_agenda_label']); - } - } - - // Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing. - if (isModEnabled('mailing') && !empty($objcon->email) - && (empty($actioncode) || $actioncode == 'AC_OTH_AUTO' || $actioncode == 'AC_EMAILING')) { - $langs->load("mails"); - - $sql2 = "SELECT m.rowid as id, m.titre as label, mc.date_envoi as dp, mc.date_envoi as dp2, '100' as percent, 'mailing' as type"; - $sql2 .= ", null as fk_element, '' as elementtype, null as contact_id"; - $sql2 .= ", 'AC_EMAILING' as acode, '' as alabel, '' as apicto"; - $sql2 .= ", u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; // User that valid action - if (is_object($filterobj) && get_class($filterobj) == 'Societe') { - $sql2 .= ", '' as lastname, '' as firstname"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') { - $sql2 .= ", '' as lastname, '' as firstname"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') { - $sql2 .= ", '' as ref"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'Product') { - $sql2 .= ", '' as ref"; - } elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') { - $sql2 .= ", '' as ref"; - } - $sql2 .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."user as u"; - $sql2 .= " WHERE mc.email = '".$db->escape($objcon->email)."'"; // Search is done on email. - $sql2 .= " AND mc.statut = 1"; - $sql2 .= " AND u.rowid = m.fk_user_valid"; - $sql2 .= " AND mc.fk_mailing=m.rowid"; - } - - if (!empty($sql) && !empty($sql2)) { - $sql = $sql." UNION ".$sql2; - } elseif (empty($sql) && !empty($sql2)) { - $sql = $sql2; - } - - // TODO Add limit in nb of results - if ($sql) { // May not be defined if module Agenda is not enabled and mailing module disabled too - $sql .= $db->order($sortfield_new, $sortorder); - - dol_syslog("ticket.lib::show_ticket_messaging", LOG_DEBUG); - $resql = $db->query($sql); - if ($resql) { - $i = 0; - $num = $db->num_rows($resql); - - while ($i < $num) { - $obj = $db->fetch_object($resql); - - if ($obj->type == 'action') { - $contactaction = new ActionComm($db); - $contactaction->id = $obj->id; - $result = $contactaction->fetchResources(); - if ($result < 0) { - dol_print_error($db); - setEventMessage("ticket.lib::show_ticket_messaging Error fetch ressource", 'errors'); - } - - //if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; - //elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; - $tododone = ''; - if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) { - $tododone = 'todo'; - } - - $histo[$numaction] = array( - 'type'=>$obj->type, - 'tododone'=>$tododone, - 'id'=>$obj->id, - 'datestart'=>$db->jdate($obj->dp), - 'dateend'=>$db->jdate($obj->dp2), - 'note'=>$obj->label, - 'message'=>$obj->message, - 'percent'=>$obj->percent, - - 'userid'=>$obj->user_id, - 'login'=>$obj->user_login, - 'userfirstname'=>$obj->user_firstname, - 'userlastname'=>$obj->user_lastname, - 'userphoto'=>$obj->user_photo, - - 'contact_id'=>$obj->fk_contact, - 'socpeopleassigned' => $contactaction->socpeopleassigned, - 'lastname'=>$obj->lastname, - 'firstname'=>$obj->firstname, - 'fk_element'=>$obj->fk_element, - 'elementtype'=>$obj->elementtype, - // Type of event - 'acode'=>$obj->acode, - 'alabel'=>$obj->alabel, - 'libelle'=>$obj->alabel, // deprecated - 'apicto'=>$obj->apicto - ); - } else { - $histo[$numaction] = array( - 'type'=>$obj->type, - 'tododone'=>'done', - 'id'=>$obj->id, - 'datestart'=>$db->jdate($obj->dp), - 'dateend'=>$db->jdate($obj->dp2), - 'note'=>$obj->label, - 'message'=>$obj->message, - 'percent'=>$obj->percent, - 'acode'=>$obj->acode, - - 'userid'=>$obj->user_id, - 'login'=>$obj->user_login, - 'userfirstname'=>$obj->user_firstname, - 'userlastname'=>$obj->user_lastname, - 'userphoto'=>$obj->user_photo - ); - } - - $numaction++; - $i++; - } - } else { - dol_print_error($db); - } - } - - // Set $out to sow events - $out = ''; - - if (!isModEnabled('agenda')) { - $langs->loadLangs(array("admin", "errors")); - $out = info_admin($langs->trans("WarningModuleXDisabledSoYouMayMissEventHere", $langs->transnoentitiesnoconv("Module2400Name")), 0, 0, 'warning'); - } - - if (isModEnabled('agenda') || (isModEnabled('mailing') && !empty($objcon->email))) { - $delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60; - - require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; - include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; - require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; - - $formactions = new FormActions($db); - - $actionstatic = new ActionComm($db); - $userstatic = new User($db); - $contactstatic = new Contact($db); - $userGetNomUrlCache = array(); - - $out .= '
'; - $out .= '
'; - $out .= ''; - - if ($objcon && get_class($objcon) == 'Contact' && - (is_null($filterobj) || get_class($filterobj) == 'Societe')) { - $out .= ''; - } else { - $out .= ''; - } - if ($filterobj && get_class($filterobj) == 'Societe') { - $out .= ''; - } - - $out .= "\n"; - - $out .= '
'; - $out .= ''; - - $out .= ''; - - $out .= getTitleFieldOfList('Date', 0, $_SERVER["PHP_SELF"], 'a.datep', '', $param, '', $sortfield, $sortorder, '')."\n"; - - $out .= ''; - if ($donetodo) { - $out .= ''; - } - $out .= ''; - $out .= ''; - - $out .= ''; - $out .= ''; - - - $out .= '
'.$langs->trans("Search").' : '; - $out .= ''; - //$out .= img_picto($langs->trans("Type"), 'type'); - $out .= $formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1, 0, 0, 1, 'minwidth200imp'); - $out .= ''; - $out .= ''; - $out .= ''; - $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); - $out .= $searchpicto; - $out .= '
'; - - $out .= ''; - $out .= '
'; - - $out .= "\n"; - - $out .= '\n"; - - if (empty($histo)) { - $out .= ''.$langs->trans("NoRecordFound").''; - } - } - - if ($noprint) { - return $out; - } else { - print $out; - } -} - -/** - * Get timeline icon - * @param ActionComm $actionstatic actioncomm - * @param array $histo histo - * @param int $key key - * @return string - */ -function getTicketTimelineIcon($actionstatic, &$histo, $key) -{ - global $conf, $langs; - $out = ''."\n"; - $iconClass = 'fa fa-comments'; - $img_picto = ''; - $colorClass = ''; - $pictoTitle = ''; - - if ($histo[$key]['percent'] == -1) { - $colorClass = 'timeline-icon-not-applicble'; - $pictoTitle = $langs->trans('StatusNotApplicable'); - } elseif ($histo[$key]['percent'] == 0) { - $colorClass = 'timeline-icon-todo'; - $pictoTitle = $langs->trans('StatusActionToDo').' (0%)'; - } elseif ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100) { - $colorClass = 'timeline-icon-in-progress'; - $pictoTitle = $langs->trans('StatusActionInProcess').' ('.$histo[$key]['percent'].'%)'; - } elseif ($histo[$key]['percent'] >= 100) { - $colorClass = 'timeline-icon-done'; - $pictoTitle = $langs->trans('StatusActionDone').' (100%)'; - } - - if ($actionstatic->code == 'AC_TICKET_CREATE') { - $iconClass = 'fa fa-ticket'; - } elseif ($actionstatic->code == 'AC_TICKET_MODIFY') { - $iconClass = 'fa fa-pencilxxx'; - } elseif ($actionstatic->code == 'TICKET_MSG') { - $iconClass = 'fa fa-comments'; - } elseif ($actionstatic->code == 'TICKET_MSG_PRIVATE') { - $iconClass = 'fa fa-mask'; - } elseif (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - if ($actionstatic->type_picto) { - $img_picto = img_picto('', $actionstatic->type_picto); - } else { - if ($actionstatic->type_code == 'AC_RDV') { - $iconClass = 'fa fa-handshake'; - } elseif ($actionstatic->type_code == 'AC_TEL') { - $iconClass = 'fa fa-phone'; - } elseif ($actionstatic->type_code == 'AC_FAX') { - $iconClass = 'fa fa-fax'; - } elseif ($actionstatic->type_code == 'AC_EMAIL') { - $iconClass = 'fa fa-envelope'; - } elseif ($actionstatic->type_code == 'AC_INT') { - $iconClass = 'fa fa-shipping-fast'; - } elseif ($actionstatic->type_code == 'AC_OTH_AUTO') { - $iconClass = 'fa fa-robot'; - } elseif (!preg_match('/_AUTO/', $actionstatic->type_code)) { - $iconClass = 'fa fa-robot'; - } - } - } - - $out .= ''.$img_picto.''."\n"; - return $out; -} - -/** - * getTicketActionCommEcmList - * - * @param ActionComm $object Object ActionComm - * @return array Array of documents in index table - */ -function getTicketActionCommEcmList($object) -{ - global $conf, $db; - - $documents = array(); - - $sql = 'SELECT ecm.rowid as id, ecm.src_object_type, ecm.src_object_id, ecm.filepath, ecm.filename'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'ecm_files ecm'; - $sql .= " WHERE ecm.filepath = 'agenda/".((int) $object->id)."'"; - //$sql.= " ecm.src_object_type = '".$db->escape($object->element)."' AND ecm.src_object_id = ".((int) $object->id); // Old version didn't add object_type during upload - $sql .= ' ORDER BY ecm.position ASC'; - - $resql = $db->query($sql); - if ($resql) { - if ($db->num_rows($resql)) { - while ($obj = $db->fetch_object($resql)) { - $documents[$obj->id] = $obj; - } - } - } - - return $documents; -} diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php index bef020d9a38..ed8b87c9791 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/info.php @@ -166,18 +166,40 @@ if ($permok) { } -//print '
'; -$morehtmlcenter = ''; -if (isModEnabled('agenda')) { - $addActionBtnRight = !empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create); - $morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight); -} //print '
'; if (!empty($object->id)) { print '
'; + //print '
'; + $morehtmlcenter = ''; + + // Show link to change view in message + $messagingUrl = DOL_URL_ROOT.'/projet/messaging.php?id='.$object->id; + $morehtmlcenter .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); + + // Show link to change view in agenda + $messagingUrl = DOL_URL_ROOT.'/projet/info.php?id='.$object->id; + $morehtmlcenter .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); + + + // // Show link to send an email (if read and not closed) + // $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; + // $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; + // $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus); + + // // Show link to add a private message (if read and not closed) + // $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; + // $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; + // $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus); + + // Show link to add event + if (isModEnabled('agenda')) { + $addActionBtnRight = !empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create); + $morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight); + } + $param = '&id='.$object->id; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.$contextpage; diff --git a/htdocs/projet/messaging.php b/htdocs/projet/messaging.php new file mode 100644 index 00000000000..9200d802794 --- /dev/null +++ b/htdocs/projet/messaging.php @@ -0,0 +1,221 @@ + + * Copyright (C) 2005-2009 Regis Houssin + * + * 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/projet/messaging.php + * \ingroup project + * \brief Page with events on project + */ + +// Load Dolibarr environment +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + +// Load translation files required by the page +$langs->load("projects"); + +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$socid = GETPOST('socid', 'int'); +$action = GETPOST('action', 'aZ09'); + +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST("sortfield", "aZ09comma"); +$sortorder = GETPOST("sortorder", 'aZ09comma'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +$page = is_numeric($page) ? $page : 0; +$page = $page == -1 ? 0 : $page; +if (!$sortfield) { + $sortfield = "a.datep,a.id"; +} +if (!$sortorder) { + $sortorder = "DESC"; +} +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; + +if (GETPOST('actioncode', 'array')) { + $actioncode = GETPOST('actioncode', 'array', 3); + if (!count($actioncode)) { + $actioncode = '0'; + } +} else { + $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); +} +$search_agenda_label = GETPOST('search_agenda_label'); + +$hookmanager->initHooks(array('projectcardinfo')); + +// Security check +$id = GETPOST("id", 'int'); +$socid = 0; +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. +$result = restrictedArea($user, 'projet', $id, 'projet&project'); + +if (!$user->rights->projet->lire) { + accessforbidden(); +} + + + +/* + * Actions + */ + +$parameters = array('id'=>$socid); +$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'); +} + +// Purge search criteria +if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers + $actioncode = ''; + $search_agenda_label = ''; +} + + + +/* + * View + */ + +$form = new Form($db); +$object = new Project($db); + +if ($id > 0 || !empty($ref)) { + $object->fetch($id, $ref); + $object->fetch_thirdparty(); + if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) { + $object->fetchComments(); + } + $object->info($object->id); +} +$agenda = (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) ? '/'.$langs->trans("Agenda") : ''; +$title = $langs->trans('Events').$agenda.' - '.$object->ref.' '.$object->name; +if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { + $title = $object->ref.' '.$object->name.' - '.$langs->trans("Info"); +} +$help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; +llxHeader("", $title, $help_url); + +$head = project_prepare_head($object); + +print dol_get_fiche_head($head, 'agenda', $langs->trans("Project"), -1, ($object->public ? 'projectpub' : 'project')); + + +// Project card + +$linkback = ''.$langs->trans("BackToList").''; + +$morehtmlref = '
'; +// Title +$morehtmlref .= $object->title; +// Thirdparty +if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { + $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); +} +$morehtmlref .= '
'; + +// Define a complementary filter for search of next/prev ref. +if (empty($user->rights->projet->all->lire)) { + $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); + $object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; +} + +dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + +print '
'; +print '
'; + +dol_print_object_info($object, 1); + +print '
'; + +print '
'; + +print dol_get_fiche_end(); + + +// Actions buttons + +$out = ''; +$permok = $user->rights->agenda->myactions->create; +if ($permok) { + $out .= '&projectid='.$object->id; +} + + + +//print '
'; + +if (!empty($object->id)) { + print '
'; + + //print '
'; + $morehtmlcenter = ''; + + // Show link to change view in message + $messagingUrl = DOL_URL_ROOT.'/projet/messaging.php?id='.$object->id; + $morehtmlcenter .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 2); + + // Show link to change view in agenda + $messagingUrl = DOL_URL_ROOT.'/projet/info.php?id='.$object->id; + $morehtmlcenter .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1); + + + // // Show link to send an email (if read and not closed) + // $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; + // $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; + // $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus); + + // // Show link to add a private message (if read and not closed) + // $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; + // $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; + // $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus); + + // Show link to add event + if (isModEnabled('agenda')) { + $addActionBtnRight = !empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create); + $morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight); + } + + $param = '&id='.$object->id; + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.$contextpage; + } + if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.$limit; + } + + print_barre_liste($langs->trans("ActionsOnProject"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlcenter, '', 0, 1, 1); + + // List of all actions + $filters = array(); + $filters['search_agenda_label'] = $search_agenda_label; + show_actions_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 841f810e5ec..0bd6a98cab9 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1564,7 +1564,7 @@ if ($action == 'create' || $action == 'presend') { // List of all actions $filters = array(); $filters['search_agenda_label'] = $search_agenda_label; - show_ticket_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); + show_actions_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); } if ($action != 'presend' && $action != 'presend_addmessage' && $action != 'add_message') { diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index 88ac4ef686c..fb95c5a66f1 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -265,7 +265,7 @@ if (!empty($object->id)) { // List of all actions $filters = array(); $filters['search_agenda_label'] = $search_agenda_label; - show_ticket_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); + show_actions_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); } // End of page From 797d866d0a88839b5d88e49264fac8863f0ea98d Mon Sep 17 00:00:00 2001 From: Faustin Date: Sun, 9 Oct 2022 15:37:04 +0200 Subject: [PATCH 002/176] =?UTF-8?q?NEW=C2=A0#22527:=20can=20now=20view=20a?= =?UTF-8?q?ctions=20in=20messaging=20list=20for=20third=20parties?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/societe/agenda.php | 24 +++- htdocs/societe/messaging.php | 211 +++++++++++++++++++++++++++++++++++ 2 files changed, 231 insertions(+), 4 deletions(-) create mode 100644 htdocs/societe/messaging.php diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 550d8ca772d..9e6c10a0ccd 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -160,10 +160,26 @@ if ($socid > 0) { $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog'); } - $newcardbutton = ''; + $morehtmlright = ''; + + $messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id; + $morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); + $messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; + $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); + + // // Show link to send an email (if read and not closed) + // $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; + // $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; + // $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus); + + // // Show link to add a private message (if read and not closed) + // $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; + // $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; + // $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus); + if (isModEnabled('agenda')) { if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { - $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } } @@ -178,8 +194,8 @@ if ($socid > 0) { $param .= '&limit='.urlencode($limit); } - print load_fiche_titre($langs->trans("ActionsOnCompany"), $newcardbutton, ''); - //print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $newcardbutton, '', 0, 1, 1); + // print load_fiche_titre($langs->trans("ActionsOnCompany"), $newcardbutton, ''); + print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); // List of all actions $filters = array(); diff --git a/htdocs/societe/messaging.php b/htdocs/societe/messaging.php new file mode 100644 index 00000000000..c73d6ffe0b1 --- /dev/null +++ b/htdocs/societe/messaging.php @@ -0,0 +1,211 @@ + + * Copyright (C) 2005 Brice Davoleau + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2006-2019 Laurent Destailleur + * Copyright (C) 2007 Patrick Raguin + * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2015 Marcos García + * + * 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/societe/messaging.php + * \ingroup societe + * \brief Page of third party events + */ + +// Load Dolibarr environment +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('agenda', 'bills', 'companies', 'orders', 'propal')); + + +if (GETPOST('actioncode', 'array')) { + $actioncode = GETPOST('actioncode', 'array', 3); + if (!count($actioncode)) { + $actioncode = '0'; + } +} else { + $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); +} + +$search_agenda_label = GETPOST('search_agenda_label'); + +// Security check +$socid = GETPOST('socid', 'int'); +if ($user->socid) { + $socid = $user->socid; +} +$result = restrictedArea($user, 'societe', $socid, '&societe'); + +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +if (empty($page) || $page == -1) { + $page = 0; +} // If $page is not defined, or '' or -1 +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (!$sortfield) { + $sortfield = 'a.datep,a.id'; +} +if (!$sortorder) { + $sortorder = 'DESC,DESC'; +} + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('agendathirdparty')); + + +/* + * Actions + */ + +$parameters = array('id'=>$socid); +$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)) { + // Cancel + if (GETPOST('cancel', 'alpha') && !empty($backtopage)) { + header("Location: ".$backtopage); + exit; + } + + // 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 + $actioncode = ''; + $search_agenda_label = ''; + } +} + + + +/* + * View + */ + +$form = new Form($db); + +if ($socid > 0) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + + $object = new Societe($db); + $result = $object->fetch($socid); + + $title = $langs->trans("Agenda"); + if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { + $title = $object->name." - ".$title; + } + llxHeader('', $title); + + if (isModEnabled('notification')) { + $langs->load("mails"); + } + $head = societe_prepare_head($object); + + print dol_get_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, 'company'); + + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); + + print '
'; + + print '
'; + + $object->info($socid); + dol_print_object_info($object, 1); + + print '
'; + + print dol_get_fiche_end(); + + + + // Actions buttons + + $objthirdparty = $object; + $objcon = new stdClass(); + + $out = ''; + $permok = $user->hasRight('agenda', 'myactions', 'create'); + if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { + if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') { + $out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : '').'&backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : '')); + } + $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&percentage=-1'; + $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog'); + } + + $morehtmlright = ''; + + $messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id; + $morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 2); + $messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; + $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1); + + // // Show link to send an email (if read and not closed) + // $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; + // $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; + // $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus); + + // // Show link to add a private message (if read and not closed) + // $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; + // $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; + // $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus); + + if (isModEnabled('agenda')) { + if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); + } + } + + if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + print '
'; + + $param = '&socid='.urlencode($socid); + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.urlencode($contextpage); + } + if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.urlencode($limit); + } + + // print load_fiche_titre($langs->trans("ActionsOnCompany"), $newcardbutton, ''); + print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); + + // List of all actions + $filters = array(); + $filters['search_agenda_label'] = $search_agenda_label; + + // TODO Replace this with same code than into list.php + show_actions_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); + } +} + +// End of page +llxFooter(); +$db->close(); From 5528dc3843b2ccc4ef71ab4c76175fe7dfe3a2b5 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Tue, 11 Oct 2022 10:26:03 +0200 Subject: [PATCH 003/176] FIX closed warehouse for shipping --- htdocs/commande/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 2e2dbc97946..29ad812f6e6 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2334,7 +2334,7 @@ if ($resql) { // Get local and virtual stock and store it into cache if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) { - $generic_product->load_stock('nobatch'); // ->load_virtual_stock() is already included into load_stock() + $generic_product->load_stock('nobatch,warehouseopen'); // ->load_virtual_stock() is already included into load_stock() $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel; $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; } else { From 37290764556c22d24c7e66a46634c92b5599155c Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 13 Oct 2022 15:30:38 +0200 Subject: [PATCH 004/176] Add the supplier price as a hidden field when editing a supplier_proposal line. Otherwise, the relationship between the line and the supplier is removed. --- htdocs/core/tpl/objectline_edit.tpl.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 3ce3fffd28d..64404081e54 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -186,6 +186,7 @@ $coldisplay++; ?> fk_fournprice.'">'); } $coldisplay++; From e91763239acf56960cb01e41679113c51f1b207f Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Fri, 14 Oct 2022 11:14:04 +0200 Subject: [PATCH 005/176] relaunch stickler From e1e7ce80748f557e67406b5edf95e28275366d1f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 14 Oct 2022 12:09:02 +0200 Subject: [PATCH 006/176] FIX: #22581 --- htdocs/expedition/card.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 8aa54ca8904..7aecd063490 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -215,6 +215,8 @@ if (empty($reshook)) { $object->size_units = GETPOST('size_units', 'int'); $object->weight_units = GETPOST('weight_units', 'int'); + $product = new Product($db); + // We will loop on each line of the original document to complete the shipping object with various info and quantity to deliver $classname = ucfirst($object->origin); $objectsrc = new $classname($db); @@ -250,10 +252,20 @@ if (empty($reshook)) { $stockLocation = "ent1".$i."_0"; $qty = "qtyl".$i; + $is_batch_or_serial=0; + if (!empty($objectsrc->lines[$i]->fk_product)) { + $resultFetch = $product->fetch($objectsrc->lines[$i]->fk_product, '', '', '', 1, 1, 1); + if ($resultFetch < 0) { + setEventMessages($product->error, $product->errors, 'errors'); + } + $is_batch_or_serial = $product->status_batch; + } + if (!empty($conf->productbatch->enabled) && $objectsrc->lines[$i]->product_tobatch) { // If product need a batch number if (GETPOSTISSET($batch)) { //shipment line with batch-enable product $qty .= '_'.$j; + while (GETPOSTISSET($batch)) { // save line of detail into sub_qty $sub_qty[$j]['q'] = GETPOST($qty, 'int'); // the qty we want to move for this stock record @@ -261,7 +273,11 @@ if (empty($reshook)) { $subtotalqty += $sub_qty[$j]['q']; //var_dump($qty);var_dump($batch);var_dump($sub_qty[$j]['q']);var_dump($sub_qty[$j]['id_batch']); - + if ($is_batch_or_serial==2 && $sub_qty[$j]['q']>1) { + setEventMessages($langs->trans("TooManyQtyForSerialNumber", $product->ref, ''), null, 'errors'); + $totalqty=0; + break 2; + } $j++; $batch = "batchl".$i."_".$j; $qty = "qtyl".$i.'_'.$j; @@ -286,6 +302,7 @@ if (empty($reshook)) { $qty .= '_'.$j; while (GETPOSTISSET($stockLocation)) { // save sub line of warehouse + $stockLine[$i][$j]['qty'] = price2num(GETPOST($qty, 'alpha'), 'MS'); $stockLine[$i][$j]['warehouse_id'] = GETPOST($stockLocation, 'int'); $stockLine[$i][$j]['ix_l'] = GETPOST($idl, 'int'); @@ -316,7 +333,6 @@ if (empty($reshook)) { } //var_dump($batch_line[2]); - if ($totalqty > 0) { // There is at least one thing to ship //var_dump($_POST);exit; for ($i = 0; $i < $num; $i++) { From 012275cb3e91188f8842de1a69b16aa9616440d3 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 14 Oct 2022 12:10:04 +0200 Subject: [PATCH 007/176] FIX: #22581 --- htdocs/expedition/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 7aecd063490..fc443f6790b 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -302,7 +302,6 @@ if (empty($reshook)) { $qty .= '_'.$j; while (GETPOSTISSET($stockLocation)) { // save sub line of warehouse - $stockLine[$i][$j]['qty'] = price2num(GETPOST($qty, 'alpha'), 'MS'); $stockLine[$i][$j]['warehouse_id'] = GETPOST($stockLocation, 'int'); $stockLine[$i][$j]['ix_l'] = GETPOST($idl, 'int'); From c002957b49a2540a602bfd279337bc2b96c21d42 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 14 Oct 2022 12:10:26 +0200 Subject: [PATCH 008/176] FIX: #22581 --- htdocs/expedition/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index fc443f6790b..29e1bd266b8 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -265,7 +265,6 @@ if (empty($reshook)) { if (GETPOSTISSET($batch)) { //shipment line with batch-enable product $qty .= '_'.$j; - while (GETPOSTISSET($batch)) { // save line of detail into sub_qty $sub_qty[$j]['q'] = GETPOST($qty, 'int'); // the qty we want to move for this stock record From ecac08fa7a1ac7f9907eadb250ee901782d64dda Mon Sep 17 00:00:00 2001 From: kkhelifa Date: Fri, 14 Oct 2022 17:00:49 +0200 Subject: [PATCH 009/176] FIX: Fix the function get_origin() on MouvementStock class for general case --- htdocs/product/stock/class/mouvementstock.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 31e66796a48..b1e184c3fe2 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -976,7 +976,7 @@ class MouvementStock extends CommonObject if ($origin_type) { // Separate originetype with "@" : left part is class name, right part is module name $origin_type_array = explode('@', $origin_type); - $classname = ucfirst($origin_type_array[0]); + $classname = strtolower($origin_type_array[0]); $modulename = empty($origin_type_array[1]) ? $classname : $origin_type_array[1]; $result = dol_include_once('/'.$modulename.'/class/'.strtolower($classname).'.class.php'); if ($result) { From df51c0ea519e8a22e5769ad83adbcf9621c957a3 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 15 Oct 2022 13:07:07 +0200 Subject: [PATCH 010/176] Fix php 8 error --- htdocs/datapolicy/class/datapolicycron.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/datapolicy/class/datapolicycron.class.php b/htdocs/datapolicy/class/datapolicycron.class.php index 965d93754f7..13e31581f76 100644 --- a/htdocs/datapolicy/class/datapolicycron.class.php +++ b/htdocs/datapolicy/class/datapolicycron.class.php @@ -451,8 +451,8 @@ class DataPolicyCron $this->db->begin(); foreach ($arrayofparameters as $key => $params) { - if ($conf->global->$key != '' && is_numeric($conf->global->$key) && (int) $conf->global->$key > 0) { - $sql = sprintf($params['sql'], (int) $conf->entity, (int) $conf->global->$key, (int) $conf->global->$key); + if (getDolGlobalInt($key) != '' && is_numeric(getDolGlobalInt($key)) && (int) getDolGlobalInt($key) > 0) { + $sql = sprintf($params['sql'], (int) $conf->entity, (int) getDolGlobalInt($key), (int) getDolGlobalInt($key)); $resql = $this->db->query($sql); From 1044e79aa147701201fa7bf0272df1a99bb5263c Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 15 Oct 2022 13:19:55 +0200 Subject: [PATCH 011/176] fix php 8 error --- htdocs/compta/facture/class/facture-rec.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 7cfe15b64e6..e8c965f5937 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1274,6 +1274,8 @@ class FactureRec extends CommonInvoice $tmparray = dol_getdate($now); $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day + $this->output = null; + dol_syslog("createRecurringInvoices restrictioninvoiceid=".$restrictioninvoiceid." forcevalidation=".$forcevalidation); $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_rec'; From 4b404909f6dbb269d545a8a72f721a06dd2289f5 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 15 Oct 2022 19:11:38 +0200 Subject: [PATCH 012/176] Fix php 8 error --- htdocs/ticket/class/api_tickets.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 3151f75877b..6d00317da58 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -241,7 +241,8 @@ class Tickets extends DolibarrApi if (!$socid && DolibarrApiAccess::$user->socid) { $socid = DolibarrApiAccess::$user->socid; } - + + $search_sale = null; // If the internal user must only see his customers, force searching by him if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) { $search_sale = DolibarrApiAccess::$user->id; From 2067e90f149d4dd77ec3d3588cbbacc3e8248686 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 15 Oct 2022 17:12:34 +0000 Subject: [PATCH 013/176] Fixing style errors. --- htdocs/ticket/class/api_tickets.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 6d00317da58..629eab03d77 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -241,7 +241,7 @@ class Tickets extends DolibarrApi if (!$socid && DolibarrApiAccess::$user->socid) { $socid = DolibarrApiAccess::$user->socid; } - + $search_sale = null; // If the internal user must only see his customers, force searching by him if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) { From 7a50d03256e4d9ec828d10e3fb50fa787038148a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 16 Oct 2022 14:45:35 +0200 Subject: [PATCH 014/176] FIX wrong perm check --- htdocs/core/boxes/box_dolibarr_state_board.php | 2 +- htdocs/index.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index 83615c17fd3..e158da13f14 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -124,7 +124,7 @@ class box_dolibarr_state_board extends ModeleBoxes 'contacts' => isModEnabled('societe') && $user->hasRight('societe', 'contact', 'lire'), 'products' => isModEnabled('product') && $user->hasRight('produit', 'lire'), 'services' => isModEnabled('service') && $user->hasRight('service', 'lire'), - 'proposals' => isModEnabled('propal') && $user->hasRight('propale', 'lire'), + 'proposals' => isModEnabled('propal') && $user->hasRight('propal', 'lire'), 'orders' => isModEnabled('commande') && $user->hasRight('commande', 'lire'), 'invoices' => isModEnabled('facture') && $user->hasRight('facture', 'lire'), 'donations' => isModEnabled('don') && $user->hasRight('don', 'lire'), diff --git a/htdocs/index.php b/htdocs/index.php index 903f77c0ed8..f9bedb661ac 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -176,7 +176,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } // Number of commercial customer proposals open (expired) - if (isModEnabled('propal') && empty($conf->global->MAIN_DISABLE_BLOCK_CUSTOMER) && $user->hasRight('propale', 'lire')) { + if (isModEnabled('propal') && empty($conf->global->MAIN_DISABLE_BLOCK_CUSTOMER) && $user->hasRight('propal', 'lire')) { include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $board = new Propal($db); $dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened"); From babf1e0e27eede723a3d9076f4b736437cddbf81 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Oct 2022 01:55:57 +0200 Subject: [PATCH 015/176] Fix doc --- htdocs/adherents/class/api_members.class.php | 10 +++++----- htdocs/compta/bank/class/api_bankaccounts.class.php | 4 ++-- htdocs/compta/facture/class/api_invoices.class.php | 1 - 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index d30e851b9a2..abd75b262c5 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -480,11 +480,11 @@ class Members extends DolibarrApi /** * Add a subscription for a member * - * @param int $id ID of member - * @param int $start_date Start date {@from body} {@type timestamp} - * @param int $end_date End date {@from body} {@type timestamp} - * @param float $amount Amount (may be 0) {@from body} - * @param string $label Label {@from body} + * @param int $id ID of member + * @param string $start_date Start date {@from body} {@type timestamp} + * @param string $end_date End date {@from body} {@type timestamp} + * @param float $amount Amount (may be 0) {@from body} + * @param string $label Label {@from body} * @return int ID of subscription * * @url POST {id}/subscriptions diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 8e38d1ffe78..c9886a176f0 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -471,7 +471,7 @@ class BankAccounts extends DolibarrApi * Add a line to an account * * @param int $id ID of account - * @param int $date Payment date (timestamp) {@from body} {@type timestamp} + * @param string $date Payment date (timestamp) {@from body} {@type timestamp} * @param string $type Payment mode (TYP,VIR,PRE,LIQ,VAD,CB,CHQ...) {@from body} * @param string $label Label {@from body} * @param float $amount Amount (may be 0) {@from body} @@ -480,7 +480,7 @@ class BankAccounts extends DolibarrApi * @param string $cheque_writer Name of cheque writer {@from body} * @param string $cheque_bank Bank of cheque writer {@from body} * @param string $accountancycode Accountancy code {@from body} - * @param int $datev Payment date value (timestamp) {@from body} {@type timestamp} + * @param string $datev Payment date value (timestamp) {@from body} {@type timestamp} * @param string $num_releve Bank statement numero {@from body} * @return int ID of line * diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index e9f9f9e5e65..dc1917f17b4 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -1450,7 +1450,6 @@ class Invoices extends DolibarrApi $multicurrency_amounts[$id] = $newvalue; } - // Creation of payment line $paymentobj = new Paiement($this->db); $paymentobj->datepaye = $datepaye; From 68f16b13d70b8bbc8e9051177f7d46069f0eca0a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Oct 2022 02:52:03 +0200 Subject: [PATCH 016/176] Fix typo --- htdocs/compta/prelevement/class/bonprelevement.class.php | 3 ++- htdocs/langs/en_US/errors.lang | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index a1dcdba6f58..17ecdbd865d 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -353,7 +353,8 @@ class BonPrelevement extends CommonObject if ($this->fetched == 1) { if ($date < $this->date_trans) { - $this->error = 'DateOfMovementLowerThanDateOfFileTransmission'; + $langs->load("errors"); + $this->error = $langs->trans('ErrorDateOfMovementLowerThanDateOfFileTransmission'); dol_syslog("bon-prelevment::set_infocredit 1027 ".$this->error); return -1027; } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index afcbe76e828..3d661690fd3 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -294,6 +294,7 @@ ErrorFailedToWriteInTempDirectory=Failed to write in temp directory ErrorQuantityIsLimitedTo=Quantity is limited to %s ErrorValueForTooLow=Value for %s is too low ErrorValueCantBeNull=Value for %s can't be null +ErrorDateOfMovementLowerThanDateOfFileTransmission=The date of the bank transaction can't be lower than the date of the file transmission # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. From 99962b9ade9c8eca2af1faf9359323bea2e72eb4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Oct 2022 15:41:59 +0200 Subject: [PATCH 017/176] FIX Search ambigous field on MO list --- htdocs/mrp/mo_list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index dfbe224e733..01bcc161a12 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -230,8 +230,8 @@ $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; if (isset($extrafields->attributes[$object->table_element]['label']) && 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)"; } -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mrp_production lineparent ON t.fk_parent_line = lineparent.rowid"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mrp_mo moparent ON lineparent.fk_mo = moparent.rowid"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mrp_production as lineparent ON t.fk_parent_line = lineparent.rowid"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mrp_mo as moparent ON lineparent.fk_mo = moparent.rowid"; // Add table from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook @@ -266,7 +266,7 @@ foreach ($search as $key => $val) { $mode_search = 2; } if ($search[$key] != '') { - $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); + $sql .= natural_search('t.'.$key, $search[$key], (($key == 'status') ? 2 : $mode_search)); } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { From 159628be564850591f248ddac426dd9a8cb210b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Oct 2022 15:54:48 +0200 Subject: [PATCH 018/176] Fix the quick filter on MO --- htdocs/core/ajax/selectsearchbox.php | 1 - htdocs/core/class/html.form.class.php | 1 + htdocs/mrp/mo_list.php | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 54e3e1e4470..87eec4ac632 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -87,7 +87,6 @@ if (((isModEnabled('product') && $user->hasRight('produit', 'lire')) || (isModEn if (isModEnabled('mrp') && $user->hasRight('mrp', 'read') && empty($conf->global->MAIN_SEARCHFORM_MRP_DISABLED)) { $arrayresult['searchintomo'] = array('position'=>35, 'shortcut'=>'', 'img'=>'object_mrp', 'label'=>$langs->trans("SearchIntoMO", $search_boxvalue), 'text'=>img_picto('', 'object_mrp', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMO", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/mrp/mo_list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } - if (isModEnabled('project') && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->hasRight('projet', 'lire')) { $arrayresult['searchintoprojects'] = array('position'=>40, 'shortcut'=>'Q', 'img'=>'object_project', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('', 'object_project', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5ed1f76227b..5869a85f3cf 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8167,6 +8167,7 @@ class Form if(! data.id) return null;'; if ($callurlonselect) { + // We forge the url with 'sall=' $outdelayed .= ' var urlBase = data.url; diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 01bcc161a12..c275cd644ec 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -84,7 +84,7 @@ if (!$sortorder) { } // Initialize array of search criterias -$search_all = GETPOST('search_all', 'alphanohtml'); +$search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'); $search = array(); foreach ($object->fields as $key => $val) { if (GETPOST('search_'.$key, 'alpha') !== '') { From ebd7605545ea9318779bd99704e92a270eaa18aa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Oct 2022 16:39:52 +0200 Subject: [PATCH 019/176] Fix bad recalculation of cost price of production of a product --- htdocs/langs/en_US/products.lang | 2 +- htdocs/mrp/mo_production.php | 41 ++++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index a0a3f4e588d..38f57cda105 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -399,7 +399,7 @@ ActionAvailableOnVariantProductOnly=Action only available on the variant of prod ProductsPricePerCustomer=Product prices per customers ProductSupplierExtraFields=Additional Attributes (Supplier Prices) DeleteLinkedProduct=Delete the child product linked to the combination -AmountUsedToUpdateWAP=Amount to use to update the Weighted Average Price +AmountUsedToUpdateWAP=Unit amount to use to update the Weighted Average Price PMPValue=Weighted average price PMPValueShort=WAP mandatoryperiod=Mandatory periods diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index fb0930deede..c86fcb1f926 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -802,6 +802,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Lines to consume + $bomcostupdated = 0; // We will recalculate the unitary cost to produce a product using the real "products to consume into MO" + if (!empty($object->lines)) { $nblinetoconsume = 0; foreach ($object->lines as $line) { @@ -820,7 +822,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $linecost = price2num($tmpproduct->pmp, 'MT'); if ($object->qty > 0) { - // add free consume line cost to bomcost + // add free consume line cost to $bomcostupdated $costprice = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp); if (empty($costprice)) { require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; @@ -831,12 +833,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $costprice = 0; } } - $linecost = price2num(($line->qty * $costprice) / $object->qty, 'MT'); - $bomcost += $linecost; + $linecost = price2num(($line->qty * $costprice) / $object->qty, 'MT'); // price for line for all quantities + $bomcostupdated += price2num(($line->qty * $costprice) / $object->qty, 'MU'); // same but with full accuracy } - $bomcost = price2num($bomcost, 'MU'); - + $bomcostupdated = price2num($bomcostupdated, 'MU'); $arrayoflines = $object->fetchLinesLinked('consumed', $line->id); $alreadyconsumed = 0; foreach ($arrayoflines as $line2) { @@ -1111,7 +1112,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans("Product").''; print ''.$langs->trans("Qty").''; if ($permissiontoupdatecost) { - if (empty($bomcost)) { + if (empty($bomcostupdated)) { print ''.$form->textwithpicto($langs->trans("UnitCost"), $langs->trans("AmountUsedToUpdateWAP")).''; } else { print ''.$form->textwithpicto($langs->trans("ManufacturingPrice"), $langs->trans("AmountUsedToUpdateWAP")).''; @@ -1199,17 +1200,25 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($permissiontoupdatecost) { // Defined $manufacturingcost $manufacturingcost = 0; - if ($object->mrptype == 0) { // If MO is a "Manufacture" type (and not "Disassemble" - $manufacturingcost = $bomcost; + $manufacturingcostsrc = ''; + if ($object->mrptype == 0) { // If MO is a "Manufacture" type (and not "Disassemble") + $manufacturingcost = $bomcostupdated; + $manufacturingcostsrc = $langs->trans("CalculatedFromProductsToConsume"); + if (empty($manufacturingcost)) { + $manufacturingcost = $bomcost; + $manufacturingcostsrc = $langs->trans("ValueFromBom"); + } if (empty($manufacturingcost)) { $manufacturingcost = price2num($tmpproduct->cost_price, 'MU'); + $manufacturingcostsrc = $langs->trans("CostPrice"); } if (empty($manufacturingcost)) { $manufacturingcost = price2num($tmpproduct->pmp, 'MU'); + $manufacturingcostsrc = $langs->trans("PMPValue"); } } - print ''; + print ''; if ($manufacturingcost) { print price($manufacturingcost); } @@ -1306,19 +1315,27 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($permissiontoupdatecost) { // Defined $manufacturingcost $manufacturingcost = 0; - if ($object->mrptype == 0) { // If MO is a "Manufacture" type (and not "Disassemble" - $manufacturingcost = $bomcost; + $manufacturingcostsrc = ''; + if ($object->mrptype == 0) { // If MO is a "Manufacture" type (and not "Disassemble") + $manufacturingcost = $bomcostupdated; + $manufacturingcostsrc = $langs->trans("CalculatedFromProductsToConsume"); + if (empty($manufacturingcost)) { + $manufacturingcost = $bomcost; + $manufacturingcostsrc = $langs->trans("ValueFromBom"); + } if (empty($manufacturingcost)) { $manufacturingcost = price2num($tmpproduct->cost_price, 'MU'); + $manufacturingcostsrc = $langs->trans("CostPrice"); } if (empty($manufacturingcost)) { $manufacturingcost = price2num($tmpproduct->pmp, 'MU'); + $manufacturingcostsrc = $langs->trans("PMPValue"); } } if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $preselected = (GETPOSTISSET('pricetoproduce-'.$line->id.'-'.$i) ? GETPOST('pricetoproduce-'.$line->id.'-'.$i) : ($manufacturingcost ? price($manufacturingcost) : '')); - print ''; + print ''; } else { print ''; } From 7c615fafb914507843364ca326106924c759d498 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Oct 2022 23:14:33 +0200 Subject: [PATCH 020/176] Update datapolicycron.class.php --- htdocs/datapolicy/class/datapolicycron.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/datapolicy/class/datapolicycron.class.php b/htdocs/datapolicy/class/datapolicycron.class.php index 13e31581f76..c357fbe7d15 100644 --- a/htdocs/datapolicy/class/datapolicycron.class.php +++ b/htdocs/datapolicy/class/datapolicycron.class.php @@ -451,7 +451,7 @@ class DataPolicyCron $this->db->begin(); foreach ($arrayofparameters as $key => $params) { - if (getDolGlobalInt($key) != '' && is_numeric(getDolGlobalInt($key)) && (int) getDolGlobalInt($key) > 0) { + if (getDolGlobalInt($key) > 0) { $sql = sprintf($params['sql'], (int) $conf->entity, (int) getDolGlobalInt($key), (int) getDolGlobalInt($key)); $resql = $this->db->query($sql); From 1f790158154e0470ecfb3ab85e839e2d952859c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 00:06:20 +0200 Subject: [PATCH 021/176] Fix rpm files --- build/rpm/dolibarr_generic.spec | 2 +- build/rpm/dolibarr_opensuse.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index f6d81feaea4..a992c84f0f9 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -58,7 +58,7 @@ Requires: mysql, mysql-client %if 0%{?suse_version} # Voir http://en.opensuse.org/openSUSE:Packaging_Conventions_RPM_Macros Group: Productivity/Office/Management -Requires: apache2, apache2-mod_php5, php5 >= 5.3.0, php5-gd, php5-ldap, php5-imap, php5-mysql, php5-openssl, dejavu +Requires: apache2, apache2-mod_php, php >= 5.3.0, php-gd, php-ldap, php-imap, php-mysql, php-openssl, dejavu Requires: mysql-community-server, mysql-community-server-client BuildRequires: update-desktop-files fdupes %else diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index bd6834582ac..884e2494f74 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -25,7 +25,7 @@ BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build Group: Productivity/Office/Management -Requires: apache2, apache2-mod_php5, php5 >= 5.3.0, php5-gd, php5-ldap, php5-imap, php5-mysql, php5-openssl, dejavu +Requires: apache2, apache2-mod_php, php >= 5.3.0, php-gd, php-ldap, php-imap, php-mysql, php-openssl, dejavu Requires: mysql-community-server, mysql-community-server-client %if 0%{?suse_version} BuildRequires: update-desktop-files fdupes From 9d4b8afc3d504392fcdd4faca536add32db2cf89 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 00:12:55 +0200 Subject: [PATCH 022/176] Clean rpm --- build/rpm/dolibarr_opensuse.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index 884e2494f74..c7113828632 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -66,7 +66,6 @@ ed essere facile da usare. Programmo web, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. -%_datadir/dolibarr/htdocs/webhook #---- prep %prep From 36777ee8c7c3ef35eabf3b685fcddac04d35e1f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 00:48:05 +0200 Subject: [PATCH 023/176] Fix phpunit --- htdocs/mrp/mo_list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index c275cd644ec..e0b9a8f90da 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -266,17 +266,17 @@ foreach ($search as $key => $val) { $mode_search = 2; } if ($search[$key] != '') { - $sql .= natural_search('t.'.$key, $search[$key], (($key == 'status') ? 2 : $mode_search)); + $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search)); } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key); if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/_dtstart$/', $key)) { - $sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'"; + $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'"; } if (preg_match('/_dtend$/', $key)) { - $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'"; } } } From 7df36e4a1f423d51766c1364c1105b5d8bcc6ef3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 00:53:13 +0200 Subject: [PATCH 024/176] Try fix phpunit --- htdocs/core/lib/price.lib.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 98311d093cd..a35cb659128 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -341,20 +341,18 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt } // If rounding is not using base 10 (rare) - if (!empty($conf->global->MAIN_ROUNDING_RULE_TOT)) - { - if ($price_base_type == 'HT') - { - $result[0] = round($result[0] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[1] = round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[9] = round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[10] = round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; + if (!empty($conf->global->MAIN_ROUNDING_RULE_TOT)) { + if ($price_base_type == 'HT') { + $result[0] = price2num(round($result[0] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[1] = price2num(round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[9] = price2num(round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[10] = price2num(round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); $result[2] = price2num($result[0] + $result[1] + $result[9] + $result[10], 'MT'); } else { - $result[1] = round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[2] = round($result[2] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[9] = round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[10] = round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; + $result[1] = price2num(round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[2] = price2num(round($result[2] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[9] = price2num(round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[10] = price2num(round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); $result[0] = price2num($result[2] - $result[1] - $result[9] - $result[10], 'MT'); } } From 4cf021aeebf6409278f853a60c42eca17a9a4320 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 10:33:04 +0200 Subject: [PATCH 025/176] Debug --- dev/tools/github_lines_perusers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/github_lines_perusers.sh b/dev/tools/github_lines_perusers.sh index 5e65ddc6bf9..9a3fad09d62 100755 --- a/dev/tools/github_lines_perusers.sh +++ b/dev/tools/github_lines_perusers.sh @@ -12,5 +12,5 @@ fi echo "git log $1..$2 --shortstat | grep ... | perl ... > /tmp/github_lines_perusers.tmp" git log $1..$2 --shortstat | grep -e 'Author:' -e 'Date:' -e ' changed' -e ' insertion' -e ' deletion' | perl -n -e '/^(.*)$/; $line = $1; if ($line =~ /(changed|insertion|deletion)/) { $line =~ s/[^0-9\s]//g; my @arr=split /\s+/, $line; $tot=0; for (1..@arr) { $tot += $arr[$_]; }; print $tot."\n"; } else { print $line."\n"; };' > /tmp/github_lines_perusers.tmp -cat /tmp/github_lines_perusers.tmp | awk 'BEGIN { FS="\n"; print "user and nb of lines"; lastuser=""; } { if ($1 ~ /Author:/) { lastuser=$1 }; if ($1 ~ /^[0-9]+$/) { aaa[lastuser]=$1; } } END { for (var in aaa) print var," ",aaa[var]; } ' +cat /tmp/github_lines_perusers.tmp | awk 'BEGIN { FS="\n"; print "user and nb of lines"; lastuser=""; } { if ($1 ~ /Author:/) { lastuser=$1 }; if ($1 ~ /^[0-9]+$/) { aaa[lastuser]+=$1; } } END { for (var in aaa) print var," ",aaa[var]; } ' From 0e6359160490eae11ba40be5a4ac1c1f3d081ffa Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 18 Oct 2022 10:45:48 +0200 Subject: [PATCH 026/176] FIX avoid warning (php8) missing hook parameters --- .../comm/action/class/cactioncomm.class.php | 2 +- htdocs/comm/propal/contact.php | 6 +++--- htdocs/comm/propal/document.php | 2 +- htdocs/comm/propal/index.php | 2 +- htdocs/comm/propal/list.php | 18 ++++++++--------- htdocs/comm/propal/note.php | 2 +- htdocs/comm/propal/stats/index.php | 2 +- .../comm/propal/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/comm/prospect/index.php | 4 ++-- htdocs/commande/list.php | 20 +++++++++---------- htdocs/compta/bank/list.php | 14 ++++++------- htdocs/compta/facture/list.php | 17 ++++++++-------- htdocs/contrat/list.php | 16 +++++++-------- htdocs/core/boxes/box_activity.php | 2 +- .../boxes/box_graph_product_distribution.php | 8 ++++---- .../boxes/box_graph_propales_permonth.php | 4 ++-- htdocs/core/boxes/box_propales.php | 2 +- htdocs/core/lib/files.lib.php | 6 +++--- htdocs/core/lib/product.lib.php | 2 +- htdocs/core/menus/init_menu_auguria.sql | 18 ++++++++--------- .../doc/doc_generic_project_odt.modules.php | 2 +- .../project/doc/pdf_beluga.modules.php | 2 +- htdocs/core/tpl/contacts.tpl.php | 2 +- htdocs/core/tpl/notes.tpl.php | 2 +- htdocs/fourn/facture/list.php | 20 +++++++++---------- htdocs/hrm/core/tpl/skilldet.fiche.tpl.php | 2 +- htdocs/product/card.php | 2 +- htdocs/product/stats/card.php | 2 +- htdocs/product/stats/propal.php | 2 +- htdocs/product/stats/supplier_proposal.php | 2 +- htdocs/projet/element.php | 2 +- 31 files changed, 94 insertions(+), 95 deletions(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 049b70737e8..0942e1554a8 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -204,7 +204,7 @@ class CActionComm if ($obj->module == 'order' && isModEnabled('commande') && empty($user->rights->commande->lire)) { $qualified = 1; } - if ($obj->module == 'propal' && isModEnabled("propal") && !empty($user->rights->propal->lire)) { + if ($obj->module == 'propal' && isModEnabled("propal") && !empty($user->rights->propale->lire)) { $qualified = 1; } if ($obj->module == 'invoice_supplier' && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && !empty($user->rights->fournisseur->facture->lire)) || (isModEnabled('supplier_invoice') && !empty($user->rights->supplier_invoice->lire)))) { diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 051ee9de42c..97fceb99f9e 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -74,7 +74,7 @@ restrictedArea($user, 'propal', $object->id); * Add a new contact */ -if ($action == 'addcontact' && $user->rights->propal->creer) { +if ($action == 'addcontact' && $user->rights->propale->creer) { if ($object->id > 0) { $contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); @@ -92,12 +92,12 @@ if ($action == 'addcontact' && $user->rights->propal->creer) { setEventMessages($object->error, $object->errors, 'errors'); } } -} elseif ($action == 'swapstatut' && $user->rights->propal->creer) { +} elseif ($action == 'swapstatut' && $user->rights->propale->creer) { // Toggle the status of a contact if ($object->id > 0) { $result = $object->swapContactStatus(GETPOST('ligne', 'int')); } -} elseif ($action == 'deletecontact' && $user->rights->propal->creer) { +} elseif ($action == 'deletecontact' && $user->rights->propale->creer) { // Deletes a contact $result = $object->delete_contact($lineid); diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 1bd6cc71d50..f58ed518517 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -81,7 +81,7 @@ if (!$sortfield) { $object = new Propal($db); $object->fetch($id, $ref); -$permissiontoadd = $user->rights->propal->creer; +$permissiontoadd = $user->rights->propale->creer; // Security check if (!empty($user->socid)) { diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 4a6d9ec63ed..edb8e48405e 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -227,7 +227,7 @@ if ($resql) { /* * Open (validated) proposals */ -if (isModEnabled("propal") && $user->rights->propal->lire) { +if (isModEnabled("propal") && $user->rights->propale->lire) { $sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, s.email, s.code_compta"; $sql .= ", p.rowid as propalid, p.entity, p.total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index bd573539df3..0d560d741ce 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -578,7 +578,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql = preg_replace('/, $/', '', $sql); $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; @@ -755,12 +755,12 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; // Add HAVING from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint; $sql .= $db->order($sortfield, $sortorder); @@ -987,7 +987,7 @@ if ($resql) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; // List of mass actions available @@ -1104,7 +1104,7 @@ if ($resql) { $moreforfilter .= '
'; } $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { $moreforfilter .= $hookmanager->resPrint; } else { @@ -1362,7 +1362,7 @@ if ($resql) { // Fields from hook $parameters = array('arrayfields'=>$arrayfields); - $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['p.datec']['checked'])) { @@ -1543,7 +1543,7 @@ if ($resql) { 'totalarray' => &$totalarray, ); - $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['p.datec']['checked'])) { print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); @@ -2140,7 +2140,7 @@ if ($resql) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['p.datec']['checked'])) { @@ -2232,7 +2232,7 @@ if ($resql) { $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); - $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print ''."\n"; diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index c3af3a9b73e..d2e453eac9e 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -64,7 +64,7 @@ restrictedArea($user, 'propal', $object->id, 'propal'); * Actions */ -$permissionnote = $user->rights->propal->creer; // Used by the include of actions_setnotes.inc.php +$permissionnote = $user->rights->propale->creer; // Used by the include of actions_setnotes.inc.php $reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 9e2e485c92a..af5247fb10f 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -60,7 +60,7 @@ $endyear = $year; // Load translation files required by the page $langs->loadLangs(array('orders', 'companies', 'other', 'suppliers', 'supplier_proposal')); -if ($mode == 'customer' && !$user->rights->propal->lire) { +if ($mode == 'customer' && !$user->rights->propale->lire) { accessforbidden(); } if ($mode == 'supplier' && !$user->rights->supplier_proposal->lire) { diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index 37c0f8d5e58..613f06a6feb 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -62,7 +62,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { print ''.$objectlink->ref_client.''; print ''.dol_print_date($objectlink->date, 'day').''; print ''; - if ($user->rights->propal->lire) { + if ($user->rights->propale->lire) { $total = $total + $objectlink->total_ht; echo price($objectlink->total_ht); } diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index 19bde7072ad..83c30743c77 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -119,7 +119,7 @@ if ($resql) { /* * Liste des propal brouillons */ -if (isModEnabled("propal") && $user->rights->propal->lire) { +if (isModEnabled("propal") && $user->rights->propale->lire) { $sql = "SELECT p.rowid, p.ref, p.price, s.nom as sname"; $sql .= " FROM ".MAIN_DB_PREFIX."propal as p"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; @@ -177,7 +177,7 @@ if (isModEnabled('agenda')) { /* * Dernieres propales ouvertes */ -if (isModEnabled("propal") && $user->rights->propal->lire) { +if (isModEnabled("propal") && $user->rights->propale->lire) { $sql = "SELECT s.nom as name, s.rowid as socid, s.client, s.canvas,"; $sql .= " p.rowid as propalid, p.total_ttc, p.ref, p.datep as dp, c.label as statut, c.id as statutid"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 213be0d2389..f01518651e6 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -823,7 +823,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s2.rowid = s.parent"; @@ -857,7 +857,7 @@ if ($search_user > 0) { // Add table from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= ' WHERE c.fk_soc = s.rowid'; @@ -1012,12 +1012,12 @@ if ($search_fk_input_reason > 0) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; // Add HAVING from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint; $sql .= $db->order($sortfield, $sortorder); @@ -1224,7 +1224,7 @@ if ($resql) { // Add $param from hooks $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; // List of mass actions available @@ -1393,7 +1393,7 @@ if ($resql) { $moreforfilter .= '
'; } $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { $moreforfilter .= $hookmanager->resPrint; } else { @@ -1621,7 +1621,7 @@ if ($resql) { // Fields from hook $parameters = array('arrayfields'=>$arrayfields); - $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -1826,7 +1826,7 @@ if ($resql) { 'sortorder' => $sortorder, 'totalarray' => &$totalarray, ); - $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['c.datec']['checked'])) { print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap '); @@ -2372,7 +2372,7 @@ if ($resql) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -2595,7 +2595,7 @@ if ($resql) { $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); - $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print ''."\n"; diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index c53117a6821..1f4fc60397e 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -190,7 +190,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."bank_account as b"; if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { @@ -242,7 +242,7 @@ if (!empty($searchCategoryBankList)) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= $db->order($sortfield, $sortorder); @@ -308,7 +308,7 @@ if ($optioncss != '') { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; // List of mass actions available @@ -366,7 +366,7 @@ if (isModEnabled('categorie') && $user->rights->categorie->lire) { // Bank accounts $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { $moreforfilter .= $hookmanager->resPrint; } else { @@ -438,7 +438,7 @@ 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 +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['b.datec']['checked'])) { @@ -502,7 +502,7 @@ if (!empty($arrayfields['toreconcile']['checked'])) { 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); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['b.datec']['checked'])) { print_liste_field_titre($arrayfields['b.datec']['label'], $_SERVER["PHP_SELF"], "b.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); @@ -684,7 +684,7 @@ foreach ($accounts as $key => $type) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp); // Note that $action and $objecttmpect may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp, $action); // Note that $action and $objecttmpect may have been modified by hook print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['b.datec']['checked'])) { diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 2618e688698..67b208d65ae 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -595,7 +595,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s2.rowid = s.parent"; @@ -859,7 +859,7 @@ if (!empty($searchCategoryCustomerList)) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; // We disable this. It create a bug when searching with sall and sorting on status. Also it create performance troubles. @@ -1147,7 +1147,7 @@ if ($resql) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; $arrayofmassactions = array( @@ -1265,7 +1265,7 @@ if ($resql) { $moreforfilter .= '
'; } $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { $moreforfilter .= $hookmanager->resPrint; } else { @@ -1552,7 +1552,7 @@ if ($resql) { // Fields from hook $parameters = array('arrayfields'=>$arrayfields); - $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['f.datec']['checked'])) { @@ -1737,7 +1737,7 @@ if ($resql) { 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); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['f.datec']['checked'])) { print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); @@ -1793,7 +1793,6 @@ if ($resql) { $total_margin = 0; $savnbfield = $totalarray['nbfield']; - $totalarray = array(); $totalarray['nbfield'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < $imaxinloop) { @@ -2436,7 +2435,7 @@ if ($resql) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['f.datec']['checked'])) { @@ -2549,7 +2548,7 @@ if ($resql) { $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 + $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print ''."\n"; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index e8267f85d58..c1b97e65e98 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -251,7 +251,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; @@ -329,7 +329,7 @@ if ($search_user > 0) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity,"; $sql .= ' s.rowid, s.nom, s.name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, s.status, s.logo,'; @@ -347,7 +347,7 @@ $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $obj $sql .= $hookmanager->resPrint; // Add HAVING from hooks $parameters = array('search_dfyear' => $search_dfyear, 'search_op2df'=>$search_op2df); -$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { if ($search_dfyear > 0 && $search_op2df) { if ($search_op2df == '<=') { @@ -582,7 +582,7 @@ if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->right } $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { $moreforfilter .= $hookmanager->resPrint; } else { @@ -674,7 +674,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['c.datec']['checked'])) { @@ -748,7 +748,7 @@ if (!empty($arrayfields['c.date_contrat']['checked'])) { 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); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['c.datec']['checked'])) { print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); @@ -943,7 +943,7 @@ while ($i < min($num, $limit)) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['c.datec']['checked'])) { @@ -1011,7 +1011,7 @@ if ($num == 0) { $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print ''; diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 56fa8172bcb..fb0a60b567f 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -102,7 +102,7 @@ class box_activity extends ModeleBoxes // list the summary of the propals - if (isModEnabled("propal") && $user->rights->propal->lire) { + if (isModEnabled("propal") && $user->rights->propale->lire) { include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $propalstatic = new Propal($this->db); diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 3ef8a3daddf..6b8177e5ed4 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -62,7 +62,7 @@ class box_graph_product_distribution extends ModeleBoxes $this->hidden = !( (isModEnabled('facture') && !empty($user->rights->facture->lire)) || (isModEnabled('commande') && !empty($user->rights->commande->lire)) - || (isModEnabled('propal') && !empty($user->rights->propal->lire)) + || (isModEnabled('propal') && !empty($user->rights->propale->lire)) ); } @@ -110,7 +110,7 @@ class box_graph_product_distribution extends ModeleBoxes if (!isModEnabled('facture') || empty($user->rights->facture->lire)) { $showinvoicenb = 0; } - if (isModEnabled('propal') || empty($user->rights->propal->lire)) { + if (isModEnabled('propal') || empty($user->rights->propale->lire)) { $showpropalnb = 0; } if (!isModEnabled('commande') || empty($user->rights->commande->lire)) { @@ -152,7 +152,7 @@ class box_graph_product_distribution extends ModeleBoxes $WIDTH = ($nbofgraph >= 2 || !empty($conf->dol_optimize_smallscreen)) ? '300' : '320'; $HEIGHT = '150'; // Height require to have 5+1 entries into legend visible. - if (isModEnabled("propal") && !empty($user->rights->propal->lire)) { + if (isModEnabled("propal") && !empty($user->rights->propale->lire)) { // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($showpropalnb) { $langs->load("propal"); @@ -365,7 +365,7 @@ class box_graph_product_distribution extends ModeleBoxes $stringtoshow .= ''; $stringtoshow .= ''; $stringtoshow .= ''; - if (isModEnabled("propal") || !empty($user->rights->propal->lire)) { + if (isModEnabled("propal") || !empty($user->rights->propale->lire)) { $stringtoshow .= ' '.$langs->trans("ForProposals"); $stringtoshow .= ' '; } diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index ff62473c969..13f3a29ec16 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -56,7 +56,7 @@ class box_graph_propales_permonth extends ModeleBoxes $this->db = $db; - $this->hidden = empty($user->rights->propal->lire); + $this->hidden = empty($user->rights->propale->lire); } /** @@ -105,7 +105,7 @@ class box_graph_propales_permonth extends ModeleBoxes $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user } - if ($user->rights->propal->lire) { + if ($user->rights->propale->lire) { $param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; $param_shownb = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb'; $param_showtot = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot'; diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index 1a3344eedfe..7114fdb5399 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -83,7 +83,7 @@ class box_propales extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."Propals", $max)); - if ($user->rights->propal->lire) { + if ($user->rights->propale->lire) { $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.logo, s.email, s.entity"; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index c3eede90efd..ce3f8961b32 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2539,7 +2539,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $original_file = $conf->facture->multidir_output[$entity].'/'.$original_file; } elseif ($modulepart == 'apercupropal' && !empty($conf->propal->multidir_output[$entity])) { // Wrapping pour les apercu propal - if ($fuser->rights->propal->{$lire}) { + if ($fuser->rights->propale->{$lire}) { $accessallowed = 1; } $original_file = $conf->propal->multidir_output[$entity].'/'.$original_file; @@ -2611,7 +2611,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $original_file = $conf->expensereport->dir_output.'/'.$original_file; } elseif ($modulepart == 'propalstats' && !empty($conf->propal->multidir_temp[$entity])) { // Wrapping pour les images des stats propales - if ($fuser->rights->propal->{$lire}) { + if ($fuser->rights->propale->{$lire}) { $accessallowed = 1; } $original_file = $conf->propal->multidir_temp[$entity].'/'.$original_file; @@ -2832,7 +2832,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, //$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } elseif (($modulepart == 'propal' || $modulepart == 'propale') && !empty($conf->propal->multidir_output[$entity])) { // Wrapping pour les propales - if ($fuser->rights->propal->{$lire} || preg_match('/^specimen/i', $original_file)) { + if ($fuser->rights->propale->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->propal->multidir_output[$entity].'/'.$original_file; diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 7795f927c19..a1bccc1dd28 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -411,7 +411,7 @@ function show_stats_for_company($product, $socid) print ''; // Customer proposals - if (isModEnabled("propal") && $user->rights->propal->lire) { + if (isModEnabled("propal") && $user->rights->propale->lire) { $nblines++; $ret = $product->load_stats_propale($socid); if ($ret < 0) { diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 10c50ca99ee..046d1da2f0e 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -157,15 +157,15 @@ 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->reception->enabled && $leftmenu=="receptions"', __HANDLER__, 'left', 1353__+MAX_llx_menu__, 'commercial', '', 1350__+MAX_llx_menu__, '/reception/stats/index.php?mainmenu=commercial&leftmenu=receptions', 'Statistics', 1, 'receptions', '$user->rights->reception->lire', '', 2, 2, __ENTITY__); -- Commercial - Proposals -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->propal->enabled', __HANDLER__, 'left', 1100__+MAX_llx_menu__, 'commercial', 'propals', 5__+MAX_llx_menu__, '/comm/propal/index.php?mainmenu=commercial&leftmenu=propals', 'Proposals', 0, 'propal', '$user->rights->propal->lire', '', 2, 4, __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->propal->enabled', __HANDLER__, 'left', 1101__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/card.php?mainmenu=commercial&action=create&leftmenu=propals', 'NewPropal', 1, 'propal', '$user->rights->propal->creer', '', 2, 0, __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->propal->enabled', __HANDLER__, 'left', 1102__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals', 'List', 1, 'propal', '$user->rights->propal->lire', '', 2, 1, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1103__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=0', 'PropalsDraft', 1, 'propal', '$user->rights->propal->lire', '', 2, 2, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1104__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=1', 'PropalsOpened', 1, 'propal', '$user->rights->propal->lire', '', 2, 3, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1105__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=2', 'PropalStatusSigned', 1, 'propal', '$user->rights->propal->lire', '', 2, 4, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1106__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=3', 'PropalStatusNotSigned', 1, 'propal', '$user->rights->propal->lire', '', 2, 5, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1107__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=4', 'PropalStatusBilled', 1, 'propal', '$user->rights->propal->lire', '', 2, 6, __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->propal->enabled', __HANDLER__, 'left', 1110__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/stats/index.php?mainmenu=commercial&leftmenu=propals', 'Statistics', 1, 'propal', '$user->rights->propal->lire', '', 2, 4, __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->propal->enabled', __HANDLER__, 'left', 1100__+MAX_llx_menu__, 'commercial', 'propals', 5__+MAX_llx_menu__, '/comm/propal/index.php?mainmenu=commercial&leftmenu=propals', 'Proposals', 0, 'propal', '$user->rights->propale->lire', '', 2, 4, __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->propal->enabled', __HANDLER__, 'left', 1101__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/card.php?mainmenu=commercial&action=create&leftmenu=propals', 'NewPropal', 1, 'propal', '$user->rights->propale->creer', '', 2, 0, __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->propal->enabled', __HANDLER__, 'left', 1102__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals', 'List', 1, 'propal', '$user->rights->propale->lire', '', 2, 1, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1103__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=0', 'PropalsDraft', 1, 'propal', '$user->rights->propale->lire', '', 2, 2, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1104__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=1', 'PropalsOpened', 1, 'propal', '$user->rights->propale->lire', '', 2, 3, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1105__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=2', 'PropalStatusSigned', 1, 'propal', '$user->rights->propale->lire', '', 2, 4, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1106__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=3', 'PropalStatusNotSigned', 1, 'propal', '$user->rights->propale->lire', '', 2, 5, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1107__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=4', 'PropalStatusBilled', 1, 'propal', '$user->rights->propale->lire', '', 2, 6, __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->propal->enabled', __HANDLER__, 'left', 1110__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/stats/index.php?mainmenu=commercial&leftmenu=propals', 'Statistics', 1, 'propal', '$user->rights->propale->lire', '', 2, 4, __ENTITY__); -- Commercial - Customer's orders 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->commande->enabled', __HANDLER__, 'left', 1200__+MAX_llx_menu__, 'commercial', 'orders', 5__+MAX_llx_menu__, '/commande/index.php?mainmenu=commercial&leftmenu=orders', 'CustomersOrders', 0, 'orders', '$user->rights->commande->lire', '', 2, 5, __ENTITY__); diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 8b1261f35f0..ee4e17ae19e 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -943,7 +943,7 @@ class doc_generic_project_odt extends ModelePDFProjects 'title' => "ListProposalsAssociatedProject", 'class' => 'Propal', 'table' => 'propal', - 'test' => $conf->propal->enabled && $user->rights->propal->lire + 'test' => $conf->propal->enabled && $user->rights->propale->lire ), 'order' => array( 'title' => "ListOrdersAssociatedProject", diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 9947bb49b0b..c60f2c4bb66 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -374,7 +374,7 @@ class pdf_beluga extends ModelePDFProjects 'class'=>'Propal', 'table'=>'propal', 'datefieldname'=>'datep', - 'test'=>$conf->propal->enabled && $user->rights->propal->lire, + 'test'=>$conf->propal->enabled && $user->rights->propale->lire, 'lang'=>'propal'), 'order'=>array( 'name'=>"CustomersOrders", diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 9d9bd226fd6..5f463e44846 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -41,7 +41,7 @@ $module = $object->element; // Special cases if ($module == 'propal') { - $permission = $user->rights->propal->creer; + $permission = $user->rights->propale->creer; } elseif ($module == 'fichinter') { $permission = $user->rights->ficheinter->creer; } elseif ($module == 'order_supplier') { diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index 9a9c5866023..dfa9b0e4591 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -60,7 +60,7 @@ if (!empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES)) { // Special cases if ($module == 'propal') { - $permission = $user->rights->propal->creer; + $permission = $user->rights->propale->creer; } elseif ($module == 'supplier_proposal') { $permission = $user->rights->supplier_proposal->creer; } elseif ($module == 'fichinter') { diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 10df6a29137..1d7149cdb10 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -433,7 +433,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; @@ -656,7 +656,7 @@ if ($search_user > 0) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; if (!$search_all) { @@ -680,7 +680,7 @@ if (!$search_all) { } // Add GroupBy from hooks $parameters = array('all' => $search_all, 'fieldstosearchall' => $fieldstosearchall); - $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; } else { $sql .= natural_search(array_keys($fieldstosearchall), $search_all); @@ -688,7 +688,7 @@ if (!$search_all) { // Add HAVING from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint; $sql .= $db->order($sortfield, $sortorder); @@ -860,7 +860,7 @@ if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; // List of mass actions available @@ -950,7 +950,7 @@ if (isModEnabled('categorie')) { $moreforfilter .= '
'; } $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { $moreforfilter .= $hookmanager->resPrint; } else { @@ -1174,7 +1174,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['f.datec']['checked'])) { @@ -1302,7 +1302,7 @@ if (!empty($arrayfields['multicurrency_rtp']['checked'])) { 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); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['f.datec']['checked'])) { print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); @@ -1725,7 +1725,7 @@ if ($num > 0) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -1793,7 +1793,7 @@ if ($num == 0) { $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print "\n"; diff --git a/htdocs/hrm/core/tpl/skilldet.fiche.tpl.php b/htdocs/hrm/core/tpl/skilldet.fiche.tpl.php index 81e3f9f2155..60bb56ff173 100644 --- a/htdocs/hrm/core/tpl/skilldet.fiche.tpl.php +++ b/htdocs/hrm/core/tpl/skilldet.fiche.tpl.php @@ -43,7 +43,7 @@ $value_private .= "\n"; /* // Special cases if ($module == 'propal') { -$permission = $user->rights->propal->creer; +$permission = $user->rights->propale->creer; } elseif ($module == 'supplier_proposal') { $permission = $user->rights->supplier_proposal->creer; } elseif ($module == 'fichinter') { diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 8eac47207cd..2071171feba 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2831,7 +2831,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == //print '
'; // Propals - if (isModEnabled("propal") && $user->rights->propal->creer) { + if (isModEnabled("propal") && $user->rights->propale->creer) { $propal = new Propal($db); $langs->load("propal"); diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index b0d06f15701..a2bcceab0e5 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -440,7 +440,7 @@ if ($result || !($id > 0)) { continue; } - if ($graphfiles == 'propal' && !$user->rights->propal->lire) { + if ($graphfiles == 'propal' && !$user->rights->propale->lire) { continue; } if ($graphfiles == 'order' && !$user->rights->commande->lire) { diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index b70d2e08161..4919ffdba84 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -138,7 +138,7 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_end(); - if ($user->rights->propal->lire) { + if ($user->rights->propale->lire) { $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, p.rowid as propalid, p.ref, d.total_ht as amount,"; $sql .= " p.ref_client,"; $sql .= "p.datep, p.fk_statut as statut, d.rowid, d.qty"; diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php index 50b17b0ac06..538fc6aa362 100644 --- a/htdocs/product/stats/supplier_proposal.php +++ b/htdocs/product/stats/supplier_proposal.php @@ -137,7 +137,7 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_end(); - if ($user->rights->propal->lire) { + if ($user->rights->propale->lire) { $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, p.rowid as propalid, p.ref, d.total_ht as amount,"; //$sql .= " p.ref_supplier,"; $sql .= "p.date_valid, p.fk_statut as statut, d.rowid, d.qty"; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 346382c6294..01ffe38cc0d 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -388,7 +388,7 @@ $listofreferent = array( 'lang'=>'propal', 'buttonnew'=>'AddProp', 'testnew'=>$user->rights->propal->creer, - 'test'=>$conf->propal->enabled && $user->rights->propal->lire), + 'test'=>$conf->propal->enabled && $user->rights->propale->lire), 'order'=>array( 'name'=>"CustomersOrders", 'title'=>"ListOrdersAssociatedProject", From 8856c5c3d69bf57742210e95b789d9e5b58e2e1c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 18 Oct 2022 10:52:14 +0200 Subject: [PATCH 027/176] FIX merge error --- htdocs/comm/action/class/cactioncomm.class.php | 2 +- htdocs/comm/propal/contact.php | 6 +++--- htdocs/comm/propal/document.php | 2 +- htdocs/comm/propal/index.php | 2 +- htdocs/comm/propal/note.php | 2 +- htdocs/comm/propal/stats/index.php | 2 +- .../comm/propal/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/comm/prospect/index.php | 4 ++-- htdocs/core/boxes/box_activity.php | 2 +- .../boxes/box_graph_product_distribution.php | 8 ++++---- .../core/boxes/box_graph_propales_permonth.php | 4 ++-- htdocs/core/boxes/box_propales.php | 2 +- htdocs/core/lib/files.lib.php | 6 +++--- htdocs/core/lib/product.lib.php | 2 +- htdocs/core/menus/init_menu_auguria.sql | 18 +++++++++--------- .../doc/doc_generic_project_odt.modules.php | 2 +- .../modules/project/doc/pdf_beluga.modules.php | 2 +- htdocs/core/tpl/contacts.tpl.php | 2 +- htdocs/core/tpl/notes.tpl.php | 2 +- htdocs/hrm/core/tpl/skilldet.fiche.tpl.php | 2 +- htdocs/product/card.php | 2 +- htdocs/product/stats/card.php | 2 +- htdocs/product/stats/propal.php | 2 +- htdocs/product/stats/supplier_proposal.php | 2 +- htdocs/projet/element.php | 2 +- 25 files changed, 42 insertions(+), 42 deletions(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 0942e1554a8..049b70737e8 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -204,7 +204,7 @@ class CActionComm if ($obj->module == 'order' && isModEnabled('commande') && empty($user->rights->commande->lire)) { $qualified = 1; } - if ($obj->module == 'propal' && isModEnabled("propal") && !empty($user->rights->propale->lire)) { + if ($obj->module == 'propal' && isModEnabled("propal") && !empty($user->rights->propal->lire)) { $qualified = 1; } if ($obj->module == 'invoice_supplier' && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && !empty($user->rights->fournisseur->facture->lire)) || (isModEnabled('supplier_invoice') && !empty($user->rights->supplier_invoice->lire)))) { diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 97fceb99f9e..051ee9de42c 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -74,7 +74,7 @@ restrictedArea($user, 'propal', $object->id); * Add a new contact */ -if ($action == 'addcontact' && $user->rights->propale->creer) { +if ($action == 'addcontact' && $user->rights->propal->creer) { if ($object->id > 0) { $contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); @@ -92,12 +92,12 @@ if ($action == 'addcontact' && $user->rights->propale->creer) { setEventMessages($object->error, $object->errors, 'errors'); } } -} elseif ($action == 'swapstatut' && $user->rights->propale->creer) { +} elseif ($action == 'swapstatut' && $user->rights->propal->creer) { // Toggle the status of a contact if ($object->id > 0) { $result = $object->swapContactStatus(GETPOST('ligne', 'int')); } -} elseif ($action == 'deletecontact' && $user->rights->propale->creer) { +} elseif ($action == 'deletecontact' && $user->rights->propal->creer) { // Deletes a contact $result = $object->delete_contact($lineid); diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index f58ed518517..1bd6cc71d50 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -81,7 +81,7 @@ if (!$sortfield) { $object = new Propal($db); $object->fetch($id, $ref); -$permissiontoadd = $user->rights->propale->creer; +$permissiontoadd = $user->rights->propal->creer; // Security check if (!empty($user->socid)) { diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index edb8e48405e..4a6d9ec63ed 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -227,7 +227,7 @@ if ($resql) { /* * Open (validated) proposals */ -if (isModEnabled("propal") && $user->rights->propale->lire) { +if (isModEnabled("propal") && $user->rights->propal->lire) { $sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, s.email, s.code_compta"; $sql .= ", p.rowid as propalid, p.entity, p.total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index d2e453eac9e..c3af3a9b73e 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -64,7 +64,7 @@ restrictedArea($user, 'propal', $object->id, 'propal'); * Actions */ -$permissionnote = $user->rights->propale->creer; // Used by the include of actions_setnotes.inc.php +$permissionnote = $user->rights->propal->creer; // Used by the include of actions_setnotes.inc.php $reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index af5247fb10f..9e2e485c92a 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -60,7 +60,7 @@ $endyear = $year; // Load translation files required by the page $langs->loadLangs(array('orders', 'companies', 'other', 'suppliers', 'supplier_proposal')); -if ($mode == 'customer' && !$user->rights->propale->lire) { +if ($mode == 'customer' && !$user->rights->propal->lire) { accessforbidden(); } if ($mode == 'supplier' && !$user->rights->supplier_proposal->lire) { diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index 613f06a6feb..37c0f8d5e58 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -62,7 +62,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { print ''.$objectlink->ref_client.''; print ''.dol_print_date($objectlink->date, 'day').''; print ''; - if ($user->rights->propale->lire) { + if ($user->rights->propal->lire) { $total = $total + $objectlink->total_ht; echo price($objectlink->total_ht); } diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index 83c30743c77..19bde7072ad 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -119,7 +119,7 @@ if ($resql) { /* * Liste des propal brouillons */ -if (isModEnabled("propal") && $user->rights->propale->lire) { +if (isModEnabled("propal") && $user->rights->propal->lire) { $sql = "SELECT p.rowid, p.ref, p.price, s.nom as sname"; $sql .= " FROM ".MAIN_DB_PREFIX."propal as p"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; @@ -177,7 +177,7 @@ if (isModEnabled('agenda')) { /* * Dernieres propales ouvertes */ -if (isModEnabled("propal") && $user->rights->propale->lire) { +if (isModEnabled("propal") && $user->rights->propal->lire) { $sql = "SELECT s.nom as name, s.rowid as socid, s.client, s.canvas,"; $sql .= " p.rowid as propalid, p.total_ttc, p.ref, p.datep as dp, c.label as statut, c.id as statutid"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index fb0a60b567f..56fa8172bcb 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -102,7 +102,7 @@ class box_activity extends ModeleBoxes // list the summary of the propals - if (isModEnabled("propal") && $user->rights->propale->lire) { + if (isModEnabled("propal") && $user->rights->propal->lire) { include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $propalstatic = new Propal($this->db); diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 6b8177e5ed4..3ef8a3daddf 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -62,7 +62,7 @@ class box_graph_product_distribution extends ModeleBoxes $this->hidden = !( (isModEnabled('facture') && !empty($user->rights->facture->lire)) || (isModEnabled('commande') && !empty($user->rights->commande->lire)) - || (isModEnabled('propal') && !empty($user->rights->propale->lire)) + || (isModEnabled('propal') && !empty($user->rights->propal->lire)) ); } @@ -110,7 +110,7 @@ class box_graph_product_distribution extends ModeleBoxes if (!isModEnabled('facture') || empty($user->rights->facture->lire)) { $showinvoicenb = 0; } - if (isModEnabled('propal') || empty($user->rights->propale->lire)) { + if (isModEnabled('propal') || empty($user->rights->propal->lire)) { $showpropalnb = 0; } if (!isModEnabled('commande') || empty($user->rights->commande->lire)) { @@ -152,7 +152,7 @@ class box_graph_product_distribution extends ModeleBoxes $WIDTH = ($nbofgraph >= 2 || !empty($conf->dol_optimize_smallscreen)) ? '300' : '320'; $HEIGHT = '150'; // Height require to have 5+1 entries into legend visible. - if (isModEnabled("propal") && !empty($user->rights->propale->lire)) { + if (isModEnabled("propal") && !empty($user->rights->propal->lire)) { // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($showpropalnb) { $langs->load("propal"); @@ -365,7 +365,7 @@ class box_graph_product_distribution extends ModeleBoxes $stringtoshow .= ''; $stringtoshow .= ''; $stringtoshow .= ''; - if (isModEnabled("propal") || !empty($user->rights->propale->lire)) { + if (isModEnabled("propal") || !empty($user->rights->propal->lire)) { $stringtoshow .= ' '.$langs->trans("ForProposals"); $stringtoshow .= ' '; } diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 13f3a29ec16..ff62473c969 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -56,7 +56,7 @@ class box_graph_propales_permonth extends ModeleBoxes $this->db = $db; - $this->hidden = empty($user->rights->propale->lire); + $this->hidden = empty($user->rights->propal->lire); } /** @@ -105,7 +105,7 @@ class box_graph_propales_permonth extends ModeleBoxes $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user } - if ($user->rights->propale->lire) { + if ($user->rights->propal->lire) { $param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; $param_shownb = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb'; $param_showtot = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot'; diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index 7114fdb5399..1a3344eedfe 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -83,7 +83,7 @@ class box_propales extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."Propals", $max)); - if ($user->rights->propale->lire) { + if ($user->rights->propal->lire) { $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.logo, s.email, s.entity"; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index ce3f8961b32..c3eede90efd 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2539,7 +2539,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $original_file = $conf->facture->multidir_output[$entity].'/'.$original_file; } elseif ($modulepart == 'apercupropal' && !empty($conf->propal->multidir_output[$entity])) { // Wrapping pour les apercu propal - if ($fuser->rights->propale->{$lire}) { + if ($fuser->rights->propal->{$lire}) { $accessallowed = 1; } $original_file = $conf->propal->multidir_output[$entity].'/'.$original_file; @@ -2611,7 +2611,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $original_file = $conf->expensereport->dir_output.'/'.$original_file; } elseif ($modulepart == 'propalstats' && !empty($conf->propal->multidir_temp[$entity])) { // Wrapping pour les images des stats propales - if ($fuser->rights->propale->{$lire}) { + if ($fuser->rights->propal->{$lire}) { $accessallowed = 1; } $original_file = $conf->propal->multidir_temp[$entity].'/'.$original_file; @@ -2832,7 +2832,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, //$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } elseif (($modulepart == 'propal' || $modulepart == 'propale') && !empty($conf->propal->multidir_output[$entity])) { // Wrapping pour les propales - if ($fuser->rights->propale->{$lire} || preg_match('/^specimen/i', $original_file)) { + if ($fuser->rights->propal->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->propal->multidir_output[$entity].'/'.$original_file; diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index a1bccc1dd28..7795f927c19 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -411,7 +411,7 @@ function show_stats_for_company($product, $socid) print ''; // Customer proposals - if (isModEnabled("propal") && $user->rights->propale->lire) { + if (isModEnabled("propal") && $user->rights->propal->lire) { $nblines++; $ret = $product->load_stats_propale($socid); if ($ret < 0) { diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 046d1da2f0e..10c50ca99ee 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -157,15 +157,15 @@ 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->reception->enabled && $leftmenu=="receptions"', __HANDLER__, 'left', 1353__+MAX_llx_menu__, 'commercial', '', 1350__+MAX_llx_menu__, '/reception/stats/index.php?mainmenu=commercial&leftmenu=receptions', 'Statistics', 1, 'receptions', '$user->rights->reception->lire', '', 2, 2, __ENTITY__); -- Commercial - Proposals -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->propal->enabled', __HANDLER__, 'left', 1100__+MAX_llx_menu__, 'commercial', 'propals', 5__+MAX_llx_menu__, '/comm/propal/index.php?mainmenu=commercial&leftmenu=propals', 'Proposals', 0, 'propal', '$user->rights->propale->lire', '', 2, 4, __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->propal->enabled', __HANDLER__, 'left', 1101__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/card.php?mainmenu=commercial&action=create&leftmenu=propals', 'NewPropal', 1, 'propal', '$user->rights->propale->creer', '', 2, 0, __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->propal->enabled', __HANDLER__, 'left', 1102__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals', 'List', 1, 'propal', '$user->rights->propale->lire', '', 2, 1, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1103__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=0', 'PropalsDraft', 1, 'propal', '$user->rights->propale->lire', '', 2, 2, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1104__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=1', 'PropalsOpened', 1, 'propal', '$user->rights->propale->lire', '', 2, 3, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1105__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=2', 'PropalStatusSigned', 1, 'propal', '$user->rights->propale->lire', '', 2, 4, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1106__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=3', 'PropalStatusNotSigned', 1, 'propal', '$user->rights->propale->lire', '', 2, 5, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1107__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=4', 'PropalStatusBilled', 1, 'propal', '$user->rights->propale->lire', '', 2, 6, __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->propal->enabled', __HANDLER__, 'left', 1110__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/stats/index.php?mainmenu=commercial&leftmenu=propals', 'Statistics', 1, 'propal', '$user->rights->propale->lire', '', 2, 4, __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->propal->enabled', __HANDLER__, 'left', 1100__+MAX_llx_menu__, 'commercial', 'propals', 5__+MAX_llx_menu__, '/comm/propal/index.php?mainmenu=commercial&leftmenu=propals', 'Proposals', 0, 'propal', '$user->rights->propal->lire', '', 2, 4, __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->propal->enabled', __HANDLER__, 'left', 1101__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/card.php?mainmenu=commercial&action=create&leftmenu=propals', 'NewPropal', 1, 'propal', '$user->rights->propal->creer', '', 2, 0, __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->propal->enabled', __HANDLER__, 'left', 1102__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals', 'List', 1, 'propal', '$user->rights->propal->lire', '', 2, 1, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1103__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=0', 'PropalsDraft', 1, 'propal', '$user->rights->propal->lire', '', 2, 2, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1104__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=1', 'PropalsOpened', 1, 'propal', '$user->rights->propal->lire', '', 2, 3, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1105__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=2', 'PropalStatusSigned', 1, 'propal', '$user->rights->propal->lire', '', 2, 4, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1106__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=3', 'PropalStatusNotSigned', 1, 'propal', '$user->rights->propal->lire', '', 2, 5, __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->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1107__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=4', 'PropalStatusBilled', 1, 'propal', '$user->rights->propal->lire', '', 2, 6, __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->propal->enabled', __HANDLER__, 'left', 1110__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/stats/index.php?mainmenu=commercial&leftmenu=propals', 'Statistics', 1, 'propal', '$user->rights->propal->lire', '', 2, 4, __ENTITY__); -- Commercial - Customer's orders 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->commande->enabled', __HANDLER__, 'left', 1200__+MAX_llx_menu__, 'commercial', 'orders', 5__+MAX_llx_menu__, '/commande/index.php?mainmenu=commercial&leftmenu=orders', 'CustomersOrders', 0, 'orders', '$user->rights->commande->lire', '', 2, 5, __ENTITY__); diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index ee4e17ae19e..8b1261f35f0 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -943,7 +943,7 @@ class doc_generic_project_odt extends ModelePDFProjects 'title' => "ListProposalsAssociatedProject", 'class' => 'Propal', 'table' => 'propal', - 'test' => $conf->propal->enabled && $user->rights->propale->lire + 'test' => $conf->propal->enabled && $user->rights->propal->lire ), 'order' => array( 'title' => "ListOrdersAssociatedProject", diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index c60f2c4bb66..9947bb49b0b 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -374,7 +374,7 @@ class pdf_beluga extends ModelePDFProjects 'class'=>'Propal', 'table'=>'propal', 'datefieldname'=>'datep', - 'test'=>$conf->propal->enabled && $user->rights->propale->lire, + 'test'=>$conf->propal->enabled && $user->rights->propal->lire, 'lang'=>'propal'), 'order'=>array( 'name'=>"CustomersOrders", diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 5f463e44846..9d9bd226fd6 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -41,7 +41,7 @@ $module = $object->element; // Special cases if ($module == 'propal') { - $permission = $user->rights->propale->creer; + $permission = $user->rights->propal->creer; } elseif ($module == 'fichinter') { $permission = $user->rights->ficheinter->creer; } elseif ($module == 'order_supplier') { diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index dfa9b0e4591..9a9c5866023 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -60,7 +60,7 @@ if (!empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES)) { // Special cases if ($module == 'propal') { - $permission = $user->rights->propale->creer; + $permission = $user->rights->propal->creer; } elseif ($module == 'supplier_proposal') { $permission = $user->rights->supplier_proposal->creer; } elseif ($module == 'fichinter') { diff --git a/htdocs/hrm/core/tpl/skilldet.fiche.tpl.php b/htdocs/hrm/core/tpl/skilldet.fiche.tpl.php index 60bb56ff173..81e3f9f2155 100644 --- a/htdocs/hrm/core/tpl/skilldet.fiche.tpl.php +++ b/htdocs/hrm/core/tpl/skilldet.fiche.tpl.php @@ -43,7 +43,7 @@ $value_private .= "\n"; /* // Special cases if ($module == 'propal') { -$permission = $user->rights->propale->creer; +$permission = $user->rights->propal->creer; } elseif ($module == 'supplier_proposal') { $permission = $user->rights->supplier_proposal->creer; } elseif ($module == 'fichinter') { diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 2071171feba..8eac47207cd 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2831,7 +2831,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == //print '
'; // Propals - if (isModEnabled("propal") && $user->rights->propale->creer) { + if (isModEnabled("propal") && $user->rights->propal->creer) { $propal = new Propal($db); $langs->load("propal"); diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index a2bcceab0e5..b0d06f15701 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -440,7 +440,7 @@ if ($result || !($id > 0)) { continue; } - if ($graphfiles == 'propal' && !$user->rights->propale->lire) { + if ($graphfiles == 'propal' && !$user->rights->propal->lire) { continue; } if ($graphfiles == 'order' && !$user->rights->commande->lire) { diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index 4919ffdba84..b70d2e08161 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -138,7 +138,7 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_end(); - if ($user->rights->propale->lire) { + if ($user->rights->propal->lire) { $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, p.rowid as propalid, p.ref, d.total_ht as amount,"; $sql .= " p.ref_client,"; $sql .= "p.datep, p.fk_statut as statut, d.rowid, d.qty"; diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php index 538fc6aa362..50b17b0ac06 100644 --- a/htdocs/product/stats/supplier_proposal.php +++ b/htdocs/product/stats/supplier_proposal.php @@ -137,7 +137,7 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_end(); - if ($user->rights->propale->lire) { + if ($user->rights->propal->lire) { $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, p.rowid as propalid, p.ref, d.total_ht as amount,"; //$sql .= " p.ref_supplier,"; $sql .= "p.date_valid, p.fk_statut as statut, d.rowid, d.qty"; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 01ffe38cc0d..346382c6294 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -388,7 +388,7 @@ $listofreferent = array( 'lang'=>'propal', 'buttonnew'=>'AddProp', 'testnew'=>$user->rights->propal->creer, - 'test'=>$conf->propal->enabled && $user->rights->propale->lire), + 'test'=>$conf->propal->enabled && $user->rights->propal->lire), 'order'=>array( 'name'=>"CustomersOrders", 'title'=>"ListOrdersAssociatedProject", From 938bc2791725128ca8935faf2ef5c632bbf93920 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 12:59:15 +0200 Subject: [PATCH 028/176] Update sample for fail2ban --- dev/setup/fail2ban/filter.d/web-dolibarr-limitpublic.conf | 7 +++---- .../fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf | 7 +++---- .../fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf | 7 +++---- htdocs/admin/system/security.php | 7 ++++--- htdocs/langs/en_US/admin.lang | 4 +++- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dev/setup/fail2ban/filter.d/web-dolibarr-limitpublic.conf b/dev/setup/fail2ban/filter.d/web-dolibarr-limitpublic.conf index 45b4a9b8084..2eedad18821 100644 --- a/dev/setup/fail2ban/filter.d/web-dolibarr-limitpublic.conf +++ b/dev/setup/fail2ban/filter.d/web-dolibarr-limitpublic.conf @@ -1,8 +1,7 @@ # Fail2Ban configuration file # -# Regexp to catch known spambots and software alike. Please verify -# that it is your intent to block IPs which were driven by -# above mentioned bots. +# Regexp to detect access on public pages so we can add mitigation on IP making too much +# access to your a Dolibarr instance. [Definition] @@ -11,7 +10,7 @@ # echo `date +'%Y-%m-%d %H:%M:%S'`" INFO 1.2.3.4 --- Access to GET /public/clicktodial/cidlookup.php" >> /mypath/documents/dolibarr.log # # then -# fail2ban-client status web-dol-passforgotten +# fail2ban-client status web-dolibarr-limitpublic # # To test rule file on a existing log file # fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-limitpublic.conf diff --git a/dev/setup/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf b/dev/setup/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf index d5922909ba9..1e126c17693 100644 --- a/dev/setup/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf +++ b/dev/setup/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf @@ -1,8 +1,7 @@ # Fail2Ban configuration file # -# Regexp to catch known spambots and software alike. Please verify -# that it is your intent to block IPs which were driven by -# above mentioned bots. +# Regexp to detect try to check a couple login/password so we can add mitigation +# on IP making too much tries. [Definition] @@ -11,7 +10,7 @@ # echo `date +'%Y-%m-%d %H:%M:%S'`" INFO 1.2.3.4 functions_dolibarr::check_user_password_abcd Authentication KO" >> /mypath/documents/dolibarr.log # # then -# fail2ban-client status web-dol-bruteforce +# fail2ban-client status web-dolibarr-rulesbruteforce # # To test rule file on a existing log file # fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf diff --git a/dev/setup/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf b/dev/setup/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf index edc2ca68092..8cc20dd4be4 100644 --- a/dev/setup/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf +++ b/dev/setup/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf @@ -1,8 +1,7 @@ # Fail2Ban configuration file # -# Regexp to catch known spambots and software alike. Please verify -# that it is your intent to block IPs which were driven by -# above mentioned bots. +# Regexp to detect access on passwordforgotten.php page so we can add mitigation on IP making too much +# access to this Dolibarr page. [Definition] @@ -11,7 +10,7 @@ # echo `date +'%Y-%m-%d %H:%M:%S'`" INFO 1.2.3.4 --- Access to GET /passwordforgotten.php - action=buildnewpassword, massaction=" >> /mypath/documents/dolibarr.log # # then -# fail2ban-client status web-dol-passforgotten +# fail2ban-client status web-dolibarr-rulespassforgotten # # To test rule file on a existing log file # fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index b0ea7571a2d..1ea81cd5dd3 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -570,9 +570,10 @@ print 'For a higher security, we also recommend to implement limits and mitigati print ''; print '
'; -print 'Login process -> This can be done using a fail2ban rule (see example into dev/setup)'."
"; -print DOL_URL_ROOT.'/passwordforgotten.php (see example into dev/setup)'."
"; -print DOL_URL_ROOT.'/public/* (see example into dev/setup)'."
"; +$urlexamplebase = 'https://github.com/Dolibarr/dolibarr/blob/develop/dev/setup/fail2ban/filter.d/'; +print '- Login process (see fail2ban example on GitHub)
'; +print '- '.DOL_URL_ROOT.'/passwordforgotten.php (see fail2ban example on GitHub)
'; +print '- '.DOL_URL_ROOT.'/public/* (see fail2ban example on GitHub)
'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b26761b3a49..ba92fc4f8a1 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2329,4 +2329,6 @@ HelpCssOnViewDesc=The Css used when viewing the field. HelpCssOnListDesc=The Css used when field is inside a list table.
Example: "tdoverflowmax200" RECEPTION_PDF_HIDE_ORDERED=Hide the quantity ordered on the generated documents for receptions MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT=Show the price on the generated documents for receptions -WarningDisabled=Warning disabled \ No newline at end of file +WarningDisabled=Warning disabled +LimitsAndMitigation=Access limits and mitigation + \ No newline at end of file From 46b5f80db9ba3c8f7582b87d460cec67538e16a4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 13:30:51 +0200 Subject: [PATCH 029/176] Clean code --- htdocs/core/class/commonobject.class.php | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 85fc7569505..a198d74f808 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3757,25 +3757,7 @@ abstract class CommonObject $fieldlocaltax2 = 'localtax2'; $fieldttc = 'total_ttc'; // Specific code for backward compatibility with old field names - if ($this->element == 'facture' || $this->element == 'facturerec') { - $fieldtva = 'total_tva'; - } - if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier' || $this->element == 'invoice_supplier_rec') { - $fieldtva = 'total_tva'; - } - if ($this->element == 'propal') { - $fieldtva = 'total_tva'; - } - if ($this->element == 'expensereport') { - $fieldtva = 'total_tva'; - } - if ($this->element == 'supplier_proposal') { - $fieldtva = 'total_tva'; - } - if ($this->element == 'commande') { - $fieldtva = 'total_tva'; - } - if ($this->element == 'order_supplier') { + if (in_array($this->element, array('propal', 'commande', 'facture', 'facturerec', 'supplier_proposal', 'order_supplier', 'facture_fourn', 'invoice_supplier', 'invoice_supplier_rec', 'expensereport'))) { $fieldtva = 'total_tva'; } From da3ae71a47b94806a783efa96e6a2fc782e93c22 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 13:32:18 +0200 Subject: [PATCH 030/176] Try to fix rounding error --- htdocs/core/class/commonobject.class.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b2d5ac8e068..ee4a56eaa9c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3177,12 +3177,17 @@ abstract class CommonObject } $sqlfix = "UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldtva." = ".($obj->total_tva - $diff).", total_ttc = ".($obj->total_ttc - $diff)." WHERE rowid = ".$obj->rowid; dol_syslog('We found a difference of '.$diff.' for line rowid = '.$obj->rowid.". We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix); - $resqlfix = $this->db->query($sqlfix); - if (!$resqlfix) dol_print_error($this->db, 'Failed to update line'); - $this->total_tva -= $diff; - $this->total_ttc -= $diff; - $total_tva_by_vats[$obj->vatrate] -= $diff; - $total_ttc_by_vats[$obj->vatrate] -= $diff; + + $resqlfix = $this->db->query($sqlfix); + + if (!$resqlfix) { + dol_print_error($this->db, 'Failed to update line'); + } + + $this->total_tva = (float) price2num($this->total_tva - $diff, '', 1); + $this->total_ttc = (float) price2num($this->total_ttc - $diff, '', 1); + $total_tva_by_vats[$obj->vatrate] = (float) price2num($total_tva_by_vats[$obj->vatrate] - $diff, '', 1); + $total_ttc_by_vats[$obj->vatrate] = (float) price2num($total_ttc_by_vats[$obj->vatrate] - $diff, '', 1); } } @@ -3210,6 +3215,13 @@ abstract class CommonObject } } + // Clean total + $this->total_ht = (float) price2num($this->total_ht); + $this->total_tva = (float) price2num($this->total_tva); + $this->total_localtax1 = (float) price2num($this->total_localtax1); + $this->total_localtax2 = (float) price2num($this->total_localtax2); + $this->total_ttc = (float) price2num($this->total_ttc); + $this->db->free($resql); // Now update global field total_ht, total_ttc and tva From a9031505f145161a34f37516c95e72591362efd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 18 Oct 2022 14:26:26 +0200 Subject: [PATCH 031/176] display count extrafields in invoice admin --- htdocs/core/lib/invoice.lib.php | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index b98f17e46ee..bd02d7cca53 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry - * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2015 Juanjo Menent * Copyright (C) 2017 Charlie Benke * Copyright (C) 2017 ATM-CONSULTING * @@ -137,7 +137,13 @@ function facture_prepare_head($object) */ function invoice_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('facture'); + $extrafields->fetch_name_optionals_label('facturedet'); + $extrafields->fetch_name_optionals_label('facture_rec'); + $extrafields->fetch_name_optionals_label('facturedet_rec'); $h = 0; $head = array(); @@ -160,25 +166,41 @@ function invoice_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_cust_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoices"); + $nbExtrafields = $extrafields->attributes['facture']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_cust_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); + $nbExtrafields = $extrafields->attributes['facturedet']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributeslines'; $h++; $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_rec_cust_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoicesRec"); + $nbExtrafields = $extrafields->attributes['facture_rec']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributesrec'; $h++; $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_rec_cust_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLinesRec"); + $nbExtrafields = $extrafields->attributes['facturedet_rec']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributeslinesrec'; $h++; - if ($conf->global->INVOICE_USE_SITUATION) { // Warning, implementation is seriously bugged and a new one not compatible is expected to become stable + if (!empty($conf->global->INVOICE_USE_SITUATION)) { // Warning, implementation is seriously bugged and a new one not compatible is expected to become stable $head[$h][0] = DOL_URL_ROOT.'/admin/facture_situation.php'; $head[$h][1] = $langs->trans("InvoiceSituation"); $head[$h][2] = 'situation'; From 9c62169da763d05b330057232de391ca9196a06a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 19:28:43 +0200 Subject: [PATCH 032/176] Fix typo --- htdocs/product/stock/tpl/stockcorrection.tpl.php | 5 +++-- htdocs/product/stock/tpl/stocktransfer.tpl.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 08a66d1b8c6..77113fa8cd9 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -93,7 +93,7 @@ if ($object->element == 'product') { if (empty($ident) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) { $ident = $conf->global->MAIN_DEFAULT_WAREHOUSE; } - print img_picto('', 'stock').$formproduct->selectWarehouses($ident, 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100'); + print img_picto('', 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($ident, 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100 maxwidth300 widthcentpercentminusx'); print ''; } if ($object->element == 'stock') { @@ -134,9 +134,10 @@ if (!empty($conf->productbatch->enabled) && ) { print ''; print 'element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; - print ''; + print img_picto('', 'barcode', 'class="pictofixedwidth"').''; print ''; print ''; + print ''; if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''.$langs->trans("SellByDate").''; diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index f2ecfa1d73c..35f5c28a2a3 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -104,7 +104,7 @@ if (!empty($conf->productbatch->enabled) && print ''; print ''; } else { - print ''; + print img_picto('', 'barcode', 'class="pictofixedwidth"').''; } print ''; print ''; From ae31b595e5a4a51127e21d88dea7e24b6d683140 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 19:48:49 +0200 Subject: [PATCH 033/176] NEW Can set a monthly frequency (or multiple) in cron tasks. --- htdocs/cron/card.php | 13 +++++++++++++ htdocs/cron/class/cronjob.class.php | 24 +++++++++++++++++------- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 87a054c699f..5de627a9a9a 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -473,6 +473,16 @@ if (($action == "create") || ($action == "edit")) { } $input .= ""; print $input; + + $input = " unitfrequency == "2678400") { + $input .= ' checked />'; + } else { + $input .= ' />'; + } + $input .= ""; + print $input; + print ""; print ""; print ""; @@ -664,6 +674,9 @@ if (($action == "create") || ($action == "edit")) { if ($object->unitfrequency == "604800") { print $langs->trans('CronEach')." ".($object->frequency)." ".$langs->trans('Weeks'); } + if ($object->unitfrequency == "2678400") { + print $langs->trans('CronEach')." ".($object->frequency)." ".$langs->trans('Month'); + } print ""; print ''; diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index db48c0e7fce..8f4b32ae502 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2007-2022 Laurent Destailleur * Copyright (C) 2013 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -23,6 +23,7 @@ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"; +require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"; /** @@ -1408,21 +1409,30 @@ class Cronjob extends CommonObject if (empty($this->datenextrun)) { if (empty($this->datestart)) { - $this->datenextrun = $now + ($this->frequency * $this->unitfrequency); + if ($this->unitfrequency == 2678400) { + $this->datenextrun = dol_time_plus_duree($now, $this->frequency, 'm'); + } else { + $this->datenextrun = $now + ($this->frequency * $this->unitfrequency); + } } else { - $this->datenextrun = $this->datestart + ($this->frequency * $this->unitfrequency); + if ($this->unitfrequency == 2678400) { + $this->datenextrun = dol_time_plus_duree($this->datestart, $this->frequency, 'm'); + } else { + $this->datenextrun = $this->datestart + ($this->frequency * $this->unitfrequency); + } } } if ($this->datenextrun < $now && $this->frequency > 0 && $this->unitfrequency > 0) { // Loop until date is after future while ($this->datenextrun < $now) { - $this->datenextrun += ($this->frequency * $this->unitfrequency); - - // TODO For exact frequency (every month, every year, ...), use instead a dol_time_plus_duree($time, $duration_value, $duration_unit) + if ($this->unitfrequency == 2678400) { + $this->datenextrun = dol_time_plus_duree($this->datenextrun, $this->frequency, 'm'); + } else { + $this->datenextrun += ($this->frequency * $this->unitfrequency); + } } } else { - //$this->datenextrun=$this->datenextrun + ($this->frequency * $this->unitfrequency); dol_syslog(get_class($this)."::reprogram_jobs datenextrun is already in future, we do not change it"); } From 99d56f74ae47860587c69d8dc3a27ee564e88275 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 19:49:02 +0200 Subject: [PATCH 034/176] NEW Can set a monthly frequency (or multiple) in cron tasks. --- htdocs/core/lib/date.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 9aaf0771d44..03223a7b65a 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -169,7 +169,7 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforend } else { $date->add($interval); } - //Change the behavior of PHP over data-interval when the result of this function is Feb 29 (non-leap years), 30 or Feb 31 (php returns March 1, 2 or 3 respectively) + //Change the behavior of PHP over data-interval when the result of this function is Feb 29 (non-leap years), 30 or Feb 31 (so php returns March 1, 2 or 3 respectively) if ($ruleforendofmonth == 1 && $duration_unit == 'm') { $timeyear = dol_print_date($time, '%Y'); $timemonth = dol_print_date($time, '%m'); From dcc7962757d3905eff0ea5aea04931d20e2d95c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 23:00:50 +0200 Subject: [PATCH 035/176] Fix default email templates --- .../mysql/data/llx_c_email_templates.sql | 16 +++++----- .../install/mysql/migration/15.0.0-16.0.0.sql | 31 +++++++++++++++++++ 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_email_templates.sql b/htdocs/install/mysql/data/llx_c_email_templates.sql index bce46a70e49..21775cba58a 100644 --- a/htdocs/install/mysql/data/llx_c_email_templates.sql +++ b/htdocs/install/mysql/data/llx_c_email_templates.sql @@ -21,18 +21,18 @@ -- -- Bank Thirdparty -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, 'banque','thirdparty','',0,null,null,'(YourSEPAMandate)',1,'$conf->societe->enabled && $conf->banque->enabled && $conf->prelevement->enabled',0,'__(YourSEPAMandate)__','__(Hello)__,

\n\n__(FindYourSEPAMandate)__ :
\n__MYCOMPANY_NAME__
\n__MYCOMPANY_FULLADDRESS__

\n__(Sincerely)__
\n__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, 'banque','thirdparty','',0,null,null,'(YourSEPAMandate)',1,'isModEnabled("societe") && isModEnabled("banque") && isModEnabled("prelevement")',0,'__(YourSEPAMandate)__','__(Hello)__,

\n\n__(FindYourSEPAMandate)__ :
\n__MYCOMPANY_NAME__
\n__MYCOMPANY_FULLADDRESS__

\n__(Sincerely)__
\n__USER_SIGNATURE__',null, 0); -- Members -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,'(SendingEmailOnAutoSubscription)' ,10,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipRequestWasReceived)__','__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipRequestWasReceived)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\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,'(SendingEmailOnMemberValidation)' ,20,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasValidated)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipWasValidated)__
__(FirstName)__ : __MEMBER_FIRSTNAME__
__(LastName)__ : __MEMBER_LASTNAME__
__(ID)__ : __MEMBER_ID__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\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,'(SendingEmailOnNewSubscription)' ,30,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourSubscriptionWasRecorded)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourSubscriptionWasRecorded)__
\n\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 1); -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,'(SendingReminderForExpiredSubscription)',40,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(SubscriptionReminderEmail)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfSubscriptionReminderEmail)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\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,'(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__(Civility)__ : __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__(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, 'adherent','member','',0,null,null,'(SendingEmailOnAutoSubscription)' ,10, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipRequestWasReceived)__','__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipRequestWasReceived)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\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,'(SendingEmailOnMemberValidation)' ,20, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasValidated)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipWasValidated)__
__(FirstName)__ : __MEMBER_FIRSTNAME__
__(LastName)__ : __MEMBER_LASTNAME__
__(ID)__ : __MEMBER_ID__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\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,'(SendingEmailOnNewSubscription)' ,30, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourSubscriptionWasRecorded)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourSubscriptionWasRecorded)__
\n\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 1); +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,'(SendingReminderForExpiredSubscription)',40, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(SubscriptionReminderEmail)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfSubscriptionReminderEmail)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\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,'(SendingEmailOnCancelation)' ,50, 'isModEnabled("adherent")',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, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(CardContent)__', '__(Hello)__,

\n\n__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civility)__ : __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__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -- Recruiting -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); +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,'isModEnabled("recruitment")',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); -- Event organization INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskConf)', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__,

__(OrganizationEventConfRequestWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 795726bd89c..df7102d105f 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -734,3 +734,34 @@ ALTER TABLE llx_cronjob ADD UNIQUE INDEX uk_cronjob (label, entity); ALTER TABLE llx_expedition ADD COLUMN billed smallint DEFAULT 0; ALTER TABLE llx_loan_schedule ADD UNIQUE INDEX uk_loan_schedule_ref (fk_loan, datep); + + + +-- Bank Thirdparty +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, 'banque','thirdparty','',0,null,null,'(YourSEPAMandate)',1,'isModEnabled("societe") && isModEnabled("banque") && isModEnabled("prelevement")',0,'__(YourSEPAMandate)__','__(Hello)__,

\n\n__(FindYourSEPAMandate)__ :
\n__MYCOMPANY_NAME__
\n__MYCOMPANY_FULLADDRESS__

\n__(Sincerely)__
\n__USER_SIGNATURE__',null, 0); + +-- Members +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,'(SendingEmailOnAutoSubscription)' ,10, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipRequestWasReceived)__','__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipRequestWasReceived)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\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,'(SendingEmailOnMemberValidation)' ,20, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasValidated)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipWasValidated)__
__(FirstName)__ : __MEMBER_FIRSTNAME__
__(LastName)__ : __MEMBER_LASTNAME__
__(ID)__ : __MEMBER_ID__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\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,'(SendingEmailOnNewSubscription)' ,30, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourSubscriptionWasRecorded)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourSubscriptionWasRecorded)__
\n\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 1); +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,'(SendingReminderForExpiredSubscription)',40, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(SubscriptionReminderEmail)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfSubscriptionReminderEmail)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\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,'(SendingEmailOnCancelation)' ,50, 'isModEnabled("adherent")',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, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(CardContent)__', '__(Hello)__,

\n\n__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civility)__ : __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__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); + +-- Recruiting +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,'isModEnabled("recruitment")',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); + +-- Event organization +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskConf)', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__,

__(OrganizationEventConfRequestWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskBooth)', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__,

__(OrganizationEventBoothRequestWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +-- TODO Add message for registration only to event __ONLINE_PAYMENT_TEXT_AND_URL__ +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsBooth)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailBoothPayment)__', '__(Hello)__,

__(OrganizationEventPaymentOfBoothWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsEvent)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailRegistrationPayment)__', '__(Hello)__,

__(OrganizationEventPaymentOfRegistrationWasReceived)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailAttendees)', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__,

__(OrganizationEventBulkMailToAttendees)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__,

__(OrganizationEventBulkMailToSpeakers)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); + +-- Partnership +INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipWillSoonBeCanceled)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipWillSoonBeCanceledTopic)__', 0, '\n

__(Hello)__,

\n__(YourPartnershipWillSoonBeCanceledContent)__

\n
\n\n
\n\n __(Sincerely)__
\n __[MAIN_INFO_SOCIETE_NOM]__
\n \n'); +INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipCanceled)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipCanceledTopic)__', 0, '\n

__(Hello)__,

\n__(YourPartnershipCanceledContent)__

\n
\n\n
\n\n __(Sincerely)__
\n __[MAIN_INFO_SOCIETE_NOM]__
\n \n'); +INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipRefused)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipRefusedTopic)__', 0, '\n

__(Hello)__,

\n__(YourPartnershipRefusedContent)__

\n
\n\n
\n\n __(Sincerely)__
\n __[MAIN_INFO_SOCIETE_NOM]__
\n \n'); +INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipAccepted)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipAcceptedTopic)__', 0, '\n

__(Hello)__,

\n__(YourPartnershipAcceptedContent)__

\n
\n\n
\n\n __(Sincerely)__
\n __[MAIN_INFO_SOCIETE_NOM]__
\n \n'); From c5c9262a3ca0b578b42c5e3627a11733963e37af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 23:09:19 +0200 Subject: [PATCH 036/176] Fix template of emails --- htdocs/install/mysql/data/llx_c_email_templates.sql | 5 +++-- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_email_templates.sql b/htdocs/install/mysql/data/llx_c_email_templates.sql index 21775cba58a..d2886631942 100644 --- a/htdocs/install/mysql/data/llx_c_email_templates.sql +++ b/htdocs/install/mysql/data/llx_c_email_templates.sql @@ -38,8 +38,9 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskConf)', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__,

__(OrganizationEventConfRequestWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskBooth)', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__,

__(OrganizationEventBoothRequestWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); -- TODO Add message for registration only to event __ONLINE_PAYMENT_TEXT_AND_URL__ -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsBooth)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailBoothPayment)__', '__(Hello)__,

__(OrganizationEventPaymentOfBoothWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsEvent)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailRegistrationPayment)__', '__(Hello)__,

__(OrganizationEventPaymentOfRegistrationWasReceived)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailBoothPayment)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailBoothPayment)__', '__(Hello)__,

__(OrganizationEventPaymentOfBoothWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailRegistrationPayment)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailRegistrationPayment)__', '__(Hello)__,

__(OrganizationEventPaymentOfRegistrationWasReceived)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +-- INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailAttendees)', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__,

__(OrganizationEventBulkMailToAttendees)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__,

__(OrganizationEventBulkMailToSpeakers)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index df7102d105f..517930eb490 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -755,8 +755,9 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskConf)', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__,

__(OrganizationEventConfRequestWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskBooth)', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__,

__(OrganizationEventBoothRequestWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); -- TODO Add message for registration only to event __ONLINE_PAYMENT_TEXT_AND_URL__ -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsBooth)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailBoothPayment)__', '__(Hello)__,

__(OrganizationEventPaymentOfBoothWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsEvent)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailRegistrationPayment)__', '__(Hello)__,

__(OrganizationEventPaymentOfRegistrationWasReceived)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailBoothPayment)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailBoothPayment)__', '__(Hello)__,

__(OrganizationEventPaymentOfBoothWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailRegistrationPayment)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailRegistrationPayment)__', '__(Hello)__,

__(OrganizationEventPaymentOfRegistrationWasReceived)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +-- INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailAttendees)', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__,

__(OrganizationEventBulkMailToAttendees)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__,

__(OrganizationEventBulkMailToSpeakers)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); From a6ff67a161870585f253ace45e34248854541ce9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 23:12:15 +0200 Subject: [PATCH 037/176] Fix debug module eventorganization --- htdocs/admin/eventorganization.php | 37 +++++++++++++++-------- htdocs/core/class/html.formmail.class.php | 2 +- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index 40c86d79e13..cc9b8d7bca8 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -220,7 +220,7 @@ if ($action == 'edit') { foreach ($arrayofparameters as $constname => $val) { if ($val['enabled']==1) { $setupnotempty++; - print ''; + print ''; $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); $tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '

'."\n".$langs->trans($constname . 'Tooltip2') : ''); print ''.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).''; @@ -302,7 +302,8 @@ if ($action == 'edit') { foreach ($arrayofparameters as $constname => $val) { if ($val['enabled']==1) { $setupnotempty++; - print ''; + print ''; + print ''; $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); $tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '

'."\n".$langs->trans($constname . 'Tooltip2') : ''); print $form->textwithpicto($langs->trans($constname), $tooltiphelp); @@ -320,12 +321,17 @@ if ($action == 'edit') { $formmail = new FormMail($db); $tmp = explode(':', $val['type']); - - $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname)); - if ($template < 0) { - setEventMessages(null, $formmail->errors, 'errors'); + $labelemailtemplate = getDolGlobalString($constname); + if ($labelemailtemplate && $labelemailtemplate != '-1') { + $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname)); + if (is_numeric($template) && $template < 0) { + setEventMessages($formmail->error, $formmail->errors, 'errors'); + } else { + if ($template->label != 'default') { + print $langs->trans($template->label); + } + } } - print $langs->trans($template->label); } } elseif (preg_match('/category:/', $val['type'])) { if (getDolGlobalString($constname)) { @@ -353,16 +359,21 @@ if ($action == 'edit') { } } elseif ($val['type'] == 'product') { $product = new Product($db); - $resprod = $product->fetch(getDolGlobalString($constname)); - if ($resprod > 0) { - print $product->getNomUrl(1); - } elseif ($resprod < 0) { - setEventMessages($product->error, $product->errors, "errors"); + $idproduct = getDolGlobalString($constname); + if ($idproduct > 0) { + $resprod = $product->fetch($idproduct); + if ($resprod > 0) { + print $product->getNomUrl(1); + } elseif ($resprod < 0) { + setEventMessages($product->error, $product->errors, "errors"); + } } } else { print getDolGlobalString($constname); } - print ''; + print ''; + + print ''; } } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index debfbbf1b8e..16302dc3c1a 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1284,7 +1284,7 @@ class FormMail extends Form * @param int $id Id of template to get, or -1 for first found with position 0, or 0 for first found whatever is position (priority order depends on lang provided or not) or -2 for exact match with label (no answer if not found) * @param int $active 1=Only active template, 0=Only disabled, -1=All * @param string $label Label of template to get - * @return ModelMail|integer One instance of ModelMail or -1 if error + * @return ModelMail|integer One instance of ModelMail or < 0 if error */ public function getEMailTemplate($dbs, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '') { From ac6f187d392c1d6a1b63066ae631f44eedbd9e29 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 23:12:40 +0200 Subject: [PATCH 038/176] Better setup by default for module eventorganization --- .../modules/modEventOrganization.class.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index f600ef633aa..9ad2ede9b77 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -370,6 +370,28 @@ class modEventOrganization extends DolibarrModules $init = $this->_init($sql, $options); + + // Insert some vars + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($this->db); + + $template = $formmail->getEMailTemplate($this->db, 'conferenceorbooth', $user, $langs, 0, 1, '(EventOrganizationEmailAskConf)'); + if ($template->id > 0) { + dolibarr_set_const($this->db, 'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF', $template->id, 'chaine', 0, '', $conf->entity); + } + $template = $formmail->getEMailTemplate($this->db, 'conferenceorbooth', $user, $langs, 0, 1, '(EventOrganizationEmailAskBooth)'); + if ($template->id > 0) { + dolibarr_set_const($this->db, 'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH', $template->id, 'chaine', 0, '', $conf->entity); + } + $template = $formmail->getEMailTemplate($this->db, 'conferenceorbooth', $user, $langs, 0, 1, '(EventOrganizationEmailBoothPayment)'); + if ($template->id > 0) { + dolibarr_set_const($this->db, 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH', $template->id, 'chaine', 0, '', $conf->entity); + } + $template = $formmail->getEMailTemplate($this->db, 'conferenceorbooth', $user, $langs, 0, 1, '(EventOrganizationEmailRegistrationPayment)'); + if ($template->id > 0) { + dolibarr_set_const($this->db, 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT', $template->id, 'chaine', 0, '', $conf->entity); + } + return $init; } From 391df5043b1b16a37204053f61036f811b5ddd62 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 23:18:22 +0200 Subject: [PATCH 039/176] Fix css --- htdocs/admin/mails_templates.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 1b5f8353f12..5a4eac7bcca 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -1173,7 +1173,7 @@ if ($num) { $class .= ' tdoverflowmax100'; } if ($value == 'topic') { - $class .= 'tdoverflowmax200 small'; + $class .= ' tdoverflowmax200 small'; } if ($value == 'type_template') { $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow; From 2bfc60587e4e749d8f889876b6ee1692a3f1de87 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 23:28:47 +0200 Subject: [PATCH 040/176] Fix title of emails sents on payment --- htdocs/public/payment/paymentok.php | 40 ++++++++--------------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 4d1336351b3..bb50440aff3 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1289,7 +1289,7 @@ if ($ispaymentok) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; } else { - $subject = '['.$object->ref.' - '.$outputlangs->trans("NewRegistration").']'; + $subject = '['.$appli.'] '.$object->ref.' - '.$outputlangs->trans("NewRegistration").']'; $msg = $outputlangs->trans("OrganizationEventPaymentOfRegistrationWasReceived"); } @@ -1493,7 +1493,7 @@ if ($ispaymentok) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; } else { - $subject = '['.$booth->ref.' - '.$outputlangs->trans("NewRegistration").']'; + $subject = '['.$appli.'] '.$booth->ref.' - '.$outputlangs->trans("NewRegistration").']'; $msg = $outputlangs->trans("OrganizationEventPaymentOfBoothWasReceived"); } @@ -1542,6 +1542,14 @@ if ($ispaymentok) { } } + +// Set $appli for emails title +$appli = constant('DOL_APPLICATION_TITLE'); +if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { + $appli = $conf->global->MAIN_APPLICATION_TITLE; +} + + if ($ispaymentok) { // Get on url call $onlinetoken = empty($PAYPALTOKEN) ? $_SESSION['onlinetoken'] : $PAYPALTOKEN; @@ -1600,19 +1608,6 @@ if ($ispaymentok) { //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current // Define link to login card - $appli = constant('DOL_APPLICATION_TITLE'); - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { - $appli = $conf->global->MAIN_APPLICATION_TITLE; - if (preg_match('/\d\.\d/', $appli)) { - if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) { - $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } - } else { - $appli .= " ".DOL_VERSION; - } - } else { - $appli .= " ".DOL_VERSION; - } $urlback = $_SERVER["REQUEST_URI"]; $topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("NewOnlinePaymentReceived"); @@ -1740,21 +1735,6 @@ if ($ispaymentok) { $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - // Define link to login card - $appli = constant('DOL_APPLICATION_TITLE'); - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { - $appli = $conf->global->MAIN_APPLICATION_TITLE; - if (preg_match('/\d\.\d/', $appli)) { - if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) { - $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } - } else { - $appli .= " ".DOL_VERSION; - } - } else { - $appli .= " ".DOL_VERSION; - } - $urlback = $_SERVER["REQUEST_URI"]; $topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("ValidationOfPaymentFailed"); $content = ""; From 0db1863429154ae0962769c006e992a30f934cf7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 23:31:32 +0200 Subject: [PATCH 041/176] Fix title of emails sents on payment --- htdocs/public/payment/paymentko.php | 19 ++++--------------- htdocs/public/payment/paymentok.php | 5 +---- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index 29adb2947d0..2504260cbc5 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -136,6 +136,10 @@ foreach ($_POST as $k => $v) { dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment'); +// Set $appli for emails title +$appli = $mysoc->name; + + if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice // Get on url call $fulltag = $FULLTAG; @@ -173,21 +177,6 @@ if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice $from = $conf->global->MAILING_EMAIL_FROM; $sendto = $sendemail; - // Define link to login card - $appli = constant('DOL_APPLICATION_TITLE'); - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { - $appli = $conf->global->MAIN_APPLICATION_TITLE; - if (preg_match('/\d\.\d/', $appli)) { - if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) { - $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } - } else { - $appli .= " ".DOL_VERSION; - } - } else { - $appli .= " ".DOL_VERSION; - } - $urlback = $_SERVER["REQUEST_URI"]; $topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("NewOnlinePaymentFailed"); $content = ""; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index bb50440aff3..ea1de4ca7ef 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1544,10 +1544,7 @@ if ($ispaymentok) { // Set $appli for emails title -$appli = constant('DOL_APPLICATION_TITLE'); -if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { - $appli = $conf->global->MAIN_APPLICATION_TITLE; -} +$appli = $mysoc->name; if ($ispaymentok) { From 2b2d01cdc96d94d3f2831d6cdba3de4411ab9b18 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 23:18:22 +0200 Subject: [PATCH 042/176] Fix css --- htdocs/admin/mails_templates.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index f9fe30ef6d7..c3912dc2b67 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -1173,7 +1173,7 @@ if ($num) { $class .= ' tdoverflowmax100'; } if ($value == 'topic') { - $class .= 'tdoverflowmax200 small'; + $class .= ' tdoverflowmax200 small'; } if ($value == 'type_template') { $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow; From b562ab994841fb264a21412da3b5f4d5841d79bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 23:12:15 +0200 Subject: [PATCH 043/176] Fix debug module eventorganization --- htdocs/admin/eventorganization.php | 37 +++++++++++++++-------- htdocs/core/class/html.formmail.class.php | 2 +- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index f91f8ef13f1..8efbfcdb669 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -220,7 +220,7 @@ if ($action == 'edit') { foreach ($arrayofparameters as $constname => $val) { if ($val['enabled']==1) { $setupnotempty++; - print ''; + print ''; $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); $tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '

'."\n".$langs->trans($constname . 'Tooltip2') : ''); print ''.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).''; @@ -313,7 +313,8 @@ if ($action == 'edit') { foreach ($arrayofparameters as $constname => $val) { if ($val['enabled']==1) { $setupnotempty++; - print ''; + print ''; + print ''; $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); $tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '

'."\n".$langs->trans($constname . 'Tooltip2') : ''); print $form->textwithpicto($langs->trans($constname), $tooltiphelp); @@ -331,12 +332,17 @@ if ($action == 'edit') { $formmail = new FormMail($db); $tmp = explode(':', $val['type']); - - $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname)); - if ($template < 0) { - setEventMessages(null, $formmail->errors, 'errors'); + $labelemailtemplate = getDolGlobalString($constname); + if ($labelemailtemplate && $labelemailtemplate != '-1') { + $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname)); + if (is_numeric($template) && $template < 0) { + setEventMessages($formmail->error, $formmail->errors, 'errors'); + } else { + if ($template->label != 'default') { + print $langs->trans($template->label); + } + } } - print $langs->trans($template->label); } } elseif (preg_match('/category:/', $val['type'])) { if (getDolGlobalString($constname)) { @@ -364,16 +370,21 @@ if ($action == 'edit') { } } elseif ($val['type'] == 'product') { $product = new Product($db); - $resprod = $product->fetch(getDolGlobalString($constname)); - if ($resprod > 0) { - print $product->getNomUrl(1); - } elseif ($resprod < 0) { - setEventMessages($product->error, $product->errors, "errors"); + $idproduct = getDolGlobalString($constname); + if ($idproduct > 0) { + $resprod = $product->fetch($idproduct); + if ($resprod > 0) { + print $product->getNomUrl(1); + } elseif ($resprod < 0) { + setEventMessages($product->error, $product->errors, "errors"); + } } } else { print getDolGlobalString($constname); } - print ''; + print ''; + + print ''; } } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 281cfaca58d..74f0eadfdf2 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1277,7 +1277,7 @@ class FormMail extends Form * @param int $id Id of template to get, or -1 for first found with position 0, or 0 for first found whatever is position (priority order depends on lang provided or not) or -2 for exact match with label (no answer if not found) * @param int $active 1=Only active template, 0=Only disabled, -1=All * @param string $label Label of template to get - * @return ModelMail|integer One instance of ModelMail or -1 if error + * @return ModelMail|integer One instance of ModelMail or < 0 if error */ public function getEMailTemplate($dbs, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '') { From 8d8230795614927bffa999405a134511e3ebb9c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 23:28:47 +0200 Subject: [PATCH 044/176] Fix title of emails sents on payment --- htdocs/public/payment/paymentok.php | 40 ++++++++--------------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index b4a099333c9..96eeff1cad2 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1287,7 +1287,7 @@ if ($ispaymentok) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; } else { - $subject = '['.$object->ref.' - '.$outputlangs->trans("NewRegistration").']'; + $subject = '['.$appli.'] '.$object->ref.' - '.$outputlangs->trans("NewRegistration").']'; $msg = $outputlangs->trans("OrganizationEventPaymentOfRegistrationWasReceived"); } @@ -1491,7 +1491,7 @@ if ($ispaymentok) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; } else { - $subject = '['.$booth->ref.' - '.$outputlangs->trans("NewRegistration").']'; + $subject = '['.$appli.'] '.$booth->ref.' - '.$outputlangs->trans("NewRegistration").']'; $msg = $outputlangs->trans("OrganizationEventPaymentOfBoothWasReceived"); } @@ -1540,6 +1540,14 @@ if ($ispaymentok) { } } + +// Set $appli for emails title +$appli = constant('DOL_APPLICATION_TITLE'); +if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { + $appli = $conf->global->MAIN_APPLICATION_TITLE; +} + + if ($ispaymentok) { // Get on url call $onlinetoken = empty($PAYPALTOKEN) ? $_SESSION['onlinetoken'] : $PAYPALTOKEN; @@ -1598,19 +1606,6 @@ if ($ispaymentok) { //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current // Define link to login card - $appli = constant('DOL_APPLICATION_TITLE'); - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { - $appli = $conf->global->MAIN_APPLICATION_TITLE; - if (preg_match('/\d\.\d/', $appli)) { - if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) { - $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } - } else { - $appli .= " ".DOL_VERSION; - } - } else { - $appli .= " ".DOL_VERSION; - } $urlback = $_SERVER["REQUEST_URI"]; $topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("NewOnlinePaymentReceived"); @@ -1738,21 +1733,6 @@ if ($ispaymentok) { $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - // Define link to login card - $appli = constant('DOL_APPLICATION_TITLE'); - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { - $appli = $conf->global->MAIN_APPLICATION_TITLE; - if (preg_match('/\d\.\d/', $appli)) { - if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) { - $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } - } else { - $appli .= " ".DOL_VERSION; - } - } else { - $appli .= " ".DOL_VERSION; - } - $urlback = $_SERVER["REQUEST_URI"]; $topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("ValidationOfPaymentFailed"); $content = ""; From 2101611bd519d1353242a76ec9544c6b9893adc6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Oct 2022 23:31:32 +0200 Subject: [PATCH 045/176] Fix title of emails sents on payment --- htdocs/public/payment/paymentko.php | 19 ++++--------------- htdocs/public/payment/paymentok.php | 5 +---- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index 606bed0c490..bed4a3d63f0 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -135,6 +135,10 @@ foreach ($_POST as $k => $v) { dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment'); +// Set $appli for emails title +$appli = $mysoc->name; + + if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice // Get on url call $fulltag = $FULLTAG; @@ -172,21 +176,6 @@ if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice $from = $conf->global->MAILING_EMAIL_FROM; $sendto = $sendemail; - // Define link to login card - $appli = constant('DOL_APPLICATION_TITLE'); - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { - $appli = $conf->global->MAIN_APPLICATION_TITLE; - if (preg_match('/\d\.\d/', $appli)) { - if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) { - $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } - } else { - $appli .= " ".DOL_VERSION; - } - } else { - $appli .= " ".DOL_VERSION; - } - $urlback = $_SERVER["REQUEST_URI"]; $topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("NewOnlinePaymentFailed"); $content = ""; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 96eeff1cad2..154e4606cd5 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1542,10 +1542,7 @@ if ($ispaymentok) { // Set $appli for emails title -$appli = constant('DOL_APPLICATION_TITLE'); -if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { - $appli = $conf->global->MAIN_APPLICATION_TITLE; -} +$appli = $mysoc->name; if ($ispaymentok) { From 4cbd19e6bd4da96acb481d0b893bf06c39bc5fb0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Oct 2022 00:01:18 +0200 Subject: [PATCH 046/176] Debug attendee registration --- .../class/conferenceorboothattendee.class.php | 7 +++++-- htdocs/public/payment/paymentok.php | 12 +++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 222a0c78946..909758ca3f2 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -103,12 +103,13 @@ class ConferenceOrBoothAttendee extends CommonObject public $fields = array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'comment'=>"Reference of object"), - 'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'), + 'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>15, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>20, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), 'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'autofocusoncreate'=>1, 'searchall'=>1), 'firstname' => array('type'=>'varchar(100)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1), 'lastname' => array('type'=>'varchar(100)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>32, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), + 'email_company' => array('type'=>'mail', 'label'=>'EmailCompany', 'enabled'=>'1', 'position'=>41, 'notnull'=>0, 'visible'=>-2, 'searchall'=>1), 'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1, 'showoncombobox'=>'1',), 'fk_invoice' => array('type'=>'integer:Facture:compta/facture/class/facture.class.php', 'label'=>'Invoice', 'enabled'=>'$conf->facture->enabled', 'position'=>57, 'notnull'=>0, 'visible'=>-1, 'index'=>0, 'picto'=>'bill', 'css'=>'tdoverflowmax150 maxwidth500'), 'amount' => array('type'=>'price', 'label'=>'AmountPaid', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"AmountOfSubscriptionPaid",), @@ -125,11 +126,13 @@ class ConferenceOrBoothAttendee extends CommonObject ); public $rowid; public $ref; - public $fk_soc; public $fk_actioncomm; + public $fk_project; public $email; public $firstname; public $lastname; + public $fk_soc; + public $email_company; public $date_subscription; public $fk_invoice; public $amount; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index ea1de4ca7ef..c56732f5938 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1266,7 +1266,7 @@ if ($ispaymentok) { $thirdparty = new Societe($db); $resultthirdparty = $thirdparty->fetch($attendeetovalidate->fk_soc); if ($resultthirdparty < 0) { - setEventMessages(null, $attendeetovalidate->errors, "errors"); + setEventMessages($resultthirdparty->error, $resultthirdparty->errors, "errors"); } else { require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; @@ -1293,7 +1293,6 @@ if ($ispaymentok) { $msg = $outputlangs->trans("OrganizationEventPaymentOfRegistrationWasReceived"); } - $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); complete_substitutions_array($substitutionarray, $outputlangs, $object); @@ -1301,6 +1300,13 @@ if ($ispaymentok) { $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); $sendto = $attendeetovalidate->email; + $cc = ''; + if ($thirdparty->email) { + $cc = $thirdparty->email; + } + if ($attendeetovalidate->email_company && $attendeetovalidate->email_company != $thirdparty->email) { + $cc = ($cc ? ', ' : '').$attendeetovalidate->email_company; + } $from = $conf->global->MAILING_EMAIL_FROM; $urlback = $_SERVER["REQUEST_URI"]; @@ -1321,7 +1327,7 @@ if ($ispaymentok) { $listofmimes = array(dol_mimetype($file)); } - $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, $listofpaths, $listofmimes, $listofnames, '', '', 0, $ishtml); + $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, $listofpaths, $listofmimes, $listofnames, $cc, '', 0, $ishtml); $result = $mailfile->sendfile(); if ($result) { From fee00a3655e66ba4fb9a966c2d4c81bbd9a2a18c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Oct 2022 00:29:23 +0200 Subject: [PATCH 047/176] Look and feel --- htdocs/comm/mailing/cibles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 1beefca8cf6..ed3cfce4163 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -544,7 +544,7 @@ if ($object->fetch($id) >= 0) { if ($allowaddtarget) { $morehtmlcenter = ''.$langs->trans("ToClearAllRecipientsClickHere").' id.'" class="button reposition smallpaddingimp">'.$langs->trans("TargetsReset").''; } - $morehtmlcenter .= '   id.'">'.$langs->trans("Download").''; + $morehtmlcenter .= '   id.'">'.img_picto('', 'download', 'class="pictofixedwidth"').$langs->trans("Download").''; $massactionbutton = ''; From 5d12903b3458699a65da1d87bedce50a68a4c4bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 19 Oct 2022 10:22:55 +0200 Subject: [PATCH 048/176] add count extrafields badge in bank admin --- htdocs/core/lib/bank.lib.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 8920808766a..736b200bea3 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -131,7 +131,12 @@ function bank_prepare_head(Account $object) */ function bank_admin_prepare_head($object) { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('bank_account'); + $extrafields->fetch_name_optionals_label('bank'); + $h = 0; $head = array(); @@ -154,11 +159,19 @@ function bank_admin_prepare_head($object) $head[$h][0] = DOL_URL_ROOT.'/admin/bank_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields").' ('.$langs->trans("BankAccounts").')'; + $nbExtrafields = $extrafields->attributes['bank_account']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; $head[$h][0] = DOL_URL_ROOT.'/admin/bankline_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields").' ('.$langs->trans("BankTransactions").')'; + $nbExtrafields = $extrafields->attributes['bank']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'bankline_extrafields'; $h++; From 477f5e2890fc841cc9b87fedb2b4358b27b6a0a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Courtier?= Date: Wed, 19 Oct 2022 11:53:17 +0200 Subject: [PATCH 049/176] FIX: Missing return 0 if object not found --- htdocs/commande/class/commande.class.php | 6 ++++++ htdocs/compta/facture/class/facture.class.php | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 54e50baa9f7..97bd4d36fa4 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4138,6 +4138,12 @@ class OrderLine extends CommonOrderLine $result = $this->db->query($sql); if ($result) { $objp = $this->db->fetch_object($result); + + if (!$objp) { + $this->error = 'OrderLine with id '. $rowid .' not found sql='.$sql; + return 0; + } + $this->rowid = $objp->rowid; $this->id = $objp->rowid; $this->fk_commande = $objp->fk_commande; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 862a86e9e16..8804e58b1c1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5293,6 +5293,11 @@ class FactureLigne extends CommonInvoiceLine if ($result) { $objp = $this->db->fetch_object($result); + if (!$objp) { + $this->error = 'InvoiceLine with id '. $rowid .' not found sql='.$sql; + return 0; + } + $this->rowid = $objp->rowid; $this->id = $objp->rowid; $this->fk_facture = $objp->fk_facture; From d4344a736f9a70d98f986d665bb3232487698576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 19 Oct 2022 12:28:51 +0200 Subject: [PATCH 050/176] add accessible values --- htdocs/product/dynamic_price/class/price_parser.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/product/dynamic_price/class/price_parser.class.php b/htdocs/product/dynamic_price/class/price_parser.class.php index 764ff919cc7..412d015f8b9 100644 --- a/htdocs/product/dynamic_price/class/price_parser.class.php +++ b/htdocs/product/dynamic_price/class/price_parser.class.php @@ -150,6 +150,8 @@ class PriceParser "length" => $product->length, "surface" => $product->surface, "price_min" => $product->price_min, + "cost_price" => $product->cost_price, + "pmp" => $product->pmp, )); //Retrieve all extrafield for product and add it to values From 801af96fcdb95ba0ad564116f7f2d459362cdd11 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Oct 2022 16:09:02 +0200 Subject: [PATCH 051/176] FIX Import contact when duplicate thirdparties FIX Import of socialnetwork field --- .../modules/import/import_csv.modules.php | 21 +++++++++--- .../modules/import/import_xlsx.modules.php | 32 +++++++++++++------ htdocs/langs/en_US/errors.lang | 1 + 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 594ab96d955..09f93a436ea 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -458,17 +458,27 @@ class ImportCsv extends ModeleImports $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. } - call_user_func_array(array($classinstance, $method), $param_array); + $result = call_user_func_array(array($classinstance, $method), $param_array); + + // If duplicate record found + if (!($classinstance->id != '') && $result == -2) { + $this->errors[$error]['lib'] = $langs->trans('ErrorMultipleRecordFoundFromRef', $newval); + $this->errors[$error]['type'] = 'FOREIGNKEY'; + $errorforthistable++; + $error++; + } + // If not found, try the fetch from label if (!($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeorlabel') { $param_array = array('', '', $newval); call_user_func_array(array($classinstance, $method), $param_array); } $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval] = $classinstance->id; + //print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. '; if ($classinstance->id != '') { // id may be 0, it is a found value $newval = $classinstance->id; - } else { + } elseif (! $error) { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', num2Alpha($key - 1), $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); } elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) { @@ -729,9 +739,13 @@ class ImportCsv extends ModeleImports if (isModEnabled("socialnetworks") && strpos($fieldname, "socialnetworks") !== false) { if (!in_array("socialnetworks", $listfields)) { $listfields[] = "socialnetworks"; + $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array + $listvalues[$socialkey] = ''; } + //var_dump($newval); var_dump($arrayrecord[($key - 1)]['type']); if (!empty($newval) && $arrayrecord[($key - 1)]['type'] > 0) { - $socialkey = array_search("socialnetworks", $listfields); + $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array + //var_dump('sk='.$socialkey); // socialkey=19 $socialnetwork = explode("_", $fieldname)[1]; if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { $json = new stdClass(); @@ -833,7 +847,6 @@ class ImportCsv extends ModeleImports if (empty($lastinsertid)) { // No insert done yet for a parent table $sqlSelect = "SELECT ".$fname." FROM ".$tablename; - $data = array_combine($listfields, $listvalues); $where = array(); // filters to forge SQL request $filters = array(); // filters to forge output error message diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 3637ce105c1..a6470aef520 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -502,17 +502,28 @@ class ImportXlsx extends ModeleImports }*/ $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. } - call_user_func_array(array($classinstance, $method), $param_array); + + $result = call_user_func_array(array($classinstance, $method), $param_array); + + // If duplicate record found + if (!($classinstance->id != '') && $result == -2) { + $this->errors[$error]['lib'] = $langs->trans('ErrorMultipleRecordFoundFromRef', $newval); + $this->errors[$error]['type'] = 'FOREIGNKEY'; + $errorforthistable++; + $error++; + } + // If not found, try the fetch from label if (!($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeorlabel') { $param_array = array('', '', $newval); call_user_func_array(array($classinstance, $method), $param_array); } $this->cacheconvert[$file . '_' . $class . '_' . $method . '_'][$newval] = $classinstance->id; + //print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. '; if ($classinstance->id != '') { // id may be 0, it is a found value $newval = $classinstance->id; - } else { + } elseif (! $error) { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); } elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) { @@ -770,12 +781,14 @@ class ImportXlsx extends ModeleImports } // Define $listfields and $listvalues to build SQL request - if ($conf->socialnetworks->enabled && strpos($fieldname, "socialnetworks") !== false) { + if (isModEnabled("socialnetworks") && strpos($fieldname, "socialnetworks") !== false) { if (!in_array("socialnetworks", $listfields)) { $listfields[] = "socialnetworks"; + $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array. Example socialkey=19 + $listvalues[$socialkey] = ''; } if (!empty($newval) && $arrayrecord[($key)]['type'] > 0) { - $socialkey = array_search("socialnetworks", $listfields); + $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array. Example socialkey=19 $socialnetwork = explode("_", $fieldname)[1]; if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { $json = new stdClass(); @@ -797,7 +810,7 @@ class ImportXlsx extends ModeleImports } elseif (empty($newval) && $arrayrecord[($key)]['type'] == 0) { $listvalues[] = "''"; } else { - $listvalues[] = "'" . $this->db->escape($newval) . "'"; + $listvalues[] = "'".$this->db->escape($newval)."'"; } } } @@ -810,7 +823,7 @@ class ImportXlsx extends ModeleImports if (!empty($listfields) && is_array($objimport->array_import_fieldshidden[0])) { // Loop on each hidden fields to add them into listfields/listvalues foreach ($objimport->array_import_fieldshidden[0] as $key => $val) { - if (!preg_match('/^' . preg_quote($alias, '/') . '\./', $key)) { + if (!preg_match('/^'.preg_quote($alias, '/').'\./', $key)) { continue; // Not a field of current table } if ($val == 'user->id') { @@ -876,17 +889,16 @@ class ImportXlsx extends ModeleImports if (!empty($updatekeys)) { // We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields) - $where = array(); - if (empty($lastinsertid)) { // No insert done yet for a parent table $sqlSelect = "SELECT ".$fname." FROM " . $tablename; $data = array_combine($listfields, $listvalues); - $filters = array(); + $where = array(); // filters to forge SQL request + $filters = array(); // filters to forge output error message foreach ($updatekeys as $key) { $col = $objimport->array_import_updatekeys[0][$key]; $key = preg_replace('/^.*\./i', '', $key); - if ($conf->socialnetworks->enabled && strpos($key, "socialnetworks") !== false) { + if (isModEnabled("socialnetworks") && strpos($key, "socialnetworks") !== false) { $tmp = explode("_", $key); $key = $tmp[0]; $socialnetwork = $tmp[1]; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 6ff5a63196a..8c64ccf7874 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -97,6 +97,7 @@ ErrorWrongValueForField=Field %s: '%s' does not match regex rule < ErrorHtmlInjectionForField=Field %s: The value '%s' contains a malicious data not allowed ErrorFieldValueNotIn=Field %s: '%s' is not a value found in field %s of %s ErrorFieldRefNotIn=Field %s: '%s' is not a %s existing ref +ErrorMultipleRecordFoundFromRef=Several record found when searching from ref %s. No way to know which ID to use. ErrorsOnXLines=%s errors found ErrorFileIsInfectedWithAVirus=The antivirus program was not able to validate the file (file might be infected by a virus) ErrorNumRefModel=A reference exists into database (%s) and is not compatible with this numbering rule. Remove record or renamed reference to activate this module. From 0d1702627601ec1842213b025779b5f78d6b3abe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Oct 2022 16:09:02 +0200 Subject: [PATCH 052/176] FIX Import contact when duplicate thirdparties FIX Import of socialnetwork field --- .../modules/import/import_csv.modules.php | 21 +++++++++--- .../modules/import/import_xlsx.modules.php | 32 +++++++++++++------ htdocs/langs/en_US/errors.lang | 1 + 3 files changed, 41 insertions(+), 13 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 0bea7d1d739..b251d70ad8f 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -458,17 +458,27 @@ class ImportCsv extends ModeleImports $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. } - call_user_func_array(array($classinstance, $method), $param_array); + $result = call_user_func_array(array($classinstance, $method), $param_array); + + // If duplicate record found + if (!($classinstance->id != '') && $result == -2) { + $this->errors[$error]['lib'] = $langs->trans('ErrorMultipleRecordFoundFromRef', $newval); + $this->errors[$error]['type'] = 'FOREIGNKEY'; + $errorforthistable++; + $error++; + } + // If not found, try the fetch from label if (!($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeorlabel') { $param_array = array('', '', $newval); call_user_func_array(array($classinstance, $method), $param_array); } $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval] = $classinstance->id; + //print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. '; if ($classinstance->id != '') { // id may be 0, it is a found value $newval = $classinstance->id; - } else { + } elseif (! $error) { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', num2Alpha($key - 1), $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); } elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) { @@ -729,9 +739,13 @@ class ImportCsv extends ModeleImports if ($conf->socialnetworks->enabled && strpos($fieldname, "socialnetworks") !== false) { if (!in_array("socialnetworks", $listfields)) { $listfields[] = "socialnetworks"; + $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array + $listvalues[$socialkey] = ''; } + //var_dump($newval); var_dump($arrayrecord[($key - 1)]['type']); if (!empty($newval) && $arrayrecord[($key - 1)]['type'] > 0) { - $socialkey = array_search("socialnetworks", $listfields); + $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array + //var_dump('sk='.$socialkey); // socialkey=19 $socialnetwork = explode("_", $fieldname)[1]; if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { $json = new stdClass(); @@ -833,7 +847,6 @@ class ImportCsv extends ModeleImports if (empty($lastinsertid)) { // No insert done yet for a parent table $sqlSelect = "SELECT ".$fname." FROM ".$tablename; - $data = array_combine($listfields, $listvalues); $where = array(); // filters to forge SQL request $filters = array(); // filters to forge output error message diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 8652f106ca2..4023c1ecc99 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -502,17 +502,28 @@ class ImportXlsx extends ModeleImports }*/ $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. } - call_user_func_array(array($classinstance, $method), $param_array); + + $result = call_user_func_array(array($classinstance, $method), $param_array); + + // If duplicate record found + if (!($classinstance->id != '') && $result == -2) { + $this->errors[$error]['lib'] = $langs->trans('ErrorMultipleRecordFoundFromRef', $newval); + $this->errors[$error]['type'] = 'FOREIGNKEY'; + $errorforthistable++; + $error++; + } + // If not found, try the fetch from label if (!($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeorlabel') { $param_array = array('', '', $newval); call_user_func_array(array($classinstance, $method), $param_array); } $this->cacheconvert[$file . '_' . $class . '_' . $method . '_'][$newval] = $classinstance->id; + //print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. '; if ($classinstance->id != '') { // id may be 0, it is a found value $newval = $classinstance->id; - } else { + } elseif (! $error) { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); } elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) { @@ -770,12 +781,14 @@ class ImportXlsx extends ModeleImports } // Define $listfields and $listvalues to build SQL request - if ($conf->socialnetworks->enabled && strpos($fieldname, "socialnetworks") !== false) { + if (isModEnabled("socialnetworks") && strpos($fieldname, "socialnetworks") !== false) { if (!in_array("socialnetworks", $listfields)) { $listfields[] = "socialnetworks"; + $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array. Example socialkey=19 + $listvalues[$socialkey] = ''; } if (!empty($newval) && $arrayrecord[($key)]['type'] > 0) { - $socialkey = array_search("socialnetworks", $listfields); + $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array. Example socialkey=19 $socialnetwork = explode("_", $fieldname)[1]; if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { $json = new stdClass(); @@ -797,7 +810,7 @@ class ImportXlsx extends ModeleImports } elseif (empty($newval) && $arrayrecord[($key)]['type'] == 0) { $listvalues[] = "''"; } else { - $listvalues[] = "'" . $this->db->escape($newval) . "'"; + $listvalues[] = "'".$this->db->escape($newval)."'"; } } } @@ -810,7 +823,7 @@ class ImportXlsx extends ModeleImports if (!empty($listfields) && is_array($objimport->array_import_fieldshidden[0])) { // Loop on each hidden fields to add them into listfields/listvalues foreach ($objimport->array_import_fieldshidden[0] as $key => $val) { - if (!preg_match('/^' . preg_quote($alias, '/') . '\./', $key)) { + if (!preg_match('/^'.preg_quote($alias, '/').'\./', $key)) { continue; // Not a field of current table } if ($val == 'user->id') { @@ -880,12 +893,13 @@ class ImportXlsx extends ModeleImports $sqlSelect = "SELECT ".$fname." FROM " . $tablename; $data = array_combine($listfields, $listvalues); - $where = array(); - $filters = array(); + + $where = array(); // filters to forge SQL request + $filters = array(); // filters to forge output error message foreach ($updatekeys as $key) { $col = $objimport->array_import_updatekeys[0][$key]; $key = preg_replace('/^.*\./i', '', $key); - if ($conf->socialnetworks->enabled && strpos($key, "socialnetworks") !== false) { + if (isModEnabled("socialnetworks") && strpos($key, "socialnetworks") !== false) { $tmp = explode("_", $key); $key = $tmp[0]; $socialnetwork = $tmp[1]; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 3d661690fd3..3e2f4aa44d3 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -96,6 +96,7 @@ ErrorWrongValueForField=Field %s: '%s' does not match regex rule < ErrorHtmlInjectionForField=Field %s: The value '%s' contains a malicious data not allowed ErrorFieldValueNotIn=Field %s: '%s' is not a value found in field %s of %s ErrorFieldRefNotIn=Field %s: '%s' is not a %s existing ref +ErrorMultipleRecordFoundFromRef=Several record found when searching from ref %s. No way to know which ID to use. ErrorsOnXLines=%s errors found ErrorFileIsInfectedWithAVirus=The antivirus program was not able to validate the file (file might be infected by a virus) ErrorSpecialCharNotAllowedForField=Special characters are not allowed for field "%s" From b32ee6320dcf65d9cf56284dc826828d03fca8ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Oct 2022 17:01:18 +0200 Subject: [PATCH 053/176] FIX Search on social networks --- htdocs/contact/list.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 1a2dac09da3..605fafd9e01 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -500,7 +500,15 @@ if (strlen($search_fax)) { if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active'] && strlen($search_[$key])) { - $sql .= " AND p.socialnetworks LIKE '%\"".$key."\":\"".$search_[$key]."%'"; + $searchkeyinjsonformat = preg_replace('/"$/', '', preg_replace('/^"/', '', json_encode($search_[$key]))); + if (in_array($db->type, array('mysql', 'mysqli'))) { + $sql .= " AND p.socialnetworks REGEXP '\"".$db->escapeforlike($db->escape($key))."\":\"[^\"]*".$db->escapeforlike($db->escape($searchkeyinjsonformat))."'"; + } elseif ($db->type == 'pgsql') { + $sql .= " AND p.socialnetworks ~ '\"".$db->escapeforlike($db->escape($key))."\":\"[^\"]*".$db->escapeforlike($db->escape($searchkeyinjsonformat))."'"; + } else { + // Works with all database but not reliable because search only for social network code starting with earched value + $sql .= " AND p.socialnetworks LIKE '%\"".$db->escapeforlike($db->escape($key))."\":\"".$db->escapeforlike($db->escape($searchkeyinjsonformat))."%'"; + } } } } @@ -555,6 +563,7 @@ if ($view == "recent") { } else { $sql .= $db->order($sortfield, $sortorder); } +//print $sql; // Count total nb of records $nbtotalofrecords = ''; From 8d515b9c2f2b206a03b890f248e47e00dd490e5e Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 19 Oct 2022 17:06:20 +0200 Subject: [PATCH 054/176] FIX - php 8 Warning newonlinessign --- htdocs/public/onlinesign/newonlinesign.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 91c3ec2ce73..09d8eccd66f 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -78,6 +78,9 @@ $message = GETPOST('message', 'aZ09'); $suffix = GETPOST("suffix", 'aZ09'); $source = GETPOST("source", 'alpha'); $ref = $REF = GETPOST("ref", 'alpha'); +$urlok = ''; +$urlko = ''; + if (empty($source)) { $source = 'proposal'; From 2eb3b62c8389eed0884d3217d91930f124580bdc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Oct 2022 17:21:42 +0200 Subject: [PATCH 055/176] Fix trans --- htdocs/langs/en_US/languages.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index 78378c6c5d3..b6368a7d374 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -36,6 +36,7 @@ Language_en_SA=English (Saudi Arabia) Language_en_SG=English (Singapore) Language_en_US=English (United States) Language_en_ZA=English (South Africa) +Language_en_ZW=English (Zimbabwe) Language_es_ES=Spanish Language_es_AR=Spanish (Argentina) Language_es_BO=Spanish (Bolivia) From e507eac37d75572bb0409053fd4adeb851b08303 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Oct 2022 17:35:40 +0200 Subject: [PATCH 056/176] Fix consistency of test --- htdocs/accountancy/admin/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index e70bc39bfd0..9eabd378e11 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -85,7 +85,7 @@ if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) { // Clean code // To manage zero or not at the end of the accounting account - if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1) { + if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { $account_number = $account_number; } else { $account_number = clean_account($account_number); @@ -148,7 +148,7 @@ if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) { // Clean code // To manage zero or not at the end of the accounting account - if (isset($conf->global->ACCOUNTING_MANAGE_ZERO) && $conf->global->ACCOUNTING_MANAGE_ZERO == 1) { + if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { $account_number = $account_number; } else { $account_number = clean_account($account_number); From 39daea97551b4fda3769db4755658d96f3120463 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Oct 2022 17:43:36 +0200 Subject: [PATCH 057/176] Exclude .git dir fom package generation --- build/makepack-dolibarrmodule.pl | 1 + htdocs/modulebuilder/index.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build/makepack-dolibarrmodule.pl b/build/makepack-dolibarrmodule.pl index 4a9a217b570..8fbb28dc35f 100755 --- a/build/makepack-dolibarrmodule.pl +++ b/build/makepack-dolibarrmodule.pl @@ -293,6 +293,7 @@ foreach my $PROJECT (@PROJECTLIST) { } print "Clean $BUILDROOT\n"; $ret=`rm -fr $BUILDROOT/$PROJECTLC/.cache`; + $ret=`rm -fr $BUILDROOT/$PROJECTLC/.git`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/.project`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/.settings`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/index.php`; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index e247b5fabb5..705dc202932 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1780,7 +1780,7 @@ if ($dirins && $action == 'generatepackage') { dol_mkdir($dirofmodule); } // Note: We exclude /bin/ to not include the already generated zip - $result = dol_compress_dir($dir, $outputfilezip, 'zip', '/\/bin\//', $modulelowercase); + $result = dol_compress_dir($dir, $outputfilezip, 'zip', '/\/bin\/|\.git/', $modulelowercase); } else { $result = -1; } From 92d556caf26ee0dc10bc5de60194db5596c0d9dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Oct 2022 17:53:06 +0200 Subject: [PATCH 058/176] Fix phpunit --- test/phpunit/CodingSqlTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/CodingSqlTest.php b/test/phpunit/CodingSqlTest.php index 96ae1f61ab0..582d22d30cc 100644 --- a/test/phpunit/CodingSqlTest.php +++ b/test/phpunit/CodingSqlTest.php @@ -193,7 +193,7 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase $result=strpos($filecontent, '"'); if ($result) { - $result=(! strpos($filecontent, '["') && ! strpos($filecontent, '{"')); + $result=(! strpos($filecontent, '["') && ! strpos($filecontent, '{"') && ! strpos($filecontent, '("')); } //print __METHOD__." Result for checking we don't have double quote = ".$result."\n"; $this->assertTrue($result===false, 'Found double quote that is not [" neither {" (used for json content) into '.$file.'. Bad.'); From 01abfe538f576bdc6092327ddf21c76d7086d2cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Oct 2022 17:54:20 +0200 Subject: [PATCH 059/176] Doc --- test/phpunit/CodingSqlTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/CodingSqlTest.php b/test/phpunit/CodingSqlTest.php index 582d22d30cc..9a1490caeb2 100644 --- a/test/phpunit/CodingSqlTest.php +++ b/test/phpunit/CodingSqlTest.php @@ -196,7 +196,7 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase $result=(! strpos($filecontent, '["') && ! strpos($filecontent, '{"') && ! strpos($filecontent, '("')); } //print __METHOD__." Result for checking we don't have double quote = ".$result."\n"; - $this->assertTrue($result===false, 'Found double quote that is not [" neither {" (used for json content) into '.$file.'. Bad.'); + $this->assertTrue($result===false, 'Found double quote that is not [" neither {" (used for json content) neither (" (used for content with string like isModEnabled("")) into '.$file.'. Bad.'); $result=strpos($filecontent, 'int('); //print __METHOD__." Result for checking we don't have 'int(' instead of 'integer' = ".$result."\n"; From ba855257950c441fb7a692e3a4e8472622955d81 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Oct 2022 17:55:50 +0200 Subject: [PATCH 060/176] Fix missing $user --- htdocs/core/modules/modEventOrganization.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index 9ad2ede9b77..437fa691713 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -327,7 +327,7 @@ class modEventOrganization extends DolibarrModules */ public function init($options = '') { - global $conf, $langs; + global $conf, $langs, $user; // Permissions $this->remove($options); From 2670c2f33f6c6b7a0f1ab085503f7c531dd17d59 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Oct 2022 18:48:43 +0200 Subject: [PATCH 061/176] NEW On a bank reconciled line, we can modify the bank receipt --- htdocs/compta/bank/line.php | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 49edf3c3a1a..cb10a7310c6 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -657,13 +657,13 @@ if ($result) { if ($user->rights->banque->consolidate) { print ''; if ($objp->rappro) { - print 'rappro ? ' disabled' : '').'>'; - print ''; + print 'rappro ? ' disabled' : '').'>'; + print ''; } else { - print 'rappro ? ' disabled' : '').'>'; + print 'rappro ? ' disabled' : '').'>'; } if ($objp->num_releve) { - print '   ('.$langs->trans("AccountStatement").' '.$objp->num_releve.')'; + print '   ('.$langs->trans("AccountStatement").' '.$objp->num_releve.')'; } print ''; } else { @@ -675,6 +675,28 @@ if ($result) { if ($user->rights->banque->consolidate) { print ''; print 'rappro ? ' checked="checked"' : '')).'">'; + + print ' + + '; + print ''; } else { print ''.yn($objp->rappro).''; From d9aaf3e4d36461fb5547c6b4c04b08906bc42237 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Wed, 19 Oct 2022 22:02:04 +0200 Subject: [PATCH 062/176] ajax.php Add price --- htdocs/takepos/ajax/ajax.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index 1ee27c51f8b..671ef27ba96 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -84,6 +84,7 @@ if ($action == 'getProducts') { } unset($prod->fields); unset($prod->db); + $prod->price_formated=price(price2num($prod->price, 'MU'), 1, $langs, 1, -1, -1, $conf->currency); $res[] = $prod; } } @@ -301,7 +302,7 @@ if ($action == 'getProducts') { 'object' => 'product', 'img' => $ig, 'qty' => 1, - //'price_formated' => price(price2num($obj->price, 'MU'), 1, $langs, 1, -1, -1, $conf->currency) + 'price_formated' => price(price2num($obj->price, 'MU'), 1, $langs, 1, -1, -1, $conf->currency) ); // Add entries to row from hooks $parameters=array(); From bdc979eaadfe75c46f727e5643a557424456960b Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Wed, 19 Oct 2022 22:03:26 +0200 Subject: [PATCH 063/176] pos.css.php Add price --- htdocs/takepos/css/pos.css.php | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index ed968ea6f4e..f4a130dc5f1 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -826,10 +826,6 @@ div#moreinfo, div#infowarehouse { clear: both; } -.div5 .price { - display: none; -} - .div5 .imgadd { display: none; } @@ -925,18 +921,12 @@ div#moreinfo, div#infowarehouse { .div5 .arrow .centerinmiddle { transform: translate(0, 0); } - - .div5 .price { - font-size: 14px; - margin-left: auto; - margin-right: 30px; - padding-right: 10px; - font-weight: bold; - color: #ff6d6d; - display: flex; - } .div5 .imgadd { display: flex; } + + div.wrapper2{ + height:10%; + } } \ No newline at end of file From 6b1e4dbf6b83c3c34065f381118edd092ccc4364 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Wed, 19 Oct 2022 22:05:01 +0200 Subject: [PATCH 064/176] Index Add price --- htdocs/takepos/index.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 7443c380b9a..8be5a97e465 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -1375,9 +1375,6 @@ if (!empty($conf->global->TAKEPOS_WEIGHING_SCALE)) {
-
-
-
...
From 3362fec9e2fc7778786c99638aa913b8e3500409 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 11:44:22 +0200 Subject: [PATCH 065/176] Fix log --- htdocs/core/login/functions_ldap.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index cd4ed16eae6..0d4f19d1a3f 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -94,9 +94,9 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) if ($ldapdebug) { dol_syslog("functions_ldap::check_user_password_ldap Server:".join(',', $ldap->server).", Port:".$ldap->serverPort.", Protocol:".$ldap->ldapProtocolVersion.", Type:".$ldap->serverType); - dol_syslog("functions_ldap::check_user_password_ldap uid/samacountname=".$ldapuserattr.", dn=".$ldapdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword); + dol_syslog("functions_ldap::check_user_password_ldap uid/samaccountname=".$ldapuserattr.", dn=".$ldapdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword); print "DEBUG: Server:".join(',', $ldap->server).", Port:".$ldap->serverPort.", Protocol:".$ldap->ldapProtocolVersion.", Type:".$ldap->serverType."
\n"; - print "DEBUG: uid/samacountname=".$ldapuserattr.", dn=".$ldapdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword."
\n"; + print "DEBUG: uid/samaccountname=".$ldapuserattr.", dn=".$ldapdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword."
\n"; } $resultFetchLdapUser = 0; From e3435bc301523f63b22f2dfbcca633d805c79216 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 12:14:11 +0200 Subject: [PATCH 066/176] Add debug for ldap --- htdocs/core/class/ldap.class.php | 22 ++++++++++++++++++++-- htdocs/core/login/functions_ldap.php | 6 +++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 4f77cfbaae5..426dec37962 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -193,12 +193,20 @@ class Ldap { // phpcs:enable global $conf; + global $dolibarr_main_auth_ldap_debug; $connected = 0; $this->bind = 0; $this->error = 0; $this->connectedServer = ''; + $ldapdebug = ((empty($dolibarr_main_auth_ldap_debug) || $dolibarr_main_auth_ldap_debug == "false") ? false : true); + + if ($ldapdebug) { + dol_syslog(get_class($this)."::connect_bind"); + print "DEBUG: connect_bind
\n"; + } + // Check parameters if (count($this->server) == 0 || empty($this->server[0])) { $this->error = 'LDAP setup (file conf.php) is not complete'; @@ -223,18 +231,28 @@ class Ldap } if ($this->serverPing($host, $this->serverPort) === true) { + if ($ldapdebug) { + dol_syslog(get_class($this)."::connect_bind serverPing true, we try ldap_connect to ".$host); + } $this->connection = ldap_connect($host, $this->serverPort); } else { if (preg_match('/^ldaps/i', $host)) { // With host = ldaps://server, the serverPing to ssl://server sometimes fails, even if the ldap_connect succeed, so - // we test this case and continue in suche a case even if serverPing fails. + // we test this case and continue in such a case even if serverPing fails. + if ($ldapdebug) { + dol_syslog(get_class($this)."::connect_bind serverPing false, we try ldap_connect to ".$host); + } $this->connection = ldap_connect($host, $this->serverPort); } else { continue; } } - if (is_resource($this->connection) || is_object($this->connection)) { + if (is_resource($this->connection) || is_object($this->connection)) { + if ($ldapdebug) { + dol_syslog(get_class($this)."::connect_bind this->connection is ok", LOG_DEBUG); + } + // Upgrade connexion to TLS, if requested by the configuration if (!empty($conf->global->LDAP_SERVER_USE_TLS)) { // For test/debug diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index 0d4f19d1a3f..faf0024d801 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -77,7 +77,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) $ldapdn = $dolibarr_main_auth_ldap_dn; $ldapadminlogin = $dolibarr_main_auth_ldap_admin_login; $ldapadminpass = $dolibarr_main_auth_ldap_admin_pass; - $ldapdebug = (empty($dolibarr_main_auth_ldap_debug) || $dolibarr_main_auth_ldap_debug == "false" ? false : true); + $ldapdebug = ((empty($dolibarr_main_auth_ldap_debug) || $dolibarr_main_auth_ldap_debug == "false") ? false : true); if ($ldapdebug) { print "DEBUG: Logging LDAP steps
\n"; @@ -94,9 +94,9 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) if ($ldapdebug) { dol_syslog("functions_ldap::check_user_password_ldap Server:".join(',', $ldap->server).", Port:".$ldap->serverPort.", Protocol:".$ldap->ldapProtocolVersion.", Type:".$ldap->serverType); - dol_syslog("functions_ldap::check_user_password_ldap uid/samaccountname=".$ldapuserattr.", dn=".$ldapdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword); + dol_syslog("functions_ldap::check_user_password_ldap uid/samaccountname=".$ldapuserattr.", dn=".$ldapdn.", Admin:".$ldap->searchUser.", Pass:".dol_trunc($ldap->searchPassword, 3)); print "DEBUG: Server:".join(',', $ldap->server).", Port:".$ldap->serverPort.", Protocol:".$ldap->ldapProtocolVersion.", Type:".$ldap->serverType."
\n"; - print "DEBUG: uid/samaccountname=".$ldapuserattr.", dn=".$ldapdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword."
\n"; + print "DEBUG: uid/samaccountname=".$ldapuserattr.", dn=".$ldapdn.", Admin:".$ldap->searchUser.", Pass:".dol_trunc($ldap->searchPassword, 3)."
\n"; } $resultFetchLdapUser = 0; From 69ca6c02d7156e28cfd788219a2fdc9a9a71d169 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 12:14:11 +0200 Subject: [PATCH 067/176] Add debug for ldap --- htdocs/core/class/ldap.class.php | 22 ++++++++++++++++++++-- htdocs/core/login/functions_ldap.php | 6 +++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 83e3adeda93..7b3c6c4ac2c 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -193,12 +193,20 @@ class Ldap { // phpcs:enable global $conf; + global $dolibarr_main_auth_ldap_debug; $connected = 0; $this->bind = 0; $this->error = 0; $this->connectedServer = ''; + $ldapdebug = ((empty($dolibarr_main_auth_ldap_debug) || $dolibarr_main_auth_ldap_debug == "false") ? false : true); + + if ($ldapdebug) { + dol_syslog(get_class($this)."::connect_bind"); + print "DEBUG: connect_bind
\n"; + } + // Check parameters if (count($this->server) == 0 || empty($this->server[0])) { $this->error = 'LDAP setup (file conf.php) is not complete'; @@ -223,18 +231,28 @@ class Ldap } if ($this->serverPing($host, $this->serverPort) === true) { + if ($ldapdebug) { + dol_syslog(get_class($this)."::connect_bind serverPing true, we try ldap_connect to ".$host); + } $this->connection = ldap_connect($host, $this->serverPort); } else { if (preg_match('/^ldaps/i', $host)) { // With host = ldaps://server, the serverPing to ssl://server sometimes fails, even if the ldap_connect succeed, so - // we test this case and continue in suche a case even if serverPing fails. + // we test this case and continue in such a case even if serverPing fails. + if ($ldapdebug) { + dol_syslog(get_class($this)."::connect_bind serverPing false, we try ldap_connect to ".$host); + } $this->connection = ldap_connect($host, $this->serverPort); } else { continue; } } - if (is_resource($this->connection) || is_object($this->connection)) { + if (is_resource($this->connection) || is_object($this->connection)) { + if ($ldapdebug) { + dol_syslog(get_class($this)."::connect_bind this->connection is ok", LOG_DEBUG); + } + // Upgrade connexion to TLS, if requested by the configuration if (!empty($conf->global->LDAP_SERVER_USE_TLS)) { // For test/debug diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index 3f217573b18..68ad25168f0 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -77,7 +77,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) $ldapdn = $dolibarr_main_auth_ldap_dn; $ldapadminlogin = $dolibarr_main_auth_ldap_admin_login; $ldapadminpass = $dolibarr_main_auth_ldap_admin_pass; - $ldapdebug = (empty($dolibarr_main_auth_ldap_debug) || $dolibarr_main_auth_ldap_debug == "false" ? false : true); + $ldapdebug = ((empty($dolibarr_main_auth_ldap_debug) || $dolibarr_main_auth_ldap_debug == "false") ? false : true); if ($ldapdebug) { print "DEBUG: Logging LDAP steps
\n"; @@ -94,9 +94,9 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) if ($ldapdebug) { dol_syslog("functions_ldap::check_user_password_ldap Server:".join(',', $ldap->server).", Port:".$ldap->serverPort.", Protocol:".$ldap->ldapProtocolVersion.", Type:".$ldap->serverType); - dol_syslog("functions_ldap::check_user_password_ldap uid/samacountname=".$ldapuserattr.", dn=".$ldapdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword); + dol_syslog("functions_ldap::check_user_password_ldap uid/samaccountname=".$ldapuserattr.", dn=".$ldapdn.", Admin:".$ldap->searchUser.", Pass:".dol_trunc($ldap->searchPassword, 3)); print "DEBUG: Server:".join(',', $ldap->server).", Port:".$ldap->serverPort.", Protocol:".$ldap->ldapProtocolVersion.", Type:".$ldap->serverType."
\n"; - print "DEBUG: uid/samacountname=".$ldapuserattr.", dn=".$ldapdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword."
\n"; + print "DEBUG: uid/samaccountname=".$ldapuserattr.", dn=".$ldapdn.", Admin:".$ldap->searchUser.", Pass:".dol_trunc($ldap->searchPassword, 3)."
\n"; } $resultFetchLdapUser = 0; From 11ef2517e972ade70d578d66114ad4e525eb52d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 20 Oct 2022 12:30:10 +0200 Subject: [PATCH 068/176] add extrafields count badge --- htdocs/core/lib/fichinter.lib.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index eaa1f85d142..87c9ce4a3fc 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -139,7 +139,11 @@ function fichinter_prepare_head($object) */ function fichinter_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('fichinter'); + $extrafields->fetch_name_optionals_label('fichinterdet'); $h = 0; $head = array(); @@ -159,19 +163,25 @@ function fichinter_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/fichinter/admin/fichinter_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['fichinter']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; $head[$h][0] = DOL_URL_ROOT.'/fichinter/admin/fichinterdet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); + $nbExtrafields = $extrafields->attributes['fichinterdet']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributesdet'; $h++; - - complete_head_from_modules($conf, $langs, null, $head, $h, 'fichinter_admin', 'remove'); - return $head; + return $head; } /** From 01eb097e5edfe2e36435c401cde6db141246dc8c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 12:48:06 +0200 Subject: [PATCH 069/176] Doc --- dev/examples/ldap/ldapsearch_sample1.txt | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/dev/examples/ldap/ldapsearch_sample1.txt b/dev/examples/ldap/ldapsearch_sample1.txt index a02ad632cd0..2a30f19ab22 100644 --- a/dev/examples/ldap/ldapsearch_sample1.txt +++ b/dev/examples/ldap/ldapsearch_sample1.txt @@ -1,28 +1,29 @@ # ldapsearch_sample1.txt # ldapsearch is into package ldap-utils on debian. # -# Use this sample to search into a ldap +# Use this samples to test a ldap_bind or to make a search into a ldap # # Anonymous access -# ldapsearch -h hostname -p 389 +# ldapsearch -h hostname -p 389 # # Login access (using a Bind DN) -# ldapsearch -h hostname -p 389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -# ldapsearch -H ldap://hostname:389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -# ldapsearch -d1 -H ldap://hostname:389 -x -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -# ldapsearch -H ldap://hostname:389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password +# Such access must succeed to use LDAP as login module. +# ldapsearch -h hostname -p 389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password +# ldapsearch -H ldap://hostname:389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password +# ldapsearch -d1 -H ldap://hostname:389 -x -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password +# ldapsearch -H ldap://hostname:389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password # # Login access in SSL (using a Bind DN) -# ldapsearch -H ldaps://hostnamme:636 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -b "cn=users,dc=ldap,dc=test,dc=local +# ldapsearch -H ldaps://hostnamme:636 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -b "cn=users,dc=ldap,dc=test,dc=local" # If it fails, you may try to use "hostname" that is real name of certificate. # You must also check that /etc/ldap/ldap.conf contains the line TLS_CACERT /etc/ssl/certs/ca-certificates.crt # What to search -# ldapsearch -h hostname -p 389 -x -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -b "cn=users,dc=ldap,dc=test,dc=local" -# ldapsearch -h hostname -p 389 -x -D "cn=manager,o=somecompany.com" -w password -b "ou=people,dc=teclib,dc=infra" -# ldapsearch -h hostname -p 389 -x -D "cn=manager,o=somecompany.com" -w password -b "o=somecompany.com" "(objectclass=*)" +# ldapsearch -h hostname -p 389 -x -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -b "cn=users,dc=ldap,dc=test,dc=local" +# ldapsearch -h hostname -p 389 -x -D "cn=manager,o=somecompany.com" -w password -b "ou=people,dc=teclib,dc=infra" +# ldapsearch -h hostname -p 389 -x -D "cn=manager,o=somecompany.com" -w password -b "o=somecompany.com" "(objectclass=*)" # # Example to test a ldap search: -# ldapsearch -h hostname -p 389 -x -z 5 -b 'OU=Collaborateurs,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -D 'CN=UserAdmin,OU=Informatique,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -w password +# ldapsearch -h hostname -p 389 -x -z 5 -b 'OU=Collaborateurs,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -D 'CN=UserAdmin,OU=Informatique,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -w password From 36fd3f78167670d1b9cbec860bf93747a14cae86 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 13:11:46 +0200 Subject: [PATCH 070/176] Fix top_httphead method not found --- htdocs/core/ajax/selectsearchbox.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 5d47aeff430..f2e44577260 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -21,12 +21,9 @@ * \brief This script returns content of possible search */ - // This script is called with a POST method or as an include. if (!isset($usedbyinclude) || empty($usedbyinclude)) { - top_httphead('application/json'); - if (!defined('NOTOKENRENEWAL')) { define('NOTOKENRENEWAL', 1); // Disables token renewal } @@ -45,6 +42,9 @@ if (!isset($usedbyinclude) || empty($usedbyinclude)) { } $res = @include '../../main.inc.php'; + + top_httphead('application/json'); + if ($res == 'ERROR_NOT_LOGGED') { $langs->load("other"); $arrayresult['jumptologin'] = array('img'=>'object_generic', 'label'=>$langs->trans("JumpToLogin"), 'text'=>' '.$langs->trans("JumpToLogin"), 'url'=>DOL_URL_ROOT.'/index.php'); From ae845fccc5f006466d66bc0b1be7ceb157936cce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 13:40:46 +0200 Subject: [PATCH 071/176] Clean code --- htdocs/public/recruitment/view.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index 24c0eaf6088..57cb82d9b08 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -94,7 +94,7 @@ if ($cancel) { $action = 'view'; } -if ($action == "view" || $action == "presend" || $action == "close" || $action == "confirm_public_close" || $action == "add_message") { +if ($action == "view" || $action == "presend" || $action == "dosubmit") { $error = 0; $display_ticket = false; if (!strlen($ref)) { @@ -119,11 +119,11 @@ if ($action == "view" || $action == "presend" || $action == "close" || $action = } /* - if (!$error && $action == "add_message" && $display_ticket && GETPOSTISSET('btn_add_message')) + if (!$error && $action == "dosubmit") { - // TODO Add message... - $ret = $object->newMessage($user, $action, 0, 1); + // Test MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS + // TODO Create job application @@ -136,7 +136,7 @@ if ($action == "view" || $action == "presend" || $action == "close" || $action = if ($error || $errors) { setEventMessages($object->error, $object->errors, 'errors'); - if ($action == "add_message") { + if ($action == "dosubmit") { $action = 'presend'; } else { $action = ''; @@ -185,7 +185,7 @@ print ''."\n"; print '
'."\n"; print '
'."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; From eb4a260fca948fae4c780b43c18a15913d2699c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20N=C3=BA=C3=B1ez?= Date: Thu, 20 Oct 2022 13:52:51 +0200 Subject: [PATCH 072/176] NEW: Add option FICHINTER_ALLOW_EXTERNAL_DOWNLOAD --- htdocs/core/class/commonobject.class.php | 3 +++ htdocs/core/lib/functions.lib.php | 11 +++++++++++ htdocs/fichinter/card.php | 8 +++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a198d74f808..7d1c1295cb6 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5611,6 +5611,9 @@ abstract class CommonObject if ($this->element == 'contrat' && !empty($conf->global->CONTRACT_ALLOW_EXTERNAL_DOWNLOAD)) { $setsharekey = true; } + if ($this->element == 'fichinter' && !empty($conf->global->FICHINTER_ALLOW_EXTERNAL_DOWNLOAD)) { + $setsharekey = true; + } if ($this->element == 'supplier_proposal' && !empty($conf->global->SUPPLIER_PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD)) { $setsharekey = true; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6c278f4764d..e8537b03391 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7782,6 +7782,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if (is_object($object) && $object->element == 'contrat') { $typeforonlinepayment = 'contract'; } + if (is_object($object) && $object->element == 'fichinter') { + $typeforonlinepayment = 'ficheinter'; + } $url = getOnlinePaymentUrl(0, $typeforonlinepayment, $substitutionarray['__REF__']); $paymenturl = $url; } @@ -7814,6 +7817,11 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, } else { $substitutionarray['__DIRECTDOWNLOAD_URL_CONTRACT__'] = ''; } + if (!empty($conf->global->FICHINTER_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'fichinter') { + $substitutionarray['__DIRECTDOWNLOAD_URL_FICHINTER__'] = $object->getLastMainDocLink($object->element); + } else { + $substitutionarray['__DIRECTDOWNLOAD_URL_FICHINTER__'] = ''; + } if (!empty($conf->global->SUPPLIER_PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'supplier_proposal') { $substitutionarray['__DIRECTDOWNLOAD_URL_SUPPLIER_PROPOSAL__'] = $object->getLastMainDocLink($object->element); } else { @@ -7832,6 +7840,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if (is_object($object) && $object->element == 'contrat') { $substitutionarray['__URL_CONTRACT__'] = DOL_MAIN_URL_ROOT."/contrat/card.php?id=".$object->id; } + if (is_object($object) && $object->element == 'fichinter') { + $substitutionarray['__URL_FICHINTER__'] = DOL_MAIN_URL_ROOT."/fichinter/card.php?id=".$object->id; + } if (is_object($object) && $object->element == 'supplier_proposal') { $substitutionarray['__URL_SUPPLIER_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/supplier_proposal/card.php?id=".$object->id; } diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index cef3f737c53..ff8492f6d14 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1713,7 +1713,13 @@ if ($action == 'create') { $linktoelem = $form->showLinkToObjectBlock($object, null, array('fichinter')); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); - + //Show direct download link + if ($object->statut != Fichinter::STATUS_DRAFT && !empty($conf->global->FICHINTER_ALLOW_EXTERNAL_DOWNLOAD)) + { + print '
'."\n"; + print showDirectDownloadLink($object).'
'; + } + print '
'; // List of actions on element From 2aea86dc8c3b21cb65d5aa23622640615da44063 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 13:58:59 +0200 Subject: [PATCH 073/176] FIX #yogosha12673 --- htdocs/langs/en_US/users.lang | 2 +- htdocs/user/passwordforgotten.php | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index c6b5c2fe106..3f2c7f5f53a 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -47,7 +47,7 @@ RemoveFromGroup=Remove from group PasswordChangedAndSentTo=Password changed and sent to %s. PasswordChangeRequest=Request to change password for %s PasswordChangeRequestSent=Request to change password for %s sent to %s. -IfLoginExistPasswordRequestSent=If this login is a valid account, an email to reset password has been sent. +IfLoginExistPasswordRequestSent=If this login is a valid account (with a valid email), an email to reset password has been sent. IfEmailExistPasswordRequestSent=If this email is a valid account, an email to reset password has been sent. ConfirmPasswordReset=Confirm password reset MenuUsersAndGroups=Users & Groups diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index eee3816ca67..30c5da0b2af 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -139,7 +139,12 @@ if (empty($reshook)) { $username = ''; } else { if (!$edituser->email) { - $message = '
'.$langs->trans("ErrorLoginHasNoEmail").'
'; + //$message = '
'.$langs->trans("ErrorLoginHasNoEmail").'
'; + if (!$isanemail) { + $message .= $langs->trans("IfLoginExistPasswordRequestSent"); + } else { + $message .= $langs->trans("IfEmailExistPasswordRequestSent"); + } } else { $newpassword = $edituser->setPassword($user, '', 1); if ($newpassword < 0) { From 57ca1e9e3ca9f29aa73e051a7fb0e562c34445be Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 20 Oct 2022 12:02:06 +0000 Subject: [PATCH 074/176] Fixing style errors. --- htdocs/fichinter/card.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index ff8492f6d14..384049ab92a 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1714,12 +1714,11 @@ if ($action == 'create') { $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); //Show direct download link - if ($object->statut != Fichinter::STATUS_DRAFT && !empty($conf->global->FICHINTER_ALLOW_EXTERNAL_DOWNLOAD)) - { + if ($object->statut != Fichinter::STATUS_DRAFT && !empty($conf->global->FICHINTER_ALLOW_EXTERNAL_DOWNLOAD)) { print '
'."\n"; print showDirectDownloadLink($object).'
'; } - + print '
'; // List of actions on element From dc85e0df88e64ef0a0d841e68258a7af3505d9e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 15:08:23 +0200 Subject: [PATCH 075/176] Fix #yogosha12949 --- htdocs/core/class/utils.class.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index d67bee7abac..f5c33bac652 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -354,6 +354,8 @@ class Utils $handle = ''; + // If $lowmemorydump is set, it means we want to make the compression using an external pipe instead retreiving the + // content of the dump in PHP memory array $output_arr and then print it into the PHP pipe open with xopen(). $lowmemorydump = GETPOSTISSET("lowmemorydump") ? GETPOST("lowmemorydump") : getDolGlobalString('MAIN_LOW_MEMORY_DUMP'); // Start call method to execute dump @@ -371,22 +373,22 @@ class Utils } } else { if ($compression == 'none') { - $fullcommandclear .= " > ".$outputfile; - $fullcommandcrypted .= " > ".$outputfile; + $fullcommandclear .= " > ".dol_sanitizePathName($outputfile); + $fullcommandcrypted .= " > ".dol_sanitizePathName($outputfile); $handle = 1; } elseif ($compression == 'gz') { - $fullcommandclear .= " | gzip > ".$outputfile; - $fullcommandcrypted .= " | gzip > ".$outputfile; + $fullcommandclear .= " | gzip > ".dol_sanitizePathName($outputfile); + $fullcommandcrypted .= " | gzip > ".dol_sanitizePathName($outputfile); $paramcrypted.=" | gzip"; $handle = 1; } elseif ($compression == 'bz') { - $fullcommandclear .= " | bzip2 > ".$outputfile; - $fullcommandcrypted .= " | bzip2 > ".$outputfile; + $fullcommandclear .= " | bzip2 > ".dol_sanitizePathName($outputfile); + $fullcommandcrypted .= " | bzip2 > ".dol_sanitizePathName($outputfile); $paramcrypted.=" | bzip2"; $handle = 1; } elseif ($compression == 'zstd') { - $fullcommandclear .= " | zstd > ".$outputfile; - $fullcommandcrypted .= " | zstd > ".$outputfile; + $fullcommandclear .= " | zstd > ".dol_sanitizePathName($outputfile); + $fullcommandcrypted .= " | zstd > ".dol_sanitizePathName($outputfile); $paramcrypted.=" | zstd"; $handle = 1; } @@ -411,8 +413,8 @@ class Utils } - // TODO Replace with executeCLI function but - // we must first introduce a low memory mode + // TODO Replace with Utils->executeCLI() function but + // we must first introduce the variant with $lowmemorydump into this method. if ($execmethod == 1) { $output_arr = array(); $retval = null; From 0fc3b99a06298f8ddde0b4ce5d8436264d59f619 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 15:11:07 +0200 Subject: [PATCH 076/176] css --- htdocs/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/index.php b/htdocs/index.php index c8c1a234f02..61a7d7f6d81 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -127,7 +127,7 @@ if ($user->admin && empty($conf->global->MAIN_REMOVE_INSTALL_WARNING)) { } if ($message) { - print $message; + print $message.'
'; //$message.='
'; //print info_admin($langs->trans("WarningUntilDirRemoved",DOL_DOCUMENT_ROOT."/install")); } From 510125ceb06ef904ed1906ba2e452a879fe19531 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 15:47:44 +0200 Subject: [PATCH 077/176] Fix sanitize data --- htdocs/admin/tools/dolibarr_export.php | 4 +-- htdocs/admin/tools/export.php | 2 +- htdocs/core/class/utils.class.php | 44 ++++++++++++++------------ htdocs/core/lib/functions.lib.php | 2 ++ htdocs/langs/en_US/admin.lang | 2 +- 5 files changed, 30 insertions(+), 24 deletions(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 779db36fb2f..d01efa0ea5b 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -212,10 +212,10 @@ function hideoptions(){ if (div.style.display === "none") { div.style.display = "block"; - lnk.innerText="'.$langs->trans("HideAdvancedoptions").'"; + lnk.innerText="'.dol_escape_js($langs->transnoentitiesnoconv("HideAdvancedoptions")).'"; } else { div.style.display = "none"; - lnk.innerText="'.$langs->trans("ShowAdvancedOptions").'..."; + lnk.innerText="'.dol_escape_js($langs->transnoentitiesnoconv("ShowAdvancedOptions")).'..."; } } '; diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 8299e2198ee..8e7643ffc5d 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -35,7 +35,7 @@ $langs->load("admin"); $action = GETPOST('action', 'aZ09'); $what = GETPOST('what', 'alpha'); $export_type = GETPOST('export_type', 'alpha'); -$file = GETPOST('filename_template', 'alpha'); +$file = dol_sanitizeFileName(GETPOST('filename_template', 'alpha')); // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index f5c33bac652..3ab8ff836bf 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -215,6 +215,9 @@ class Utils dol_syslog("Utils::dumpDatabase type=".$type." compression=".$compression." file=".$file, LOG_DEBUG); require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + // Clean data + $file = dol_sanitizeFileName($file); + // Check compression parameter if (!in_array($compression, array('none', 'gz', 'bz', 'zip', 'zstd'))) { $langs->load("errors"); @@ -373,23 +376,23 @@ class Utils } } else { if ($compression == 'none') { - $fullcommandclear .= " > ".dol_sanitizePathName($outputfile); - $fullcommandcrypted .= " > ".dol_sanitizePathName($outputfile); + $fullcommandclear .= ' > "'.dol_sanitizePathName($outputfile).'"'; + $fullcommandcrypted .= ' > "'.dol_sanitizePathName($outputfile).'"'; $handle = 1; } elseif ($compression == 'gz') { - $fullcommandclear .= " | gzip > ".dol_sanitizePathName($outputfile); - $fullcommandcrypted .= " | gzip > ".dol_sanitizePathName($outputfile); - $paramcrypted.=" | gzip"; + $fullcommandclear .= ' | gzip > "'.dol_sanitizePathName($outputfile).'"'; + $fullcommandcrypted .= ' | gzip > "'.dol_sanitizePathName($outputfile).'"'; + $paramcrypted .= ' | gzip'; $handle = 1; } elseif ($compression == 'bz') { - $fullcommandclear .= " | bzip2 > ".dol_sanitizePathName($outputfile); - $fullcommandcrypted .= " | bzip2 > ".dol_sanitizePathName($outputfile); - $paramcrypted.=" | bzip2"; + $fullcommandclear .= ' | bzip2 > "'.dol_sanitizePathName($outputfile).'"'; + $fullcommandcrypted .= ' | bzip2 > "'.dol_sanitizePathName($outputfile).'"'; + $paramcrypted .= ' | bzip2'; $handle = 1; } elseif ($compression == 'zstd') { - $fullcommandclear .= " | zstd > ".dol_sanitizePathName($outputfile); - $fullcommandcrypted .= " | zstd > ".dol_sanitizePathName($outputfile); - $paramcrypted.=" | zstd"; + $fullcommandclear .= ' | zstd > "'.dol_sanitizePathName($outputfile).'"'; + $fullcommandcrypted .= ' | zstd > "'.dol_sanitizePathName($outputfile).'"'; + $paramcrypted .= ' | zstd'; $handle = 1; } } @@ -473,15 +476,16 @@ class Utils } } - - if ($compression == 'none') { - fclose($handle); - } elseif ($compression == 'gz') { - gzclose($handle); - } elseif ($compression == 'bz') { - bzclose($handle); - } elseif ($compression == 'zstd') { - fclose($handle); + if (!$lowmemorydump) { + if ($compression == 'none') { + fclose($handle); + } elseif ($compression == 'gz') { + gzclose($handle); + } elseif ($compression == 'bz') { + bzclose($handle); + } elseif ($compression == 'zstd') { + fclose($handle); + } } if (!empty($conf->global->MAIN_UMASK)) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6c278f4764d..f026d58e2de 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1233,6 +1233,7 @@ function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1) $tmp = dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars); $tmp = preg_replace('/\-\-+/', '_', $tmp); $tmp = preg_replace('/\s+\-([^\s])/', ' _$1', $tmp); + $tmp = preg_replace('/\s+\-$/', '', $tmp); $tmp = str_replace('..', '', $tmp); return $tmp; } @@ -1257,6 +1258,7 @@ function dol_sanitizePathName($str, $newstr = '_', $unaccent = 1) $tmp = dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars); $tmp = preg_replace('/\-\-+/', '_', $tmp); $tmp = preg_replace('/\s+\-([^\s])/', ' _$1', $tmp); + $tmp = preg_replace('/\s+\-$/', '', $tmp); $tmp = str_replace('..', '', $tmp); return $tmp; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index ba92fc4f8a1..fc793a1f465 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2270,7 +2270,7 @@ LateWarningAfter="Late" warning after TemplateforBusinessCards=Template for a business card in different size InventorySetup= Inventory Setup ExportUseLowMemoryMode=Use a low memory mode -ExportUseLowMemoryModeHelp=Use the low memory mode to execute the exec of the dump (compression is done through a pipe instead of into the PHP memory). This method does not allow to check that file is completed and error message can't be reported if it fails. +ExportUseLowMemoryModeHelp=Use the low memory mode to generate the dump file (compression is done through a pipe instead of into the PHP memory). This method does not allow to check that the file is complete and error message can't be reported if it fails. Use it if you experience not enough memory errors. ModuleWebhookName = Webhook ModuleWebhookDesc = Interface to catch dolibarr triggers and send it to an URL From fea4cf4305e7942ff544318a3ed4941405ca330b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 16:05:37 +0200 Subject: [PATCH 078/176] trans --- htdocs/langs/en_US/admin.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index fc793a1f465..a78c19f5dd9 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -646,9 +646,9 @@ Module2400Name=Events/Agenda Module2400Desc=Track events. Log automatic events for tracking purposes or record manual events or meetings. This is the principal module for good Customer or Vendor Relationship Management. Module2500Name=DMS / ECM Module2500Desc=Document Management System / Electronic Content Management. Automatic organization of your generated or stored documents. Share them when you need. -Module2600Name=API/Web services (SOAP server) +Module2600Name=API / Web services (SOAP server) Module2600Desc=Enable the Dolibarr SOAP server providing API services -Module2610Name=API/Web services (REST server) +Module2610Name=API / Web services (REST server) Module2610Desc=Enable the Dolibarr REST server providing API services Module2660Name=Call WebServices (SOAP client) Module2660Desc=Enable the Dolibarr web services client (Can be used to push data/requests to external servers. Only Purchase orders are currently supported.) From 72d163b896faa17bfd6f2130c6e40c2a26ec69d9 Mon Sep 17 00:00:00 2001 From: melina Date: Thu, 20 Oct 2022 16:21:31 +0200 Subject: [PATCH 079/176] Added hidden constant and modified edit on reference --- htdocs/product/card.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 8eac47207cd..8ddef85682a 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1866,7 +1866,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; // Ref - print ''; + if (!empty($conf->global->MAIN_PRODUCT_REF_NOT_EDITABLE)) { + print ''; + } + else { + print ''; + } + // Label print ''; From d9d38ee2656e8aa7d8bef5415752968ec762a421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20N=C3=BA=C3=B1ez?= Date: Thu, 20 Oct 2022 16:33:48 +0200 Subject: [PATCH 080/176] Add admin fichinter checkboxes --- htdocs/admin/fichinter.php | 59 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 4e4438263c3..9bd82d3d766 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -208,6 +208,32 @@ if ($action == 'updateMask') { $error++; } + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} elseif ($action == "set_FICHINTER_ALLOW_ONLINE_SIGN") { + $val = GETPOST('FICHINTER_ALLOW_ONLINE_SIGN', 'alpha'); + $res = dolibarr_set_const($db, "FICHINTER_ALLOW_ONLINE_SIGN", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); + + if (!($res > 0)) { + $error++; + } + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} elseif ($action == "set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD") { + $val = GETPOST('FICHINTER_ALLOW_EXTERNAL_DOWNLOAD', 'alpha'); + $res = dolibarr_set_const($db, "FICHINTER_ALLOW_EXTERNAL_DOWNLOAD", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); + + if (!($res > 0)) { + $error++; + } + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -594,6 +620,39 @@ print ''; print ''; print ''; +// Allow online signing +print '
'; +print ''; +print ''; +print '
'; +print ''; +print ''; +print ''; +print ''; +print ''; +// Allow external download +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'; +print $langs->trans("allowonlinesign"); +print ''; +print ''; +print ''; +print ''; +print '
'; +print $langs->trans("allowexternaldownload"); +print ''; +print ''; +print ''; +print ''; +print '
'; print '
'; From 57e62867387ea540b0bce55e7fca2a6a6508936e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 20 Oct 2022 16:36:50 +0200 Subject: [PATCH 081/176] FIX value can be a string --- htdocs/core/ajax/constantonoff.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/ajax/constantonoff.php b/htdocs/core/ajax/constantonoff.php index b8beec3111a..fb750d346bd 100644 --- a/htdocs/core/ajax/constantonoff.php +++ b/htdocs/core/ajax/constantonoff.php @@ -49,7 +49,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; $action = GETPOST('action', 'aZ09'); // set or del $name = GETPOST('name', 'alpha'); $entity = GETPOST('entity', 'int'); -$value = ((GETPOST('value', 'int') || GETPOST('value', 'int') == '0') ? GETPOST('value', 'int') : 1); +$value = (GETPOST('value', 'aZ09') != '' ? GETPOST('value', 'aZ09') : ((GETPOST('value', 'int') || GETPOST('value', 'int') == '0') ? GETPOST('value', 'int') : 1)); /* From 556664f246883a9100afba9421b457b6e213a1a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20N=C3=BA=C3=B1ez?= Date: Thu, 20 Oct 2022 16:41:27 +0200 Subject: [PATCH 082/176] Modify fichinter card and class --- htdocs/fichinter/card.php | 7 +++++++ htdocs/fichinter/class/fichinter.class.php | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index cef3f737c53..baf15232219 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1713,6 +1713,13 @@ if ($action == 'create') { $linktoelem = $form->showLinkToObjectBlock($object, null, array('fichinter')); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + // Show online signature link + if ($object->statut != Fichinter::STATUS_DRAFT && $conf->global->FICHINTER_ALLOW_ONLINE_SIGN) { + print '
'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; + + print showOnlineSignatureUrl('fichinter', $object->ref).'
'; + } print '
'; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 7a5f3bc73ad..8a1698ca8fb 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -442,7 +442,7 @@ class Fichinter extends CommonObject $sql .= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,"; $sql .= " f.date_valid as datev,"; $sql .= " f.tms as datem,"; - $sql .= " f.duree, f.fk_projet as fk_project, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat, f.entity as entity"; + $sql .= " f.duree, f.fk_projet as fk_project, f.note_public, f.note_private, f.model_pdf, f.last_main_doc, f.extraparams, fk_contrat, f.entity as entity"; $sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f"; if ($ref) { $sql .= " WHERE f.entity IN (".getEntity('intervention').")"; @@ -482,6 +482,8 @@ class Fichinter extends CommonObject $this->extraparams = (array) json_decode($obj->extraparams, true); + $this->last_main_doc = $obj->last_main_doc; + if ($this->statut == 0) { $this->brouillon = 1; } From 56892e32e82bc95409bf30f76de7cbcd517877ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 16:45:08 +0200 Subject: [PATCH 083/176] FIX #yogosha13195 --- htdocs/comm/action/class/actioncomm.class.php | 12 ++++++------ htdocs/comm/action/index.php | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 45dbbbf12c0..228ff397607 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1591,16 +1591,16 @@ class ActionComm extends CommonObject $tooltip = img_picto('', $this->picto).' '.$langs->trans('Action').''; if (!empty($this->ref)) { - $tooltip .= '
'.$langs->trans('Ref').': '.$this->ref; + $tooltip .= '
'.$langs->trans('Ref').': '.dol_escape_htmltag($this->ref); } if (!empty($label)) { - $tooltip .= '
'.$langs->trans('Title').': '.$label; + $tooltip .= '
'.$langs->trans('Title').': '.dol_escape_htmltag($label); } if (!empty($labeltype)) { - $tooltip .= '
'.$langs->trans('Type').': '.$labeltype; + $tooltip .= '
'.$langs->trans('Type').': '.dol_escape_htmltag($labeltype); } if (!empty($this->location)) { - $tooltip .= '
'.$langs->trans('Location').': '.$this->location; + $tooltip .= '
'.$langs->trans('Location').': '.dol_escape_htmltag($this->location); } if (isset($this->transparency)) { $tooltip .= '
'.$langs->trans('Busy').': '.yn($this->transparency); @@ -1609,7 +1609,7 @@ class ActionComm extends CommonObject $langs->load("mails"); $tooltip .= '
'; //$tooltip .= '
'.img_picto('', 'email').' '.$langs->trans("Email").''; - $tooltip .= '
'.$langs->trans('MailTopic').': '.$this->email_subject; + $tooltip .= '
'.$langs->trans('MailTopic').': '.dol_escape_htmltag($this->email_subject); $tooltip .= '
'.$langs->trans('MailFrom').': '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_from); $tooltip .= '
'.$langs->trans('MailTo').': '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_to); if (!empty($this->email_tocc)) { @@ -1697,7 +1697,7 @@ class ActionComm extends CommonObject if ($withpicto) { $result .= img_object(($notooltip ? '' : $langs->trans("ShowAction").': '.$label), ($overwritepicto ? $overwritepicto : 'action'), (($this->type_color && $overwritepicto) ? 'style="color: #'.$this->type_color.' !important;" ' : '').($notooltip ? 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"' : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); } - $result .= $labelshort; + $result .= dol_escape_htmltag($labelshort); $result .= $linkend; global $action; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index f46b0adc3cb..bfb5ca991b9 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1272,9 +1272,9 @@ if (count($listofextcals)) { $event->datef = $dateend + $usertime; if ($icalevent['SUMMARY']) { - $event->label = $icalevent['SUMMARY']; + $event->label = dol_string_nohtmltag($icalevent['SUMMARY']); } elseif ($icalevent['DESCRIPTION']) { - $event->label = dol_nl2br($icalevent['DESCRIPTION'], 1); + $event->label = dol_nl2br(dol_string_nohtmltag($icalevent['DESCRIPTION']), 1); } else { $event->label = $langs->trans("ExtSiteNoLabel"); } @@ -1985,7 +1985,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa // Show title $titletoshow = $daterange; - $titletoshow .= ($titletoshow ? ' ' : '').($event->label ? $event->label : $event->libelle); + $titletoshow .= ($titletoshow ? ' ' : '').dol_escape_htmltag($event->label ? $event->label : $event->libelle); if ($event->type_code != 'ICALEVENT') { $savlabel = $event->label ? $event->label : $event->libelle; From 1f02fb24199e266e830fa97b9dc0f1838c907602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20N=C3=BA=C3=B1ez?= Date: Thu, 20 Oct 2022 16:52:57 +0200 Subject: [PATCH 084/176] Change signature lib to take fichinter into account --- htdocs/core/ajax/onlineSign.php | 87 +++++++++++++++++++++++++++++++ htdocs/core/lib/signature.lib.php | 15 ++++++ 2 files changed, 102 insertions(+) diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index 7866b972db1..0c0b63bbe0c 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -313,6 +313,93 @@ if ($action == "importSignature") { // Document format not supported to insert online signature. // We should just create an image file with the signature. } + } + } elseif ($mode == 'fichinter') { + require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + $object = new Fichinter($db); + $object->fetch(0, $ref); + + $upload_dir = !empty($conf->ficheinter->multidir_output[$object->entity])?$conf->ficheinter->multidir_output[$object->entity]:$conf->ficheinter->dir_output; + $upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/'; + $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); + $filename = "signatures/".$date."_signature.png"; + if (!is_dir($upload_dir."signatures/")) { + if (!dol_mkdir($upload_dir."signatures/")) { + $response ="Error mkdir. Failed to create dir ".$upload_dir."signatures/"; + $error++; + } + } + + if (!$error) { + $return = file_put_contents($upload_dir.$filename, $data); + if ($return == false) { + $error++; + $response = 'Error file_put_content: failed to create signature file.'; + } + } + + if (!$error) { + // Defined modele of doc + $last_main_doc_file = $object->last_main_doc; + $directdownloadlink = $object->getLastMainDocLink('fichinter'); // url to download the $object->last_main_doc + if (preg_match('/\.pdf/i', $last_main_doc_file)) { + // TODO Use the $last_main_doc_file to defined the $newpdffilename and $sourcefile + $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; + $sourcefile = $upload_dir.$ref.".pdf"; + + if (dol_is_file($sourcefile)) { + // We build the new PDF + $pdf = pdf_getInstance(); + if (class_exists('TCPDF')) { + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + } + $pdf->SetFont(pdf_getPDFFont($langs)); + + if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { + $pdf->SetCompression(false); + } + + + //$pdf->Open(); + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF + $s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297); + for ($i=1; $i<($pagecount+1); $i++) { + try { + $tppl = $pdf->importPage($i); + $s = $pdf->getTemplatesize($tppl); + $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); + $pdf->useTemplate($tppl); + } catch (Exception $e) { + dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); + $response = $e->getMessage(); + $error++; + } + } + + // A signature image file is 720 x 180 (ratio 1/4) but we use only the size into PDF + // TODO Get position of box from PDF template + $xforimgstart = 105; + $yforimgstart = (empty($s['h']) ? 250 : $s['h'] - 57); + $wforimg = $s['w']/1 - ($xforimgstart + 16); + $pdf->Image($upload_dir.$filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4)); + //$pdf->Close(); + $pdf->Output($newpdffilename, "F"); + + // Index the new file and update the last_main_doc property of object. + $object->indexFile($newpdffilename, 1); + } + if (!$error) { + $response = "success"; + } + } elseif (preg_match('/\.odt/i', $last_main_doc_file)) { + // Adding signature on .ODT not yet supported + // TODO + } else { + // Document format not supported to insert online signature. + // We should just create an image file with the signature. + } } } } else { diff --git a/htdocs/core/lib/signature.lib.php b/htdocs/core/lib/signature.lib.php index 070cbe0801f..9cc8f1f03a9 100644 --- a/htdocs/core/lib/signature.lib.php +++ b/htdocs/core/lib/signature.lib.php @@ -131,6 +131,21 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1) } else { $out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $object->entity), '0'); } + } elseif ($type == 'fichinter') { + $securekeyseed = isset($conf->global->FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN) ? $conf->global->FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN : ''; + $out = $urltouse.'/public/onlinesign/newonlinesign.php?source=fichinter&ref='.($mode ? '' : ''); + if ($mode == 1) { + $out .= 'fichinter_ref'; + } + if ($mode == 0) { + $out .= urlencode($ref); + } + $out .= ($mode ? '' : ''); + if ($mode == 1) { + $out .= "hash('".$securekeyseed."' + '".$type."' + fichinter_ref)"; + } else { + $out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $object->entity), '0'); + } } // For multicompany From 8c9e5dda1bc38f53edf6d2a541f722293f54082e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 16:53:18 +0200 Subject: [PATCH 085/176] FIX #yogosha12673 --- htdocs/user/passwordforgotten.php | 39 +++++++++++++------------------ 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 30c5da0b2af..658c45a3753 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -128,41 +128,34 @@ if (empty($reshook)) { $result = $edituser->fetch('', '', '', 1, -1, $username); } + // Set the message to show (must be the same if login/email exists or not + // to avoid to guess them. + $messagewarning = ''; + if ($result <= 0 && $edituser->error == 'USERNOTFOUND') { - $message = ''; + $message .= $messagewarning; $username = ''; } else { - if (!$edituser->email) { - //$message = '
'.$langs->trans("ErrorLoginHasNoEmail").'
'; - if (!$isanemail) { - $message .= $langs->trans("IfLoginExistPasswordRequestSent"); - } else { - $message .= $langs->trans("IfEmailExistPasswordRequestSent"); - } + if (empty($edituser->email)) { + $message .= $messagewarning; } else { $newpassword = $edituser->setPassword($user, '', 1); if ($newpassword < 0) { - // Failed + // Technical failure $message = '
'.$langs->trans("ErrorFailedToChangePassword").'
'; } else { // Success if ($edituser->send_password($user, $newpassword, 1) > 0) { - $message = ''; + $message .= $messagewarning; $username = ''; } else { + // Technical failure $message .= '
'.$edituser->error.'
'; } } From da0a62c11a6da12567ea9b07b3b6089135a34749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20N=C3=BA=C3=B1ez?= Date: Thu, 20 Oct 2022 17:33:43 +0200 Subject: [PATCH 086/176] Public intervention sign --- htdocs/public/onlinesign/newonlinesign.php | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 91c3ec2ce73..fa16492a169 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -130,6 +130,8 @@ if ($source == 'proposal') { $securekeyseed = getDolGlobalString('PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN'); } elseif ($source == 'contract') { $securekeyseed = getDolGlobalString('CONTRACT_ONLINE_SIGNATURE_SECURITY_TOKEN'); +} elseif ($source == 'fichinter') { + $securekeyseed = getDolGlobalString('FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN'); } if (!dol_verifyHash($securekeyseed.$type.$ref.(isModEnabled('multicompany') ? $entity : ''), $SECUREKEY, '0')) { httponly_accessforbidden('Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref), 403, 1); @@ -143,6 +145,10 @@ if ($source == 'proposal') { require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; $object = new Contrat($db); $result= $object->fetch(0, $ref); +} elseif ($source == 'fichinter') { + require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; + $object = new Fichinter($db); + $result= $object->fetch(0, $ref); } else { httponly_accessforbidden($langs->trans('ErrorBadParameters')." - Bad value for source", 400, 1); } @@ -289,6 +295,9 @@ if (empty($text)) { } elseif ($source == 'contract') { $text .= '
'.$langs->trans("WelcomeOnOnlineSignaturePageContract", $mysoc->name).''."\n"; $text .= ''.$langs->trans("ThisScreenAllowsYouToSignDocFromContract", $creditor).'

'."\n"; + } elseif ($source == 'fichinter') { + $text .= '
'.$langs->trans("WelcomeOnOnlineSignaturePageFichinter", $mysoc->name).''."\n"; + $text .= ''.$langs->trans("ThisScreenAllowsYouToSignDocFromFichinter", $creditor).'

'."\n"; } } print $text; @@ -300,6 +309,8 @@ if ($source == 'proposal') { print ''.$langs->trans("ThisIsInformationOnDocumentToSignProposal").' :'."\n"; } elseif ($source == 'contract') { print ''.$langs->trans("ThisIsInformationOnDocumentToSignContract").' :'."\n"; +} elseif ($source == 'fichinter') { + print ''.$langs->trans("ThisIsInformationOnDocumentToSignFichinter").' :'."\n"; } $found = false; $error = 0; @@ -430,6 +441,55 @@ if ($source == 'proposal') { } + print ''; + print ''; + print ''."\n"; +} elseif ($source == 'fichinter') { // Signature on fichinter + $found = true; + $langs->load("fichinter"); + + $result = $object->fetch_thirdparty($object->socid); + // Proposer + print ''.$langs->trans("Proposer"); + print ''; + print img_picto('', 'company', 'class="pictofixedwidth"'); + print ''.$creditor.''; + print ''; + print ''."\n"; + + // Target + print ''.$langs->trans("ThirdParty"); + print ''; + print img_picto('', 'company', 'class="pictofixedwidth"'); + print ''.$object->thirdparty->name.''; + print ''."\n"; + + // Object + $text = ''.$langs->trans("SignatureFichinterRef", $object->ref).''; + print ''.$langs->trans("Designation"); + print ''.$text; + + $last_main_doc_file = $object->last_main_doc; + + if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { + // It seems document has never been generated, or was generated and then deleted. + // So we try to regenerate it with its default template. + $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. + $object->generateDocument($defaulttemplate, $langs); + } + + $directdownloadlink = $object->getLastMainDocLink('fichinter'); + if ($directdownloadlink) { + print '
'; + print img_mime($object->last_main_doc, ''); + if ($message == "signed") { + print $langs->trans("DownloadSignedDocument").''; + } else { + print $langs->trans("DownloadDocument").''; + } + } + + print ''; print ''; print ''."\n"; @@ -542,6 +602,12 @@ if ($action == "dosign" && empty($cancel)) { } else { print ''; } + } elseif ($source == 'fichinter') { + if ($message == 'signed') { + print ''.$langs->trans("FichinterSigned").''; + } else { + print ''; + } } } print ''."\n"; From b048d95cc82243b411a3478680a99d4d52e7312f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 20 Oct 2022 16:09:26 +0000 Subject: [PATCH 087/176] Fixing style errors. --- htdocs/product/card.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 8ddef85682a..e8edb5d1d8b 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1866,13 +1866,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; // Ref - if (!empty($conf->global->MAIN_PRODUCT_REF_NOT_EDITABLE)) { + if (!empty($conf->global->MAIN_PRODUCT_REF_NOT_EDITABLE)) { print ''; - } - else { + } else { print ''; } - + // Label print ''; From d2ec1285951c23b31bdca882c2f984208bd403ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 18:14:00 +0200 Subject: [PATCH 088/176] Fix field fk_user_create of event registration must be null --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 3 +++ htdocs/langs/en_US/eventorganization.lang | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 517930eb490..7c38fb59b6d 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -698,6 +698,9 @@ ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN firstnam ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN lastname varchar(100); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN email_company varchar(128) after email; +-- VMYSQL4.3 ALTER TABLE llx_eventorganization_conferenceorboothattendee MODIFY COLUMN fk_user_creat integer NULL; +-- VPGSQL8.2 ALTER TABLE llx_eventorganization_conferenceorboothattendee ALTER COLUMN fk_user_creat DROP NOT NULL; + ALTER TABLE llx_c_email_templates ADD COLUMN joinfiles text; ALTER TABLE llx_c_email_templates ADD COLUMN email_from varchar(255); diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index b4179b04be6..23f063e9a50 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -157,7 +157,7 @@ VoteOk = Your vote has been accepted. AlreadyVoted = You have already voted for this event. VoteError = An error has occurred during the vote, please try again. -SubscriptionOk = Your registration has been validated +SubscriptionOk=Your registration has been recorded ConfAttendeeSubscriptionConfirmation = Confirmation of your subscription to an event Attendee = Attendee PaymentConferenceAttendee = Conference attendee payment From 8173841ff97d13036ad08335cc6efc554e332837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20N=C3=BA=C3=B1ez?= Date: Thu, 20 Oct 2022 18:19:17 +0200 Subject: [PATCH 089/176] Translations --- htdocs/langs/en_US/commercial.lang | 4 ++++ htdocs/langs/en_US/interventions.lang | 2 ++ htdocs/langs/en_US/propal.lang | 2 ++ htdocs/langs/es_ES/commercial.lang | 15 ++++++++++++--- htdocs/langs/es_ES/interventions.lang | 5 +++++ htdocs/langs/es_ES/main.lang | 1 + htdocs/langs/es_ES/propal.lang | 4 ++++ 7 files changed, 30 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang index 9978118f763..eba95a8aabb 100644 --- a/htdocs/langs/en_US/commercial.lang +++ b/htdocs/langs/en_US/commercial.lang @@ -76,10 +76,14 @@ NoLimit=No limit ToOfferALinkForOnlineSignature=Link for online signature WelcomeOnOnlineSignaturePageProposal=Welcome to the page to accept commercial proposals from %s WelcomeOnOnlineSignaturePageContract=Welcome to %s Contract PDF Signing Page +WelcomeOnOnlineSignaturePageFichinter=Welcome to %s Intervention PDF Signing Page ThisScreenAllowsYouToSignDocFromProposal=This screen allow you to accept and sign, or refuse, a quote/commercial proposal ThisScreenAllowsYouToSignDocFromContract=This screen allow you to sign contract on PDF format online. +ThisScreenAllowsYouToSignDocFromFichinter=This screen allow you to sign intervention on PDF format online. ThisIsInformationOnDocumentToSignProposal=This is information on document to accept or refuse ThisIsInformationOnDocumentToSignContract=This is information on contract to sign +ThisIsInformationOnDocumentToSignFichinter=This is information on intervention to sign SignatureProposalRef=Signature of quote/commercial proposal %s SignatureContractRef=Signature of contract %s +SignatureFichinterRef=Signature of intervention %s FeatureOnlineSignDisabled=Feature for online signing disabled or document generated before the feature was enabled diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 767688a4ce8..7524439f3ec 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -69,3 +69,5 @@ GenerateInter=Generate intervention FichinterNoContractLinked=Intervention %s has been created without a linked contract. ErrorFicheinterCompanyDoesNotExist=Company does not exist. Intervention has not been created. NextDateToIntervention=Date for next intervention generation +AllowOnlineSign=Allow online signing +AllowExternalDownload=Allow external download \ No newline at end of file diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index d07d6d2efba..7e9afd4e27c 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -104,6 +104,7 @@ IdProduct=Product ID LineBuyPriceHT=Buy Price Amount net of tax for line SignPropal=Accept proposal SignContract=Sign contract +SignFichinter=Sign intervention RefusePropal=Refuse proposal Sign=Sign NoSign=Refuse @@ -111,5 +112,6 @@ PropalAlreadySigned=Proposal already accepted PropalAlreadyRefused=Proposal already refused PropalSigned=Proposal accepted ContractSigned=Contract signed +FichinterSigned=Intervention signed PropalRefused=Proposal refused ConfirmRefusePropal=Are you sure you want to refuse this commercial proposal? diff --git a/htdocs/langs/es_ES/commercial.lang b/htdocs/langs/es_ES/commercial.lang index 5fe49a5b4f4..8292b6391d6 100644 --- a/htdocs/langs/es_ES/commercial.lang +++ b/htdocs/langs/es_ES/commercial.lang @@ -68,13 +68,22 @@ ActionAC_OTH_AUTO=Eventos creados automáticamente ActionAC_MANUAL=Eventos creados manualmente ActionAC_AUTO=Eventos creados automáticamente ActionAC_OTH_AUTOShort=Auto +ActionAC_EVENTORGANIZATION=Eventos de organización Stats=Estadísticas de venta StatusProsp=Estado prospección DraftPropals=Presupuestos borrador NoLimit=Sin límite ToOfferALinkForOnlineSignature=Enlace para la firma en línea -WelcomeOnOnlineSignaturePage=Bienvenido a la página para aceptar presupuestos de %s -ThisScreenAllowsYouToSignDocFrom=Esta pantalla le permite aceptar y firmar, o rechazar, una presupuesto/propuesta comercial -ThisIsInformationOnDocumentToSign=Esta es la información del documento para aceptar o rechazar +WelcomeOnOnlineSignaturePageProposal=Bienvenido a la página para firmar presupuestos de %s +WelcomeOnOnlineSignaturePageContract=Bienvenido a la página para firmar contratos de %s +WelcomeOnOnlineSignaturePageFichinter=Bienvenido a la página para firmar intervenciones de %s +ThisScreenAllowsYouToSignDocFromProposal=Esta página permite aceptar y firmar o rechazar un presupuesto o propuesta comercial. +ThisScreenAllowsYouToSignDocFromContract=Esta página permite aceptar y firmar el contrato PDF online. +ThisScreenAllowsYouToSignDocFromFichinter=Esta página permite aceptar y firmar una intervención en formato PDF online. +ThisIsInformationOnDocumentToSignProposal=Esta es la información del presupuesto para aceptar o rechazar +ThisIsInformationOnDocumentToSignContract=Esta es la información del contrato a firmar +ThisIsInformationOnDocumentToSignFichinter=Esta es la información de la intervención a firmar SignatureProposalRef=Firma del presupuesto/propuesta comercial %s +SignatureContractRef=Firma del contrato %s +SignatureFichinterRef=Firma de la intervención %s FeatureOnlineSignDisabled=Característica para la firma en línea inhabilitada o documento generado antes de que se habilitara la característica diff --git a/htdocs/langs/es_ES/interventions.lang b/htdocs/langs/es_ES/interventions.lang index 83471928031..b335c533713 100644 --- a/htdocs/langs/es_ES/interventions.lang +++ b/htdocs/langs/es_ES/interventions.lang @@ -66,3 +66,8 @@ RepeatableIntervention=Plantilla de intervención ToCreateAPredefinedIntervention=Para crear una intervención predefinida o recurrente, cree una intervención común y conviértala en plantilla de intervención ConfirmReopenIntervention=¿Está seguro de querer volver a abrir la intervención %s ? GenerateInter=Generar intervención +FichinterNoContractLinked=La intervención %s se ha creado sin un contacto vinculado. +ErrorFicheinterCompanyDoesNotExist=La compañía no existe, la intervención no se ha creado. +NextDateToIntervention=Fecha para la próxima generación de intervención +AllowOnlineSign=Permitir firma online +AllowExternalDownload=Permitir descarga externa \ No newline at end of file diff --git a/htdocs/langs/es_ES/main.lang b/htdocs/langs/es_ES/main.lang index 2af1c00c5cf..00488783f8a 100644 --- a/htdocs/langs/es_ES/main.lang +++ b/htdocs/langs/es_ES/main.lang @@ -926,6 +926,7 @@ DirectDownloadInternalLink=Enlace de descarga privado PrivateDownloadLinkDesc=Debe iniciar sesión y necesita permisos para ver o descargar el archivo Download=Descargar DownloadDocument=Descargar el documento +DownloadSignedDocument=Descargar el documento firmado ActualizeCurrency=Actualizar el tipo de cambio Fiscalyear=Año fiscal ModuleBuilder=Módulo Builder diff --git a/htdocs/langs/es_ES/propal.lang b/htdocs/langs/es_ES/propal.lang index 2f31aab4e89..159daf31178 100644 --- a/htdocs/langs/es_ES/propal.lang +++ b/htdocs/langs/es_ES/propal.lang @@ -103,11 +103,15 @@ IdProposal=ID de Presupuesto IdProduct=ID del Producto LineBuyPriceHT=Precio de compra Importe neto de impuestos por línea SignPropal=Aceptar presupuesto +SignContract=Firmar contrato +SignFichinter=Firmar intervención RefusePropal=Rechazar presupuesto Sign=Firma NoSign=Establecer no firmado PropalAlreadySigned=Presupuesto ya aceptado PropalAlreadyRefused=Presupuesto ya rechazado PropalSigned=Presupuesto aceptado +ContractSigned=Contrato firmado +FichinterSigned=Intervención firmada PropalRefused=Presupuesto rechazado ConfirmRefusePropal=¿Está seguro de querer rechazar este presupuesto? From 2db3f6f70932add5b303b7ddd2dda90eeae28afd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 18:23:41 +0200 Subject: [PATCH 090/176] Fix price style --- htdocs/product/price.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index b129a1ff4e5..5dcb08dc238 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -2240,7 +2240,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { } print ''; - print ''; + print ''; print ''; // Print the search button print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -2289,6 +2289,8 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print '"; + + // VAT Rate print '"; - print '"; + print '"; - print '"; + print '"; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { //print '"; - print ''; + print ''; } print ''; @@ -2367,6 +2369,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ""; print '"; + // VAT Rate print '"; + print '"; print '"; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { //print '"; - print ''; + print ''; } print ''; From 3e38d30956e1d65228741056a62491dcb5afe32a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 18:41:23 +0200 Subject: [PATCH 091/176] Fix price must be including tax --- htdocs/public/eventorganization/attendee_new.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index 8bb85022b2e..161f56dc6f8 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -474,7 +474,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION); } - // Create invoice + // Create the draft invoice for the payment if ($resultprod < 0) { $error++; $errmsg .= $productforinvoicerow->error; @@ -528,7 +528,11 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen // If there is no lines yet, we add one if (empty($facture->lines)) { - $result = $facture->addline($labelforproduct, floatval($project->price_registration), 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, $date_start, $date_end, 0, 0, '', 'HT', 0, 1); + $pu_ttc = floatval($project->price_registration); + $pu_ht = 0; + $price_base_type = 'TTC'; + + $result = $facture->addline($labelforproduct, $pu_ht, 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, $date_start, $date_end, 0, 0, '', $price_base_type, $pu_ttc, 1); if ($result <= 0) { $confattendee->error = $facture->error; $confattendee->errors = $facture->errors; From 80fea518de86e5d609c752a5a61741c55a05a1be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20N=C3=BA=C3=B1ez?= Date: Thu, 20 Oct 2022 18:46:24 +0200 Subject: [PATCH 092/176] Fix little translation bug --- htdocs/admin/fichinter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 9bd82d3d766..2d48a9ebcb1 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -626,7 +626,7 @@ print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; -// Allow online signing +// Allow online signing print ''; print ''; print ''; @@ -635,7 +635,7 @@ print ''; print ''; -print ''; +print ''; // Allow external download print ''; print ''; diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index 0c0b63bbe0c..c71fed19f6d 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -313,7 +313,7 @@ if ($action == "importSignature") { // Document format not supported to insert online signature. // We should just create an image file with the signature. } - } + } } elseif ($mode == 'fichinter') { require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 8a1698ca8fb..e36598d04bc 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -483,7 +483,7 @@ class Fichinter extends CommonObject $this->extraparams = (array) json_decode($obj->extraparams, true); $this->last_main_doc = $obj->last_main_doc; - + if ($this->statut == 0) { $this->brouillon = 1; } From 2d378ecede8d96ed279d1d11cb7681a8aace5c52 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 19:16:25 +0200 Subject: [PATCH 095/176] CSS --- htdocs/langs/en_US/eventorganization.lang | 1 + htdocs/public/eventorganization/attendee_new.php | 14 ++++++++------ htdocs/theme/eldy/global.inc.php | 4 ++++ htdocs/theme/md/style.css.php | 4 ++++ 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 23f063e9a50..e9d434651b2 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -165,6 +165,7 @@ PaymentBoothLocation = Booth location payment DeleteConferenceOrBoothAttendee=Remove attendee RegistrationAndPaymentWereAlreadyRecorder=A registration and a payment were already recorded for the email %s EmailAttendee=Attendee email +EmailCompany=Company email EmailCompanyForInvoice=Company email (for invoice, if different of attendee email) ErrorSeveralCompaniesWithEmailContactUs=Several companies with this email has been found so we can't validate automaticaly your registration. Please contact us at %s for a manual validation ErrorSeveralCompaniesWithNameContactUs=Several companies with this name has been found so we can't validate automaticaly your registration. Please contact us at %s for a manual validation diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index 161f56dc6f8..af49d142f51 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -652,21 +652,23 @@ print '
'; print $langs->trans("EvntOrgWelcomeMessage", $project->title . ' '. $conference->label); print '
'; $maxattendees = 0; -if ($conference->id) { +if ($conference->id > 0) { + /* date of project is not date of event so commented print $langs->trans("Date").': '; print dol_print_date($conference->datep); if ($conference->date_end) { print ' - '; print dol_print_date($conference->datef); - } + }*/ } else { + /* date of project is not date of event so commented print $langs->trans("Date").': '; print dol_print_date($project->date_start); if ($project->date_end) { print ' - '; print dol_print_date($project->date_end); - } - $maxattendees = $project->max_attendees; + }*/ + $maxattendees = $project->max_attendees; // Max attendeed for the project/event } print '
'; @@ -729,7 +731,7 @@ if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS // Email company for invoice if ($project->price_registration) { - print '
' . "\n"; } @@ -780,7 +782,7 @@ if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS if ($project->price_registration) { print ''; } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index f0208223cf4..c68b39d38df 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -4835,8 +4835,12 @@ input#cardholder-name { } .divmainbodylarge { margin-left: 40px; margin-right: 40px; } +.publicnewmemberform div.titre { font-size: 2em; } #divsubscribe { max-width: 900px; } #tablesubscribe { width: 100%; } +#tablesubscribe tr td { font-size: 1.15em; } +#tablesubscribe .price-registration { font-size: 1.5em; } + div#card-element { border: 1px solid #ccc; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 3357a2f8c7a..dd1194972b5 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4684,8 +4684,12 @@ span.buttonpaymentsmall { #tablepublicpayment tr.liste_total td { border-top: none; } .divmainbodylarge { margin-left: 40px; margin-right: 40px; } +.publicnewmemberform div.titre { font-size: 2em; } #divsubscribe { max-width: 900px; } #tablesubscribe { width: 100%; } +#tablesubscribe tr td { font-size: 1.15em; } +#tablesubscribe .price-registration { font-size: 1.5em; } + div#card-element { border: 1px solid #ccc; From 84d47e9b0ca3b175644641250cdbc77b77ceee24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 19:26:24 +0200 Subject: [PATCH 096/176] Fix max nb of attendees reached --- htdocs/langs/en_US/eventorganization.lang | 4 ++-- htdocs/public/eventorganization/attendee_new.php | 6 ++++-- htdocs/theme/eldy/global.inc.php | 1 + htdocs/theme/md/style.css.php | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index e9d434651b2..f9531260c97 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -122,7 +122,7 @@ ViewAndVote = View and vote for suggested events PublicAttendeeSubscriptionGlobalPage = Public link for registration to the event PublicAttendeeSubscriptionPage = Public link for registration to this event only MissingOrBadSecureKey = The security key is invalid or missing -EvntOrgWelcomeMessage = This form allows you to register as a new participant to the event : %s +EvntOrgWelcomeMessage = This form allows you to register as a new participant to the event EvntOrgDuration = This conference starts on %s and ends on %s. ConferenceAttendeeFee = Conference attendee fee for the event : '%s' occurring from %s to %s. BoothLocationFee = Booth location for the event : '%s' occurring from %s to %s @@ -132,7 +132,7 @@ LabelOfconference=Conference label ConferenceIsNotConfirmed=Registration not available, conference is not confirmed yet DateMustBeBeforeThan=%s must be before %s DateMustBeAfterThan=%s must be after %s - +MaxNbOfAttendeesReached=The maximum number of participants has been reached NewSubscription=Registration OrganizationEventConfRequestWasReceived=Your suggestion for a conference has been received OrganizationEventBoothRequestWasReceived=Your request for a booth has been received diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index af49d142f51..371d69710b7 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -645,11 +645,13 @@ print load_fiche_titre($langs->trans("NewRegistration"), '', '', 0, 0, 'center') print '
'; print '
'; -print '
'; +print '
'; // Welcome message -print $langs->trans("EvntOrgWelcomeMessage", $project->title . ' '. $conference->label); +print $langs->trans("EvntOrgWelcomeMessage"); +print '
'; +print ''.$project->title . ' '. $conference->label.''; print '
'; $maxattendees = 0; if ($conference->id > 0) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index c68b39d38df..1415f420e92 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -4837,6 +4837,7 @@ input#cardholder-name { .divmainbodylarge { margin-left: 40px; margin-right: 40px; } .publicnewmemberform div.titre { font-size: 2em; } #divsubscribe { max-width: 900px; } +#divsubscribe .eventlabel { font-size: 1.5em; } #tablesubscribe { width: 100%; } #tablesubscribe tr td { font-size: 1.15em; } #tablesubscribe .price-registration { font-size: 1.5em; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index dd1194972b5..be49f427eae 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4686,6 +4686,7 @@ span.buttonpaymentsmall { .divmainbodylarge { margin-left: 40px; margin-right: 40px; } .publicnewmemberform div.titre { font-size: 2em; } #divsubscribe { max-width: 900px; } +#divsubscribe .eventlabel { font-size: 1.5em; } #tablesubscribe { width: 100%; } #tablesubscribe tr td { font-size: 1.15em; } #tablesubscribe .price-registration { font-size: 1.5em; } From 89261d51e395b691ff375c0dbe2c1861177e0465 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 19:30:19 +0200 Subject: [PATCH 097/176] css --- htdocs/public/eventorganization/attendee_new.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index 371d69710b7..e0ad4a0420b 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -681,7 +681,6 @@ if ($maxattendees && $currentnbofattendees >= $maxattendees) { } -print '
'; dol_htmloutput_errors($errmsg, $errors); From 6dc17dc5a4146939fb4955b1e09c0d65ea634097 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 20 Oct 2022 22:10:19 +0200 Subject: [PATCH 098/176] Move title column on thead from td to th --- htdocs/core/tpl/objectline_title.tpl.php | 54 ++++++++++++------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index 6d8238cd885..7fe63613ea1 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -49,19 +49,19 @@ print '
'; // Adds a line numbering column if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ''; + print ''; } // Description -print ''; +print ''; // Supplier ref if ($this->element == 'supplier_proposal' || $this->element == 'order_supplier' || $this->element == 'invoice_supplier' || $this->element == 'invoice_supplier_rec') { - print ''; + print ''; } // VAT -print ''; // Price HT -print ''; +print ''; // Multicurrency if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { - print ''; + print ''; } if ($inputalsopricewithtax) { - print ''; + print ''; } // Qty -print ''; +print ''; // Unit if (!empty($conf->global->PRODUCT_USE_UNITS)) { - print ''; + print ''; } // Reduction short -print ''; // Fields for situation invoice if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) { - print ''; - print ''; + print ''; + print ''; } // Purchase price if ($usemargins && isModEnabled('margin') && empty($user->socid)) { if (!empty($user->rights->margins->creer)) { if ($conf->global->MARGIN_TYPE == "1") { - print ''; + print ''; } else { - print ''; + print ''; } } if (!empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { - print ''; + print ''; } if (!empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) { - print ''; + print ''; } } // Total HT -print ''; +print ''; // Multicurrency if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { - print ''; + print ''; } if ($outputalsopricetotalwithtax) { - print ''; + print ''; } if (isModEnabled('asset') && $object->element == 'invoice_supplier') { - print ''; + print ''; } -print ''; // No width to allow autodim +print ''; // No width to allow autodim -print ''; +print ''; -print ''; +print ''; if ($action == 'selectlines') { - print ''; } print "\n"; From a52de14003e891ca4407a00d78efbfbc8fd73892 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 22:56:07 +0200 Subject: [PATCH 099/176] Debug hrm module --- htdocs/adherents/card.php | 2 +- htdocs/adherents/class/adherent.class.php | 38 ++- htdocs/adherents/list.php | 10 +- htdocs/adherents/type.php | 10 +- htdocs/hrm/class/evaluation.class.php | 2 +- htdocs/hrm/class/position.class.php | 4 +- htdocs/hrm/core/tpl/objectline_title.tpl.php | 2 +- htdocs/hrm/evaluation_agenda.php | 2 +- htdocs/hrm/evaluation_card.php | 109 +++---- htdocs/hrm/evaluation_contact.php | 49 +-- htdocs/hrm/evaluation_document.php | 8 +- htdocs/hrm/evaluation_list.php | 1 + htdocs/hrm/evaluation_note.php | 2 +- htdocs/hrm/position_list.php | 289 +++++++++++------- htdocs/hrm/skill_list.php | 15 - .../install/mysql/migration/16.0.0-17.0.0.sql | 1 + htdocs/langs/en_US/hrm.lang | 4 +- .../modulebuilder/template/myobject_card.php | 1 + .../modulebuilder/template/myobject_list.php | 4 +- .../inventory/class/inventory.class.php | 8 +- htdocs/theme/eldy/global.inc.php | 6 + htdocs/theme/md/style.css.php | 6 + 22 files changed, 315 insertions(+), 258 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index bd105e7a672..35829b5dcbf 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1728,7 +1728,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '\n"; // Morphy - print ''; + print ''; print ''; // Company diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 0e37981cc84..dd9d58eb7d3 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -520,21 +520,45 @@ class Adherent extends CommonObject * Return translated label by the nature of a adherent (physical or moral) * * @param string $morphy Nature of the adherent (physical or moral) + * @param int $addbadge Add badge (1=Full label, 2=First letter only) * @return string Label */ - public function getmorphylib($morphy = '') + public function getmorphylib($morphy = '', $addbadge = 0) { global $langs; + + // Clean var if (!$morphy) { $morphy = $this->morphy; } - if ($morphy == 'phy') { - return $langs->trans("Physical"); + + if ($addbadge) { + $s = ''; + if ($morphy == 'phy') { + if ($addbadge == 2) { + $labeltoshow = dol_substr($langs->trans("Physical"), 0, 1); + } else { + $labeltoshow = $langs->trans("Physical"); + } + $s .= ''.$labeltoshow.''; + } + if ($morphy == 'mor') { + if ($addbadge == 2) { + $labeltoshow = dol_substr($langs->trans("Moral"), 0, 1); + } else { + $labeltoshow = $langs->trans("Moral"); + } + $s .= ''.$labeltoshow.''; + } + } else { + if ($morphy == 'phy') { + $s = $langs->trans("Physical"); + } elseif ($morphy == 'mor') { + $s = $langs->trans("Moral"); + } } - if ($morphy == 'mor') { - return $langs->trans("Moral"); - } - return $morphy; + + return $s; } /** diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 8118c4f9d4a..4b3a5cdb82c 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -947,6 +947,7 @@ while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); $datefin = $db->jdate($obj->datefin); + $memberstatic->id = $obj->rowid; $memberstatic->ref = $obj->ref; $memberstatic->civility_id = $obj->civility; @@ -1063,14 +1064,7 @@ while ($i < min($num, $limit)) { // Nature (Moral/Physical) if (!empty($arrayfields['d.morphy']['checked'])) { print '\n"; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index c26a9d13536..cc3c697e032 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -720,7 +720,7 @@ if ($rowid > 0) { */ // Moral/Physique - print "\n"; + print "\n"; // EMail print "\n"; @@ -740,9 +740,9 @@ if ($rowid > 0) { } print ''; } else { - print '"; @@ -845,7 +845,7 @@ if ($rowid > 0) { print '"; diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 879acff61fa..b35a23a6389 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -119,7 +119,7 @@ class Evaluation extends CommonObject 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'default'=>0, 'visible'=>5, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '6' => 'Closed'),), 'date_eval' => array('type'=>'date', 'label'=>'DateEval', 'enabled'=>'1', 'position'=>502, 'notnull'=>1, 'visible'=>1,), 'fk_user' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'User', 'enabled'=>'1', 'position'=>504, 'notnull'=>1, 'visible'=>1,), - 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'Job', 'enabled'=>'1', 'position'=>505, 'notnull'=>1, 'visible'=>1,), + 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'JobPosition', 'enabled'=>'1', 'position'=>505, 'notnull'=>1, 'visible'=>1,), ); public $rowid; public $ref; diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index 19246dc2313..5d0c04a4f47 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -110,10 +110,10 @@ class Position extends CommonObject 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,), 'fk_contrat' => array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'fk_contrat', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>0,), 'fk_user' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Employee', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'default'=>0), - 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'Job', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1,), + 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'JobPosition', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1,), 'date_start' => array('type'=>'date', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>51, 'notnull'=>1, 'visible'=>1,), 'date_end' => array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>52, 'notnull'=>0, 'visible'=>1,), - 'abort_comment' => array('type'=>'varchar(255)', 'label'=>'AbandonmentComment', 'enabled'=>'1', 'position'=>502, 'notnull'=>0, 'visible'=>1,), + 'abort_comment' => array('type'=>'varchar(255)', 'label'=>'AbandonmentComment', 'enabled'=>'getDolGlobalInt("HRM_JOB_POSITON_ENDING_COMMENT")', 'position'=>502, 'notnull'=>0, 'visible'=>1,), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>0,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>0,), 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',), diff --git a/htdocs/hrm/core/tpl/objectline_title.tpl.php b/htdocs/hrm/core/tpl/objectline_title.tpl.php index 3801288543a..ae835ea2bca 100644 --- a/htdocs/hrm/core/tpl/objectline_title.tpl.php +++ b/htdocs/hrm/core/tpl/objectline_title.tpl.php @@ -65,7 +65,7 @@ print ''; print ''; // Note -print ''; +print ''; //print ''; // No width to allow autodim diff --git a/htdocs/hrm/evaluation_agenda.php b/htdocs/hrm/evaluation_agenda.php index a6c6c2a9406..732b91d756f 100644 --- a/htdocs/hrm/evaluation_agenda.php +++ b/htdocs/hrm/evaluation_agenda.php @@ -158,7 +158,7 @@ if ($object->id > 0) { $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('Job').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); $morehtmlref .= ''; diff --git a/htdocs/hrm/evaluation_card.php b/htdocs/hrm/evaluation_card.php index 9f9b937a467..08854e2d88e 100644 --- a/htdocs/hrm/evaluation_card.php +++ b/htdocs/hrm/evaluation_card.php @@ -94,7 +94,9 @@ $upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->enti //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->hrm->enabled)) accessforbidden(); +if (!isModEnabled("hrm")) { + accessforbidden(); +} if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden(); @@ -283,11 +285,7 @@ if ($action == 'create') { print dol_get_fiche_end(); - print '
'; - print ''; - print '  '; - print ''; // Cancel for create does not post form if we don't know the backtopage - print '
'; + print $form->buttonsSaveCancel("Create", "Cancel"); print ''; } @@ -321,9 +319,7 @@ if (($id || $ref) && $action == 'edit') { print dol_get_fiche_end(); - print '
'; - print '   '; - print '
'; + print $form->buttonsSaveCancel(); print ''; } @@ -381,8 +377,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $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 + // Confirmation of action xxxx (You can use it for xxx = 'close', xxx = 'reopen', ...) if ($action == 'xxx') { + $text = $langs->trans('ConfirmActionMyObject', $object->ref); + $formquestion = array(); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); @@ -412,7 +410,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('Job').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); $morehtmlref .= ''; @@ -446,11 +444,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea * Lines */ - if (!empty($object->table_element_line)) { - if ($object->status == Evaluation::STATUS_DRAFT) { - $result = $object->getLinesArray(); + if (!empty($object->table_element_line) && $object->status == Evaluation::STATUS_DRAFT) { + // Show object lines + $result = $object->getLinesArray(); + if ($result < 0) { + dol_print_error($db, $object->error, $object->errors); + } - print ' + print '
'; + + print ' @@ -458,46 +461,44 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea '; - 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 '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
 '; @@ -2252,7 +2252,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print '
'.$langs->trans("ThirdParty").'' . $langs->trans('RefCustomer') . ''.$langs->trans('RefCustomer').''.$langs->trans("AppliedPricesFrom").''.$langs->trans("PriceBase").''.$langs->trans("DefaultTaxRate").'' . $langs->trans('Default') . ''.$langs->trans($object->price_base_type)."'; $positiverates = ''; @@ -2310,12 +2312,12 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { //print $object->default_vat_code?' ('.$object->default_vat_code.')':''; print "'.price($object->price)."'.price($object->price)."'.price($object->price_ttc)."'.price($object->price_ttc)."' . price($object->price_ttc) . "'.price($resultarray[2]).''.price($resultarray[2]).''.price($object->price_min).''.dol_escape_htmltag($line->ref_customer).'".dol_print_date($line->datec, "dayhour", 'tzuserrel')."'.$langs->trans($line->price_base_type)."'; $positiverates = ''; @@ -2386,12 +2389,13 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { echo vatrate($positiverates.($line->default_vat_code ? ' ('.$line->default_vat_code.')' : ''), '%', ($line->tva_npr ? $line->tva_npr : $line->recuperableonly)); print "'.price($line->price)."'.price($line->price_ttc)."' . price($line->price_ttc) . "'.price($resultarray[2]).''.price($resultarray[2]).''.price($line->price_min).'
'; -print $langs->trans("allowonlinesign"); +print $langs->trans("AllowOnlineSign"); print ''; print ''; @@ -642,7 +642,7 @@ print ''; print ''; print '
'; -print $langs->trans("allowexternaldownload"); +print $langs->trans("AllowExternalDownload"); print ''; print ''; From dfbcc2a045e2008a82b330f7c4483c7ba074186c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20N=C3=BA=C3=B1ez?= Date: Thu, 20 Oct 2022 18:50:48 +0200 Subject: [PATCH 093/176] Fix bug in checkboxes --- htdocs/admin/fichinter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 2d48a9ebcb1..e0da7ba9eb3 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -629,7 +629,7 @@ print ''; print $langs->trans("AllowOnlineSign"); print ''; -print ''; +print ''; print ''; print ''; @@ -645,7 +645,7 @@ print ''; print $langs->trans("AllowExternalDownload"); print ''; -print ''; +print ''; print ''; print ''; From fadd77ef47660f7965c172cf495b5f899b0dcf79 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 20 Oct 2022 16:54:45 +0000 Subject: [PATCH 094/176] Fixing style errors. --- htdocs/admin/fichinter.php | 4 ++-- htdocs/core/ajax/onlineSign.php | 2 +- htdocs/fichinter/class/fichinter.class.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index e0da7ba9eb3..cf637d37329 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -620,7 +620,7 @@ print ''; print '
'; print ''; print '
' . $langs->trans("EmailCompanyForInvoice") . ''; + print '
' . $form->textwithpicto($langs->trans("EmailCompany"), $langs->trans("EmailCompanyForInvoice")) . ''; print img_picto('', 'email', 'class="pictofixedwidth"'); print '
' . $langs->trans('Price') . ''; - print price($project->price_registration, 1, $langs, 1, -1, -1, $conf->currency); + print ''.price($project->price_registration, 1, $langs, 1, -1, -1, $conf->currency).''; print '
  '.$langs->trans('Description').''.$langs->trans('Description').''.$langs->trans("SupplierRef").''.$langs->trans("SupplierRef").''; +print ''; if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || !empty($conf->global->FACTURE_LOCAL_TAX2_OPTION)) { print $langs->trans('Taxes'); } else { @@ -82,30 +82,30 @@ if (in_array($object->element, array('propal', 'commande', 'facture', 'supplier_ print ''; } } -print ''; +print ''.$langs->trans('PriceUHT').''.$langs->trans('PriceUHT').''.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).''.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).''.$langs->trans('PriceUTTC').''.$langs->trans('PriceUTTC').''.$langs->trans('Qty').''.$langs->trans('Qty').''.$langs->trans('Unit').''.$langs->trans('Unit').''; +print ''; print $langs->trans('ReductionShort'); if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT) { @@ -122,59 +122,59 @@ if (in_array($object->element, array('propal', 'commande', 'facture')) && $objec print ''; } } -print ''; +print ''.$langs->trans('Progress').''.$form->textwithpicto($langs->trans('TotalHT100Short'), $langs->trans('UnitPriceXQtyLessDiscount')).''.$langs->trans('Progress').''.$form->textwithpicto($langs->trans('TotalHT100Short'), $langs->trans('UnitPriceXQtyLessDiscount')).''.$langs->trans('BuyingPrice').''.$langs->trans('BuyingPrice').''.$langs->trans('CostPrice').''.$langs->trans('CostPrice').''.$langs->trans('MarginRate').''.$langs->trans('MarginRate').''.$langs->trans('MarkRate').''.$langs->trans('MarkRate').''.$langs->trans('TotalHTShort').''.$langs->trans('TotalHTShort').''.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).''.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).''.$langs->trans('TotalTTCShort').''.$langs->trans('TotalTTCShort').''; + print ''; print ''; print ''; - print ''; + print '
'.$langs->trans("Type").''.$adht->getNomUrl(1)."
'.$langs->trans("MemberNature").''.$object->getmorphylib().'
'.$langs->trans("MemberNature").''.$object->getmorphylib('', 1).'
'; - $s = ''; - if ($obj->morphy == 'phy') { - $s .= ''.dol_substr($langs->trans("Physical"), 0, 1).''; - } - if ($obj->morphy == 'mor') { - $s .= ''.dol_substr($langs->trans("Moral"), 0, 1).''; - } - print $s; + print $memberstatic->getmorphylib('', 2); print "".$adh->getmorphylib($objp->morphy)."".$adh->getmorphylib($objp->morphy, 1)."".dol_print_email($objp->email, 0, 0, 1)."'; + print ''; if (!empty($objp->subscription)) { - print $langs->trans("SubscriptionNotReceived"); + print ''.$langs->trans("SubscriptionNotReceived").''; if ($objp->status > 0) { print " ".img_warning(); } @@ -758,7 +758,7 @@ if ($rowid > 0) { print ''.img_edit().''; } if ($user->rights->adherent->supprimer) { - print ''.img_picto($langs->trans("Resiliate"), 'disable.png').''; + print ''.img_picto($langs->trans("Resiliate"), 'disable.png').''; } print "
'.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%'); + $doleditor = new DolEditor('comment', $object->note_public, '', 220, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%'); $doleditor->Create(); print "
'.$langs->trans('Label').''.$langs->trans('Description').''.$langs->trans('EmployeeRank').''.$form->textwithpicto($langs->trans("Level"), $langs->trans('EmployeeRank')).'
'; - print ''; - print ''; - print ''; - print ''; - print ''; - }*/ - - - if (!empty($object->lines)) { - $conf->modules_parts['tpl']['hrm']='/hrm/core/tpl/'; // Pour utilisation du tpl hrm sur cet écran - print '
'.$langs->trans('Skill').''.$langs->trans('Description').''.$langs->trans('Rank').'
'; - $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, ''); - print '
'; - } - - - - if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { - print ''; - - if ($object->status == $object::STATUS_DRAFT && $permissiontoadd) { - print '
'; - print ''; - print '
'; - } - } - - - print '
'; - - print "\n"; - print "
"; + if (!empty($conf->use_javascript_ajax) && $object->status == 0) { + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; } + + $conf->modules_parts['tpl']['hrm']='/hrm/core/tpl/'; // Pour utilisation du tpl hrm sur cet écran + + 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 + + $parameters = array(); + $reshook = $hookmanager->executeHooks('formAddObjectLine', $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)) + $object->formAddObjectLine(1, $mysoc, $soc); + } + } + */ + + if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { + print '
'; + } + print '
'; + + print "\n"; + + print "
"; } // list of comparison diff --git a/htdocs/hrm/evaluation_contact.php b/htdocs/hrm/evaluation_contact.php index 1c1d9ed26fd..4ea2e8e81be 100644 --- a/htdocs/hrm/evaluation_contact.php +++ b/htdocs/hrm/evaluation_contact.php @@ -31,8 +31,9 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -require_once DOL_DOCUMENT_ROOT . '/hrm/class/evaluation.class.php'; -require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_evaluation.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/hrm/class/evaluation.class.php'; +require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_evaluation.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php'; // Load translation files required by the page $langs->loadLangs(array('hrm', 'companies', 'other', 'mails')); @@ -138,43 +139,13 @@ if ($object->id) { $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 (isModEnabled('project')) - { - $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 .= $langs->trans('Label').' : '.$object->label; + $u_position = new User(($db)); + $u_position->fetch($object->fk_user); + $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); + $job = new Job($db); + $job->fetch($object->fk_job); + $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); $morehtmlref .= '
'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); diff --git a/htdocs/hrm/evaluation_document.php b/htdocs/hrm/evaluation_document.php index 23f9d260f0f..84bc6023291 100644 --- a/htdocs/hrm/evaluation_document.php +++ b/htdocs/hrm/evaluation_document.php @@ -33,9 +33,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT . '/hrm/class/evaluation.class.php'; -require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_evaluation.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php'; +require_once DOL_DOCUMENT_ROOT.'/hrm/class/evaluation.class.php'; +require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_evaluation.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php'; // Load translation files required by the page $langs->loadLangs(array('hrm', 'companies', 'other', 'mails')); @@ -138,7 +138,7 @@ if ($object->id) { $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('Job').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); $morehtmlref .= '
'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php index f475cef7af7..cf3272b894e 100644 --- a/htdocs/hrm/evaluation_list.php +++ b/htdocs/hrm/evaluation_list.php @@ -54,6 +54,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'); +$ref = GETPOST('ref', 'alpha'); // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; diff --git a/htdocs/hrm/evaluation_note.php b/htdocs/hrm/evaluation_note.php index 5c02b533bb7..ff0921cc59e 100644 --- a/htdocs/hrm/evaluation_note.php +++ b/htdocs/hrm/evaluation_note.php @@ -113,7 +113,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('Job').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); $morehtmlref .= '
'; diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php index e79af867a74..739dc8bee02 100644 --- a/htdocs/hrm/position_list.php +++ b/htdocs/hrm/position_list.php @@ -54,6 +54,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'); +$ref = GETPOST('ref', 'alpha'); // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; @@ -115,11 +116,11 @@ $arrayfields = array(); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) { - $visible = (int) dol_eval($val['visible'], 1, 1, '1'); + $visible = (int) 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, 1, '1')), + 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], 'help'=> isset($val['help']) ? $val['help'] : '' ); @@ -136,18 +137,15 @@ $permissiontoread = $user->rights->hrm->all->read; $permissiontoadd = $user->rights->hrm->all->write; $permissiontodelete = $user->rights->hrm->all->delete; -// Security check -if (empty($conf->hrm->enabled)) { - accessforbidden('Module not enabled'); -} - // Security check (enable the most restrictive one) if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) accessforbidden(); //$socid = 0; if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->hrm->enabled)) accessforbidden(); +if (!isModEnabled('hrm')) { + accessforbidden('Module hrm not enabled'); +} if (!$permissiontoread) accessforbidden(); @@ -250,23 +248,23 @@ foreach ($search as $key => $val) { } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) { - if ($search[$key] == '-1' || $search[$key] === '0') { + if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) { $search[$key] = ''; } $mode_search = 2; } if ($search[$key] != '') { - $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); + $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search)); } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { $columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key); if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/_dtstart$/', $key)) { - $sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'"; } if (preg_match('/_dtend$/', $key)) { - $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'"; } } } @@ -290,7 +288,7 @@ $sql .= $hookmanager->resPrint; /* If a group by is required $sql .= " GROUP BY "; foreach($object->fields as $key => $val) { - $sql .= "t.".$key.", "; + $sql .= "t.".$db->escape($key).", "; } // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { @@ -305,8 +303,6 @@ $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)) { @@ -316,24 +312,24 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $page = 0; $offset = 0; } + $db->free($resql); } -// 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); +// Complete request and execute it with limit +$sql .= $db->order($sortfield, $sortorder); +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); @@ -366,6 +362,9 @@ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', ''); $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -374,11 +373,17 @@ if ($limit > 0 && $limit != $conf->liste_limit) { } foreach ($search as $key => $val) { - if (is_array($search[$key]) && count($search[$key])) { + if (is_array($search[$key])) { foreach ($search[$key] as $skey) { - $param .= '&search_'.$key.'[]='.urlencode($skey); + if ($skey != '') { + $param .= '&search_'.$key.'[]='.urlencode($skey); + } } - } else { + } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) { + $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int')); + $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int')); + $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int')); + } elseif ($search[$key] != '') { $param .= '&search_'.$key.'='.urlencode($search[$key]); } } @@ -399,7 +404,7 @@ $arrayofmassactions = array( //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); -if ($permissiontodelete) { +if (!empty($permissiontodelete)) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { @@ -418,6 +423,7 @@ print ''; print ''; print ''; print ''; +print ''; $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/position.php', 1).'?action=create', '', $permissiontoadd); @@ -431,9 +437,12 @@ $trackid = 'xxxx'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { + $setupstring = ''; foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); + $setupstring .= $key."=".$val.";"; } + print ''."\n"; print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; } @@ -457,7 +466,7 @@ if (!empty($moreforfilter)) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table @@ -467,7 +476,15 @@ print ''; +// Action column +if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; +} foreach ($object->fields as $key => $val) { + $searchkey = empty($search[$key]) ? '' : $search[$key]; $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { $cssforfield .= ($cssforfield ? ' ' : '').'center'; @@ -475,7 +492,7 @@ foreach ($object->fields as $key => $val) { $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' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { @@ -483,9 +500,7 @@ foreach ($object->fields as $key => $val) { if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { - print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); - } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) { - print ''; + print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { print '
'; print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); @@ -493,6 +508,12 @@ foreach ($object->fields as $key => $val) { print '
'; print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; + } elseif ($key == 'lang') { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; + $formadmin = new FormAdmin($db); + print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2); + } else { + print ''; } print ''; } @@ -505,16 +526,23 @@ $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 '
'; +if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; +} print ''."\n"; +$totalarray = array(); +$totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; +if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +} foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { @@ -523,21 +551,26 @@ foreach ($object->fields as $key => $val) { $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' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } + $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label 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"; + $totalarray['nbfield']++; } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); $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"; +if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +} +$totalarray['nbfield']++; print ''."\n"; @@ -555,9 +588,11 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar // Loop on record // -------------------------------------------------------------------- $i = 0; +$savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < ($limit ? min($num, $limit) : $num)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen @@ -566,75 +601,107 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - print ''; - foreach ($object->fields as $key => $val) { - $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } elseif ($key == 'status') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; } - - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { - $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); - } elseif ($key == 'rowid') { - print $object->getNomUrl(1); - } else { - print $object->showOutputField($val, $key, $object->$key, ''); + } else { + // Show here line of result + $j = 0; + print ''; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; - } - if (!isset($totalarray['val'])) { - $totalarray['val'] = array(); - } - if (!isset($totalarray['val']['t.'.$key])) { - $totalarray['val']['t.'.$key] = 0; - } - $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']++; - } + foreach ($object->fields as $key => $val) { + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } elseif ($key == 'status') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } - print ''."\n"; + 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')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { + $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); + } elseif ($key == 'rowid') { + print $object->showOutputField($val, $key, $object->id, ''); + } else { + print $object->showOutputField($val, $key, $object->$key, ''); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + } + if (!isset($totalarray['val'])) { + $totalarray['val'] = array(); + } + if (!isset($totalarray['val']['t.'.$key])) { + $totalarray['val']['t.'.$key] = 0; + } + $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 + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print ''."\n"; + } $i++; } @@ -650,14 +717,14 @@ if ($num == 0) { $colspan++; } } - print ''; + 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 +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; -$searchpicto = $form->showFilterButtons(); -print $searchpicto; -print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
'; + print '
'; } - - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + // Output Kanban + print $object->getKanbanView(''); + if ($i == ($imaxinloop - 1)) { + print '
'; + 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 ''; - 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 '
'; + 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").'
'.$langs->trans("NoRecordFound").'
'."\n"; diff --git a/htdocs/hrm/skill_list.php b/htdocs/hrm/skill_list.php index 664d54212a3..ddf385b170e 100644 --- a/htdocs/hrm/skill_list.php +++ b/htdocs/hrm/skill_list.php @@ -344,21 +344,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', ''); -// Example : Adding jquery code -// print ''; - $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 618e001b21c..f9eb9968f4f 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -195,3 +195,4 @@ ALTER TABLE llx_bank_url ADD INDEX idx_bank_url_url_id (url_id); ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_code varchar(3) NULL; ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_tx double(24,8) NULL; +ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN rank rankorder integer; diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index cbd3dc91663..966f2399a13 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -26,8 +26,8 @@ HRM_DEFAULT_SKILL_DESCRIPTION=Default description of ranks when skill is created deplacement=Shift DateEval=Evaluation date JobCard=Job card -JobPosition=Job -JobsPosition=Jobs +JobPosition=Job profile +JobsPosition=Job profiles NewSkill=New Skill SkillType=Skill type Skilldets=List of ranks for this skill diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 093a17aed94..95f10b5b90c 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -356,6 +356,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea }*/ $formquestion = array(); + /* $forcecombo=0; if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 009b7b7de3a..30ccdd22e44 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -136,7 +136,7 @@ if (!$sortorder) { } // Initialize array of search criterias -$search_all = GETPOST('search_all', 'alphanohtml'); +$search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'); $search = array(); foreach ($object->fields as $key => $val) { if (GETPOST('search_'.$key, 'alpha') !== '') { @@ -198,7 +198,7 @@ if ($user->socid > 0) accessforbidden(); //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); if (!isModEnabled("mymodule")) { - accessforbidden(); + accessforbidden('Module mymodule not enabled'); } if (!$permissiontoread) accessforbidden(); diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 281d58ea99e..9acc4232490 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -104,10 +104,10 @@ class Inventory extends CommonObject 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Warehouse', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'index'=>1, 'help'=>'InventoryForASpecificWarehouse', 'picto'=>'stock', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax200'), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'get_name_url_params' => '0::0:-1:0::1', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'InventoryForASpecificProduct', 'picto'=>'product', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax200'), 'categories_product' => array('type'=>'chkbxlst:categorie:label:rowid::type=0:0:', 'label'=>'OrProductsWithCategories', 'visible'=>3, 'enabled'=>1, 'position'=>33, 'help'=>'', 'picto'=>'category', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx'), - 'date_inventory' => array('type'=>'date', 'label'=>'DateValue', 'visible'=>1, 'enabled'=>'$conf->global->STOCK_INVENTORY_ADD_A_VALUE_DATE', 'position'=>35), // This date is not used so disabled by default. - 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), - 'date_validation' => array('type'=>'datetime', 'label'=>'DateValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>502), + 'date_inventory' => array('type'=>'date', 'label'=>'DateValue', 'visible'=>1, 'enabled'=>'$conf->global->STOCK_INVENTORY_ADD_A_VALUE_DATE', 'position'=>35, 'csslist'=>'nowraponall'), // This date is not used so disabled by default. + 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500, 'csslist'=>'nowraponall'), + 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501, 'csslist'=>'nowraponall'), + 'date_validation' => array('type'=>'datetime', 'label'=>'DateValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>502, 'csslist'=>'nowraponall'), 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax200'), 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511, 'csslist'=>'tdoverflowmax200'), 'fk_user_valid' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>512, 'csslist'=>'tdoverflowmax200'), diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 9c0ac895a55..30427202cc1 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -846,6 +846,9 @@ textarea.centpercent { .paddingleft { padding-: 4px; } +.paddingleftimp { + padding-: 4px !important; +} .paddingleft2 { padding-: 2px; } @@ -855,6 +858,9 @@ textarea.centpercent { .paddingright { padding-: 4px; } +.paddingrightimp { + padding-: 4px !important; +} .paddingright2 { padding-: 2px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 346b683f83c..8f06afd20d8 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -997,6 +997,9 @@ textarea.centpercent { .paddingleft { padding-: 4px; } +.paddingleftimp { + padding-: 4px !important; +} .paddingleft2 { padding-: 2px; } @@ -1006,6 +1009,9 @@ textarea.centpercent { .paddingright { padding-: 4px; } +.paddingrightimp { + padding-: 4px !important; +} .paddingright2 { padding-: 2px; } From dde7f6f65576013da57b737567fb1453fbe9ddf3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2022 23:33:36 +0200 Subject: [PATCH 100/176] Look and feel v17 --- htdocs/core/lib/functions.lib.php | 6 +-- htdocs/core/tpl/commonfields_add.tpl.php | 2 +- .../class/knowledgerecord.class.php | 4 +- .../knowledgerecord_card.php | 37 +++++++++++++++++-- htdocs/theme/eldy/global.inc.php | 6 ++- htdocs/theme/md/style.css.php | 6 ++- 6 files changed, 50 insertions(+), 11 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f026d58e2de..8d6a0ff9414 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1820,7 +1820,7 @@ function dol_fiche_head($links = array(), $active = '0', $title = '', $notab = 0 * @param array $links Array of tabs. Note that label into $links[$i][1] must be already HTML escaped. * @param string $active Active tab name * @param string $title Title - * @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using print dol_get_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after) + * @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using print dol_get_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after), -3=-2+'noborderbottom' * @param string $picto Add a picto on tab title * @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto. * @param string $morehtmlright Add more html content on right of tabs title @@ -1994,8 +1994,8 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab $out .= "
\n"; } - if (!$notab || $notab == -1 || $notab == -2) { - $out .= "\n".'
'."\n"; + if (!$notab || $notab == -1 || $notab == -2 || $notab == -3) { + $out .= "\n".'
'."\n"; } $parameters = array('tabname' => $active, 'out' => $out); diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php index be91d7b28a5..24fddc2fda4 100644 --- a/htdocs/core/tpl/commonfields_add.tpl.php +++ b/htdocs/core/tpl/commonfields_add.tpl.php @@ -35,7 +35,7 @@ if (empty($conf) || !is_object($conf)) { $object->fields = dol_sort_array($object->fields, 'position'); foreach ($object->fields as $key => $val) { - // Discard if extrafield is a hidden field on form + // Discard if field is a hidden field on form if (abs($val['visible']) != 1 && abs($val['visible']) != 3) { continue; } diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index c20fa91c621..3e78b5b557c 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -105,7 +105,6 @@ class KnowledgeRecord extends CommonObject 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>20, 'index'=>1), 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflowmax300', 'copytoclipboard'=>1, 'tdcss'=>'titlefieldcreate nowraponall'), 'lang' => array('type'=>'varchar(6)', 'label'=>'Language', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1, 'tdcss'=>'titlefieldcreate nowraponall', "csslist"=>"tdoverflowmax100"), - 'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>3, 'csslist'=>'tdoverflowmax300', 'copytoclipboard'=>1, 'tdcss'=>'titlefieldcreate nowraponall'), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>2,), 'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>'1', 'position'=>600, 'notnull'=>0, 'visible'=>0,), @@ -115,7 +114,8 @@ class KnowledgeRecord extends CommonObject 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,), 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), //'url' => array('type'=>'varchar(255)', 'label'=>'URL', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'csslist'=>'tdoverflow200', 'help'=>'UrlForInfoPage'), - 'fk_c_ticket_category' => array('type'=>'integer:CTicketCategory:ticket/class/cticketcategory.class.php:0:(t.active:=:1):pos', 'label'=>'SuggestedForTicketsInGroup', 'enabled'=>'$conf->ticket->enabled', 'position'=>512, 'notnull'=>0, 'visible'=>-1, 'help'=>'YouCanLinkArticleToATicketCategory', 'csslist'=>'minwidth200 tdoverflowmax250'), + 'fk_c_ticket_category' => array('type'=>'integer:CTicketCategory:ticket/class/cticketcategory.class.php:0:(t.active:=:1):pos', 'label'=>'SuggestedForTicketsInGroup', 'enabled'=>'$conf->ticket->enabled', 'position'=>520, 'notnull'=>0, 'visible'=>-1, 'help'=>'YouCanLinkArticleToATicketCategory', 'csslist'=>'minwidth200 tdoverflowmax250'), + 'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>600, 'notnull'=>0, 'visible'=>3, 'csslist'=>'tdoverflowmax300', 'copytoclipboard'=>1, 'tdcss'=>'titlefieldcreate nowraponall'), 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>5, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '9'=>'Obsolete'),), ); public $rowid; diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index ce3fceeff1c..c28bc9e1c9c 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -182,12 +182,14 @@ if ($action == 'create') { print ''; } - print dol_get_fiche_head(array(), ''); + print dol_get_fiche_head(array(), '', '', -3); print ''."\n"; // Common attributes + $object->fields['answer']['enabled'] = 0; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; + $object->fields['answer']['enabled'] = 1; if (isModEnabled('categorie')) { $cate_arbo = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', 'parent', 64, 0, 1); @@ -205,6 +207,14 @@ if ($action == 'create') { print '
'."\n"; + // Add field answer + print '
'; + print $langs->trans($object->fields['answer']['label']).'
'; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor('answer', $object->answer, '', 200, 'dolibarr_notes', 'In', true, 0, true, ROWS_9, '100%'); + $out = $doleditor->Create(1); + print $out; + print dol_get_fiche_end(); print $form->buttonsSaveCancel('Create'); @@ -229,12 +239,14 @@ if (($id || $ref) && $action == 'edit') { print ''; } - print dol_get_fiche_head(); + print dol_get_fiche_head(array(), '', '', -3); print ''."\n"; // Common attributes + $object->fields['answer']['enabled'] = 0; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; + $object->fields['answer']['enabled'] = 1; if (isModEnabled('categorie')) { $cate_arbo = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', 'parent', 64, 0, 1); @@ -260,6 +272,14 @@ if (($id || $ref) && $action == 'edit') { print '
'; + // Add field answer + print '
'; + print $langs->trans($object->fields['answer']['label']).'
'; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor('answer', $object->answer, '', 200, 'dolibarr_notes', 'In', true, 0, true, ROWS_9, '100%'); + $out = $doleditor->Create(1); + print $out; + print dol_get_fiche_end(); print $form->buttonsSaveCancel(); @@ -408,11 +428,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $keyforbreak='fk_c_ticket_category'; // 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 + $object->fields['answer']['enabled'] = 0; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + $object->fields['answer']['enabled'] = 1; // Categories if (isModEnabled('categorie')) { - print ''.$langs->trans("Categories").''; + print ''.$langs->trans("Categories").''; print $form->showCategories($object->id, Categorie::TYPE_KNOWLEDGEMANAGEMENT, 1); print ""; } @@ -421,11 +443,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print ''; + print '
'; print '
'; print '
'; + // Add field answer + print '
'; + print $langs->trans($object->fields['answer']['label']).'
'; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor('answer', $object->answer, '', 200, 'dolibarr_notes', 'In', true, 0, true, ROWS_9, '100%', 1); + $out = $doleditor->Create(1); + print $out; + print dol_get_fiche_end(); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 30427202cc1..3fba934bf4e 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5606,8 +5606,12 @@ a.cke_dialog_ui_button } .cke_dialog_ui_hbox_last { - vertical-align: bottom ! important; + vertical-align: bottom !important; } +.cke_dialog_ui_hbox_first { + vertical-align: middle !important; +} + /* .cke_editable { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8f06afd20d8..9ebabb5fc5f 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5448,7 +5448,11 @@ a.cke_dialog_ui_button } .cke_dialog_ui_hbox_last { - vertical-align: bottom ! important; + vertical-align: bottom !important; +} +.cke_dialog_ui_hbox_last +{ + vertical-align: bottom !important; } /* .cke_editable From 8b61fd5c1a1ee5c6464c426c1a1644f4b93c23ad Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Fri, 21 Oct 2022 00:31:31 +0200 Subject: [PATCH 101/176] Lang --- htdocs/langs/en_US/cron.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index 9705f8823b0..021de63de05 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -84,6 +84,7 @@ MakeLocalDatabaseDumpShort=Local database backup MakeLocalDatabaseDump=Create a local database dump. Parameters are: compression ('gz' or 'bz' or 'none'), backup type ('mysql', 'pgsql', 'auto'), 1, 'auto' or filename to build, number of backup files to keep MakeSendLocalDatabaseDumpShort=Send local database backup MakeSendLocalDatabaseDump=Send local database backup by email. Parameters are: to, from, subject, message, filename (Name of file sent), filter ('sql' for backup of database only) +BackupIsTooLargeSend=Sorry, last backup file is too large to be send by email WarningCronDelayed=Attention, for performance purpose, whatever is next date of execution of enabled jobs, your jobs may be delayed to a maximum of %s hours, before being run. DATAPOLICYJob=Data cleaner and anonymizer JobXMustBeEnabled=Job %s must be enabled From 0e5f01dd13fec2a74c2905c457132ad99dc8a80a Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Fri, 21 Oct 2022 00:33:04 +0200 Subject: [PATCH 102/176] Add param --- htdocs/core/class/utils.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 9a330c7aba5..daaebd09ecf 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -1237,9 +1237,10 @@ class Utils * @param string $message Message * @param string $filename List of files to attach (full path of filename on file system) * @param string $filter Filter file send + * @param string $sizelimit Limit size to send file * @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK) */ - public function sendBackup($sendto = '', $from = '', $subject = '', $message = '', $filename = '', $filter = '') + public function sendBackup($sendto = '', $from = '', $subject = '', $message = '', $filename = '', $filter = '', $sizelimit = 100000000) { global $conf, $langs; From 1db5ab30a944aa41718a1540234a0c8a48960234 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Fri, 21 Oct 2022 00:34:52 +0200 Subject: [PATCH 103/176] Link download file in mail --- htdocs/core/class/utils.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index daaebd09ecf..1d3df8191a6 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -1298,9 +1298,13 @@ class Utils } if ($filepath) { - if ($filesize > 100000000) { - $output = 'Sorry, last backup file is too large to be send by email'; - $error++; + if ($filesize > $sizelimit) { + $message .= '
'.$langs->trans("BackupIsTooLargeSend"); + $documenturl = $dolibarr_main_url_root.'/document.php?modulepart=systemtools&atachement=1&file=backup/'.urlencode($filename[0]); + $message .= '
Lien de téléchargement'; + $filepath = ''; + $mimetype = ''; + $filename = ''; } } else { $output = 'No backup file found'; From 2fabbf846a8553eb68ade5c0830c5717c38fdcd5 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 21 Oct 2022 06:35:40 +0200 Subject: [PATCH 104/176] FIX more simple --- htdocs/core/ajax/constantonoff.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/ajax/constantonoff.php b/htdocs/core/ajax/constantonoff.php index fb750d346bd..405424229ab 100644 --- a/htdocs/core/ajax/constantonoff.php +++ b/htdocs/core/ajax/constantonoff.php @@ -49,7 +49,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; $action = GETPOST('action', 'aZ09'); // set or del $name = GETPOST('name', 'alpha'); $entity = GETPOST('entity', 'int'); -$value = (GETPOST('value', 'aZ09') != '' ? GETPOST('value', 'aZ09') : ((GETPOST('value', 'int') || GETPOST('value', 'int') == '0') ? GETPOST('value', 'int') : 1)); +$value = (GETPOST('value', 'aZ09') != '' ? GETPOST('value', 'aZ09') : 1); /* From a96a623c0ee9af7b074d9a1cb842d52424784720 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 21 Oct 2022 06:48:33 +0200 Subject: [PATCH 105/176] FIX remove unused code for avoid error --- htdocs/core/class/translate.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 5bfdbc7e0f1..394f328ccdf 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -721,9 +721,9 @@ class Translate return $str; } else { - if ($key[0] == '$') { + /*if ($key[0] == '$') { return dol_eval($key, 1, 1, '1'); - } + }*/ return $this->getTradFromKey($key); } } From f57412107ba586af84b4d8531d5802d2946013ad Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 21 Oct 2022 11:09:36 +0200 Subject: [PATCH 106/176] FIX missing hook parameters --- htdocs/commande/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index f01518651e6..bb296fae10b 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -823,7 +823,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s2.rowid = s.parent"; From 3e5273d83b2c6e8d4135d4f7822ed1e199078589 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Oct 2022 11:14:28 +0200 Subject: [PATCH 107/176] NEW Option PRODUIT_DESC_IN_FORM accept (desktop only or +smartphone) --- htdocs/admin/fckeditor.php | 2 +- htdocs/contact/consumption.php | 6 +++--- htdocs/contrat/card.php | 2 +- htdocs/core/boxes/box_services_contracts.php | 6 ------ htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/conf.class.php | 5 ++++- htdocs/core/lib/sendings.lib.php | 4 ++-- htdocs/core/tpl/objectline_view.tpl.php | 2 +- htdocs/delivery/card.php | 4 ++-- htdocs/expedition/card.php | 6 +++--- htdocs/expedition/shipment.php | 4 ++-- .../class/knowledgerecord.class.php | 2 +- htdocs/langs/en_US/admin.lang | 3 ++- htdocs/langs/en_US/knowledgemanagement.lang | 2 +- htdocs/main.inc.php | 10 +++++++++- htdocs/product/admin/product.php | 5 +++-- htdocs/reception/card.php | 8 ++++---- htdocs/societe/consumption.php | 6 +++--- 18 files changed, 43 insertions(+), 36 deletions(-) diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index dd4748a99f1..eeeb5035e16 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -93,7 +93,7 @@ foreach ($modules as $const => $desc) { if ($action == 'enable_'.strtolower($const)) { dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1", 'chaine', 0, '', $conf->entity); // If fckeditor is active in the product/service description, it is activated in the forms - if ($const == 'PRODUCTDESC' && !empty($conf->global->PRODUIT_DESC_IN_FORM)) { + if ($const == 'PRODUCTDESC' && getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) { dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1", 'chaine', 0, '', $conf->entity); } header("Location: ".$_SERVER["PHP_SELF"]); diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index fcab597d43a..bbd5bf005d2 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -520,7 +520,7 @@ if ($sql_select) { } $text .= ' - '.(!empty($objp->label) ? $objp->label : $label); - $description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($objp->description)); + $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description)); } if (($objp->info_bits & 2) == 2) { @@ -571,7 +571,7 @@ if ($sql_select) { echo get_date_range($objp->date_start, $objp->date_end); // Add description in form - if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) { + if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) { print (!empty($objp->description) && $objp->description != $objp->product_label) ? '
'.dol_htmlentitiesbr($objp->description) : ''; } } else { @@ -608,7 +608,7 @@ if ($sql_select) { // Show range $prodreftxt .= get_date_range($objp->date_start, $objp->date_end); // Add description in form - if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) + if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) { $prodreftxt .= (!empty($objp->description) && $objp->description!=$objp->product_label)?'
'.dol_htmlentitiesbr($objp->description):''; } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 4c6c07da2cb..111b2d58fd9 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1589,7 +1589,7 @@ if ($action == 'create') { $description = $objp->description; // Add description in form - if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) { + if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) { $text .= (!empty($objp->description) && $objp->description != $objp->plabel) ? '
'.dol_htmlentitiesbr($objp->description) : ''; $description = ''; // Already added into main visible desc } diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index 9ec279fe2d0..3d1e640f34b 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -169,12 +169,6 @@ class box_services_contracts extends ModeleBoxes } $description = $objp->description; - // Add description in form - if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) { - //$text .= (!empty($objp->description) && $objp->description!=$objp->product_label)?'
'.dol_htmlentitiesbr($objp->description):''; - $description = ''; // Already added into main visible desc - } - $s = $form->textwithtooltip($text, $description, 3, '', '', '', 0, (!empty($objp->fk_parent_line) ?img_picto('', 'rightarrow') : '')); } else { $s = img_object($langs->trans("ShowProductOrService"), ($objp->product_type ? 'service' : 'product')).' '.dol_htmlentitiesbr($objp->description); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a198d74f808..d8eb8789d6e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5015,7 +5015,7 @@ abstract class CommonObject } $text .= ' - '.(!empty($line->label) ? $line->label : $label); - $description .= (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : (!empty($line->description) ? dol_htmlentitiesbr($line->description) : '')); // Description is what to show on popup. We shown nothing if already into desc. + $description .= (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : (!empty($line->description) ? dol_htmlentitiesbr($line->description) : '')); // Description is what to show on popup. We shown nothing if already into desc. } $line->pu_ttc = price2num((!empty($line->subprice) ? $line->subprice : 0) * (1 + ((!empty($line->tva_tx) ? $line->tva_tx : 0) / 100)), 'MU'); diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 234f8d80e0c..42927d398aa 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -347,7 +347,7 @@ class Conf $db->free($resql); } - // Include other local consts.php files and fetch their values to the corresponding database constants. + // Include other local file xxx/zzz_consts.php to overwrite some variables if (!empty($this->global->LOCAL_CONSTS_FILES)) { $filesList = explode(":", $this->global->LOCAL_CONSTS_FILES); foreach ($filesList as $file) { @@ -675,6 +675,9 @@ class Conf } $this->product->limit_size = $this->global->PRODUIT_LIMIT_SIZE; + // Set PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE, may be modified later according to browser + $this->global->PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE = (isset($this->global->PRODUIT_DESC_IN_FORM) ? $this->global->PRODUIT_DESC_IN_FORM : 0); + // conf->theme et $this->css if (empty($this->global->MAIN_THEME)) { $this->global->MAIN_THEME = "eldy"; diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 110dcabb0f0..6d9598a04ae 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -341,14 +341,14 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') $product_static->status_batch = $objp->product_tobatch; $text = $product_static->getNomUrl(1); $text .= ' - '.$label; - $description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($objp->description)); + $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description)); print $form->textwithtooltip($text, $description, 3, '', '', $i); // Show range print_date_range($objp->date_start, $objp->date_end); // Add description in form - if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) { + if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) { print (!empty($objp->description) && $objp->description != $objp->product) ? '
'.dol_htmlentitiesbr($objp->description) : ''; } diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 11104f61798..03e98e1147d 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -213,7 +213,7 @@ if (($line->info_bits & 2) == 2) { } // Add description in form - if ($line->fk_product > 0 && !empty($conf->global->PRODUIT_DESC_IN_FORM)) { + if ($line->fk_product > 0 && getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) { if ($line->element == 'facturedetrec') { print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start_fill || $line->date_end_fill) ? '' : '
').'
'.dol_htmlentitiesbr($line->description) : ''; } elseif ($line->element == 'invoice_supplier_det_rec') { diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 8ab49d36990..d458b14b0cb 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -577,11 +577,11 @@ if ($action == 'create') { } $text .= ' '.$object->lines[$i]->product_ref.''; $text .= ' - '.$label; - $description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($object->lines[$i]->description)); + $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($object->lines[$i]->description)); //print $description; print $form->textwithtooltip($text, $description, 3, '', '', $i); print_date_range($object->lines[$i]->date_start, $object->lines[$i]->date_end); - if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) { + if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) { print (!empty($object->lines[$i]->description) && $object->lines[$i]->description != $object->lines[$i]->product_label) ? '
'.dol_htmlentitiesbr($object->lines[$i]->description) : ''; } } else { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 17173088eed..6c880a6e425 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1143,7 +1143,7 @@ if ($action == 'create') { $product_static->status_buy = $line->product_tobuy; $product_static->status_batch = $line->product_tobatch; - $showdescinproductdesc = (getDolGlobalString('PRODUIT_DESC_IN_FORM') == 2 ? 1 : 0); + $showdescinproductdesc = getDolGlobalString('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE'); $text = $product_static->getNomUrl(1); $text .= ' - '.(!empty($line->label) ? $line->label : $line->product_label); @@ -2202,10 +2202,10 @@ if ($action == 'create') { $text = $product_static->getNomUrl(1); $text .= ' - '.$label; - $description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($lines[$i]->description)); + $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($lines[$i]->description)); print $form->textwithtooltip($text, $description, 3, '', '', $i); print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : '', !empty($lines[$i]->date_end) ? $lines[$i]->date_end : ''); - if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) { + if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) { print (!empty($lines[$i]->description) && $lines[$i]->description != $lines[$i]->product) ? '
'.dol_htmlentitiesbr($lines[$i]->description) : ''; } print "\n"; diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 769642d305a..97162f4aaf2 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -733,7 +733,7 @@ if ($id > 0 || !empty($ref)) { $text = $product_static->getNomUrl(1); $text .= ' - '.$label; - $description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($objp->description)).'
'; + $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description)).'
'; $description .= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80); print $form->textwithtooltip($text, $description, 3, '', '', $i); @@ -741,7 +741,7 @@ if ($id > 0 || !empty($ref)) { print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end)); // Add description in form - if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) { + if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) { print ($objp->description && $objp->description != $objp->product_label) ? '
'.dol_htmlentitiesbr($objp->description) : ''; } diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 3e78b5b557c..fee18df2478 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -114,7 +114,7 @@ class KnowledgeRecord extends CommonObject 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,), 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), //'url' => array('type'=>'varchar(255)', 'label'=>'URL', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'csslist'=>'tdoverflow200', 'help'=>'UrlForInfoPage'), - 'fk_c_ticket_category' => array('type'=>'integer:CTicketCategory:ticket/class/cticketcategory.class.php:0:(t.active:=:1):pos', 'label'=>'SuggestedForTicketsInGroup', 'enabled'=>'$conf->ticket->enabled', 'position'=>520, 'notnull'=>0, 'visible'=>-1, 'help'=>'YouCanLinkArticleToATicketCategory', 'csslist'=>'minwidth200 tdoverflowmax250'), + 'fk_c_ticket_category' => array('type'=>'integer:CTicketCategory:ticket/class/cticketcategory.class.php:0:(t.active:=:1):pos', 'label'=>'SuggestedForTicketsInGroup', 'enabled'=>'isModEnabled("ticket")', 'position'=>520, 'notnull'=>0, 'visible'=>-1, 'help'=>'YouCanLinkArticleToATicketCategory', 'csslist'=>'minwidth200 tdoverflowmax250'), 'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>600, 'notnull'=>0, 'visible'=>3, 'csslist'=>'tdoverflowmax300', 'copytoclipboard'=>1, 'tdcss'=>'titlefieldcreate nowraponall'), 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>5, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '9'=>'Obsolete'),), ); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index a78c19f5dd9..e8f8f5bac6d 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2331,4 +2331,5 @@ RECEPTION_PDF_HIDE_ORDERED=Hide the quantity ordered on the generated documents MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT=Show the price on the generated documents for receptions WarningDisabled=Warning disabled LimitsAndMitigation=Access limits and mitigation - \ No newline at end of file +DesktopsOnly=Desktops only +DesktopsAndSmartphones=Desktops et smartphones \ No newline at end of file diff --git a/htdocs/langs/en_US/knowledgemanagement.lang b/htdocs/langs/en_US/knowledgemanagement.lang index 1746b0671ce..38c1624afad 100644 --- a/htdocs/langs/en_US/knowledgemanagement.lang +++ b/htdocs/langs/en_US/knowledgemanagement.lang @@ -47,7 +47,7 @@ KnowledgeRecord = Article KnowledgeRecordExtraFields = Extrafields for Article GroupOfTicket=Group of tickets YouCanLinkArticleToATicketCategory=You can link the article to a ticket group (so the article will be highlighted on any tickets in this group) -SuggestedForTicketsInGroup=Suggested for tickets when group is +SuggestedForTicketsInGroup=Suggested on ticket creation SetObsolete=Set as obsolete ConfirmCloseKM=Do you confirm the closing of this article as obsolete ? diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index dcf9bb7d96d..32d442008eb 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1207,14 +1207,22 @@ if (GETPOST('dol_no_mouse_hover', 'int') || !empty($_SESSION['dol_no_mouse_hover if (GETPOST('dol_use_jmobile', 'int') || !empty($_SESSION['dol_use_jmobile'])) { $conf->dol_use_jmobile = 1; } +// If not on Desktop if (!empty($conf->browser->layout) && $conf->browser->layout != 'classic') { $conf->dol_no_mouse_hover = 1; } + +// If on smartphone or optmized for small screen if ((!empty($conf->browser->layout) && $conf->browser->layout == 'phone') || (!empty($_SESSION['dol_screenwidth']) && $_SESSION['dol_screenwidth'] < 400) - || (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 400) + || (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 400 + || !empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) ) { $conf->dol_optimize_smallscreen = 1; + + if (isset($conf->global->PRODUIT_DESC_IN_FORM) && $conf->global->PRODUIT_DESC_IN_FORM == 1) { + $conf->global->PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE = 0; + } } // Replace themes bugged with jmobile with eldy if (!empty($conf->dol_use_jmobile) && in_array($conf->theme, array('bureau2crea', 'cameleo', 'amarok'))) { diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 7462431d087..a8106a9ae88 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -133,7 +133,7 @@ if ($action == 'other') { /*$value = GETPOST('PRODUIT_SOUSPRODUITS', 'alpha'); $res = dolibarr_set_const($db, "PRODUIT_SOUSPRODUITS", $value, 'chaine', 0, '', $conf->entity);*/ - $value = GETPOST('activate_viewProdDescInForm', 'alpha'); + $value = GETPOST('PRODUIT_DESC_IN_FORM', 'alpha'); $res = dolibarr_set_const($db, "PRODUIT_DESC_IN_FORM", $value, 'chaine', 0, '', $conf->entity); $value = GETPOST('activate_viewProdTextsInThirdpartyLanguage', 'alpha'); @@ -689,7 +689,8 @@ print ''; print ''; print ''.$langs->trans("ViewProductDescInFormAbility").''; print ''; -print $form->selectyesno("activate_viewProdDescInForm", $conf->global->PRODUIT_DESC_IN_FORM, 1); +$arrayofchoices = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes").' ('.$langs->trans("DesktopsOnly").')', '2' => $langs->trans("Yes").' ('.$langs->trans("DesktopsAndSmartphones").')'); +print $form->selectarray("PRODUIT_DESC_IN_FORM", $arrayofchoices, getDolGlobalInt('PRODUIT_DESC_IN_FORM'), 0); print ''; print ''; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index d69806f2517..011781f33e2 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1102,14 +1102,14 @@ if ($action == 'create') { $text = $product_static->getNomUrl(1); $text .= ' - '.(!empty($line->label) ? $line->label : $line->product_label); - $description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($line->desc)); + $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($line->desc)); print $form->textwithtooltip($text, $description, 3, '', '', $i); // Show range print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end)); // Add description in form - if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) { + if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) { print ($line->desc && $line->desc != $line->product_label) ? '
'.dol_htmlentitiesbr($line->desc) : ''; } } @@ -1825,10 +1825,10 @@ if ($action == 'create') { if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) { $text = $lines[$i]->product->getNomUrl(1); $text .= ' - '.$label; - $description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($lines[$i]->product->description)); + $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($lines[$i]->product->description)); print $form->textwithtooltip($text, $description, 3, '', '', $i); print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : 0, !empty($lines[$i]->date_end) ? $lines[$i]->date_end : 0); - if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) { + if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) { print (!empty($lines[$i]->product->description) && $lines[$i]->description != $lines[$i]->product->description) ? '
'.dol_htmlentitiesbr($lines[$i]->description) : ''; } } diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 0ddbe7f2ad5..c74b5e68985 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -564,7 +564,7 @@ if ($sql_select) { } $text .= ' - '.(!empty($objp->label) ? $objp->label : $label); - $description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($objp->description)); + $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description)); } if (($objp->info_bits & 2) == 2) { ?> @@ -619,7 +619,7 @@ if ($sql_select) { echo get_date_range($objp->date_start, $objp->date_end); // Add description in form - if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) { + if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) { print (!empty($objp->description) && $objp->description != $objp->product_label) ? '
'.dol_htmlentitiesbr($objp->description) : ''; } } else { @@ -656,7 +656,7 @@ if ($sql_select) { // Show range $prodreftxt .= get_date_range($objp->date_start, $objp->date_end); // Add description in form - if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) + if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) { $prodreftxt .= (!empty($objp->description) && $objp->description!=$objp->product_label)?'
'.dol_htmlentitiesbr($objp->description):''; } From 71364a67170bd653320cdd2879bdcdf7380f3016 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 21 Oct 2022 11:28:20 +0200 Subject: [PATCH 108/176] FIX missing token --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 4ec5fcc02c6..c3794a74ec7 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -735,7 +735,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) { // Get the HT price for the product and display it console.log("Load unit price without tax and set it into #price_ht for product id="+$(this).val()+" socid=socid; ?>"); $.post('/product/ajax/products.php?action=fetch', - { 'id': $(this).val(), 'socid': socid; ?> }, + { 'id': $(this).val(), 'socid': socid; ?>, 'token': '' }, function(data) { console.log("objectline_create.tpl Load unit price end, we got value ht="+data.price_ht+" ttc="+data.price_ttc+" pricebasetype="+data.pricebasetype); From 11aaf4748c08e2c7811574d0ff3c9c41b77281fc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Oct 2022 11:32:12 +0200 Subject: [PATCH 109/176] css --- htdocs/compta/prelevement/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index c03a2eea6b5..8be48493d08 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -285,7 +285,7 @@ if ($id > 0 || $ref) { print ''.$langs->trans("TransMetod").''; print $form->selectarray("methode", $object->methodes_trans); print ''; - print '
'; + print ''; print '
'; print ''; print '
'; From c74cc53b2205fdb30ff0e6f7f7befd630a3538b3 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 21 Oct 2022 12:16:52 +0200 Subject: [PATCH 110/176] Fix migration script when running on mysql 8 --- htdocs/install/mysql/migration/16.0.0-17.0.0.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index f9eb9968f4f..1dfcd489ee9 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -195,4 +195,5 @@ ALTER TABLE llx_bank_url ADD INDEX idx_bank_url_url_id (url_id); ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_code varchar(3) NULL; ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_tx double(24,8) NULL; -ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN rank rankorder integer; +-- VMYSQL4.3 ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN `rank` rankorder integer; +-- VPGSQL8.2 ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN rank rankorder integer; From 4a3a72245f00b6b9a0f6eba2049f4adc74f2b5ef Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Wed, 19 Oct 2022 12:16:44 +0200 Subject: [PATCH 111/176] Use shared entity on supplier order create --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9e59dbceda6..c535ad14b72 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1398,7 +1398,7 @@ class CommandeFournisseur extends CommonOrder $sql .= ", '".$this->db->escape($this->ref_supplier)."'"; $sql .= ", '".$this->db->escape($this->note_private)."'"; $sql .= ", '".$this->db->escape($this->note_public)."'"; - $sql .= ", ".((int) $conf->entity); + $sql .= ", ".setEntity($this); $sql .= ", ".((int) $this->socid); $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : "null"); $sql .= ", '".$this->db->idate($date)."'"; From 1d21d734006acca77978a5f1252f8f2cb4988956 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Oct 2022 13:19:21 +0200 Subject: [PATCH 112/176] NEW Add date event (!= date project) and location on event organization --- .../conferenceorbooth_list.php | 29 +++- .../conferenceorboothattendee_list.php | 29 +++- .../install/mysql/migration/16.0.0-17.0.0.sql | 5 + htdocs/install/mysql/tables/llx_projet.sql | 5 +- htdocs/projet/card.php | 154 +++++++++++++----- htdocs/projet/class/project.class.php | 86 +++++++--- htdocs/projet/comment.php | 18 +- htdocs/projet/contact.php | 18 +- htdocs/projet/element.php | 18 +- htdocs/projet/ganttview.php | 18 +- htdocs/projet/list.php | 6 +- htdocs/projet/tasks.php | 22 +-- htdocs/projet/tasks/comment.php | 18 +- htdocs/projet/tasks/contact.php | 18 +- htdocs/projet/tasks/document.php | 18 +- htdocs/projet/tasks/list.php | 5 +- htdocs/projet/tasks/note.php | 18 +- htdocs/projet/tasks/task.php | 20 +-- htdocs/projet/tasks/time.php | 25 +-- .../public/eventorganization/attendee_new.php | 24 +-- 20 files changed, 351 insertions(+), 203 deletions(-) diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 520435c9cdc..cf7ffcb607a 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -348,8 +348,15 @@ if ($projectid > 0) { } print ''; - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($project->budget_amount, '')) { + print ''.price($project->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").' ('.$langs->trans("Project").')'; $start = dol_print_date($project->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($project->date_end, 'day'); @@ -360,13 +367,23 @@ if ($projectid > 0) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($project->budget_amount, '')) { - print price($project->budget_amount, '', $langs, 1, 0, 0, $conf->currency); + // Date start - end of event + print ''.$langs->trans("Dates").' ('.$langs->trans("Event").')'; + $start = dol_print_date($project->date_start_event, 'day'); + print ($start ? $start : '?'); + $end = dol_print_date($project->date_end_event, 'day'); + print ' - '; + print ($end ? $end : '?'); + if ($object->hasDelay()) { + print img_warning("Late"); } print ''; + // Location event + print ''.$langs->trans("Location").''; + print $project->location; + print ''; + // Other attributes $cols = 2; $objectconf = $object; diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 167a79959f5..dccad6b9583 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -474,8 +474,15 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { } print ''; - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) { + print ''.price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").' ('.$langs->trans("Project").')'; $start = dol_print_date($projectstatic->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($projectstatic->date_end, 'day'); @@ -486,13 +493,23 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) { - print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); + // Date start - end of event + print ''.$langs->trans("Dates").' ('.$langs->trans("Event").')'; + $start = dol_print_date($projectstatic->date_start_event, 'day'); + print ($start ? $start : '?'); + $end = dol_print_date($projectstatic->date_end_event, 'day'); + print ' - '; + print ($end ? $end : '?'); + if ($projectstatic->hasDelay()) { + print img_warning("Late"); } print ''; + // Location event + print ''.$langs->trans("Location").''; + print $projectstatic->location; + print ''; + // Other attributes $cols = 2; $objectconf = $object; diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index f9eb9968f4f..f796ac441ee 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -196,3 +196,8 @@ ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_code varchar(3) N ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_tx double(24,8) NULL; ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN rank rankorder integer; + +ALTER TABLE llx_projet ADD COLUMN date_start_event datetime; +ALTER TABLE llx_projet ADD COLUMN date_end_event datetime; +ALTER TABLE llx_projet ADD COLUMN location varchar(255); + diff --git a/htdocs/install/mysql/tables/llx_projet.sql b/htdocs/install/mysql/tables/llx_projet.sql index 197a92ac2be..5b3df54ba14 100644 --- a/htdocs/install/mysql/tables/llx_projet.sql +++ b/htdocs/install/mysql/tables/llx_projet.sql @@ -47,7 +47,10 @@ create table llx_projet usage_opportunity integer DEFAULT 0, -- Set to 1 if project is used to follow an opportunity usage_task integer DEFAULT 1, -- Set to 1 if project is used to manage tasks and/or record timesheet usage_bill_time integer DEFAULT 0, -- Set to 1 if time spent must be converted into invoices - usage_organize_event integer DEFAULT 0, -- Set to 1 if you want to use project to organize an event or receive attendees registration + usage_organize_event integer DEFAULT 0, -- Set to 1 if you want to use project to organize an event or receive attendees registration + date_start_event datetime, -- date start event + date_end_event datetime, -- date end event + location varchar(255), -- location accept_conference_suggestions integer DEFAULT 0, -- Set to 1 if you want to allow unknown people to suggest conferences accept_booth_suggestions integer DEFAULT 0, -- Set to 1 if you want to Allow unknown people to suggest booth max_attendees integer DEFAULT 0, diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 17d5c042389..e3a916c0be0 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -55,13 +55,15 @@ $dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09'); $status = GETPOST('status', 'int'); $opp_status = GETPOST('opp_status', 'int'); -$opp_percent = price2num(GETPOST('opp_percent', 'alpha')); -$objcanvas = GETPOST("objcanvas", "alpha"); -$comefromclone = GETPOST("comefromclone", "alpha"); +$opp_percent = price2num(GETPOST('opp_percent', 'alphanohtml')); +$objcanvas = GETPOST("objcanvas", "alphanohtml"); +$comefromclone = GETPOST("comefromclone", "alphanohtml"); +$date_start = dol_mktime(0, 0, 0, GETPOST('projectstartmonth', 'int'), GETPOST('projectstartday', 'int'), GETPOST('projectstartyear', 'int')); +$date_end = dol_mktime(0, 0, 0, GETPOST('projectendmonth', 'int'), GETPOST('projectendday', 'int'), GETPOST('projectendyear', 'int')); +$date_start_event = dol_mktime(0, 0, 0, GETPOST('date_start_eventmonth', 'int'), GETPOST('date_start_eventday', 'int'), GETPOST('date_start_eventyear', 'int')); +$date_end_event = dol_mktime(0, 0, 0, GETPOST('date_end_eventmonth', 'int'), GETPOST('date_end_eventday', 'int'), GETPOST('date_end_eventyear', 'int')); +$location = GETPOST('location', 'alphanohtml'); -if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $action != "update" && !GETPOST("cancel"))) { - accessforbidden(); -} $mine = GETPOST('mode') == 'mine' ? 1 : 0; //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects @@ -88,14 +90,15 @@ if ($id > 0 || !empty($ref)) { // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); -$date_start = dol_mktime(0, 0, 0, GETPOST('projectstartmonth', 'int'), GETPOST('projectstartday', 'int'), GETPOST('projectstartyear', 'int')); -$date_end = dol_mktime(0, 0, 0, GETPOST('projectendmonth', 'int'), GETPOST('projectendday', 'int'), GETPOST('projectendyear', 'int')); - // Security check $socid = GETPOST('socid', 'int'); //if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. restrictedArea($user, 'projet', $object->id, 'projet&project'); +if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $action != "update" && !GETPOST("cancel"))) { + accessforbidden(); +} + $permissiondellink = $user->rights->projet->creer; // Used by the include of actions_dellink.inc.php @@ -187,6 +190,9 @@ if (empty($reshook)) { $object->date_c = dol_now(); $object->date_start = $date_start; $object->date_end = $date_end; + $object->date_start_event = $date_start_event; + $object->date_end_event = $date_end_event; + $object->location = $location; $object->statut = $status; $object->opp_status = $opp_status; $object->opp_percent = $opp_percent; @@ -281,6 +287,9 @@ if (empty($reshook)) { $object->public = GETPOST('public', 'alpha'); $object->date_start = (!GETPOST('projectstart')) ? '' : $date_start; $object->date_end = (!GETPOST('projectend')) ? '' : $date_end; + $object->date_start_event = (!GETPOST('date_start_event')) ? '' : $date_start_event; + $object->date_end_event = (!GETPOST('date_end_event')) ? '' : $date_end_event; + $object->location = $location; if (GETPOSTISSET('opp_amount')) { $object->opp_amount = price2num(GETPOST('opp_amount', 'alpha')); } @@ -603,6 +612,23 @@ if ($action == 'create' && $user->rights->projet->creer) { print ' '; $htmltext = $langs->trans("EventOrganizationDescriptionLong"); print ''; + print ''; } print ''; print ''; @@ -673,16 +699,6 @@ if ($action == 'create' && $user->rights->projet->creer) { } print ''; - // Date start - print ''.$langs->trans("DateStart").''; - print $form->selectDate(($date_start ? $date_start : ''), 'projectstart', 0, 0, 0, '', 1, 0); - print ''; - - // Date end - print ''.$langs->trans("DateEnd").''; - print $form->selectDate(($date_end ? $date_end : -1), 'projectend', 0, 0, 0, '', 1, 0); - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { // Opportunity status print ''.$langs->trans("OpportunityStatus").''; @@ -708,6 +724,27 @@ if ($action == 'create' && $user->rights->projet->creer) { print ''; print ''; + // Date project + print ''.$langs->trans("Date").(isModEnabled('eventorganization') ? ' ('.$langs->trans("Project").')' : '').''; + print $form->selectDate(($date_start ? $date_start : ''), 'projectstart', 0, 0, 0, '', 1, 0); + print ' '.$langs->trans("to").' '; + print $form->selectDate(($date_end ? $date_end : -1), 'projectend', 0, 0, 0, '', 1, 0); + print ''; + + if (isModEnabled('eventorganization')) { + // Date event + print ''.$langs->trans("Date").' ('.$langs->trans("Event").')'; + print $form->selectDate(($date_start_event ? $date_start_event : -1), 'date_start_event', 0, 0, 0, '', 1, 0); + print ' '.$langs->trans("to").' '; + print $form->selectDate(($date_end_event ? $date_end_event : -1), 'date_end_event', 0, 0, 0, '', 1, 0); + print ''; + + // Location + print ''.$langs->trans("Location").''; + print ''; + print ''; + } + // Description print ''.$langs->trans("Description").''; print ''; @@ -852,11 +889,12 @@ if ($action == 'create' && $user->rights->projet->creer) { // Status print ''.$langs->trans("Status").''; - print ''; foreach ($object->statuts_short as $key => $val) { - print ''; + print ''; } print ''; + print ajax_combobox('status'); print ''; // Usage @@ -902,6 +940,21 @@ if ($action == 'create' && $user->rights->projet->creer) { print 'usage_organize_event ? ' checked="checked"' : '')) . '"> '; $htmltext = $langs->trans("EventOrganizationDescriptionLong"); print ''; + print ''; } print ''; } @@ -981,9 +1034,18 @@ if ($action == 'create' && $user->rights->projet->creer) { print ''; } - // Date start - print ''.$langs->trans("DateStart").''; + // Budget + print ''.$langs->trans("Budget").''; + print ''; + print $langs->getCurrencySymbol($conf->currency); + print ''; + print ''; + + // Date project + print ''.$langs->trans("Date").(isModEnabled('eventorganization') ? ' ('.$langs->trans("Project").')' : '').''; print $form->selectDate($object->date_start ? $object->date_start : -1, 'projectstart', 0, 0, 0, '', 1, 0); + print ' '.$langs->trans("to").' '; + print $form->selectDate($object->date_end ? $object->date_end : -1, 'projectend', 0, 0, 0, '', 1, 0); print '     rights->projet->creer) { print '/>'; print ''; - // Date end - print ''.$langs->trans("DateEnd").''; - print $form->selectDate($object->date_end ? $object->date_end : -1, 'projectend', 0, 0, 0, '', 1, 0); - print ''; + if (isModEnabled('eventorganization')) { + // Date event + print ''.$langs->trans("Date").' ('.$langs->trans("Event").')'; + print $form->selectDate(($date_start_event ? $date_start_event : ($object->date_start_event ? $object->date_start_event : -1)), 'date_start_event', 0, 0, 0, '', 1, 0); + print ' '.$langs->trans("to").' '; + print $form->selectDate(($date_end_event ? $date_end_event : ($object->date_end_event ? $object->date_end_event : -1)), 'date_end_event', 0, 0, 0, '', 1, 0); + print ''; - // Budget - print ''.$langs->trans("Budget").''; - print ''; - print $langs->getCurrencySymbol($conf->currency); - print ''; - print ''; + // Location + print ''.$langs->trans("Location").''; + print ''; + print ''; + } // Description print ''.$langs->trans("Description").''; @@ -1143,18 +1207,6 @@ if ($action == 'create' && $user->rights->projet->creer) { */ } - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; - $start = dol_print_date($object->date_start, 'day'); - print ($start ? $start : '?'); - $end = dol_print_date($object->date_end, 'day'); - print ' - '; - print ($end ? $end : '?'); - if ($object->hasDelay()) { - print img_warning("Late"); - } - print ''; - // Budget print ''.$langs->trans("Budget").''; if (strcmp($object->budget_amount, '')) { @@ -1162,6 +1214,18 @@ if ($action == 'create' && $user->rights->projet->creer) { } print ''; + // Date start - end project + print ''.$langs->trans("Dates").''; + $start = dol_print_date($object->date_start, 'day'); + print ($start ? $start : '?'); + $end = dol_print_date($object->date_end, 'day'); + print ' - '; + print ($end ? $end : '?'); + if ($object->hasDelay()) { + print img_warning("Late"); + } + print ''; + // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 9987f9bc4f0..38bb55b5a24 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -87,29 +87,44 @@ class Project extends CommonObject public $title; /** - * @var int Date start + * @var int Date start * @deprecated * @see $date_start */ public $dateo; /** - * @var int Date start + * @var int Date start */ public $date_start; /** - * @var int Date end + * @var int Date end * @deprecated * @see $date_end */ public $datee; /** - * @var int Date end + * @var int Date end */ public $date_end; + /** + * @var int Date start event + */ + public $date_start_event; + + /** + * @var int Date end event + */ + public $date_end_event; + + /** + * @var string Location + */ + public $location; + /** * @var int Date close */ @@ -264,30 +279,35 @@ class Project extends CommonObject 'datee' =>array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>1, 'visible'=>1, 'position'=>35), 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>55, 'searchall'=>1), 'public' =>array('type'=>'integer', 'label'=>'Visibility', 'enabled'=>1, 'visible'=>1, 'position'=>65), - 'fk_opp_status' =>array('type'=>'integer', 'label'=>'OpportunityStatusShort', 'enabled'=>'!empty($conf->global->PROJECT_USE_OPPORTUNITIES)', 'visible'=>1, 'position'=>75), - 'opp_percent' =>array('type'=>'double(5,2)', 'label'=>'OpportunityProbabilityShort', 'enabled'=>'!empty($conf->global->PROJECT_USE_OPPORTUNITIES)', 'visible'=>1, 'position'=>80), + 'fk_opp_status' =>array('type'=>'integer', 'label'=>'OpportunityStatusShort', 'enabled'=>'getDolGlobalString("PROJECT_USE_OPPORTUNITIES")', 'visible'=>1, 'position'=>75), + 'opp_percent' =>array('type'=>'double(5,2)', 'label'=>'OpportunityProbabilityShort', 'enabled'=>'getDolGlobalString("PROJECT_USE_OPPORTUNITIES")', 'visible'=>1, 'position'=>80), 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>85, 'searchall'=>1), 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>90, 'searchall'=>1), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPdf', 'enabled'=>1, 'visible'=>0, 'position'=>95), 'date_close' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>0, 'position'=>105), 'fk_user_close' =>array('type'=>'integer', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>0, 'position'=>110), - 'opp_amount' =>array('type'=>'double(24,8)', 'label'=>'OpportunityAmountShort', 'enabled'=>1, 'visible'=>'!empty($conf->global->PROJECT_USE_OPPORTUNITIES)', 'position'=>115), + 'opp_amount' =>array('type'=>'double(24,8)', 'label'=>'OpportunityAmountShort', 'enabled'=>1, 'visible'=>'getDolGlobalString("PROJECT_USE_OPPORTUNITIES")', 'position'=>115), 'budget_amount' =>array('type'=>'double(24,8)', 'label'=>'Budget', 'enabled'=>1, 'visible'=>1, 'position'=>119), 'usage_bill_time' =>array('type'=>'integer', 'label'=>'UsageBillTimeShort', 'enabled'=>1, 'visible'=>-1, 'position'=>130), 'usage_opportunity' =>array('type'=>'integer', 'label'=>'UsageOpportunity', 'enabled'=>1, 'visible'=>-1, 'position'=>135), 'usage_task' =>array('type'=>'integer', 'label'=>'UsageTasks', 'enabled'=>1, 'visible'=>-1, 'position'=>140), 'usage_organize_event' =>array('type'=>'integer', 'label'=>'UsageOrganizeEvent', 'enabled'=>1, 'visible'=>-1, 'position'=>145), - 'accept_conference_suggestions' =>array('type'=>'integer', 'label'=>'AllowUnknownPeopleSuggestConf', 'enabled'=>1, 'visible'=>-1, 'position'=>146), - 'accept_booth_suggestions' =>array('type'=>'integer', 'label'=>'AllowUnknownPeopleSuggestBooth', 'enabled'=>1, 'visible'=>-1, 'position'=>147), - 'price_registration' =>array('type'=>'double(24,8)', 'label'=>'PriceOfRegistration', 'enabled'=>1, 'visible'=>-1, 'position'=>148), - 'price_booth' =>array('type'=>'double(24,8)', 'label'=>'PriceOfBooth', 'enabled'=>1, 'visible'=>-1, 'position'=>149), - 'max_attendees' =>array('type'=>'integer', 'label'=>'MaxNbOfAttendees', 'enabled'=>1, 'visible'=>-1, 'position'=>150), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreationShort', 'enabled'=>1, 'visible'=>-2, 'position'=>200), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModificationShort', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>205), - 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserCreation', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>210), - 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModification', 'enabled'=>1, 'visible'=>0, 'position'=>215), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>0, 'position'=>220), - 'email_msgid'=>array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'enabled'=>1, 'visible'=>-1, 'position'=>250, 'help'=>'EmailMsgIDWhenSourceisEmail'), + // Properties for event organization + 'date_start_event' =>array('type'=>'date', 'label'=>'DateStartEvent', 'enabled'=>1, 'visible'=>1, 'position'=>200), + 'date_end_event' =>array('type'=>'date', 'label'=>'DateEndEvent', 'enabled'=>1, 'visible'=>1, 'position'=>201), + 'location' =>array('type'=>'text', 'label'=>'Location', 'enabled'=>1, 'visible'=>3, 'position'=>55, 'searchall'=>202), + 'accept_conference_suggestions' =>array('type'=>'integer', 'label'=>'AllowUnknownPeopleSuggestConf', 'enabled'=>1, 'visible'=>-1, 'position'=>210), + 'accept_booth_suggestions' =>array('type'=>'integer', 'label'=>'AllowUnknownPeopleSuggestBooth', 'enabled'=>1, 'visible'=>-1, 'position'=>211), + 'price_registration' =>array('type'=>'double(24,8)', 'label'=>'PriceOfRegistration', 'enabled'=>1, 'visible'=>-1, 'position'=>212), + 'price_booth' =>array('type'=>'double(24,8)', 'label'=>'PriceOfBooth', 'enabled'=>1, 'visible'=>-1, 'position'=>215), + 'max_attendees' =>array('type'=>'integer', 'label'=>'MaxNbOfAttendees', 'enabled'=>1, 'visible'=>-1, 'position'=>215), + // Generic + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreationShort', 'enabled'=>1, 'visible'=>-2, 'position'=>400), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModificationShort', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>405), + 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserCreation', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>410), + 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModification', 'enabled'=>1, 'visible'=>0, 'position'=>415), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>0, 'position'=>420), + 'email_msgid'=>array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'enabled'=>1, 'visible'=>-1, 'position'=>450, 'help'=>'EmailMsgIDWhenSourceisEmail'), 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>500) ); // END MODULEBUILDER PROPERTIES @@ -408,6 +428,9 @@ class Project extends CommonObject $sql .= ", price_registration"; $sql .= ", price_booth"; $sql .= ", max_attendees"; + $sql .= ", date_start_event"; + $sql .= ", date_end_event"; + $sql .= ", location"; $sql .= ", email_msgid"; $sql .= ", note_private"; $sql .= ", note_public"; @@ -436,6 +459,9 @@ class Project extends CommonObject $sql .= ", ".(strcmp($this->price_registration, '') ? price2num($this->price_registration) : 'null'); $sql .= ", ".(strcmp($this->price_booth, '') ? price2num($this->price_booth) : 'null'); $sql .= ", ".(strcmp($this->max_attendees, '') ? ((int) $this->max_attendees) : 'null'); + $sql .= ", ".($this->date_start_event != '' ? "'".$this->db->idate($this->date_start_event)."'" : 'null'); + $sql .= ", ".($this->date_end_event != '' ? "'".$this->db->idate($this->date_end_event)."'" : 'null'); + $sql .= ", ".($this->location ? "'".$this->db->escape($this->location)."'" : 'null'); $sql .= ", ".($this->email_msgid ? "'".$this->db->escape($this->email_msgid)."'" : 'null'); $sql .= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : 'null'); $sql .= ", ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : 'null'); @@ -530,11 +556,11 @@ class Project extends CommonObject $sql .= ", fk_opp_status = ".((is_numeric($this->opp_status) && $this->opp_status > 0) ? $this->opp_status : 'null'); $sql .= ", opp_percent = ".((is_numeric($this->opp_percent) && $this->opp_percent != '') ? $this->opp_percent : 'null'); $sql .= ", public = ".($this->public ? 1 : 0); - $sql .= ", datec=".($this->date_c != '' ? "'".$this->db->idate($this->date_c)."'" : 'null'); - $sql .= ", dateo=".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null'); - $sql .= ", datee=".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); - $sql .= ", date_close=".($this->date_close != '' ? "'".$this->db->idate($this->date_close)."'" : 'null'); - $sql .= ", fk_user_close=".($this->fk_user_close > 0 ? $this->fk_user_close : "null"); + $sql .= ", datec = ".($this->date_c != '' ? "'".$this->db->idate($this->date_c)."'" : 'null'); + $sql .= ", dateo = ".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null'); + $sql .= ", datee = ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); + $sql .= ", date_close = ".($this->date_close != '' ? "'".$this->db->idate($this->date_close)."'" : 'null'); + $sql .= ", fk_user_close = ".($this->fk_user_close > 0 ? $this->fk_user_close : "null"); $sql .= ", opp_amount = ".(strcmp($this->opp_amount, '') ? price2num($this->opp_amount) : "null"); $sql .= ", budget_amount = ".(strcmp($this->budget_amount, '') ? price2num($this->budget_amount) : "null"); $sql .= ", fk_user_modif = ".$user->id; @@ -547,6 +573,9 @@ class Project extends CommonObject $sql .= ", price_registration = ".(strcmp($this->price_registration, '') ? price2num($this->price_registration) : "null"); $sql .= ", price_booth = ".(strcmp($this->price_booth, '') ? price2num($this->price_booth) : "null"); $sql .= ", max_attendees = ".(strcmp($this->max_attendees, '') ? price2num($this->max_attendees) : "null"); + $sql .= ", date_start_event = ".($this->date_start_event != '' ? "'".$this->db->idate($this->date_start_event)."'" : 'null'); + $sql .= ", date_end_event = ".($this->date_end_event != '' ? "'".$this->db->idate($this->date_end_event)."'" : 'null'); + $sql .= ", location = '".$this->db->escape($this->location)."'"; $sql .= ", entity = ".((int) $this->entity); $sql .= " WHERE rowid = ".((int) $this->id); @@ -631,9 +660,9 @@ class Project extends CommonObject } $sql = "SELECT rowid, entity, ref, title, description, public, datec, opp_amount, budget_amount,"; - $sql .= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut as status, fk_opp_status, opp_percent,"; + $sql .= " tms, dateo as date_start, datee as date_end, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut as status, fk_opp_status, opp_percent,"; $sql .= " note_private, note_public, model_pdf, usage_opportunity, usage_task, usage_bill_time, usage_organize_event, email_msgid,"; - $sql .= " accept_conference_suggestions, accept_booth_suggestions, price_registration, price_booth, max_attendees"; + $sql .= " accept_conference_suggestions, accept_booth_suggestions, price_registration, price_booth, max_attendees, date_start_event, date_end_event, location"; $sql .= " FROM ".MAIN_DB_PREFIX."projet"; if (!empty($id)) { $sql .= " WHERE rowid = ".((int) $id); @@ -665,8 +694,8 @@ class Project extends CommonObject $this->datec = $this->db->jdate($obj->datec); // TODO deprecated $this->date_m = $this->db->jdate($obj->tms); $this->datem = $this->db->jdate($obj->tms); // TODO deprecated - $this->date_start = $this->db->jdate($obj->dateo); - $this->date_end = $this->db->jdate($obj->datee); + $this->date_start = $this->db->jdate($obj->date_start); + $this->date_end = $this->db->jdate($obj->date_end); $this->date_close = $this->db->jdate($obj->date_close); $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; @@ -692,6 +721,9 @@ class Project extends CommonObject $this->price_registration = $obj->price_registration; $this->price_booth = $obj->price_booth; $this->max_attendees = $obj->max_attendees; + $this->date_start_event = $this->db->jdate($obj->date_start_event); + $this->date_end_event = $this->db->jdate($obj->date_end_event); + $this->location = $obj->location; $this->email_msgid = $obj->email_msgid; $this->db->free($resql); diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index 5ea5b920f8c..872aab6046c 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -134,15 +134,6 @@ if ($object->public) { } print ''; -// Date start - end -print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; -print dol_print_date($object->date_start, 'day'); -$end = dol_print_date($object->date_end, 'day'); -if ($end) { - print ' - '.$end; -} -print ''; - // Budget print ''.$langs->trans("Budget").''; if (strcmp($object->budget_amount, '')) { @@ -150,6 +141,15 @@ if (strcmp($object->budget_amount, '')) { } print ''; +// Date start - end project +print ''.$langs->trans("Dates").''; +print dol_print_date($object->date_start, 'day'); +$end = dol_print_date($object->date_end, 'day'); +if ($end) { + print ' - '.$end; +} +print ''; + // Other attributes $cols = 2; // include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index ee37aa68fdd..3e2e85a3757 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -385,8 +385,15 @@ if ($id > 0 || !empty($ref)) { print ''; } - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($object->budget_amount, '')) { + print ''.price($object->budget_amount, '', $langs, 0, 0, 0, $conf->currency).''; + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").''; $start = dol_print_date($object->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($object->date_end, 'day'); @@ -397,13 +404,6 @@ if ($id > 0 || !empty($ref)) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($object->budget_amount, '')) { - print ''.price($object->budget_amount, '', $langs, 0, 0, 0, $conf->currency).''; - } - print ''; - // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 346382c6294..7bf40647783 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -307,8 +307,15 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { print ''; } -// Date start - end -print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; +// Budget +print ''.$langs->trans("Budget").''; +if (strcmp($object->budget_amount, '')) { + print ''.price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; +} +print ''; + +// Date start - end project +print ''.$langs->trans("Dates").''; $start = dol_print_date($object->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($object->date_end, 'day'); @@ -319,13 +326,6 @@ if ($object->hasDelay()) { } print ''; -// Budget -print ''.$langs->trans("Budget").''; -if (strcmp($object->budget_amount, '')) { - print ''.price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; -} -print ''; - // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index c5549429edb..c04614c859e 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -179,8 +179,15 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) { } print ''; - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($object->budget_amount, '')) { + print price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency); + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").''; $start = dol_print_date($object->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($object->date_end, 'day'); @@ -191,13 +198,6 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($object->budget_amount, '')) { - print price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency); - } - print ''; - // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 9ca5fc63c76..696888a75dd 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1355,7 +1355,8 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } - // Date start + + // Date start project if (!empty($arrayfields['p.dateo']['checked'])) { print ''; print dol_print_date($db->jdate($obj->date_start), 'day'); @@ -1364,7 +1365,7 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } - // Date end + // Date end project if (!empty($arrayfields['p.datee']['checked'])) { print ''; print dol_print_date($db->jdate($obj->date_end), 'day'); @@ -1373,6 +1374,7 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } + // Visibility if (!empty($arrayfields['p.public']['checked'])) { print ''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 73d3c238026..f957b59b3c2 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -614,8 +614,15 @@ if ($id > 0 || !empty($ref)) { } print ''; - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($object->budget_amount, '')) { + print ''.price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").''; $start = dol_print_date($object->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($object->date_end, 'day'); @@ -626,13 +633,6 @@ if ($id > 0 || !empty($ref)) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($object->budget_amount, '')) { - print ''.price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; - } - print ''; - // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; @@ -750,12 +750,12 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third } print ''; - // Date start + // Date start task print ''.$langs->trans("DateStart").''; print $form->selectDate((!empty($date_start) ? $date_start : ''), 'dateo', 1, 1, 0, '', 1, 1); print ''; - // Date end + // Date end task print ''.$langs->trans("DateEnd").''; print $form->selectDate((!empty($date_end) ? $date_end : -1), 'datee', -1, 1, 0, '', 1, 1); print ''; diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php index 1f5628bb050..e6749612f46 100644 --- a/htdocs/projet/tasks/comment.php +++ b/htdocs/projet/tasks/comment.php @@ -221,8 +221,15 @@ if ($id > 0 || !empty($ref)) { print ''; } - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) { + print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").''; $start = dol_print_date($projectstatic->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($projectstatic->date_end, 'day'); @@ -233,13 +240,6 @@ if ($id > 0 || !empty($ref)) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) { - print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); - } - print ''; - // Other attributes $cols = 2; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 14a87b375e8..4427af86f52 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -257,8 +257,15 @@ if ($id > 0 || !empty($ref)) { } print ''; - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) { + print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").''; $start = dol_print_date($projectstatic->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($projectstatic->date_end, 'day'); @@ -269,13 +276,6 @@ if ($id > 0 || !empty($ref)) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) { - print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); - } - print ''; - // Other attributes $cols = 2; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 3e569cd557f..fb89ba372e7 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -214,8 +214,15 @@ if ($object->id > 0) { } print ''; - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) { + print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").''; $start = dol_print_date($projectstatic->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($projectstatic->date_end, 'day'); @@ -226,13 +233,6 @@ if ($object->id > 0) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) { - print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); - } - print ''; - // Other attributes $cols = 2; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 1f0130bd7b4..76261480ffe 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -1117,7 +1117,8 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } - // Date start + + // Date start project if (!empty($arrayfields['t.dateo']['checked'])) { print ''; print dol_print_date($db->jdate($obj->date_start), 'day'); @@ -1126,7 +1127,7 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } - // Date end + // Date end project if (!empty($arrayfields['t.datee']['checked'])) { print ''; print dol_print_date($db->jdate($obj->date_end), 'day'); diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 40f8f636e72..7c02dad5785 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -203,8 +203,15 @@ if ($object->id > 0) { } print ''; - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) { + print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").''; $start = dol_print_date($projectstatic->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($projectstatic->date_end, 'day'); @@ -215,13 +222,6 @@ if ($object->id > 0) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) { - print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); - } - print ''; - // Other attributes $cols = 2; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 77cd9f09c9e..95c755097eb 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -325,8 +325,15 @@ if ($id > 0 || !empty($ref)) { } print ''; - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) { + print ''.price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").''; $start = dol_print_date($projectstatic->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($projectstatic->date_end, 'day'); @@ -337,13 +344,6 @@ if ($id > 0 || !empty($ref)) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) { - print ''.price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; - } - print ''; - // Other attributes $cols = 2; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; @@ -578,7 +578,7 @@ if ($id > 0 || !empty($ref)) { } print ''; - // Date start - Date end + // Date start - Date end task print ''.$langs->trans("DateStart").' - '.$langs->trans("Deadline").''; $start = dol_print_date($object->date_start, 'dayhour'); print ($start ? $start : '?'); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 00d45eedea7..d268a72b12d 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -967,8 +967,15 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } print ''; - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) { + print ''.price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").''; $start = dol_print_date($projectstatic->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($projectstatic->date_end, 'day'); @@ -979,16 +986,12 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) { - print ''.price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; - } - print ''; - // Other attributes $cols = 2; - //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + $savobject = $object; + $object = $projectstatic; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + $object = $savobject; print ''; @@ -1127,7 +1130,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } print ''; - // Date start - Date end + // Date start - Date end task print ''.$langs->trans("DateStart").' - '.$langs->trans("Deadline").''; $start = dol_print_date($object->date_start, 'dayhour'); print ($start ? $start : '?'); diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index 589bf2c8dac..995b5f7a44c 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -646,7 +646,7 @@ print '
'; // Welcome message -print $langs->trans("EvntOrgWelcomeMessage", $project->title . ' '. $conference->label); +print ''.$langs->trans("EvntOrgWelcomeMessage", $project->title . ' '. $conference->label).''; print '
'; $maxattendees = 0; if ($conference->id) { @@ -691,8 +691,8 @@ if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS print ''; print '
'; - - print '
' . $langs->trans("FieldsWithAreMandatory", '*') . '
'; + print '
'; + //print '' . $langs->trans("FieldsWithAreMandatory", '*') . '
'; //print $langs->trans("FieldsWithIsForPublic",'**').'
'; print dol_get_fiche_head(''); @@ -711,18 +711,22 @@ if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS print '' . "\n"; // Email - print '' . "\n"; + print '' . "\n"; // Company - print '' . "\n"; + print 'price_registration)) ? '' : ' required').'>' . "\n"; // Email company for invoice if ($project->price_registration) { @@ -743,7 +747,7 @@ if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS print ''; // Country - print ''; // Location @@ -1056,9 +1056,9 @@ if ($action == 'create' && $user->rights->projet->creer) { if (isModEnabled('eventorganization')) { // Date event print ''; // Location diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index 21cf0052eca..8d7e4503c6b 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -524,8 +524,11 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $vattouse = get_default_tva($mysoc, $thirdparty, $productforinvoicerow->id); $labelforproduct = $outputlangs->trans("EventFee", $project->title); - $date_start = $project->date_start; - $date_end = $project->date_end; + if ($project->location) { + $labelforproduct .= ' - '.$project->location; + } + $date_start = $project->date_start_event; + $date_end = $project->date_end_event; // If there is no lines yet, we add one if (empty($facture->lines)) { @@ -652,8 +655,36 @@ print '
'; print ''.$langs->trans("EvntOrgWelcomeMessage").''; print '
'; -print ''.$project->title . ' '. $conference->label.''; -print '
'; +print ''.$project->title . ' '. $conference->label.'
'; +if ($project->date_start_event || $project->date_end_event) { + print ''; +} +if ($project->date_start_event) { + $format = 'day'; + $tmparray = dol_getdate($project->date_start_event, false, ''); + if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) { + $format = 'dayhour'; + } + print dol_print_date($project->date_start_event, $format); +} +if ($project->date_start_event && $project->date_end_event) { + print ' - '; +} +if ($project->date_end_event) { + $format = 'day'; + $tmparray = dol_getdate($project->date_end_event, false, ''); + if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) { + $format = 'dayhour'; + } + print dol_print_date($project->date_end_event, $format); +} +if ($project->date_start_event || $project->date_end_event) { + print '
'; +} +if ($project->location) { + print ''.$project->location.'
'; +} + $maxattendees = 0; if ($conference->id > 0) { /* date of project is not date of event so commented @@ -812,8 +843,8 @@ if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS } print '
'; - print "\n"; + print "
"; print ''; } From 330a1199e4f5e30acf1b1330f56e795281ebf940 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Oct 2022 15:08:54 +0200 Subject: [PATCH 115/176] Look and feel v17 --- htdocs/comm/propal/card.php | 12 ++++++------ htdocs/comm/propal/contact.php | 8 ++++---- htdocs/comm/propal/document.php | 8 ++++---- htdocs/comm/propal/info.php | 6 +++--- htdocs/comm/propal/note.php | 6 +++--- htdocs/commande/card.php | 10 +++++----- htdocs/commande/contact.php | 6 +++--- htdocs/commande/document.php | 6 +++--- htdocs/commande/info.php | 6 +++--- htdocs/commande/note.php | 6 +++--- htdocs/compta/facture/card.php | 10 +++++----- htdocs/compta/facture/contact.php | 6 +++--- htdocs/compta/facture/document.php | 6 +++--- htdocs/compta/facture/info.php | 6 +++--- htdocs/compta/facture/note.php | 6 +++--- htdocs/compta/facture/prelevement.php | 2 +- htdocs/contrat/agenda.php | 6 +++--- htdocs/contrat/card.php | 8 ++++---- htdocs/contrat/contact.php | 6 +++--- htdocs/contrat/document.php | 6 +++--- htdocs/contrat/note.php | 6 +++--- htdocs/core/class/html.form.class.php | 5 +++-- htdocs/core/lib/functions.lib.php | 6 +++--- htdocs/delivery/card.php | 11 +++++------ htdocs/eventorganization/conferenceorbooth_card.php | 2 +- .../eventorganization/conferenceorbooth_contact.php | 2 +- .../eventorganization/conferenceorbooth_document.php | 2 +- htdocs/eventorganization/conferenceorbooth_list.php | 2 +- .../conferenceorboothattendee_card.php | 2 +- .../conferenceorboothattendee_list.php | 2 +- htdocs/expedition/card.php | 11 +++++------ htdocs/expedition/contact.php | 6 +++--- htdocs/expedition/document.php | 10 +++++----- htdocs/expedition/note.php | 6 +++--- htdocs/expedition/shipment.php | 10 +++++----- htdocs/fichinter/card.php | 2 +- htdocs/fourn/commande/card.php | 7 +++---- htdocs/fourn/commande/contact.php | 6 +++--- htdocs/fourn/commande/dispatch.php | 6 +++--- htdocs/fourn/commande/document.php | 6 +++--- htdocs/fourn/commande/info.php | 6 +++--- htdocs/fourn/commande/note.php | 6 +++--- htdocs/fourn/facture/card.php | 10 +++++----- htdocs/fourn/facture/contact.php | 6 +++--- htdocs/fourn/facture/document.php | 6 +++--- htdocs/fourn/facture/info.php | 6 +++--- htdocs/fourn/facture/note.php | 6 +++--- htdocs/fourn/paiement/document.php | 2 +- htdocs/langs/en_US/projects.lang | 1 + htdocs/projet/card.php | 2 +- htdocs/projet/comment.php | 2 +- htdocs/projet/contact.php | 2 +- htdocs/projet/document.php | 2 +- htdocs/projet/element.php | 2 +- htdocs/projet/ganttview.php | 2 +- htdocs/projet/info.php | 2 +- htdocs/projet/note.php | 2 +- htdocs/projet/tasks.php | 2 +- htdocs/projet/tasks/comment.php | 2 +- htdocs/projet/tasks/contact.php | 2 +- htdocs/projet/tasks/document.php | 2 +- htdocs/projet/tasks/note.php | 2 +- htdocs/projet/tasks/task.php | 2 +- htdocs/projet/tasks/time.php | 2 +- htdocs/reception/card.php | 9 ++++----- htdocs/reception/contact.php | 9 ++++----- htdocs/reception/document.php | 9 ++++----- htdocs/reception/note.php | 9 ++++----- htdocs/supplier_proposal/contact.php | 8 ++++---- htdocs/ticket/agenda.php | 9 ++++----- htdocs/ticket/card.php | 8 ++++---- htdocs/ticket/contact.php | 9 ++++----- htdocs/ticket/document.php | 9 ++++----- htdocs/ticket/list.php | 4 ++-- htdocs/ticket/messaging.php | 9 ++++----- 75 files changed, 204 insertions(+), 213 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index f835ae3ae29..a18056e1003 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2297,20 +2297,20 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherProposals").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').''; + $morehtmlref .= '
'; if ($usercancreate) { if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + //$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); $morehtmlref .= '
'; $morehtmlref .= ''; $morehtmlref .= ''; @@ -2318,13 +2318,13 @@ if ($action == 'create') { $morehtmlref .= ''; $morehtmlref .= ''; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, $langs->trans("OutOfProject")); } } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ': '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { $morehtmlref .= ' - '.$proj->title; } diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 051ee9de42c..5039335007f 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -137,15 +137,15 @@ if ($object->id > 0) { $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').' : '.$object->thirdparty->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->propal->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ''; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); @@ -162,7 +162,7 @@ if ($object->id > 0) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { $morehtmlref .= ' - '.$proj->title; } diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 1bd6cc71d50..a2f638a8ad2 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -135,15 +135,15 @@ if ($object->id > 0) { $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').' : '.$object->thirdparty->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->propal->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ''; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); @@ -160,7 +160,7 @@ if ($object->id > 0) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { $morehtmlref .= ' - '.$proj->title; } diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php index 933791bbec2..fdf1f1d1bb9 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -82,15 +82,15 @@ $morehtmlref = '
'; $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').' : '.$object->thirdparty->getNomUrl(1); +$morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->propal->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ''; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index c3af3a9b73e..fd10809bac5 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -107,15 +107,15 @@ if ($object->id > 0) { $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').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->propal->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ''; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 7b447aaf941..bc445b90bb4 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2326,17 +2326,17 @@ if ($action == 'create' && $usercancreate) { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$soc->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$soc->getNomUrl(1, 'customer'); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($usercancreate) { if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); @@ -2347,13 +2347,13 @@ if ($action == 'create' && $usercancreate) { $morehtmlref .= ''; $morehtmlref .= ''; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, $langs->trans("OutOfProject")); } } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { $morehtmlref .= ' - '.$proj->title; } diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index c353287962e..91ecc261b80 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -130,15 +130,15 @@ if ($id > 0 || !empty($ref)) { $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').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->commande->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index c341ae59b4e..181cb50ef3a 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -129,15 +129,15 @@ if ($id > 0 || !empty($ref)) { $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').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->commande->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index 4442af6a679..e259d3e5749 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -82,15 +82,15 @@ $morehtmlref = '
'; $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').' : '.$object->thirdparty->getNomUrl(1); +$morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->commande->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 452e58076c7..82a58e40cf3 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -101,15 +101,15 @@ if ($id > 0 || !empty($ref)) { $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').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->commande->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 919c0372a21..a30541dadcf 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4363,17 +4363,17 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($usercancreate) { if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); @@ -4384,13 +4384,13 @@ if ($action == 'create') { $morehtmlref .= ''; $morehtmlref .= ''; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, $langs->trans("OutOfProject")); } } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { $morehtmlref .= ' - '.$proj->title; } diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 62705ffd876..1da25ab3c64 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -136,15 +136,15 @@ if ($id > 0 || !empty($ref)) { $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').' : '.$object->thirdparty->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->facture->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index ee3700fd67e..5088db34ade 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -140,15 +140,15 @@ if ($id > 0 || !empty($ref)) { $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').' : '.$object->thirdparty->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->facture->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index 0d70f095d31..6de7793a4b3 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -96,15 +96,15 @@ $morehtmlref = '
'; $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').' : '.$object->thirdparty->getNomUrl(1, 'customer'); +$morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->facture->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index 451ccbab8c4..b47dbe2eabd 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -118,15 +118,15 @@ if ($id > 0 || !empty($ref)) { $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').' : '.$object->thirdparty->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->facture->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 531106be626..b3a881797b5 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -349,7 +349,7 @@ if ($object->id > 0) { $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); } // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if ($type == 'bank-transfer') { if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index d46f2cb24a7..1c7d1ea8e67 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -166,18 +166,18 @@ if ($id > 0) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $permtoedit, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $permtoedit, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->contrat->creer) { if ($action != 'classify') { //$morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).''; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 111b2d58fd9..94cfc7d2954 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1372,17 +1372,17 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->contrat->creer) { if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); @@ -1393,7 +1393,7 @@ if ($action == 'create') { $morehtmlref .= ''; $morehtmlref .= ''; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1, $langs->trans("OutOfProject")); } } else { if (!empty($object->fk_project)) { diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 8ceefe2f168..14ddc998305 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -153,15 +153,15 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->contrat->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 19248769ef8..bfeb2536662 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -139,18 +139,18 @@ if ($object->id) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->contrat->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index 391b10718ce..0e578e45735 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -110,15 +110,15 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->contrat->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 02f9dc5c712..9c0f4041b51 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5384,9 +5384,10 @@ class Form * @param int $maxlength Max length * @param int $forcefocus Force focus on field (works with javascript only) * @param int $nooutput No print is done. String is returned. + * @param string $textifnoproject Text to show if no project * @return string Return html content */ - public function form_project($page, $socid, $selected = '', $htmlname = 'projectid', $discard_closed = 0, $maxlength = 20, $forcefocus = 0, $nooutput = 0) + public function form_project($page, $socid, $selected = '', $htmlname = 'projectid', $discard_closed = 0, $maxlength = 20, $forcefocus = 0, $nooutput = 0, $textifnoproject = '') { // phpcs:enable global $langs; @@ -5414,7 +5415,7 @@ class Form $projet->fetch($selected); $out .= $projet->getNomUrl(1, '', 1); } else { - $out .= " "; + $out .= ''.$textifnoproject.''; } $out .= ''; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8d6a0ff9414..de5a63df281 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2302,13 +2302,13 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi // Add alias for thirdparty if (!empty($object->name_alias)) { - $morehtmlref .= '
'.$object->name_alias.'
'; + $morehtmlref .= '
'.$object->name_alias.'
'; } // Add label if (in_array($object->element, array('product', 'bank_account', 'project_task'))) { if (!empty($object->label)) { - $morehtmlref .= '
'.$object->label.'
'; + $morehtmlref .= '
'.$object->label.'
'; } } @@ -2323,7 +2323,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi } if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && ($conf->global->MAIN_SHOW_TECHNICAL_ID == '1' || preg_match('/'.preg_quote($object->element, '/').'/i', $conf->global->MAIN_SHOW_TECHNICAL_ID)) && !empty($object->id)) { $morehtmlref .= '
'; - $morehtmlref .= '
'; + $morehtmlref .= '
'; $morehtmlref .= $langs->trans("TechnicalID").': '.$object->id; $morehtmlref .= '
'; } diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index d458b14b0cb..6a8c1be63dd 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -328,14 +328,14 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldval("RefCustomer", '', $expedition->ref_customer, $expedition, $user->rights->expedition->creer, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1); $morehtmlref .= '
'.$langs->trans("RefDeliveryReceipt").' : '.$object->ref; // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$expedition->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$expedition->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if (0) { // Do not change on shipment if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } if ($action == 'classify') { // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $expedition->id, $expedition->socid, $expedition->fk_project, 'projectid', 0, 0, 1, 1); @@ -346,14 +346,13 @@ if ($action == 'create') { $morehtmlref .= ''; $morehtmlref .= ''; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$expedition->id, $expedition->socid, $expedition->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$expedition->id, $expedition->socid, $expedition->fk_project, 'none', 0, 0, 0, 1, $langs->trans("OutOfProject")); } } else { - $morehtmlref .= ' : '; if (!empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { $morehtmlref .= ' - '.$proj->title; } diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index 46e41dec78e..b6932c2cf09 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -203,7 +203,7 @@ if (!empty($withproject)) { $morehtmlref .= $projectstatic->title; // Thirdparty if (isset($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; diff --git a/htdocs/eventorganization/conferenceorbooth_contact.php b/htdocs/eventorganization/conferenceorbooth_contact.php index 2c304bd8562..7810114aec1 100644 --- a/htdocs/eventorganization/conferenceorbooth_contact.php +++ b/htdocs/eventorganization/conferenceorbooth_contact.php @@ -187,7 +187,7 @@ if (!empty($withproject)) { $morehtmlref .= $projectstatic->title; // Thirdparty if (isset($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; diff --git a/htdocs/eventorganization/conferenceorbooth_document.php b/htdocs/eventorganization/conferenceorbooth_document.php index 56b34f68b03..78f74ded42d 100644 --- a/htdocs/eventorganization/conferenceorbooth_document.php +++ b/htdocs/eventorganization/conferenceorbooth_document.php @@ -160,7 +160,7 @@ if (!empty($withproject)) { $morehtmlref .= $projectstatic->title; // Thirdparty if (isset($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index cf7ffcb607a..f69d86c62e7 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -287,7 +287,7 @@ if ($projectid > 0) { $morehtmlref .= $project->title; // Thirdparty if (isset($project->thirdparty->id) && $project->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$project->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$project->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 20d7e588bf3..9bab2a7f49d 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -234,7 +234,7 @@ if (!empty($withproject)) { $morehtmlref .= $projectstatic->title; // Thirdparty if ($projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index dccad6b9583..1bc9c12d4f6 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -413,7 +413,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { $morehtmlref .= $projectstatic->title; // Thirdparty if ($projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 6c880a6e425..d76bd40a8a6 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1742,14 +1742,14 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if (0) { // Do not change on shipment if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } if ($action == 'classify') { // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); @@ -1760,16 +1760,15 @@ if ($action == 'create') { $morehtmlref .= ''; $morehtmlref .= ''; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, $langs->trans("OutOfProject")); } } else { // We don't have project on shipment, so we will use the project or source object instead // TODO Add project on shipment - $morehtmlref .= ' : '; if (!empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { $morehtmlref .= ' - '.$proj->title; } diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index 4c540adcd9e..b2eec02f879 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -148,14 +148,14 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if (0) { // Do not change on shipment if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } if ($action == 'classify') { // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php index 71e325677e6..a27a5390c65 100644 --- a/htdocs/expedition/document.php +++ b/htdocs/expedition/document.php @@ -118,18 +118,18 @@ if ($id > 0 || !empty($ref)) { $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); + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if (0) { // Do not change on shipment if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } if ($action == 'classify') { // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index d23bb0298ea..364b5400ff3 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -109,14 +109,14 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if (0) { // Do not change on shipment if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } if ($action == 'classify') { // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 97162f4aaf2..91805e9d0a9 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -283,17 +283,17 @@ if ($id > 0 || !empty($ref)) { $morehtmlref = '
'; // Ref customer - $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); - $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$soc->getNomUrl(1); + $morehtmlref .= '
'.$soc->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->commande->creer) { if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index cef3f737c53..d172a865811 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1159,7 +1159,7 @@ if ($action == 'create') { $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', 0, 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); // Project if (isModEnabled('project')) { $langs->load("projects"); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 67cfffdeb7c..d6961a1323e 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2033,9 +2033,8 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty'); + $morehtmlref .= '
'; if (!empty($conf->global->MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER) && !empty($usercancreate) && $action == 'edit_thirdparty') { - $morehtmlref .= ' : '; $morehtmlref .= '
'; $morehtmlref .= ''; $morehtmlref .= ''; @@ -2070,13 +2069,13 @@ if ($action == 'create') { $morehtmlref .= ''; $morehtmlref .= ''; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, $langs->trans("OutOfProject")); } } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { $morehtmlref .= ' - '.$proj->title; } diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index 92859d2eb1f..e7e2daf0386 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -134,15 +134,15 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 1a8834941c9..1fcc3daacb8 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -541,15 +541,15 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index 0eba3dbc601..e457170d323 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -130,15 +130,15 @@ if ($object->id > 0) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index 698fead1a43..c764302244f 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -141,15 +141,15 @@ $morehtmlref = '
'; $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty -$morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); +$morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 167c506b651..21c9379fa75 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -110,15 +110,15 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 44337454772..c17be415e3a 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2873,17 +2873,17 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'supplier'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'supplier'); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($usercancreate) { if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); @@ -2894,13 +2894,13 @@ if ($action == 'create') { $morehtmlref .= ''; $morehtmlref .= ''; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, $langs->trans("OutOfProject")); } } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { $morehtmlref .= ' - '.$proj->title; } diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index f9f7a754b8f..e4740b47d8a 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -133,18 +133,18 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->facture->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index fa08b721370..9ac4d53486d 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -112,18 +112,18 @@ if ($object->id > 0) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->facture->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php index a4322c2448e..bd6f8b10ee2 100644 --- a/htdocs/fourn/facture/info.php +++ b/htdocs/fourn/facture/info.php @@ -75,18 +75,18 @@ $morehtmlref = '
'; $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty -$morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); +$morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->facture->creer) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index e1eb788723f..d5b4042fdf4 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -106,18 +106,18 @@ if ($object->id > 0) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { if ($action != 'classify') { // $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/fourn/paiement/document.php b/htdocs/fourn/paiement/document.php index e26734ed9c6..2e61322997a 100644 --- a/htdocs/fourn/paiement/document.php +++ b/htdocs/fourn/paiement/document.php @@ -123,7 +123,7 @@ if ($object->id > 0) { $morehtmlref .= $object->num_payment ? ' - '.$object->num_payment : ''; // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Amount $morehtmlref .= '
'.$langs->trans('Amount').' : '. price($object->amount, '', $langs, 0, 0, -1, $conf->currency); diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 037ddd1c4e1..c61d794fcdc 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -38,6 +38,7 @@ OpportunitiesStatusForProjects=Leads amount of projects by status ShowProject=Show project ShowTask=Show task SetProject=Set project +OutOfProject=Out of project NoProject=No project defined or owned NbOfProjects=Number of projects NbOfTasks=Number of tasks diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 9da183534fd..718aeecec82 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1107,7 +1107,7 @@ if ($action == 'create' && $user->rights->projet->creer) { // Title $morehtmlref .= dol_escape_htmltag($object->title); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '; + $morehtmlref .= '
'; if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { $morehtmlref .= $object->thirdparty->getNomUrl(1, 'project'); } diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index 872aab6046c..024dce3abc9 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -105,7 +105,7 @@ $morehtmlref = '
'; $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 3e2e85a3757..f6827fc19b3 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -296,7 +296,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 0a2acc4c3bc..bb50bf0def6 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -138,7 +138,7 @@ if ($object->id > 0) { $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 7bf40647783..f96f5737cf4 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -218,7 +218,7 @@ $morehtmlref = '
'; $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index c04614c859e..f2889d7c469 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -117,7 +117,7 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) { $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php index bef020d9a38..e6aaca355e1 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/info.php @@ -132,7 +132,7 @@ $morehtmlref = '
'; $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index ce099c04745..3ca7949b35a 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -102,7 +102,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index f957b59b3c2..18a75449f24 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -553,7 +553,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php index e6749612f46..4540112f4c3 100644 --- a/htdocs/projet/tasks/comment.php +++ b/htdocs/projet/tasks/comment.php @@ -132,7 +132,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $projectstatic->title; // Thirdparty if ($projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 4427af86f52..4bbc48900af 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -196,7 +196,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $projectstatic->title; // Thirdparty if ($projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index fb89ba372e7..6a62e973a62 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -153,7 +153,7 @@ if ($object->id > 0) { $morehtmlref .= $projectstatic->title; // Thirdparty if ($projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 7c02dad5785..01c39c990f4 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -142,7 +142,7 @@ if ($object->id > 0) { $morehtmlref .= $projectstatic->title; // Thirdparty if ($projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 95c755097eb..331b29acb96 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -264,7 +264,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $projectstatic->title; // Thirdparty if (!empty($projectstatic->thirdparty->id) &&$projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index d268a72b12d..8e30664232b 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -906,7 +906,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $morehtmlref .= $projectstatic->title; // Thirdparty if (!empty($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 011781f33e2..452061a9276 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1380,14 +1380,14 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (!empty($conf->project->enabled)) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if (0) { // Do not change on reception if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } if ($action == 'classify') { // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); @@ -1403,11 +1403,10 @@ if ($action == 'create') { } else { // We don't have project on reception, so we will use the project or source object instead // TODO Add project on reception - $morehtmlref .= ' : '; if (!empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { $morehtmlref .= ' - '.$proj->title; } diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index 442657ecf43..d484ab8bc48 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -146,14 +146,14 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (!empty($conf->project->enabled)) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if (0) { // Do not change on reception if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } if ($action == 'classify') { // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); @@ -169,11 +169,10 @@ if ($id > 0 || !empty($ref)) { } else { // We don't have project on reception, so we will use the project or source object instead // TODO Add project on reception - $morehtmlref .= ' : '; if (!empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { $morehtmlref .= ' - '.$proj->title; } diff --git a/htdocs/reception/document.php b/htdocs/reception/document.php index 10227373015..2b2a2f3ffed 100644 --- a/htdocs/reception/document.php +++ b/htdocs/reception/document.php @@ -118,15 +118,15 @@ if ($id > 0 || !empty($ref)) { $morehtmlref = '
'; // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (!empty($conf->project->enabled)) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if (0) { // Do not change on shipment if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } if ($action == 'classify') { // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); @@ -142,11 +142,10 @@ if ($id > 0 || !empty($ref)) { } else { // We don't have project on shipment, so we will use the project or source object instead // TODO Add project on shipment - $morehtmlref .= ' : '; if (!empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { $morehtmlref .= ' - '.$proj->title; } diff --git a/htdocs/reception/note.php b/htdocs/reception/note.php index 617d260e643..c5ffc5c6bb7 100644 --- a/htdocs/reception/note.php +++ b/htdocs/reception/note.php @@ -123,14 +123,14 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (!empty($conf->project->enabled)) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if (0) { // Do not change on reception if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } if ($action == 'classify') { // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); @@ -146,11 +146,10 @@ if ($id > 0 || !empty($ref)) { } else { // We don't have project on reception, so we will use the project or source object instead // TODO Add project on reception - $morehtmlref .= ' : '; if (!empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { $morehtmlref .= ' - '.$proj->title; } diff --git a/htdocs/supplier_proposal/contact.php b/htdocs/supplier_proposal/contact.php index fde016c78c4..7c4fd273579 100644 --- a/htdocs/supplier_proposal/contact.php +++ b/htdocs/supplier_proposal/contact.php @@ -133,15 +133,15 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (!empty($conf->project->enabled)) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($permissiontoedit) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); @@ -158,7 +158,7 @@ if ($id > 0 || !empty($ref)) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { $morehtmlref .= ' - '.$proj->title; } diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index 9adffdfd720..202aacb98cd 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -177,11 +177,10 @@ if ($object->fk_user_create > 0) { // Thirdparty if (isModEnabled("societe")) { - $morehtmlref .= '
'.$langs->trans('ThirdParty'); + $morehtmlref .= '
'; /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' '; }*/ - $morehtmlref .= ' : '; if ($action == 'editcustomer') { $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); } else { @@ -192,11 +191,11 @@ if (isModEnabled("societe")) { // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project'); + $morehtmlref .= '
'; if ($user->rights->ticket->write) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ''; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index df46ff8e77c..b9629841979 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -955,9 +955,9 @@ if ($action == 'create' || $action == 'presend') { // Thirdparty if (isModEnabled("societe")) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' '; + $morehtmlref .= '
'; if ($action != 'editcustomer' && $object->status < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('Edit'), 0).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('Edit'), 0).' '; } if ($action == 'editcustomer') { $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); @@ -969,7 +969,7 @@ if ($action == 'create' || $action == 'presend') { // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->ticket->write) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).''; @@ -984,7 +984,7 @@ if ($action == 'create' || $action == 'presend') { $morehtmlref .= ''; $morehtmlref .= ''; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, $langs->trans("OutOfProject")); } } else { if (!empty($object->fk_project)) { diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index bf39f123708..cc0923a89e1 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -212,11 +212,10 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { // Thirdparty if (isModEnabled("societe")) { - $morehtmlref .= '
'.$langs->trans('ThirdParty'); + $morehtmlref .= '
'; /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' '; }*/ - $morehtmlref .= ' : '; if ($action == 'editcustomer') { $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); } else { @@ -227,11 +226,11 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->ticket->write) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ''; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index 5a7d46540c4..70edaf475d6 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -147,11 +147,10 @@ if ($object->id) { // Thirdparty if (isModEnabled("societe")) { - $morehtmlref .= '
'.$langs->trans('ThirdParty'); + $morehtmlref .= '
'; /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' '; }*/ - $morehtmlref .= ' : '; if ($action == 'editcustomer') { $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); } else { @@ -162,11 +161,11 @@ if ($object->id) { // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($user->rights->ticket->write) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ''; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index e2f4d9c60ba..66bda452ccf 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -578,7 +578,7 @@ if ($projectid > 0 || $project_ref) { $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; @@ -593,7 +593,7 @@ if ($projectid > 0 || $project_ref) { print '
'; print '
'; - print '
' . $langs->trans("EmailAttendee") . '*'; + print '
' . $langs->trans("EmailAttendee") . ''; print img_picto('', 'email', 'class="pictofixedwidth"'); - print '
' . $langs->trans("Company"); + print '
'; if (!empty(floatval($project->price_registration))) { - print '*'; + print ''; } - print ' '; + print $langs->trans("Company"); + if (!empty(floatval($project->price_registration))) { + print ''; + } + print ''; print img_picto('', 'company', 'class="pictofixedwidth"'); - print '
' . $langs->trans('Country') . '*'; + print '
trans('Country') . ''; print img_picto('', 'country', 'class="pictofixedwidth"'); $country_id = GETPOST('country_id'); if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { From 48c42b7f7f93ccb05a9f4bca575089b8b8a44495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 21 Oct 2022 13:43:35 +0200 Subject: [PATCH 113/176] Update modStockTransfer.class.php --- htdocs/core/modules/modStockTransfer.class.php | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/htdocs/core/modules/modStockTransfer.class.php b/htdocs/core/modules/modStockTransfer.class.php index c834900c2cf..6c8f068adf6 100644 --- a/htdocs/core/modules/modStockTransfer.class.php +++ b/htdocs/core/modules/modStockTransfer.class.php @@ -51,7 +51,7 @@ class modStockTransfer extends DolibarrModules $this->rights_class = 'stocktransfer'; // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' // It is used to group modules by family in module setup page - $this->family = "other"; + $this->family = "products"; // Module position in the family on 2 digits ('01', '10', '20', ...) $this->module_position = '90'; // Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) @@ -125,7 +125,6 @@ class modStockTransfer extends DolibarrModules $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) $this->langfiles = array("stocktransfer@stocktransfer"); $this->phpmin = array(7, 0); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(11, -3); // Minimum version of Dolibarr required by module $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) //$this->automatic_activation = array('FR'=>'StockTransferWasAutomaticallyActivatedBecauseOfYourCountryChoice'); @@ -138,12 +137,6 @@ class modStockTransfer extends DolibarrModules // ); $this->const = array(); - // Some keys to add into the overwriting translation tables - /*$this->overwrite_translation = array( - 'en_US:ParentCompany'=>'Parent company or reseller', - 'fr_FR:ParentCompany'=>'Maison mère ou revendeur' - )*/ - if (!isset($conf->stocktransfer) || !isset($conf->stocktransfer->enabled)) { $conf->stocktransfer = new stdClass(); $conf->stocktransfer->enabled = 0; @@ -435,15 +428,6 @@ class modStockTransfer extends DolibarrModules $result = $this->_load_tables('/install/mysql/tables/', 'stocktransfer'); if ($result < 0) return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') - // Create extrafields during init - //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - //$extrafields = new ExtraFields($this->db); - //$result1=$extrafields->addExtraField('stocktransfer_myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'stocktransfer@stocktransfer', '$conf->stocktransfer->enabled'); - //$result2=$extrafields->addExtraField('stocktransfer_myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'stocktransfer@stocktransfer', '$conf->stocktransfer->enabled'); - //$result3=$extrafields->addExtraField('stocktransfer_myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'stocktransfer@stocktransfer', '$conf->stocktransfer->enabled'); - //$result4=$extrafields->addExtraField('stocktransfer_myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'stocktransfer@stocktransfer', '$conf->stocktransfer->enabled'); - //$result5=$extrafields->addExtraField('stocktransfer_myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'stocktransfer@stocktransfer', '$conf->stocktransfer->enabled'); - // Permissions $this->remove($options); From 4b50bf996386f230d5ea695beff19081ee4bfc1c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Oct 2022 14:01:36 +0200 Subject: [PATCH 114/176] Show dates and location on registration page --- htdocs/projet/card.php | 12 +++--- .../public/eventorganization/attendee_new.php | 41 ++++++++++++++++--- 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index e3a916c0be0..9da183534fd 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -60,8 +60,8 @@ $objcanvas = GETPOST("objcanvas", "alphanohtml"); $comefromclone = GETPOST("comefromclone", "alphanohtml"); $date_start = dol_mktime(0, 0, 0, GETPOST('projectstartmonth', 'int'), GETPOST('projectstartday', 'int'), GETPOST('projectstartyear', 'int')); $date_end = dol_mktime(0, 0, 0, GETPOST('projectendmonth', 'int'), GETPOST('projectendday', 'int'), GETPOST('projectendyear', 'int')); -$date_start_event = dol_mktime(0, 0, 0, GETPOST('date_start_eventmonth', 'int'), GETPOST('date_start_eventday', 'int'), GETPOST('date_start_eventyear', 'int')); -$date_end_event = dol_mktime(0, 0, 0, GETPOST('date_end_eventmonth', 'int'), GETPOST('date_end_eventday', 'int'), GETPOST('date_end_eventyear', 'int')); +$date_start_event = dol_mktime(GETPOST('date_start_eventhour', 'int'), GETPOST('date_start_eventmin', 'int'), GETPOST('date_start_eventsec', 'int'), GETPOST('date_start_eventmonth', 'int'), GETPOST('date_start_eventday', 'int'), GETPOST('date_start_eventyear', 'int')); +$date_end_event = dol_mktime(GETPOST('date_end_eventhour', 'int'), GETPOST('date_end_eventmin', 'int'), GETPOST('date_end_eventsec', 'int'), GETPOST('date_end_eventmonth', 'int'), GETPOST('date_end_eventday', 'int'), GETPOST('date_end_eventyear', 'int')); $location = GETPOST('location', 'alphanohtml'); @@ -734,9 +734,9 @@ if ($action == 'create' && $user->rights->projet->creer) { if (isModEnabled('eventorganization')) { // Date event print '
'.$langs->trans("Date").' ('.$langs->trans("Event").')'; - print $form->selectDate(($date_start_event ? $date_start_event : -1), 'date_start_event', 0, 0, 0, '', 1, 0); + print $form->selectDate(($date_start_event ? $date_start_event : -1), 'date_start_event', 1, 1, 1, '', 1, 0); print ' '.$langs->trans("to").' '; - print $form->selectDate(($date_end_event ? $date_end_event : -1), 'date_end_event', 0, 0, 0, '', 1, 0); + print $form->selectDate(($date_end_event ? $date_end_event : -1), 'date_end_event', 1, 1, 1, '', 1, 0); print '
'.$langs->trans("Date").' ('.$langs->trans("Event").')'; - print $form->selectDate(($date_start_event ? $date_start_event : ($object->date_start_event ? $object->date_start_event : -1)), 'date_start_event', 0, 0, 0, '', 1, 0); + print $form->selectDate(($date_start_event ? $date_start_event : ($object->date_start_event ? $object->date_start_event : -1)), 'date_start_event', 1, 1, 1, '', 1, 0); print ' '.$langs->trans("to").' '; - print $form->selectDate(($date_end_event ? $date_end_event : ($object->date_end_event ? $object->date_end_event : -1)), 'date_end_event', 0, 0, 0, '', 1, 0); + print $form->selectDate(($date_end_event ? $date_end_event : ($object->date_end_event ? $object->date_end_event : -1)), 'date_end_event', 1, 1, 1, '', 1, 0); print '
'; + print '
'; // Visibility print ''; } diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 99003f00276..6342e08a34e 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -165,9 +165,10 @@ class FormActions * @param int $max Max number of record * @param string $moreparambacktopage More param for the backtopage * @param string $morehtmlcenter More html text on center of title line + * @param int $assignedtouser Assign event by default to this user id (will be ignored if not enough permissions) * @return int <0 if KO, >=0 if OK */ - public function showactions($object, $typeelement, $socid = 0, $forceshowtitle = 0, $morecss = 'listactions', $max = 0, $moreparambacktopage = '', $morehtmlcenter = '') + public function showactions($object, $typeelement, $socid = 0, $forceshowtitle = 0, $morecss = 'listactions', $max = 0, $moreparambacktopage = '', $morehtmlcenter = '', $assignedtouser = 0) { global $langs, $conf, $user; @@ -225,9 +226,21 @@ class FormActions $taskid = $object->id; } + $usercanaddaction = 0; + if (empty($assignedtouser) || $assignedtouser == $user->id) { + $usercanaddaction = $user->hasRight('agenda', 'myactions', 'create'); + $assignedtouser = 0; + } else { + $usercanaddaction = $user->hasRight('agenda', 'allactions', 'create'); + } + $newcardbutton = ''; - if (isModEnabled('agenda') && !empty($user->rights->agenda->myactions->create)) { - $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&token='.newToken().'&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog', 'tzuser')).'&origin='.urlencode($typeelement).'&originid='.((int) $object->id).((!empty($object->socid) && $object->socid > 0) ? '&socid='.((int) $object->socid) : ((!empty($socid) && $socid > 0) ? '&socid='.((int) $socid) : '')).($projectid > 0 ? '&projectid='.((int) $projectid) : '').($taskid > 0 ? '&taskid='.((int) $taskid) : '').'&backtopage='.urlencode($urlbacktopage); + if (isModEnabled('agenda') && $usercanaddaction) { + $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&token='.newToken().'&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog', 'tzuser')); + $url .= '&origin='.urlencode($typeelement).'&originid='.((int) $object->id).((!empty($object->socid) && $object->socid > 0) ? '&socid='.((int) $object->socid) : ((!empty($socid) && $socid > 0) ? '&socid='.((int) $socid) : '')); + $url .= ($projectid > 0 ? '&projectid='.((int) $projectid) : '').($taskid > 0 ? '&taskid='.((int) $taskid) : ''); + $url .= ($assignedtouser > 0 ? '&assignedtouser='.$assignedtouser : ''); + $url .= '&backtopage='.urlencode($urlbacktopage); $newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', $url); } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 3c65d018e6b..a539dad3505 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -2829,7 +2829,7 @@ if ($action == 'create' || $action == 'adduserldap') { // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, 'user', $socid, 1); + $somethingshown = $formactions->showactions($object, 'user', $socid, 1, 'listactions', 0, '', '', $object->id); print ''; } From c1213cfde8c69f2fb7c860432a85fa3296cea75b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Oct 2022 16:34:13 +0200 Subject: [PATCH 117/176] Fix missing code for triggers --- .../install/mysql/migration/16.0.0-17.0.0.sql | 153 ++++++++++++++++++ .../mysql/tables/llx_c_action_trigger.sql | 2 +- 2 files changed, 154 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index f796ac441ee..b10aa69767b 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -201,3 +201,156 @@ ALTER TABLE llx_projet ADD COLUMN date_start_event datetime; ALTER TABLE llx_projet ADD COLUMN date_end_event datetime; ALTER TABLE llx_projet ADD COLUMN location varchar(255); + +ALTER TABLE llx_c_action_trigger MODIFY COLUMN code varchar(128); + +-- +-- List of all managed triggered events (used for trigger agenda automatic events and for notification) +-- + +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('COMPANY_CREATE','Third party created','Executed when a third party is created','societe',1); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('COMPANY_MODIFY','Third party update','Executed when you update third party','societe',1); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('COMPANY_SENTBYMAIL','Mails sent from third party card','Executed when you send email from third party card','societe',1); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('COMPANY_DELETE','Third party deleted','Executed when you delete third party','societe',1); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_VALIDATE','Customer proposal validated','Executed when a commercial proposal is validated','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_MODIFY','Customer proposal modified','Executed when a customer proposal is modified','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_SENTBYMAIL','Commercial proposal sent by mail','Executed when a commercial proposal is sent by mail','propal',3); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_SIGNED','Customer proposal closed signed','Executed when a customer proposal is closed signed','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_REFUSED','Customer proposal closed refused','Executed when a customer proposal is closed refused','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLASSIFY_BILLED','Customer proposal set billed','Executed when a customer proposal is set to billed','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_DELETE','Customer proposal deleted','Executed when a customer proposal is deleted','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_VALIDATE','Customer order validate','Executed when a customer order is validated','commande',4); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_CLOSE','Customer order classify delivered','Executed when a customer order is set delivered','commande',5); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_MODIFY','Customer order modified','Executed when a customer order is set modified','commande',5); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_CLASSIFY_BILLED','Customer order classify billed','Executed when a customer order is set to billed','commande',5); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_CANCEL','Customer order canceled','Executed when a customer order is canceled','commande',5); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SENTBYMAIL','Customer order sent by mail','Executed when a customer order is sent by mail ','commande',5); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_DELETE','Customer order deleted','Executed when a customer order is deleted','commande',5); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_VALIDATE','Customer invoice validated','Executed when a customer invoice is approved','facture',6); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_MODIFY','Customer invoice modified','Executed when a customer invoice is modified','facture',7); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_PAYED','Customer invoice payed','Executed when a customer invoice is payed','facture',7); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_CANCEL','Customer invoice canceled','Executed when a customer invoice is conceled','facture',8); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SENTBYMAIL','Customer invoice sent by mail','Executed when a customer invoice is sent by mail','facture',9); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',9); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_DELETE','Customer invoice deleted','Executed when a customer invoice is deleted','facture',9); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_VALIDATE','Price request validated','Executed when a commercial proposal is validated','proposal_supplier',10); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_MODIFY','Price request modified','Executed when a commercial proposal is modified','proposal_supplier',10); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_SENTBYMAIL','Price request sent by mail','Executed when a commercial proposal is sent by mail','proposal_supplier',10); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_CLOSE_SIGNED','Price request closed signed','Executed when a customer proposal is closed signed','proposal_supplier',10); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_CLOSE_REFUSED','Price request closed refused','Executed when a customer proposal is closed refused','proposal_supplier',10); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_DELETE','Price request deleted','Executed when a customer proposal delete','proposal_supplier',10); +--insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_CREATE','Supplier order created','Executed when a supplier order is created','order_supplier',11); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_VALIDATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',12); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',13); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_MODIFY','Supplier order request modified','Executed when a supplier order is modified','order_supplier',13); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_SUBMIT','Supplier order request submited','Executed when a supplier order is approved','order_supplier',13); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_RECEIVE','Supplier order request received','Executed when a supplier order is received','order_supplier',13); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',13); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_CANCEL','Supplier order request canceled','Executed when a supplier order is canceled','order_supplier',13); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_SENTBYMAIL','Supplier order sent by mail','Executed when a supplier order is sent by mail','order_supplier',14); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_CLASSIFY_BILLED','Supplier order set billed','Executed when a supplier order is set as billed','order_supplier',14); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_DELETE','Supplier order deleted','Executed when a supplier order is deleted','order_supplier',14); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_VALIDATE','Supplier invoice validated','Executed when a supplier invoice is validated','invoice_supplier',15); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_MODIFY','Supplier invoice modified','Executed when a supplier invoice is modified','invoice_supplier',15); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_UNVALIDATE','Supplier invoice unvalidated','Executed when a supplier invoice status is set back to draft','invoice_supplier',15); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_PAYED','Supplier invoice payed','Executed when a supplier invoice is payed','invoice_supplier',16); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_SENTBYMAIL','Supplier invoice sent by mail','Executed when a supplier invoice is sent by mail','invoice_supplier',17); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_CANCELED','Supplier invoice cancelled','Executed when a supplier invoice is cancelled','invoice_supplier',17); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_DELETE','Supplier invoice deleted','Executed when a supplier invoice is deleted','invoice_supplier',17); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_VALIDATE','Contract validated','Executed when a contract is validated','contrat',18); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_MODIFY','Contract modified','Executed when a contract is modified','contrat',18); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_SENTBYMAIL','Contract sent by mail','Executed when a contract is sent by mail','contrat',18); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_DELETE','Contract deleted','Executed when a contract is deleted','contrat',18); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_VALIDATE','Shipping validated','Executed when a shipping is validated','shipping',20); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_MODIFY','Shipping modified','Executed when a shipping is modified','shipping',20); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_SENTBYMAIL','Shipping sent by mail','Executed when a shipping is sent by mail','shipping',21); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_DELETE','Shipping sent is deleted','Executed when a shipping is deleted','shipping',21); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECEPTION_VALIDATE','Reception validated','Executed when a reception is validated','reception',22); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECEPTION_SENTBYMAIL','Reception sent by mail','Executed when a reception is sent by mail','reception',22); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_VALIDATE','Member validated','Executed when a member is validated','member',22); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_MODIFY','Member modified','Executed when a member is modified','member',23); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SENTBYMAIL','Mails sent from member card','Executed when you send email from member card','member',23); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION_CREATE','Member subscribtion recorded','Executed when a member subscribtion is deleted','member',24); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION_MODIFY','Member subscribtion modified','Executed when a member subscribtion is modified','member',24); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION_DELETE','Member subscribtion deleted','Executed when a member subscribtion is deleted','member',24); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_RESILIATE','Member resiliated','Executed when a member is resiliated','member',25); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',26); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_EXCLUDE','Member excluded','Executed when a member is excluded','member',27); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',30); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modify','Executed when a intervention is modify','ficheinter',30); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_BILLED','Intervention set billed','Executed when a intervention is set to billed (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',32); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_UNBILLED','Intervention set unbilled','Executed when a intervention is set to unbilled (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',33); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_REOPEN','Intervention opened','Executed when a intervention is re-opened','ficheinter',34); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',35); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_DELETE','Intervention is deleted','Executed when a intervention is deleted','ficheinter',35); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_CREATE','Product or service created','Executed when a product or sevice is created','product',40); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',41); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_DELETE','Product or service deleted','Executed when a product or sevice is deleted','product',42); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_CREATE','Expense report created','Executed when an expense report is created','expensereport',201); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_MODIFY','Expense report modified','Executed when an expense report is modified','expensereport',202); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_PAID','Expense report billed','Executed when an expense report is set as billed','expensereport',204); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_DELETE','Expense report deleted','Executed when an expense report is deleted','expensereport',205); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',211); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_MODIFY','Expense report modified','Executed when an expense report is modified','expensereport',212); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',212); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_CREATE','Project creation','Executed when a project is created','project',140); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_VALIDATE','Project validation','Executed when a project is validated','project',141); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_MODIFY','Project modified','Executed when a project is modified','project',142); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_DELETE','Project deleted','Executed when a project is deleted','project',143); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_SENTBYMAIL','Project sent by mail','Executed when a project is sent by email','project',144); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_CREATE','Ticket created','Executed when a ticket is created','ticket',161); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_MODIFY','Ticket modified','Executed when a ticket is modified','ticket',163); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_ASSIGNED','Ticket assigned','Executed when a ticket is modified','ticket',164); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_CLOSE','Ticket closed','Executed when a ticket is closed','ticket',165); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_SENTBYMAIL','Ticket message sent by email','Executed when a message is sent from the ticket record','ticket',166); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_DELETE','Ticket deleted','Executed when a ticket is deleted','ticket',167); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_SENTBYMAIL','Email sent','Executed when an email is sent from user card','user',300); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_CREATE','User created','Executed when a user is created','user',301); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_MODIFY','User update','Executed when a user is updated','user',302); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_DELETE','User update','Executed when a user is deleted','user',303); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_NEW_PASSWORD','User update','Executed when a user is change password','user',304); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_ENABLEDISABLE','User update','Executed when a user is enable or disable','user',305); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modified','Executed when a intervention is modified','ficheinter',19); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_VALIDATE','BOM validated','Executed when a BOM is validated','bom',650); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_UNVALIDATE','BOM unvalidated','Executed when a BOM is unvalidated','bom',651); +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','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_MODIFY','Contact address update','Executed when a contact is updated','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',52); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',53); +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); +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); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ACTION_CREATE','Action added','Executed when an action is added to the agenda','agenda',700); + +-- holiday +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CREATE','Holiday created','Executed when a holiday is created','holiday',800); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_MODIFY','Holiday modified','Executed when a holiday is modified','holiday',801); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_VALIDATE','Holiday validated','Executed when a holiday is validated','holiday',802); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Holiday aprouved','Executed when a holiday is aprouved','holiday',803); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CANCEL','Holiday canceled','Executed when a holiday is canceled','holiday',802); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_DELETE','Holiday deleted','Executed when a holiday is deleted','holiday',804); + +-- facture rec +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_CREATE','Template invoices created','Executed when a Template invoices is created','facturerec',900); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_MODIFY','Template invoices update','Executed when a Template invoices is updated','facturerec',901); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_DELETE','Template invoices deleted','Executed when a Template invoices is deleted','facturerec',902); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_AUTOCREATEBILL','Template invoices use to create invoices with auto batch','Executed when a Template invoices is use to create invoice with auto batch','facturerec',903); diff --git a/htdocs/install/mysql/tables/llx_c_action_trigger.sql b/htdocs/install/mysql/tables/llx_c_action_trigger.sql index 8f7450d0fe9..be1c8580541 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(64) NOT NULL, + code varchar(128) NOT NULL, label varchar(128) NOT NULL, description varchar(255), rang integer DEFAULT 0 From d9c2528b62002fb53a5e47b526001d6c555af7aa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Oct 2022 23:49:45 +0200 Subject: [PATCH 118/176] Clean code --- htdocs/comm/propal/card.php | 17 ++----- htdocs/comm/propal/contact.php | 24 +++------- htdocs/comm/propal/document.php | 24 +++------- htdocs/comm/propal/info.php | 26 ++++------- htdocs/comm/propal/note.php | 26 ++++------- htdocs/commande/card.php | 17 ++----- htdocs/commande/contact.php | 27 ++++------- htdocs/commande/document.php | 27 ++++------- htdocs/commande/info.php | 26 ++++------- htdocs/commande/note.php | 30 ++++-------- htdocs/compta/facture/card.php | 17 ++----- htdocs/compta/facture/contact.php | 26 ++++------- htdocs/compta/facture/document.php | 26 ++++------- htdocs/compta/facture/info.php | 26 ++++------- htdocs/compta/facture/note.php | 26 ++++------- htdocs/compta/facture/prelevement.php | 23 ++------- htdocs/contrat/agenda.php | 26 ++++------- htdocs/contrat/card.php | 22 ++------- htdocs/contrat/contact.php | 26 ++++------- htdocs/contrat/document.php | 24 +++------- htdocs/contrat/note.php | 25 +++------- htdocs/core/class/html.form.class.php | 3 +- htdocs/delivery/card.php | 21 ++------- htdocs/expedition/card.php | 23 ++------- htdocs/expedition/contact.php | 26 +++-------- htdocs/expedition/document.php | 44 ++++++++++-------- htdocs/expedition/note.php | 26 +++-------- htdocs/expedition/shipment.php | 25 +++------- htdocs/fourn/commande/card.php | 25 +++------- htdocs/fourn/commande/contact.php | 32 +++++-------- htdocs/fourn/commande/dispatch.php | 29 ++++-------- htdocs/fourn/commande/document.php | 26 +++-------- htdocs/fourn/commande/info.php | 28 ++++------- htdocs/fourn/commande/note.php | 28 ++++------- htdocs/fourn/facture/card.php | 19 ++------ htdocs/fourn/facture/contact.php | 27 ++++------- htdocs/fourn/facture/document.php | 24 +++------- htdocs/fourn/facture/info.php | 27 ++++------- htdocs/fourn/facture/note.php | 26 ++++------- htdocs/reception/card.php | 29 +++--------- htdocs/reception/contact.php | 41 ++++++++-------- htdocs/reception/document.php | 67 ++++++++++++++++++--------- htdocs/reception/note.php | 59 +++++++++++------------ htdocs/supplier_proposal/contact.php | 22 +++------ htdocs/ticket/agenda.php | 24 ++++------ htdocs/ticket/card.php | 23 +++------ htdocs/ticket/contact.php | 23 +++------ htdocs/ticket/document.php | 23 +++------ htdocs/ticket/messaging.php | 24 +++------- 49 files changed, 432 insertions(+), 873 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index a18056e1003..87906426b44 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2306,30 +2306,19 @@ if ($action == 'create') { $langs->load("projects"); $morehtmlref .= '
'; if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - 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, $langs->trans("OutOfProject")); - } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 5039335007f..f1dff7991ef 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -69,6 +69,8 @@ if (!empty($user->socid)) { } restrictedArea($user, 'propal', $object->id); +$usercancreate = $user->hasRight("propal", "creer"); + /* * Add a new contact @@ -142,32 +144,20 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->propal->creer) { + if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index a2f638a8ad2..569a9d2494e 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -90,6 +90,8 @@ if (!empty($user->socid)) { } restrictedArea($user, 'propal', $object->id); +$usercancreate = $user->hasRight("propal", "creer"); + /* * Actions @@ -140,32 +142,20 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->propal->creer) { + if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php index fdf1f1d1bb9..ed15c4d7615 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -53,6 +53,8 @@ if (!empty($user->socid)) { } restrictedArea($user, 'propal', $object->id); +$usercancreate = $user->hasRight("propal", "creer"); + /* * View @@ -87,32 +89,20 @@ $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->propal->creer) { + if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index fd10809bac5..272ef300db2 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -59,6 +59,8 @@ $hookmanager->initHooks(array('propalnote')); restrictedArea($user, 'propal', $object->id, 'propal'); +$usercancreate = $user->hasRight("propal", "creer"); + /* * Actions @@ -112,32 +114,20 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->propal->creer) { + if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index bc445b90bb4..0bffd98e739 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2335,30 +2335,19 @@ if ($action == 'create' && $usercancreate) { $langs->load("projects"); $morehtmlref .= '
'; if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - 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', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500'); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, $langs->trans("OutOfProject")); - } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 91ecc261b80..7637d1e62ba 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -47,8 +47,11 @@ if ($user->socid) { } $result = restrictedArea($user, 'commande', $id, ''); +$usercancreate = $user->hasRight("commande", "creer"); + $object = new Commande($db); + /* * Ajout d'un nouveau contact */ @@ -135,32 +138,20 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->commande->creer) { + if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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->thirdparty->id, $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->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 181cb50ef3a..1cda0476355 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -73,7 +73,8 @@ if (!$sortfield) { $object = new Commande($db); -$permissiontoadd = $user->rights->commande->creer; +$usercancreate = $user->hasRight("commande", "creer"); +$permissiontoadd = $usercancreate; // Security check if ($user->socid) { @@ -134,32 +135,20 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->commande->creer) { + if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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->thirdparty->id, $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->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index e259d3e5749..9b091c47397 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -50,6 +50,8 @@ if ($user->socid) { } $result = restrictedArea($user, 'commande', $comid, ''); +$usercancreate = $user->hasRight("commande", "creer"); + $object = new Commande($db); if (!$object->fetch($id, $ref) > 0) { dol_print_error($db); @@ -87,32 +89,20 @@ $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->commande->creer) { + if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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->thirdparty->id, $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->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 82a58e40cf3..7ab5fa96310 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -52,6 +52,10 @@ $hookmanager->initHooks(array('ordernote')); $result = restrictedArea($user, 'commande', $id, ''); +$usercancreate = $user->hasRight("commande", "creer"); + +$permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php + $object = new Commande($db); if (!$object->fetch($id, $ref) > 0) { @@ -59,8 +63,6 @@ if (!$object->fetch($id, $ref) > 0) { exit; } -$permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php - /* * Actions @@ -106,32 +108,20 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->commande->creer) { + if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a30541dadcf..a193383836b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4372,30 +4372,19 @@ if ($action == 'create') { $langs->load("projects"); $morehtmlref .= '
'; if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - 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, $langs->trans("OutOfProject")); - } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 1da25ab3c64..0bc058a05d6 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -58,6 +58,8 @@ if ($id > 0 || !empty($ref)) { $result = restrictedArea($user, 'facture', $object->id); +$usercancreate = $user->hasRight("facture", "creer"); + /* * Add a new contact @@ -141,32 +143,20 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->facture->creer) { + if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 5088db34ade..a38fd572e09 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -81,6 +81,8 @@ if ($user->socid) { } $result = restrictedArea($user, 'facture', $object->id, ''); +$usercancreate = $user->hasRight("facture", "creer"); + /* * Actions @@ -145,32 +147,20 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->facture->creer) { + if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index 6de7793a4b3..7cbfdb50a14 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -59,6 +59,8 @@ $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); +$usercancreate = $user->hasRight("facture", "creer"); + /* * View @@ -101,32 +103,20 @@ $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->facture->creer) { + if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index b47dbe2eabd..3066b5adfc6 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -59,6 +59,8 @@ $hookmanager->initHooks(array('invoicenote')); $result = restrictedArea($user, 'facture', $id, ''); +$usercancreate = $user->hasRight("facture", "creer"); + /* * Actions @@ -123,32 +125,20 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->facture->creer) { + if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index b3a881797b5..d7a674867d0 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -364,32 +364,19 @@ if ($object->id > 0) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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 .= ''; - $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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index 1c7d1ea8e67..5b649c5b850 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -76,6 +76,8 @@ if (!$sortorder) { // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('agendacontract', 'globalcard')); +$permissiontoadd = $user->rights->contrat->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php + /* * Actions @@ -174,32 +176,20 @@ if ($id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->contrat->creer) { + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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->thirdparty->id, $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->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 94cfc7d2954..b2a89ab63ec 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -977,7 +977,6 @@ if (empty($reshook)) { // Actions to build doc $upload_dir = $conf->contrat->multidir_output[$object->entity]; - $permissiontoadd = $user->rights->contrat->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; // Actions to send emails @@ -1380,31 +1379,20 @@ if ($action == 'create') { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->contrat->creer) { + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - 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->thirdparty->id, $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->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1, $langs->trans("OutOfProject")); - } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 14ddc998305..7f1187853c8 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -54,6 +54,8 @@ $object = new Contrat($db); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('contractcard', 'globalcard')); +$permissiontoadd = $user->rights->contrat->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php + /* * Actions @@ -158,32 +160,20 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->contrat->creer) { + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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->thirdparty->id, $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->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index bfeb2536662..55fb5c690a1 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -147,32 +147,20 @@ if ($object->id) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->contrat->creer) { + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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->thirdparty->id, $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->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index 0e578e45735..94aa8369b3f 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -54,6 +54,7 @@ $result = restrictedArea($user, 'contrat', $id); $object = new Contrat($db); $object->fetch($id, $ref); +$permissiontoadd = $user->rights->contrat->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissionnote = $user->rights->contrat->creer; // Used by the include of actions_setnotes.inc.php @@ -115,32 +116,20 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->contrat->creer) { + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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->thirdparty->id, $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->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9c0f4041b51..0b108d8b759 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5401,7 +5401,6 @@ class Form $langs->load("project"); if ($htmlname != "none") { - $out .= "\n"; $out .= '
'; $out .= ''; $out .= ''; @@ -5413,7 +5412,7 @@ class Form if ($selected) { $projet = new Project($this->db); $projet->fetch($selected); - $out .= $projet->getNomUrl(1, '', 1); + $out .= $projet->getNomUrl(0, '', 1); } else { $out .= ''.$textifnoproject.''; } diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 6a8c1be63dd..0b019bec92c 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -333,31 +333,20 @@ if ($action == 'create') { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if (0) { // Do not change on shipment + if (0) { // Do not change on shipment + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; - } - if ($action == 'classify') { - // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $expedition->id, $expedition->socid, $expedition->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($expedition->socid, $expedition->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$expedition->id, $expedition->socid, $expedition->fk_project, 'none', 0, 0, 0, 1, $langs->trans("OutOfProject")); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index d76bd40a8a6..5e9dc8fb1a7 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1747,33 +1747,20 @@ if ($action == 'create') { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if (0) { // Do not change on shipment + if (0) { // Do not change on shipment + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - 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, $langs->trans("OutOfProject")); - } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - // We don't have project on shipment, so we will use the project or source object instead - // TODO Add project on shipment - if (!empty($objectsrc->fk_project)) { + if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index b2eec02f879..4ef381dfc9a 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -153,34 +153,20 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if (0) { // Do not change on shipment + if (0) { // Do not change on shipment + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - 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); - } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - // We don't have project on shipment, so we will use the project or source object instead - // TODO Add project on shipment - $morehtmlref .= ' : '; - if (!empty($objectsrc->fk_project)) { + if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php index a27a5390c65..4aca218a611 100644 --- a/htdocs/expedition/document.php +++ b/htdocs/expedition/document.php @@ -66,8 +66,26 @@ if (!$sortfield) { $object = new Expedition($db); -if ($object->fetch($id, $ref)) { +if ($id > 0 || !empty($ref)) { + $object->fetch($id, $ref); $object->fetch_thirdparty(); + + if (!empty($object->origin)) { + $typeobject = $object->origin; + $origin = $object->origin; + $object->fetch_origin(); + } + + // Linked documents + if ($typeobject == 'commande' && $object->$typeobject->id && isModEnabled('commande')) { + $objectsrc = new Commande($db); + $objectsrc->fetch($object->$typeobject->id); + } + if ($typeobject == 'propal' && $object->$typeobject->id && isModEnabled("propal")) { + $objectsrc = new Propal($db); + $objectsrc->fetch($object->$typeobject->id); + } + $upload_dir = $conf->expedition->dir_output."/sending/".dol_sanitizeFileName($object->ref); } @@ -127,34 +145,20 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if (0) { // Do not change on shipment + if (0) { // Do not change on shipment + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - 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); - } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - // We don't have project on shipment, so we will use the project or source object instead - // TODO Add project on shipment - $morehtmlref .= ' : '; if (!empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index 364b5400ff3..2e98169f042 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -114,34 +114,20 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if (0) { // Do not change on shipment + if (0) { // Do not change on shipment + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - 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); - } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - // We don't have project on shipment, so we will use the project or source object instead - // TODO Add project on shipment - $morehtmlref .= ' : '; - if (!empty($objectsrc->fk_project)) { + if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 91805e9d0a9..c1b4a04fcee 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -291,31 +291,20 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->commande->creer) { + if (0) { // Do not change on shipment + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - 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); - } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - if (!empty($object->fk_project)) { + if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $proj->fetch($objectsrc->fk_project); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index d6961a1323e..ce85f581859 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2046,7 +2046,7 @@ if ($action == 'create') { if (!empty($conf->global->MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER) && $object->statut == CommandeFournisseur::STATUS_DRAFT) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty')).''; } - $morehtmlref .= ' : '.$object->thirdparty->getNomUrl(1, 'supplier'); + $morehtmlref .= $object->thirdparty->getNomUrl(1, 'supplier'); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; } @@ -2055,32 +2055,21 @@ if ($action == 'create') { // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($usercancreate) { + $morehtmlref .= '
'; + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify' && $caneditproject) { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - 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((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 1, 1, 0, 0, '', 1, 0, 'maxwidth500'); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, $langs->trans("OutOfProject")); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index e7e2daf0386..dd945ef3d39 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -50,9 +50,12 @@ $hookmanager->initHooks(array('ordersuppliercardcontact')); $object = new CommandeFournisseur($db); +$usercancreate = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); +$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php + /* - * Add a new contact + * Actions */ if ($action == 'addcontact' && ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer)) { @@ -100,6 +103,7 @@ if ($action == 'addcontact' && ($user->rights->fournisseur->commande->creer || $ /* * View */ + $form = new Form($db); $formcompany = new FormCompany($db); $contactstatic = new Contact($db); @@ -139,32 +143,20 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { - 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); + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify' && $caneditproject) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 1fcc3daacb8..b7fd424054c 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -100,6 +100,9 @@ if (!isModEnabled('stock')) { accessforbidden(); } +$usercancreate = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); +$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php + /* * Actions @@ -546,32 +549,20 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { - 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); + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify' && $caneditproject) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index e457170d323..a598dd4b83d 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -135,32 +135,20 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { - 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); + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify' && $caneditproject) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index c764302244f..df9f52abae1 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -84,6 +84,8 @@ if (empty($user->rights->fournisseur->commande->lire)) { // Init Hooks $hookmanager->initHooks(array('ordersuppliercardinfo')); +$usercancreate = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); +$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php /* @@ -146,32 +148,20 @@ $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { - 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); + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify' && $caneditproject) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 21c9379fa75..53cb80f9e55 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -56,6 +56,8 @@ $object->fetch($id, $ref); // Permissions $permissionnote = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); // Used by the include of actions_setnotes.inc.php +$usercancreate = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); +$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php /* @@ -115,32 +117,20 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { - 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); + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify' && $caneditproject) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index c17be415e3a..a66f48fc2e0 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2881,31 +2881,20 @@ if ($action == 'create') { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - 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((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 .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, $langs->trans("OutOfProject")); - } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index e4740b47d8a..5242fce001c 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -51,6 +51,9 @@ $hookmanager->initHooks(array('invoicesuppliercardcontact')); $object = new FactureFournisseur($db); +$usercancreate = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer); +$permissiontoadd = $usercancreate; + /* * Ajout d'un nouveau contact @@ -141,32 +144,20 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->facture->creer) { + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 9ac4d53486d..cdc045b60fc 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -120,32 +120,20 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->facture->creer) { + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php index bd6f8b10ee2..b451d6fa63d 100644 --- a/htdocs/fourn/facture/info.php +++ b/htdocs/fourn/facture/info.php @@ -49,6 +49,9 @@ $hookmanager->initHooks(array('invoicesuppliercardinfo')); $object = new FactureFournisseur($db); +$usercancreate = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer); +$permissiontoadd = $usercancreate; + /* * View @@ -83,32 +86,20 @@ if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0 if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->facture->creer) { + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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->thirdparty->id, $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->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index d5b4042fdf4..20c8f6d977c 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -53,6 +53,8 @@ $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); $object = new FactureFournisseur($db); $object->fetch($id, $ref); +$usercancreate = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer); +$permissiontoadd = $usercancreate; $permissionnote = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer); // Used by the include of actions_setnotes.inc.php @@ -114,32 +116,20 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 452061a9276..d5106a3b5ea 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -51,10 +51,8 @@ if (isModEnabled("product") || isModEnabled("service")) { if (isModEnabled("propal")) { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; } -if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) { - require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; - require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; -} +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; if (isModEnabled('productbatch')) { require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; } @@ -1386,32 +1384,19 @@ if ($action == 'create') { $langs->load("projects"); $morehtmlref .= '
'; if (0) { // Do not change on reception - if ($action != 'classify') { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify' && $permissiontoadd) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - 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); - } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - // We don't have project on reception, so we will use the project or source object instead - // TODO Add project on reception - if (!empty($objectsrc->fk_project)) { + if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index d484ab8bc48..01ff7218f9e 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -35,6 +35,8 @@ if (!empty($conf->project->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; $langs->loadLangs(array("orders", "receptions", "companies")); @@ -75,6 +77,20 @@ if ($origin == 'reception') { } } +if (isModEnabled("reception")) { + $permissiontoread = $user->rights->reception->lire; + $permissiontoadd = $user->rights->reception->creer; + $permissiondellink = $user->rights->reception->creer; // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate))); + $permissiontodelete = $user->rights->reception->supprimer; +} else { + $permissiontoread = $user->rights->fournisseur->commande->receptionner; + $permissiontoadd = $user->rights->fournisseur->commande->receptionner; + $permissiondellink = $user->rights->fournisseur->commande->receptionner; // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->commande->receptionner)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->commande_advance->check))); + $permissiontodelete = $user->rights->fournisseur->commande->receptionner; +} + /* * Actions @@ -152,32 +168,19 @@ if ($id > 0 || !empty($ref)) { $langs->load("projects"); $morehtmlref .= '
'; if (0) { // Do not change on reception - if ($action != 'classify') { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify' && $permissiontoadd) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - 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); - } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - // We don't have project on reception, so we will use the project or source object instead - // TODO Add project on reception - if (!empty($objectsrc->fk_project)) { + if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } @@ -190,7 +193,7 @@ if ($id > 0 || !empty($ref)) { //print '
'; print '
'; - print '
'.$langs->trans("Visibility").''; diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index 88ac4ef686c..ed9639f21bf 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -173,11 +173,10 @@ if ($object->fk_user_create > 0) { // Thirdparty if (isModEnabled("societe")) { - $morehtmlref .= '
'.$langs->trans('ThirdParty'); + $morehtmlref .= '
'; /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' '; }*/ - $morehtmlref .= ' : '; if ($action == 'editcustomer') { $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); } else { @@ -188,11 +187,11 @@ if (isModEnabled("societe")) { // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project'); + $morehtmlref .= '
'; if ($user->rights->ticket->write) { if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ''; - $morehtmlref .= ' : '; + //$morehtmlref .= ' '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); From 9a5a3a35171a781d9acfd4396d3d5984a39c14af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Oct 2022 16:18:25 +0200 Subject: [PATCH 116/176] Fix link to create event from user card --- htdocs/comm/action/card.php | 5 +++-- htdocs/core/class/html.formactions.class.php | 19 ++++++++++++++++--- htdocs/user/card.php | 2 +- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 39d5a43bc55..8b42e6df6e2 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1181,9 +1181,10 @@ if ($action == 'create') { // Type of event if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print '
'.$langs->trans("Type").''; - $default = (empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT) ? 'AC_RDV' : $conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT); + $default = getDolGlobalString('AGENDA_USE_EVENT_TYPE_DEFAULT', 'AC_RDV'); print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"'); - print $formactions->select_type_actions(GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default), "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot + $selectedvalue = GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default); + print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot print '
'; + print '
'; // Linked documents if ($origin == 'order_supplier' && $object->$typeobject->id && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order"))) { print '
'; diff --git a/htdocs/reception/document.php b/htdocs/reception/document.php index 2b2a2f3ffed..6ef302f4143 100644 --- a/htdocs/reception/document.php +++ b/htdocs/reception/document.php @@ -37,6 +37,8 @@ require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php'; if (!empty($conf->project->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; // Load translation files required by the page $langs->loadLangs(array('companies', 'other')); @@ -65,19 +67,48 @@ if (!$sortfield) { } $object = new Reception($db); - -if ($object->fetch($id, $ref)) { +if ($id > 0 || !empty($ref)) { + $object->fetch($id, $ref); $object->fetch_thirdparty(); + + if (!empty($object->origin)) { + $origin = $object->origin; + + $object->fetch_origin(); + $typeobject = $object->origin; + } + + // Linked documents + if ($origin == 'order_supplier' && $object->$typeobject->id && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order"))) { + $objectsrc = new CommandeFournisseur($db); + $objectsrc->fetch($object->$typeobject->id); + } + $upload_dir = $conf->reception->dir_output."/".dol_sanitizeFileName($object->ref); } +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('receptiondocument')); + // Security check -if ($user->socid) { +if ($user->socid > 0) { $socid = $user->socid; } $result = restrictedArea($user, 'reception', $object->id, ''); -$permissiontoadd = $user->rights->reception->creer; // Used by the include of actions_dellink.inc.php +if (isModEnabled("reception")) { + $permissiontoread = $user->rights->reception->lire; + $permissiontoadd = $user->rights->reception->creer; + $permissiondellink = $user->rights->reception->creer; // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate))); + $permissiontodelete = $user->rights->reception->supprimer; +} else { + $permissiontoread = $user->rights->fournisseur->commande->receptionner; + $permissiontoadd = $user->rights->fournisseur->commande->receptionner; + $permissiondellink = $user->rights->fournisseur->commande->receptionner; // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->commande->receptionner)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->commande_advance->check))); + $permissiontodelete = $user->rights->fournisseur->commande->receptionner; +} /* @@ -117,6 +148,9 @@ if ($id > 0 || !empty($ref)) { $morehtmlref = '
'; + // Ref customer reception + $morehtmlref .= $form->editfieldkey("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', null, null, '', 1); // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); @@ -124,33 +158,20 @@ if ($id > 0 || !empty($ref)) { if (!empty($conf->project->enabled)) { $langs->load("projects"); $morehtmlref .= '
'; - if (0) { // Do not change on shipment - if ($action != 'classify') { + if (0) { // Do not change on reception + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify' && $permissiontoadd) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - 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); - } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - // We don't have project on shipment, so we will use the project or source object instead - // TODO Add project on shipment - if (!empty($objectsrc->fk_project)) { + if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/reception/note.php b/htdocs/reception/note.php index c5ffc5c6bb7..5b04e971702 100644 --- a/htdocs/reception/note.php +++ b/htdocs/reception/note.php @@ -28,11 +28,12 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php'; -dol_include_once('/fourn/class/fournisseur.commande.class.php'); if (!empty($conf->project->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; $langs->loadLangs(array("receptions", "companies", "bills", 'deliveries', 'orders', 'stocks', 'other', 'propal')); @@ -46,32 +47,41 @@ if ($id > 0 || !empty($ref)) { $object->fetch_thirdparty(); if (!empty($object->origin)) { - $typeobject = $object->origin; $origin = $object->origin; + $object->fetch_origin(); + $typeobject = $object->origin; } // Linked documents - if ($typeobject == 'commande' && $object->$typeobject->id && isModEnabled('commande')) { - $objectsrc = new Commande($db); - $objectsrc->fetch($object->$typeobject->id); - } - if ($typeobject == 'propal' && $object->$typeobject->id && isModEnabled("propal")) { - $objectsrc = new Propal($db); + if ($origin == 'order_supplier' && $object->$typeobject->id && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order"))) { + $objectsrc = new CommandeFournisseur($db); $objectsrc->fetch($object->$typeobject->id); } } -$permissionnote = $user->rights->reception->creer; // Used by the include of actions_setnotes.inc.php +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('receptionnote')); // Security check if ($user->socid > 0) { $socid = $user->socid; } - -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('receptionnote')); +if (isModEnabled("reception")) { + $permissiontoread = $user->rights->reception->lire; + $permissiontoadd = $user->rights->reception->creer; + $permissiondellink = $user->rights->reception->creer; // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate))); + $permissiontodelete = $user->rights->reception->supprimer; +} else { + $permissiontoread = $user->rights->fournisseur->commande->receptionner; + $permissiontoadd = $user->rights->fournisseur->commande->receptionner; + $permissiondellink = $user->rights->fournisseur->commande->receptionner; // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->commande->receptionner)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->commande_advance->check))); + $permissiontodelete = $user->rights->fournisseur->commande->receptionner; +} +$permissionnote = $user->rights->reception->creer; // Used by the include of actions_setnotes.inc.php if ($origin == 'reception') { $result = restrictedArea($user, $origin, $object->id); @@ -106,7 +116,7 @@ if (empty($reshook)) { * View */ -llxHeader('', 'Reception'); +llxHeader('', $langs->trans('Reception')); $form = new Form($db); @@ -129,32 +139,19 @@ if ($id > 0 || !empty($ref)) { $langs->load("projects"); $morehtmlref .= '
'; if (0) { // Do not change on reception - if ($action != 'classify') { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify' && $permissiontoadd) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - 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); - } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - // We don't have project on reception, so we will use the project or source object instead - // TODO Add project on reception - if (!empty($objectsrc->fk_project)) { + if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/supplier_proposal/contact.php b/htdocs/supplier_proposal/contact.php index 7c4fd273579..6b01d2af35a 100644 --- a/htdocs/supplier_proposal/contact.php +++ b/htdocs/supplier_proposal/contact.php @@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/supplier_proposal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; // Load translation files required by the page $langs->loadLangs(array("propal", "supplier_proposal", "facture", "orders", "sendings", "companies")); @@ -139,31 +141,19 @@ if ($id > 0 || !empty($ref)) { $langs->load("projects"); $morehtmlref .= '
'; if ($permissiontoedit) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index 202aacb98cd..eae0ae829e2 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -94,6 +94,7 @@ if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && accessforbidden(); } +$permissiontoadd = $user->rights->ticket->write; /* @@ -192,29 +193,20 @@ if (isModEnabled("societe")) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->ticket->write) { + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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', 0, 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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); - } else { - $morehtmlref .= ''; + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + } } } } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index b9629841979..eb824beb1d3 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -970,29 +970,20 @@ if ($action == 'create' || $action == 'presend') { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->ticket->write) { + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500'); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, $langs->trans("OutOfProject")); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); - } else { - $morehtmlref .= ''; + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + } } } } diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index cc0923a89e1..f045923e75d 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -227,29 +227,20 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->ticket->write) { + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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', 0, 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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); - } else { - $morehtmlref .= ''; + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + } } } } diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index 70edaf475d6..daa74536d1a 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -162,29 +162,20 @@ if ($object->id) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->ticket->write) { + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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', 0, 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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); - } else { - $morehtmlref .= ''; + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + } } } } diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index ed9639f21bf..6817268eca8 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -188,30 +188,20 @@ if (isModEnabled("societe")) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($user->rights->ticket->write) { + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); 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', 0, 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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); - } else { - $morehtmlref .= ''; + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + } } } } From a2d9dd3388ed150f999ed24cee30eb7274df153e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Oct 2022 00:08:10 +0200 Subject: [PATCH 119/176] Clean code --- htdocs/api/class/api.class.php | 3 +-- htdocs/contrat/class/contrat.class.php | 3 ++- htdocs/core/class/commonobject.class.php | 11 ++++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index fa5e2ff1de8..e0acc8faac8 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -113,9 +113,8 @@ class DolibarrApi unset($object->pass); unset($object->pass_indatabase); - // Remove linkedObjects. We should already have linkedObjectsIds that avoid huge responses + // Remove linkedObjects. We should already have and keep only linkedObjectsIds that avoid huge responses unset($object->linkedObjects); - unset($object->linkedObjectsFullLoaded); //unset($object->lines[$i]->linked_objects); // This is the array to create linked object during create unset($object->fields); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 4dd26d5d6a2..73d907a374e 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2805,7 +2805,8 @@ class ContratLigne extends CommonObjectLine public $table_element = 'contratdet'; /** - * @var string Name to use for 'features' parameter to check module permissions with restrictedArea() + * @var string Name to use for 'features' parameter to check module permissions user->rights->feature with restrictedArea(). + * Undefined means same value than $element. Can be use to force a check on another element for example for class of line, we mention here the parent element. */ public $element_for_permission = 'contrat'; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d8eb8789d6e..31ca9706889 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -78,7 +78,7 @@ abstract class CommonObject /** * @var array To store error results of ->validateField() */ - public $validateFieldsErrors = array(); + private $validateFieldsErrors = array(); /** * @var string ID to identify managed object @@ -86,7 +86,8 @@ abstract class CommonObject public $element; /** - * @var string Name to use for 'features' parameter to check module permissions with restrictedArea(). Undefined means same value than $element. + * @var string Name to use for 'features' parameter to check module permissions user->rights->feature with restrictedArea(). + * Undefined means same value than $element. Can be use to force a check on another element for example for class of line, we mention here the parent element. */ public $element_for_permission; @@ -136,9 +137,9 @@ abstract class CommonObject public $linkedObjects; /** - * @var boolean Array of boolean with object id as key and value as true if linkedObjects full loaded. Loaded by ->fetchObjectLinked. Important for pdf generation time reduction. + * @var boolean[] Array of boolean with object id as key and value as true if linkedObjects full loaded for object id. Loaded by ->fetchObjectLinked. Important for pdf generation time reduction. */ - public $linkedObjectsFullLoaded = array(); + private $linkedObjectsFullLoaded = array(); /** * @var CommonObject To store a cloned copy of object before to edit it and keep track of old properties @@ -7831,7 +7832,7 @@ abstract class CommonObject * get field error message * * @param string $fieldKey Key of attribute - * @return string + * @return string Error message of validation ('' if no error) */ public function getFieldError($fieldKey) { From f87ec74b9f327199adbac2c5b9668fe1c5e6df0b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Oct 2022 00:22:54 +0200 Subject: [PATCH 120/176] Replace LEFT JOIN with EXISTS --- .../comm/propal/class/propalestats.class.php | 4 +- htdocs/commande/class/commandestats.class.php | 4 +- .../facture/class/facturestats.class.php | 4 +- .../reception/class/receptionstats.class.php | 50 ++++++++++++++++++- 4 files changed, 52 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index 1e688457623..81d49bb87ad 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -109,9 +109,7 @@ class PropaleStats extends Stats } if ($categid) { - $this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cs ON cs.fk_soc = p.fk_soc'; - $this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as c ON c.rowid = cs.fk_categorie'; - $this->where .= ' AND c.rowid = '.((int) $categid); + $this->where .= ' AND EXISTS (SELECT rowid FROM '.MAIN_DB_PREFIX.'categorie_societe as cats WHERE cats.fk_soc = p.fk_soc AND cats.fk_categorie = '.((int) $categid).')'; } } diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index d02d56175ff..5f13cf780f4 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -109,9 +109,7 @@ class CommandeStats extends Stats } if ($categid) { - $this->join .= ' LEFT JOIN '.$this->categ_link.' as cats ON cats.fk_soc = c.fk_soc'; - $this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cat.rowid = cats.fk_categorie'; - $this->where .= ' AND cat.rowid = '.((int) $categid); + $this->where .= ' AND EXISTS (SELECT rowid FROM '.$this->categ_link.' as cats WHERE cats.fk_soc = c.fk_soc AND cats.fk_categorie = '.((int) $categid).')'; } } diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 55ae05ff0a5..5637fd740a0 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -118,9 +118,7 @@ class FactureStats extends Stats } if ($categid) { - $this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cs ON cs.fk_soc = f.fk_soc'; - $this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as c ON c.rowid = cs.fk_categorie'; - $this->where .= ' AND c.rowid = '.((int) $categid); + $this->where .= ' AND EXISTS (SELECT rowid FROM '.MAIN_DB_PREFIX.'categorie_societe as cats WHERE cats.fk_soc = f.fk_soc AND cats.fk_categorie = '.((int) $categid).')'; } } diff --git a/htdocs/reception/class/receptionstats.class.php b/htdocs/reception/class/receptionstats.class.php index a27f458d01a..7a8562b706d 100644 --- a/htdocs/reception/class/receptionstats.class.php +++ b/htdocs/reception/class/receptionstats.class.php @@ -69,7 +69,7 @@ class ReceptionStats extends Stats $this->where .= " c.fk_statut > 0"; // Not draft and not cancelled //$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity; - $this->where .= " AND c.entity = ".$conf->entity; + $this->where .= " AND c.entity IN (".getEntity('reception').")"; if (empty($user->rights->societe->client->voir) && !$this->socid) { $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } @@ -128,6 +128,54 @@ class ReceptionStats extends Stats return $this->_getNbByYear($sql); } + /** + * Return the orders amount by month for a year + * + * @param int $year Year to scan + * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month + * @return array Array with amount by month + */ + public function getAmountByMonth($year, $format = 0) + { + global $user; + + $sql = "SELECT date_format(c.date_valid,'%m') as dm, SUM(c.".$this->field.")"; + $sql .= " FROM ".$this->from; + if (empty($user->rights->societe->client->voir) && !$this->socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } + $sql .= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'"; + $sql .= " AND ".$this->where; + $sql .= " GROUP BY dm"; + $sql .= $this->db->order('dm', 'DESC'); + + $res = $this->_getAmountByMonth($year, $sql, $format); + return $res; + } + + /** + * Return the orders amount average by month for a year + * + * @param int $year year for stats + * @return array array with number by month + */ + public function getAverageByMonth($year) + { + global $user; + + $sql = "SELECT date_format(c.date_valid,'%m') as dm, AVG(c.".$this->field.")"; + $sql .= " FROM ".$this->from; + if (empty($user->rights->societe->client->voir) && !$this->socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } + $sql .= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'"; + $sql .= " AND ".$this->where; + $sql .= " GROUP BY dm"; + $sql .= $this->db->order('dm', 'DESC'); + + return $this->_getAverageByMonth($year, $sql); + } + /** * Return nb, total and average * From 8486919e3d91ab45036316102feb05489bb25ad8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Oct 2022 01:45:24 +0200 Subject: [PATCH 121/176] css --- htdocs/theme/eldy/global.inc.php | 1 + htdocs/theme/md/style.css.php | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 365e4a37219..9a3c800acb4 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -6615,6 +6615,7 @@ dl.dropdown { max-height: 264px; overflow: auto; border-radius: 2px; + z-index: 1; } .dropdown dd ul.selectedfieldsleft { right: auto; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 82948bf6583..8487f9d59e5 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -6374,6 +6374,7 @@ dl.dropdown { list-style:none; max-height: 264px; overflow: auto; + z-index: 1; } .dropdown dd ul.selectedfieldsleft { right: auto; From ce494354e24b79f0f455e4334d250de5b2822fd0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Oct 2022 01:54:50 +0200 Subject: [PATCH 122/176] NEW Finish removal of code using adodbtime --- htdocs/admin/system/constall.php | 2 -- htdocs/admin/system/dolibarr.php | 1 - htdocs/core/lib/functions.lib.php | 3 +++ htdocs/filefunc.inc.php | 7 ------- htdocs/install/inc.php | 10 +--------- htdocs/install/step1.php | 7 +------ 6 files changed, 5 insertions(+), 25 deletions(-) diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php index 4acb8e0ff59..dcf41aacf25 100644 --- a/htdocs/admin/system/constall.php +++ b/htdocs/admin/system/constall.php @@ -73,7 +73,6 @@ $configfileparameters = array( '?dolibarr_main_auth_ldap_admin_pass', '?dolibarr_main_auth_ldap_debug', 'separator', - '?dolibarr_lib_ADODB_PATH', '?dolibarr_lib_FPDF_PATH', '?dolibarr_lib_TCPDF_PATH', '?dolibarr_lib_FPDI_PATH', @@ -122,7 +121,6 @@ $configfilelib = array( 'dolibarr_main_auth_ldap_admin_pass', 'dolibarr_main_auth_ldap_debug', 'separator', - 'dolibarr_lib_ADODB_PATH', 'dolibarr_lib_TCPDF_PATH', 'dolibarr_lib_FPDI_PATH', 'dolibarr_lib_NUSOAP_PATH', diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 86c76ca1604..7fa1ef252cb 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -342,7 +342,6 @@ $configfileparameters = array( '?dolibarr_main_auth_ldap_admin_pass' => 'dolibarr_main_auth_ldap_admin_pass', '?dolibarr_main_auth_ldap_debug' => 'dolibarr_main_auth_ldap_debug', 'separator3' => '', - '?dolibarr_lib_ADODB_PATH' => 'dolibarr_lib_ADODB_PATH', '?dolibarr_lib_FPDF_PATH' => 'dolibarr_lib_FPDF_PATH', '?dolibarr_lib_TCPDF_PATH' => 'dolibarr_lib_TCPDF_PATH', '?dolibarr_lib_FPDI_PATH' => 'dolibarr_lib_FPDI_PATH', diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index de5a63df281..c7c699fc170 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2638,6 +2638,9 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $useadodb = getDolGlobalInt('MAIN_USE_LEGACY_ADODB_FOR_DATE', 0); //$useadodb = 1; // To switch to adodb + if (!empty($useadodb)) { + include_once DOL_DOCUMENT_ROOT.'/includes/adodbtime/adodb-time.inc.php'; + } // Analyze date $reg = array(); diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index ccd85e47810..54c7885e080 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -311,9 +311,6 @@ define('MAIN_DB_PREFIX', $dolibarr_main_db_prefix); * To use other version than embeded libraries, define here constant to path. Use '' to use include class path autodetect. */ // Path to root libraries -if (!defined('ADODB_PATH')) { - define('ADODB_PATH', (!isset($dolibarr_lib_ADODB_PATH)) ?DOL_DOCUMENT_ROOT.'/includes/adodbtime/' : (empty($dolibarr_lib_ADODB_PATH) ? '' : $dolibarr_lib_ADODB_PATH.'/')); -} if (!defined('TCPDF_PATH')) { define('TCPDF_PATH', (empty($dolibarr_lib_TCPDF_PATH)) ?DOL_DOCUMENT_ROOT.'/includes/tecnickcom/tcpdf/' : $dolibarr_lib_TCPDF_PATH.'/'); } @@ -354,10 +351,6 @@ if (!defined('DOL_DEFAULT_TTF_BOLD')) { * Include functions */ -if (!defined('ADODB_DATE_VERSION')) { - include_once ADODB_PATH.'adodb-time.inc.php'; -} - // If password is encoded, we decode it. Note: When page is called for install, $dolibarr_main_db_pass may not be defined yet. if ((!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) || !empty($dolibarr_main_db_encrypted_pass)) { if (!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) { diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index c717d55850e..e68f0d70a96 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -35,24 +35,16 @@ require_once '../filefunc.inc.php'; -// Define DOL_DOCUMENT_ROOT and ADODB_PATH used for install/upgrade process +// Define DOL_DOCUMENT_ROOT used for install/upgrade process if (!defined('DOL_DOCUMENT_ROOT')) { define('DOL_DOCUMENT_ROOT', '..'); } -if (!defined('ADODB_PATH')) { - $foundpath = DOL_DOCUMENT_ROOT.'/includes/adodbtime/'; - if (!is_dir($foundpath)) { - $foundpath = '/usr/share/php/adodb/'; - } - define('ADODB_PATH', $foundpath); -} require_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/conf.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -require_once ADODB_PATH.'adodb-time.inc.php'; $conf = new Conf(); diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 24b5dba4d01..7958012b0a1 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -825,7 +825,7 @@ function write_conf_file($conffile) global $dolibarr_main_distrib; global $db_host, $db_port, $db_name, $db_user, $db_pass, $db_type, $db_character_set, $db_collation; global $conffile, $conffiletoshow, $conffiletoshowshort; - global $force_dolibarr_lib_ADODB_PATH, $force_dolibarr_lib_NUSOAP_PATH; + global $force_dolibarr_lib_NUSOAP_PATH; global $force_dolibarr_lib_TCPDF_PATH, $force_dolibarr_lib_FPDI_PATH; global $force_dolibarr_lib_GEOIP_PATH; global $force_dolibarr_lib_ODTPHP_PATH, $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP; @@ -944,11 +944,6 @@ function write_conf_file($conffile) } fputs($fp, '$dolibarr_lib_TCPDI_PATH=\''.$force_dolibarr_lib_TCPDI_PATH.'\';'); fputs($fp, "\n"); - if (empty($force_dolibarr_lib_ADODB_PATH)) { - fputs($fp, '//'); $force_dolibarr_lib_ADODB_PATH = ''; - } - fputs($fp, '$dolibarr_lib_ADODB_PATH=\''.$force_dolibarr_lib_ADODB_PATH.'\';'); - fputs($fp, "\n"); if (empty($force_dolibarr_lib_GEOIP_PATH)) { fputs($fp, '//'); $force_dolibarr_lib_GEOIP_PATH = ''; } From 66cae76747352a29422c80fd9e6719b4c4461705 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Oct 2022 02:03:51 +0200 Subject: [PATCH 123/176] NEW Finish removal of code using adodbtime --- COPYRIGHT | 1 - build/debian/control | 1 - build/debian/copyright | 25 ------------------------- build/debian/dolibarr.postinst | 1 - build/debian/install.forced.php.install | 1 - build/debian/rules | 1 - build/rpm/dolibarr_fedora.spec | 4 +--- build/rpm/dolibarr_generic.spec | 4 +--- build/rpm/dolibarr_mandriva.spec | 1 - build/rpm/dolibarr_opensuse.spec | 1 - build/rpm/install.forced.php.fedora | 1 - build/rpm/install.forced.php.mandriva | 1 - build/rpm/install.forced.php.opensuse | 1 - 13 files changed, 2 insertions(+), 41 deletions(-) diff --git a/COPYRIGHT b/COPYRIGHT index 46e2f093900..d980219c420 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -23,7 +23,6 @@ Licence of dependencies of third-party components used by Dolibarr (all compatib Component Version License GPL Compatible Usage ------------------------------------------------------------------------------------- PHP libraries: -ADOdb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package) EvalMath 1.0 BSD Yes Safe math expressions evaluation Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert diff --git a/build/debian/control b/build/debian/control index 059325eecb9..b2890253b32 100755 --- a/build/debian/control +++ b/build/debian/control @@ -19,7 +19,6 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php-pear, php-mail-mime, # php-tcpdf, # libfpdf-tpl-php, php-fpdf, -# libphp-adodb, # libnusoap-php, # libphp-pclzip, # Required javascript libraries diff --git a/build/debian/copyright b/build/debian/copyright index 403763544a5..b99b8a65b5d 100644 --- a/build/debian/copyright +++ b/build/debian/copyright @@ -61,31 +61,6 @@ License: GPL-3+ ------------------------------------------------------------ -Files: htdocs/includes/adodbtime/* -Copyright: 2003-2005, John Lim - unknown, jackbbs -License: BSD-3-Clause - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - . - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - . - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - . - Neither the name of the John Lim nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. -Comment: - Those files are not shipped in the binary package since we use - the library as packaged in "libphp-adodb". - - ------------------------------------------------------------- - Files: htdocs/includes/ckeditor/* Copyright: 2003-2012 CKSource - Frederico Knabben License: GPL-2+ diff --git a/build/debian/dolibarr.postinst b/build/debian/dolibarr.postinst index 26a08a55826..6ba9123ede4 100644 --- a/build/debian/dolibarr.postinst +++ b/build/debian/dolibarr.postinst @@ -146,7 +146,6 @@ case "$1" in #else # File already exist. We add params not found. #echo Add new params to overwrite path to use shared libraries/fonts - #grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "" >> $config ##grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "" >> $config #grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "" >> $config #grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "" >> $config diff --git a/build/debian/install.forced.php.install b/build/debian/install.forced.php.install index 1d10699f1d4..801b1b372af 100644 --- a/build/debian/install.forced.php.install +++ b/build/debian/install.forced.php.install @@ -31,7 +31,6 @@ $force_install_distrib='debian'; // - not removed from package (see rm in rules file), // - declared into dependencies (see Depends in control file) //$force_dolibarr_lib_TCPDF_PATH=''; -//$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; //$force_dolibarr_lib_GEOIP_PATH=''; //$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; //$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; diff --git a/build/debian/rules b/build/debian/rules index dab5d84fd11..b63fcffde93 100755 --- a/build/debian/rules +++ b/build/debian/rules @@ -89,7 +89,6 @@ override_dh_install: rm -fr build/zip # clean from all PHP embedded libraries (we use package dependencies instead) -# rm -fr htdocs/includes/adodbtime # rm -fr htdocs/includes/geoip # rm -fr htdocs/includes/nusoap # rm -fr htdocs/includes/odtphp/zip/pclzip diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 1c6716408b7..c94863e8919 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -25,7 +25,7 @@ BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build Group: Applications/Productivity -Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysqli, php-adodb, php-nusoap, dejavu-sans-fonts +Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysqli, php-nusoap, dejavu-sans-fonts Requires: mysql-server, mysql #BuildRequires: desktop-file-utils @@ -104,7 +104,6 @@ cui hai bisogno ed essere facile da usare. %{__cp} -pr htdocs $RPM_BUILD_ROOT%{_datadir}/%{name} %{__cp} -pr scripts $RPM_BUILD_ROOT%{_datadir}/%{name} %{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/ckeditor/_source -%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/adodbtime %{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/nusoap %{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/fonts @@ -274,7 +273,6 @@ if [ -s $config ] && grep -q "File generated by" $config then # File already exist. We add params not found. echo Add new params to overwrite path to use shared libraries/fonts - grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "" >> $config grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "" >> $config #grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "" >> $config grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "" >> $config diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index a992c84f0f9..8e71713146e 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -46,7 +46,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} Group: Applications/Productivity -Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysqli, php-adodb, php-nusoap, dejavu-sans-fonts, php-mbstring, php-xml +Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysqli, php-nusoap, dejavu-sans-fonts, php-mbstring, php-xml Requires: mysql-server, mysql BuildRequires: desktop-file-utils %else @@ -169,7 +169,6 @@ cui hai bisogno ed essere facile da usare. %{__cp} -pr scripts $RPM_BUILD_ROOT%{_datadir}/%{name} %{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/ckeditor/_source %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} -%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/adodbtime %{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/nusoap %{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/fonts %else @@ -425,7 +424,6 @@ if [ -s $config ] && grep -q "File generated by" $config then # File already exist. We add params not found. echo Add new params to overwrite path to use shared libraries/fonts - grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "" >> $config grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "" >> $config #grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "" >> $config grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "" >> $config diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index a371e3ab02f..5c8a8e39aae 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -271,7 +271,6 @@ if [ -s $config ] && grep -q "File generated by" $config then # File already exist. We add params not found. echo Add new params to overwrite path to use shared libraries/fonts - grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "" >> $config grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "" >> $config #grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "" >> $config grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "" >> $config diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index c7113828632..ea79a50af58 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -281,7 +281,6 @@ if [ -s $config ] && grep -q "File generated by" $config then # File already exist. We add params not found. echo Add new params to overwrite path to use shared libraries/fonts - grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "" >> $config grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "" >> $config #grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "" >> $config grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "" >> $config diff --git a/build/rpm/install.forced.php.fedora b/build/rpm/install.forced.php.fedora index a8bc0d390c6..636514260cf 100644 --- a/build/rpm/install.forced.php.fedora +++ b/build/rpm/install.forced.php.fedora @@ -20,7 +20,6 @@ $force_install_lockinstall='444'; $force_install_distrib='rpmfedora'; // Value to overwrite path to use shared libraries/fonts instead of embedded one -$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; //$force_dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; //$force_dolibarr_lib_GEOIP_PATH=''; $force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; diff --git a/build/rpm/install.forced.php.mandriva b/build/rpm/install.forced.php.mandriva index a254eebbf7b..5471d146391 100644 --- a/build/rpm/install.forced.php.mandriva +++ b/build/rpm/install.forced.php.mandriva @@ -20,7 +20,6 @@ $force_install_lockinstall='444'; $force_install_distrib='rpmmandriva'; // Value to overwrite path to use shared libraries/fonts instead of embedded one -$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; //$force_dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; //$force_dolibarr_lib_GEOIP_PATH=''; $force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; diff --git a/build/rpm/install.forced.php.opensuse b/build/rpm/install.forced.php.opensuse index 24da4417121..ea50180caf4 100644 --- a/build/rpm/install.forced.php.opensuse +++ b/build/rpm/install.forced.php.opensuse @@ -20,7 +20,6 @@ $force_install_lockinstall='444'; $force_install_distrib='rpmopensuse'; // Value to overwrite path to use shared libraries/fonts instead of embedded one -//$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; //$force_dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; //$force_dolibarr_lib_GEOIP_PATH=''; //$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; From 003df66f6a8a14dfa90d33f6be49a43258aca995 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Oct 2022 02:32:43 +0200 Subject: [PATCH 124/176] Clean code --- htdocs/comm/action/card.php | 29 +++++++------------- htdocs/comm/action/document.php | 26 +++++++++++------- htdocs/comm/action/info.php | 25 +++++++++++------- htdocs/comm/propal/card.php | 4 +-- htdocs/comm/propal/contact.php | 2 +- htdocs/comm/propal/document.php | 2 +- htdocs/comm/propal/info.php | 2 +- htdocs/comm/propal/note.php | 2 +- htdocs/commande/contact.php | 2 +- htdocs/commande/document.php | 2 +- htdocs/commande/info.php | 2 +- htdocs/commande/note.php | 2 +- htdocs/compta/facture/contact.php | 2 +- htdocs/compta/facture/document.php | 2 +- htdocs/compta/facture/info.php | 2 +- htdocs/compta/facture/note.php | 2 +- htdocs/compta/facture/prelevement.php | 2 +- htdocs/contrat/agenda.php | 2 +- htdocs/contrat/contact.php | 2 +- htdocs/contrat/document.php | 2 +- htdocs/contrat/note.php | 2 +- htdocs/core/lib/functions.lib.php | 2 +- htdocs/expensereport/card.php | 38 --------------------------- htdocs/fourn/commande/contact.php | 2 +- htdocs/fourn/commande/dispatch.php | 2 +- htdocs/fourn/commande/document.php | 2 +- htdocs/fourn/commande/info.php | 2 +- htdocs/fourn/commande/note.php | 2 +- htdocs/fourn/facture/contact.php | 2 +- htdocs/fourn/facture/document.php | 2 +- htdocs/fourn/facture/info.php | 2 +- htdocs/fourn/facture/note.php | 2 +- htdocs/resource/element_resource.php | 26 +++++++++++------- 33 files changed, 87 insertions(+), 115 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 8b42e6df6e2..27d3c049c64 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -151,6 +151,8 @@ if ($user->socid && $socid) { $result = restrictedArea($user, 'societe', $socid); } +$usercancreate = $user->rights->agenda->allactions->create || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create); + /* * Actions @@ -2152,34 +2154,21 @@ if ($id > 0) { // Project if (isModEnabled('project')) { $langs->load("projects"); - //$morehtmlref.='
'.$langs->trans('Project') . ' '; - $morehtmlref .= $langs->trans('Project').' '; - if ($user->rights->agenda->allactions->create || - (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { + //$morehtmlref .= '
'; + if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - 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); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 9a4a4e6a869..f80476c2f9a 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -89,7 +89,8 @@ if ($user->socid && $socid) { $result = restrictedArea($user, 'societe', $socid); } -$permissiontoadd = $user->rights->agenda->myactions->read; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php +$usercancreate = $user->rights->agenda->allactions->create || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create); +$permissiontoadd = $usercancreate; /* @@ -162,17 +163,22 @@ if ($object->id > 0) { // Project if (isModEnabled('project')) { $langs->load("projects"); - //$morehtmlref.='
'.$langs->trans('Project') . ' '; - $morehtmlref .= $langs->trans('Project').': '; - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); - if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + //$morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - $morehtmlref .= ''; + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + } + } } } $morehtmlref .= '
'; diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index 807a8e6f412..e009c9fccf7 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -50,6 +50,8 @@ if ($user->socid && $socid) { $result = restrictedArea($user, 'societe', $socid); } +$usercancreate = $user->rights->agenda->allactions->create || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create); + /* * View @@ -89,17 +91,22 @@ $morehtmlref = '
'; // Project if (isModEnabled('project')) { $langs->load("projects"); - //$morehtmlref.='
'.$langs->trans('Project') . ' '; - $morehtmlref .= $langs->trans('Project').': '; - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); - if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + //$morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - $morehtmlref .= ''; + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + } + } } } $morehtmlref .= '
'; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 87906426b44..9180be4f99b 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2332,7 +2332,7 @@ if ($action == 'create') { print '
'; print '
'; - print ''; + print '
'; // Link for thirdparty discounts if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { @@ -2392,7 +2392,7 @@ if ($action == 'create') { // Date end proposal print ''; print ''; } // Payment terms if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { print ''; } // Module source @@ -2129,8 +2129,9 @@ if ($resql) { // Payment mode if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { - print ''; if (!$i) { $totalarray['nbfield']++; @@ -2139,8 +2140,9 @@ if ($resql) { // Payment terms if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { - print ''; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f7aa1990f13..daff55c7615 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5439,22 +5439,26 @@ class Form * @param string $deposit_percent < 0 : deposit_percent input makes no sense (for example, in list filters) * 0 : use default deposit percentage from entry * > 0 : force deposit percentage (for example, from company object) + * @param int $nooutput No print is done. String is returned. * @return void */ - public function form_conditions_reglement($page, $selected = '', $htmlname = 'cond_reglement_id', $addempty = 0, $type = '', $filtertype = -1, $deposit_percent = -1) + public function form_conditions_reglement($page, $selected = '', $htmlname = 'cond_reglement_id', $addempty = 0, $type = '', $filtertype = -1, $deposit_percent = -1, $nooutput = 0) { // phpcs:enable global $langs; + + $out = ''; + if ($htmlname != "none") { - print ''; - print ''; - print ''; + $out .= ''; + $out .= ''; + $out .= ''; if ($type) { - print ''; + $out .= ''; } - print $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent); - print ''; - print ''; + $out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent); + $out .= ''; + $out .= ''; } else { if ($selected) { $this->load_cache_conditions_paiements(); @@ -5465,15 +5469,21 @@ class Form $label = str_replace('__DEPOSIT_PERCENT__', $deposit_percent > 0 ? $deposit_percent : $this->cache_conditions_paiements[$selected]['deposit_percent'], $label); } - print $label; + $out .= $label; } else { $langs->load('errors'); - print $langs->trans('ErrorNotInDictionaryPaymentConditions'); + $out .= $langs->trans('ErrorNotInDictionaryPaymentConditions'); } } else { - print " "; + $out .= ' '; } } + + if (empty($nooutput)) { + print $out; + return ''; + } + return $out; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From a53a3fb9bf0d70f8892193780dbbc8f29e9e8df2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Oct 2022 10:26:46 +0200 Subject: [PATCH 141/176] Look and feel v17, search on multibox not too large --- htdocs/accountancy/bookkeeping/listbyaccount.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 6 ++++++ htdocs/theme/md/style.css.php | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index c4b27dce418..7ab6666d4c4 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -743,12 +743,12 @@ print ''; // Movement number if (!empty($arrayfields['t.piece_num']['checked'])) { - print ''; + print ''; } // Code journal if (!empty($arrayfields['t.code_journal']['checked'])) { print ''; } // Date document diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 9a3c800acb4..7b1983ec7a4 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1393,6 +1393,7 @@ select.flat.selectlimit { -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; + height: auto !important; } .tablelistofcalendars { @@ -6438,9 +6439,14 @@ ul.select2-results__options li { @media only screen and (min-width: 767px) { + /* CSS to have the dropdown boxes larger that the input search area */ .select2-container.select2-container--open .select2-dropdown.ui-dialog { min-width: 200px !important; } + .select2-container.select2-container--open .select2-dropdown--below { + min-width: 200px !important; + } + .select2-container--open .select2-dropdown--below { border-top: 1px solid var(--inputbordercolor); /* border-top: 1px solid #aaaaaa; */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8487f9d59e5..1a625052cb2 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1512,6 +1512,7 @@ select.flat.selectlimit { -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; + height: auto !important; } .tablelistofcalendars { @@ -6204,9 +6205,14 @@ ul.select2-results__options li { @media only screen and (min-width: 767px) { + /* CSS to have the dropdown boxes larger that the input search area */ .select2-container.select2-container--open .select2-dropdown.ui-dialog { min-width: 200px !important; } + .select2-container.select2-container--open .select2-dropdown--below { + min-width: 200px !important; + } + .select2-container--open .select2-dropdown--below { border-top: 1px solid var(--inputbordercolor); /* border-top: 1px solid #aaaaaa; */ From 774f57910f50942b0f6b563f819aba04cc4dc12e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Oct 2022 10:56:25 +0200 Subject: [PATCH 142/176] css --- htdocs/contact/card.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index fbe8b4d0c04..8e9c6f2a321 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1473,39 +1473,38 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Categories if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { print ''; - print ''; } if (!empty($object->socid)) { print ''; - print ''; } // Other attributes - $cols = 3; $parameters = array('socid'=>$socid); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; $object->load_ref_elements(); if (isModEnabled("propal")) { - print ''; } if (isModEnabled('commande') || isModEnabled("expedition")) { - print ''; } if (isModEnabled('facture')) { - print ''; } - print ''; // Column with checkbox diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 7a02d0b4564..b90a8a2c573 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -503,7 +503,7 @@ if ($result) { // Suggested accounting account print ''; print ''; // Column with checkbox diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 7b1983ec7a4..05f00488123 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -6441,10 +6441,10 @@ ul.select2-results__options li { { /* CSS to have the dropdown boxes larger that the input search area */ .select2-container.select2-container--open .select2-dropdown.ui-dialog { - min-width: 200px !important; + min-width: 220px !important; } .select2-container.select2-container--open .select2-dropdown--below { - min-width: 200px !important; + min-width: 220px !important; } .select2-container--open .select2-dropdown--below { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 1a625052cb2..df1bd11dc4f 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -6207,10 +6207,10 @@ ul.select2-results__options li { { /* CSS to have the dropdown boxes larger that the input search area */ .select2-container.select2-container--open .select2-dropdown.ui-dialog { - min-width: 200px !important; + min-width: 220px !important; } .select2-container.select2-container--open .select2-dropdown--below { - min-width: 200px !important; + min-width: 220px !important; } .select2-container--open .select2-dropdown--below { From 77af5f3cc8e7ee7174aaee6ed5ccd783fccc1f0c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Oct 2022 12:24:02 +0200 Subject: [PATCH 144/176] Fix old value of lines were not correctly loaded --- htdocs/contrat/card.php | 2 ++ htdocs/contrat/class/contrat.class.php | 2 +- htdocs/core/lib/functions.lib.php | 10 +++++----- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 802305b6306..b691524ad92 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -694,6 +694,8 @@ if (empty($reshook)) { $error++; } $objectline->fetch_optionals(); + + $objectline->oldcopy = dol_clone($objectline); } $db->begin(); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 5c72bf51c69..7d43da46b37 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -3392,7 +3392,7 @@ class ContratLigne extends CommonObjectLine } } - // If we change a planned date (start or end), sync dates for all services + // If we change a planned date (start or end) of one contract line, sync dates for all other services too if (!$error && !empty($conf->global->CONTRACT_SYNC_PLANNED_DATE_OF_SERVICES)) { dol_syslog(get_class($this)."::update CONTRACT_SYNC_PLANNED_DATE_OF_SERVICES is on so we update date for all lines", LOG_DEBUG); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0bf63ee9b0b..160dd0b7575 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1160,26 +1160,26 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0) /** * Create a clone of instance of object (new instance with same value for properties) - * With native = 0: Property that are reference are also new object (full isolation clone). This means $this->db of new object is not valid. + * With native = 0: Property that are reference are also new object (full isolation clone). This means $this->db of new object may not be valid. * With native = 1: Use PHP clone. Property that are reference are same pointer. This means $this->db of new object is still valid but point to same this->db than original object. * * @param object $object Object to clone - * @param int $native 0=Full isolation method, 1=Native PHP method + * @param int $native 0=Full isolation method, 1=Native PHP method, 2=Full isolation method+destroy non scalar or array properties (recommended) * @return object Clone object * @see https://php.net/manual/language.oop5.cloning.php */ function dol_clone($object, $native = 0) { - if (empty($native)) { + if ($native == 0) { $tmpsavdb = null; if (isset($object->db) && isset($object->db->db) && is_object($object->db->db) && get_class($object->db->db) == 'PgSql\Connection') { $tmpsavdb = $object->db; - unset($object->db); // Such property can not be serialized when PgSql/Connection + unset($object->db); // Such property can not be serialized with pgsl (when object->db->db = 'PgSql\Connection') } $myclone = unserialize(serialize($object)); // serialize then unserialize is hack to be sure to have a new object for all fields - if ($tmpsavdb) { + if (!empty($tmpsavdb)) { $object->db = $tmpsavdb; } } else { From 6530f3a1cd12d64d5703ad74617b72274549ed2a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Oct 2022 12:28:11 +0200 Subject: [PATCH 145/176] CSS --- htdocs/accountancy/bookkeeping/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 1520897c4f7..e9836c4efbf 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -985,7 +985,7 @@ if (!empty($arrayfields['t.piece_num']['checked'])) { // Code journal if (!empty($arrayfields['t.code_journal']['checked'])) { print ''; } // Date document From cd9984cd3e3cc380fdb69a935b397f1f12d6b20f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Oct 2022 19:19:41 +0200 Subject: [PATCH 146/176] Update card.php --- htdocs/product/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index e8edb5d1d8b..7c51da5d02a 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1866,10 +1866,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
'; - print '
'; + print ''; if ($action != 'editecheance' && $usercancreate && $caneditfield) { diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index f1dff7991ef..835dcc70fd0 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -144,7 +144,7 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 569a9d2494e..799539d97b1 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -142,7 +142,7 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php index ed15c4d7615..26a65f9a66e 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -89,7 +89,7 @@ $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 272ef300db2..64fe59edea5 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -114,7 +114,7 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 7637d1e62ba..aa61426e435 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -138,7 +138,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 1cda0476355..ef1e1ce1697 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -135,7 +135,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index 9b091c47397..e319cb95d36 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -89,7 +89,7 @@ $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 7ab5fa96310..946902e1a11 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -108,7 +108,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 0bc058a05d6..7b7dd41ef7e 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -143,7 +143,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index a38fd572e09..c4b11cea186 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -147,7 +147,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index 7cbfdb50a14..340c40afa4a 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -103,7 +103,7 @@ $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index 3066b5adfc6..f6c81bbf800 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -125,7 +125,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index d7a674867d0..172ec0c1120 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -363,7 +363,7 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index 5b649c5b850..9ddab3b6487 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -176,7 +176,7 @@ if ($id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 7f1187853c8..3c3bb00baeb 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -160,7 +160,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 55fb5c690a1..477d8818c4b 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -147,7 +147,7 @@ if ($object->id) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index 94aa8369b3f..1038fe83de3 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -116,7 +116,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c7c699fc170..4e7acd5fc52 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8155,7 +8155,7 @@ function print_date_range($date_start, $date_end, $format = '', $outputlangs = ' * * @param int $date_start Start date * @param int $date_end End date - * @param string $format Output format + * @param string $format Output date format ('day', 'dayhour', ...) * @param Translate $outputlangs Output language * @param integer $withparenthesis 1=Add parenthesis, 0=no parenthesis * @return string String diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index bb4f41861ec..4bb9bf378ee 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1694,44 +1694,6 @@ if ($action == 'create') { $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; - /* - // Ref customer - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); - // Thirdparty - $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); - // Project - if (isModEnabled('project')) - { - $langs->load("projects"); - $morehtmlref.='
'.$langs->trans('Project') . ' '; - if ($user->rights->commande->creer) - { - if ($action != 'classify') - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - 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.=''; - $morehtmlref.=$proj->ref; - $morehtmlref.=''; - } else { - $morehtmlref.=''; - } - } - }*/ $morehtmlref .= '
'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index dd945ef3d39..3a8a5a5c49a 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -143,7 +143,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify' && $caneditproject) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index b7fd424054c..1f63c5a594b 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -549,7 +549,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify' && $caneditproject) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index a598dd4b83d..b7d8ba118a0 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -135,7 +135,7 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify' && $caneditproject) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index df9f52abae1..4129947282f 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -148,7 +148,7 @@ $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify' && $caneditproject) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 53cb80f9e55..27e74006d85 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -117,7 +117,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify' && $caneditproject) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index 5242fce001c..1317fe2f0a7 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -144,7 +144,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index cdc045b60fc..45189f5395e 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -120,7 +120,7 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php index b451d6fa63d..0dc58debba3 100644 --- a/htdocs/fourn/facture/info.php +++ b/htdocs/fourn/facture/info.php @@ -86,7 +86,7 @@ if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0 if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index 20c8f6d977c..0136ee1d11d 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -116,7 +116,7 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index a5ca456310e..7e94465219f 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -350,21 +350,29 @@ if (!$ret) { // Thirdparty //$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project + $savobject = $object; + $object = $act; if (isModEnabled('project')) { $langs->load("projects"); - //$morehtmlref.='
'.$langs->trans('Project') . ' '; - $morehtmlref .= $langs->trans('Project').': '; - if (!empty($act->fk_project)) { - $proj = new Project($db); - $proj->fetch($act->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); - if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + //$morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - $morehtmlref .= ''; + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + } + } } } + $object = $savobject; $morehtmlref .= ''; dol_banner_tab($act, 'element_id', $linkback, ($user->socid ? 0 : 1), 'id', 'ref', $morehtmlref, '&element='.$element, 0, '', ''); From cae2f26c0500b6e1726cc52ab86768fb279ab41d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Oct 2022 02:38:44 +0200 Subject: [PATCH 125/176] Responsive --- htdocs/user/group/card.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index c17893e7eb4..a9a16826ee3 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -418,6 +418,7 @@ if ($action == 'create') { print '
'."\n"; print ''; print ''; + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print '
'; print $langs->trans('DateEndPropal'); print '
'."\n"; print ''."\n"; print ''."\n"; - print '
'.$langs->trans("NonAffectedUsers").''; @@ -426,8 +427,10 @@ if ($action == 'create') { print ''; print ''; print '
'."\n"; - print '
'; + print '
'; + print ''; + print ''."\n"; + //print '
'; } /* From 67c38dc0039ae8f5ddf95563d09a2cc1bbb60434 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Oct 2022 02:46:22 +0200 Subject: [PATCH 126/176] Debug v17 --- htdocs/hrm/admin/job_extrafields.php | 2 +- htdocs/hrm/lib/hrm.lib.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/hrm/admin/job_extrafields.php b/htdocs/hrm/admin/job_extrafields.php index 8dff50f4b6f..6ac0773c00f 100644 --- a/htdocs/hrm/admin/job_extrafields.php +++ b/htdocs/hrm/admin/job_extrafields.php @@ -67,7 +67,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; * View */ -$textobject = $langs->transnoentitiesnoconv("Job"); +$textobject = $langs->transnoentitiesnoconv("JobPosition"); $help_url = ''; $page_name = "HrmSetup"; diff --git a/htdocs/hrm/lib/hrm.lib.php b/htdocs/hrm/lib/hrm.lib.php index 2fef293784d..88a851f0137 100644 --- a/htdocs/hrm/lib/hrm.lib.php +++ b/htdocs/hrm/lib/hrm.lib.php @@ -54,13 +54,13 @@ function hrmAdminPrepareHead() $head[$h][2] = 'establishments'; $h++; - $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/evaluation_extrafields.php'; - $head[$h][1] = $langs->trans("EvaluationsExtraFields"); - $nbExtrafields = $extrafields->attributes['hrm_evaluation']['count']; + $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/skill_extrafields.php'; + $head[$h][1] = $langs->trans("SkillsExtraFields"); + $nbExtrafields = $extrafields->attributes['hrm_skill']['count']; if ($nbExtrafields > 0) { $head[$h][1] .= ''.$nbExtrafields.''; } - $head[$h][2] = 'evaluationsAttributes'; + $head[$h][2] = 'skillsAttributes'; $h++; $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/job_extrafields.php'; @@ -72,13 +72,13 @@ function hrmAdminPrepareHead() $head[$h][2] = 'jobsAttributes'; $h++; - $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/skill_extrafields.php'; - $head[$h][1] = $langs->trans("SkillsExtraFields"); - $nbExtrafields = $extrafields->attributes['hrm_skill']['count']; + $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/evaluation_extrafields.php'; + $head[$h][1] = $langs->trans("EvaluationsExtraFields"); + $nbExtrafields = $extrafields->attributes['hrm_evaluation']['count']; if ($nbExtrafields > 0) { $head[$h][1] .= ''.$nbExtrafields.''; } - $head[$h][2] = 'skillsAttributes'; + $head[$h][2] = 'evaluationsAttributes'; $h++; // Show more tabs from modules From 87f82c1064ceedf3f5f1fe2f615b9ee573f2034d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Oct 2022 03:12:03 +0200 Subject: [PATCH 127/176] Fix format date --- htdocs/core/lib/functions.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4e7acd5fc52..0bf63ee9b0b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2670,8 +2670,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $dtts->setTimestamp($time); $dtts->setTimezone($tzo); $newformat = str_replace( - array('%Y', '%y', '%m', '%d', '%H', '%M', '%S', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), - array('Y', 'y', 'm', 'd', 'H', 'i', 's', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), + array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), + array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), $format); $ret = $dtts->format($newformat); $ret = str_replace( @@ -2696,8 +2696,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $dtts->setTimestamp($timetouse); $dtts->setTimezone($tzo); $newformat = str_replace( - array('%Y', '%y', '%m', '%d', '%H', '%M', '%S', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), - array('Y', 'y', 'm', 'd', 'H', 'i', 's', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), + array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), + array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), $format); $ret = $dtts->format($newformat); $ret = str_replace( From eabafde91fac69002ee6c3a643a5ff2a9b6ada8e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Oct 2022 13:41:25 +0200 Subject: [PATCH 128/176] FIX Do not generate the contract PDF if not default template defined --- htdocs/contrat/class/contrat.class.php | 19 +++++++++++-------- .../class/fournisseur.commande.class.php | 14 ++++++++------ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 73d907a374e..5c72bf51c69 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2441,18 +2441,15 @@ class Contrat extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information - * @return int 0 if KO, 1 if OK + * @param null|array $moreparams Array to provide more information + * @return int < 0 if KO, 0 = no doc generated, > 0 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { global $conf, $langs; - $langs->load("contracts"); - $outputlangs->load("products"); - if (!dol_strlen($modele)) { - $modele = 'strato'; + $modele = ''; // No doc template/generation by default if (!empty($this->model_pdf)) { $modele = $this->model_pdf; @@ -2463,9 +2460,15 @@ class Contrat extends CommonObject } } - $modelpath = "core/modules/contract/doc/"; + if (empty($modele)) { + return 0; + } else { + $langs->load("contracts"); + $outputlangs->load("products"); - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + $modelpath = "core/modules/contract/doc/"; + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + } } /** diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9e59dbceda6..1faa0b0c49c 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3187,26 +3187,28 @@ class CommandeFournisseur extends CommonOrder * @param int $hidedesc Hide description * @param int $hideref Hide ref * @param null|array $moreparams Array to provide more information - * @return int 0 if KO, 1 if OK + * @return int < 0 if KO, 0 = no doc generated, > 0 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { global $conf, $langs; - $langs->load("suppliers"); - $outputlangs->load("products"); - if (!dol_strlen($modele)) { - $modele = ''; - if ($this->model_pdf) { + $modele = ''; // No doc template/generation by default + + if (!empty($this->model_pdf)) { $modele = $this->model_pdf; } elseif (!empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF)) { $modele = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF; } } + if (empty($modele)) { return 0; } else { + $langs->load("suppliers"); + $outputlangs->load("products"); + $modelpath = "core/modules/supplier_order/doc/"; return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } From 3cd16d80f4e54e7f445f13d81e770f95b68ef5c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Oct 2022 14:43:22 +0200 Subject: [PATCH 129/176] NEW Can edit label of an emailing even once sent --- htdocs/comm/mailing/card.php | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 2372f24a929..915a7a7ce9b 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -729,8 +729,11 @@ if ($action == 'create') { print dol_get_fiche_head(); print ''; + print ''; + print ''; + print ''; // Other attributes @@ -742,7 +745,7 @@ if ($action == 'create') { } print '
'.$langs->trans("MailTitle").'
'.$langs->trans("MailFrom").'
'.$langs->trans("MailErrorsTo").'
'; - print '

'; + print '

'; print ''; print ''; @@ -887,16 +890,16 @@ if ($action == 'create') { // Description print ''; // From print ''; From 022f0db1e87b5edef7ade1623bd415b95d45d401 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 23 Oct 2022 11:06:21 +0200 Subject: [PATCH 131/176] Fix scrutinizer partnership_type.class.php 9 issues --- .../class/partnership_type.class.php | 132 ------------------ 1 file changed, 132 deletions(-) diff --git a/htdocs/partnership/class/partnership_type.class.php b/htdocs/partnership/class/partnership_type.class.php index 0074d2e80ee..0c42dae87d2 100644 --- a/htdocs/partnership/class/partnership_type.class.php +++ b/htdocs/partnership/class/partnership_type.class.php @@ -129,9 +129,6 @@ class PartnershipType extends CommonObject public function create(User $user, $notrigger = false) { $resultcreate = $this->createCommon($user, $notrigger); - - //$resultvalidate = $this->validate($user, $notrigger); - return $resultcreate; } @@ -145,9 +142,6 @@ class PartnershipType extends CommonObject public function fetch($id, $ref = null) { $result = $this->fetchCommon($id, $ref); - if ($result > 0 && !empty($this->table_element_line)) { - $this->fetchLines(); - } return $result; } @@ -253,79 +247,6 @@ class PartnershipType extends CommonObject public function delete(User $user, $notrigger = false) { return $this->deleteCommon($user, $notrigger); - //return $this->deleteCommon($user, $notrigger, 1); - } - - /** - * Set draft status - * - * @param User $user Object user that modify - * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers - * @return int <0 if KO, >0 if OK - */ - public function setDraft($user, $notrigger = 0) - { - // Protection - if ($this->status <= self::STATUS_DRAFT) { - return 0; - } - - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->mymodule_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - - return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'PARTNERSHIPTYPE_UNVALIDATE'); - } - - /** - * Set cancel status - * - * @param User $user Object user that modify - * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers - * @return int <0 if KO, 0=Nothing done, >0 if OK - */ - public function cancel($user, $notrigger = 0) - { - // Protection - if ($this->status != self::STATUS_VALIDATED) { - return 0; - } - - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->mymodule_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - - return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'PARTNERSHIPTYPE_CANCEL'); - } - - /** - * Set back to validated status - * - * @param User $user Object user that modify - * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers - * @return int <0 if KO, 0=Nothing done, >0 if OK - */ - public function reopen($user, $notrigger = 0) - { - // Protection - if ($this->status != self::STATUS_CANCELED) { - return 0; - } - - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->mymodule_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - - return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'PARTNERSHIPTYPE_REOPEN'); } /** @@ -445,59 +366,6 @@ class PartnershipType extends CommonObject return $result; } - /** - * Return the label of the status - * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto - * @return string Label of status - */ - public function getLabelStatus($mode = 0) - { - return $this->LibStatut($this->status, $mode); - } - - /** - * Return the label of the status - * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto - * @return string Label of status - */ - public function getLibStatut($mode = 0) - { - return $this->LibStatut($this->status, $mode); - } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return the status - * - * @param int $status Id status - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto - * @return string Label of status - */ - public function LibStatut($status, $mode = 0) - { - // phpcs:enable - if (empty($this->labelStatus) || empty($this->labelStatusShort)) { - global $langs; - //$langs->load("mymodule@mymodule"); - $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); - $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled'); - $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled'); - $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); - $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled'); - $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled'); - } - - $statusType = 'status'.$status; - //if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; - if ($status == self::STATUS_CANCELED) { - $statusType = 'status6'; - } - - return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); - } - /** * Load the info information in the object * From cb2f9407188c7ae9b0731d97cd3c1aaec432d039 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 23 Oct 2022 12:20:11 +0200 Subject: [PATCH 132/176] Fix SQL error on install llx_establishment --- htdocs/install/mysql/tables/llx_establishment.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_establishment.sql b/htdocs/install/mysql/tables/llx_establishment.sql index 1b1f38074ad..a3542f6d9d6 100644 --- a/htdocs/install/mysql/tables/llx_establishment.sql +++ b/htdocs/install/mysql/tables/llx_establishment.sql @@ -22,7 +22,6 @@ CREATE TABLE llx_establishment ( rowid integer NOT NULL auto_increment PRIMARY KEY, entity integer NOT NULL DEFAULT 1, - label varchar(255), ref varchar(30), label varchar(255) NOT NULL, name varchar(128), From b6d0f9b997880b2a407583ff0f01e4cfea04f2ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Oct 2022 17:14:23 +0200 Subject: [PATCH 133/176] NEW Can copy/paste images into emails sent. --- htdocs/admin/mails.php | 10 +- htdocs/core/actions_sendmails.inc.php | 6 +- htdocs/core/class/CMailFile.class.php | 155 +++++++++++++++++++--- htdocs/core/class/html.formmail.class.php | 2 +- htdocs/core/class/smtps.class.php | 23 ++-- 5 files changed, 159 insertions(+), 37 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 1a25af49789..dfa0bccb06b 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -34,14 +34,15 @@ $langs->loadLangs(array("companies", "products", "admin", "mails", "other", "err $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09'); +$trackid = GETPOST('trackid'); + if (!$user->admin) { accessforbidden(); } $usersignature = $user->signature; -// For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html. - -if ($action == 'test' || $action == 'send') { +// For action = test or send, we ensure that content is not html, even for signature, because for this we want a test with NO html. +if ($action == 'test' || ($action == 'send' && $trackid = 'test')) { $usersignature = dol_string_nohtmltag($usersignature, 2); } @@ -130,7 +131,7 @@ $actiontypecode = ''; // Not an event for agenda $triggersendname = ''; // Disable triggers $paramname = 'id'; $mode = 'emailfortest'; -$trackid = (($action == 'testhtml') ? "testhtml" : "test"); +$trackid = ($action == 'send' ? GETPOST('trackid', 'aZ09') : $action); $sendcontext = ''; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; @@ -143,7 +144,6 @@ if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') { - /* * View */ diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 3749b403469..772d2b7ed5d 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -108,6 +108,10 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO $trackid = GETPOST('trackid', 'aZ09'); } + // Set tmp user directory (used to convert images embedded as img src=data:image) + $vardir = $conf->user->dir_output."/".$user->id; + $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path + $subject = ''; //$actionmsg = ''; $actionmsg2 = ''; @@ -359,7 +363,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO if (empty($sendcontext)) { $sendcontext = 'standard'; } - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1, '', '', $trackid, '', $sendcontext); + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1, '', '', $trackid, '', $sendcontext, '', $upload_dir_tmp); if (!empty($mailfile->error) || !empty($mailfile->errors)) { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index b3ff0aae930..ffd1d6e8e5d 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -120,6 +120,10 @@ class CMailFile * @var array filenames list (List of attached file name in message) */ public $mimefilename_list = array(); + /** + * @var array filenames cid + */ + public $cid_list = array(); // Image public $html; @@ -159,8 +163,9 @@ class CMailFile * @param string $moreinheader More in header. $moreinheader must contains the "\r\n" (TODO not supported for other MAIL_SEND_MODE different than 'mail' and 'smtps' for the moment) * @param string $sendcontext 'standard', 'emailing', ... (used to define which sending mode and parameters to use) * @param string $replyto Reply-to email (will be set to same value than From by default if not provided) + * @param string $upload_dir_tmp Temporary directory (used to convert images embedded as img src=data:image) */ - public function __construct($subject, $to, $from, $msg, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = 0, $errors_to = '', $css = '', $trackid = '', $moreinheader = '', $sendcontext = 'standard', $replyto = '') + public function __construct($subject, $to, $from, $msg, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = 0, $errors_to = '', $css = '', $trackid = '', $moreinheader = '', $sendcontext = 'standard', $replyto = '', $upload_dir_tmp = '') { global $conf, $dolibarr_main_data_root, $user; @@ -171,6 +176,8 @@ class CMailFile } } + $cid_list = array(); + $this->sendcontext = $sendcontext; // Define this->sendmode ('mail', 'smtps', 'siwftmailer', ...) according to $sendcontext ('standard', 'emailing', 'ticket') @@ -248,26 +255,41 @@ class CMailFile $findimg = 0; if (!empty($conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS)) { + // Search into the body for ]*>/", " ", $strContent); - $strContentAltText = html_entity_decode(strip_tags($strContentAltText)); + // TODO We could replace with [Filename.ext] like Gmail do. + $strContentAltText = html_entity_decode(strip_tags($strContentAltText)); // Remove any HTML tags $strContentAltText = trim(wordwrap($strContentAltText, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA) ? "\r\n" : "\n")); // Check if html header already in message, if not complete the message @@ -1447,9 +1470,10 @@ class CMailFile * @param array $filename_list Tableau * @param array $mimetype_list Tableau * @param array $mimefilename_list Tableau - * @return string Chaine fichiers encodes + * @param array $cidlist Array of CID if file must be completed with CID code + * @return string String with files encoded */ - public function write_files($filename_list, $mimetype_list, $mimefilename_list) + private function write_files($filename_list, $mimetype_list, $mimefilename_list, $cidlist) { // phpcs:enable $out = ''; @@ -1472,6 +1496,10 @@ class CMailFile $out .= "Content-Type: ".$mimetype_list[$i]."; name=\"".$filename_list[$i]."\"".$this->eol; $out .= "Content-Transfer-Encoding: base64".$this->eol; $out .= "Content-Description: ".$filename_list[$i].$this->eol; + if (!empty($cidlist) && is_array($cidlist) && $cidlist[$i]) { + $out .= "X-Attachment-Id: ".$cidlist[$i].$this->eol; + $out .= "Content-ID: <".$cidlist[$i].'>'.$this->eol; + } $out .= $this->eol; $out .= $encoded; $out .= $this->eol; @@ -1628,41 +1656,46 @@ class CMailFile /** * Seearch images into html message and init array this->images_encoded if found * - * @param string $images_dir Location of physical images files + * @param string $images_dir Location of physical images files. For example $dolibarr_main_data_root.'/medias' * @return int >0 if OK, <0 if KO */ - public function findHtmlImages($images_dir) + private function findHtmlImages($images_dir) { - // Build the list of image extensions + // Build the array of image extensions $extensions = array_keys($this->image_types); + // We search (into mail body this->html), if we find some strings like "... file=xxx.img" + // For example when: + // $matches = array(); preg_match_all('/(?:"|\')([^"\']+\.('.implode('|', $extensions).'))(?:"|\')/Ui', $this->html, $matches); // If "xxx.ext" or 'xxx.ext' found if (!empty($matches)) { $i = 0; + // We are interested in $matches[1] only (the second set of parenthesis into regex) foreach ($matches[1] as $full) { + $regs = array(); if (preg_match('/file=([A-Za-z0-9_\-\/]+[\.]?[A-Za-z0-9]+)?$/i', $full, $regs)) { // If xxx is 'file=aaa' $img = $regs[1]; if (file_exists($images_dir.'/'.$img)) { // Image path in src $src = preg_quote($full, '/'); - // Image full path $this->html_images[$i]["fullpath"] = $images_dir.'/'.$img; - // Image name $this->html_images[$i]["name"] = $img; - // Content type - if (preg_match('/^.+\.(\w{3,4})$/', $img, $reg)) { - $ext = strtolower($reg[1]); + $regext = array(); + if (preg_match('/^.+\.(\w{3,4})$/', $img, $regext)) { + $ext = strtolower($regext[1]); $this->html_images[$i]["content_type"] = $this->image_types[$ext]; } - // cid $this->html_images[$i]["cid"] = dol_hash(uniqid(time()), 3); // Force md5 hash (does not contains special chars) + // type + $this->html_images[$i]["type"] = 'cidfromurl'; + $this->html = preg_replace("/src=\"$src\"|src='$src'/i", "src=\"cid:".$this->html_images[$i]["cid"]."\"", $this->html); } $i++; @@ -1682,6 +1715,7 @@ class CMailFile // Read image file if ($image = file_get_contents($fullpath)) { // On garde que le nom de l'image + $regs = array(); preg_match('/([A-Za-z0-9_-]+[\.]?[A-Za-z0-9]+)?$/i', $img["name"], $regs); $imgName = $regs[1]; @@ -1706,6 +1740,85 @@ class CMailFile } } + /** + * Seearch images with data:image format into html message + * + * @param string $images_dir Location of where to store physicaly images files. For example $dolibarr_main_data_root.'/medias' + * @return int >0 if OK, <0 if KO + */ + private function findHtmlImagesIsSrcData($images_dir) + { + global $conf; + + // Build the array of image extensions + $extensions = array_keys($this->image_types); + + if ($images_dir && !dol_is_dir($images_dir)) { + dol_mkdir($images_dir, DOL_DATA_ROOT); + } + + // Uncomment this for debug + /* + global $dolibarr_main_data_root; + $outputfile = $dolibarr_main_data_root."/dolibarr_mail.log"; + $fp = fopen($outputfile, "w"); + fwrite($fp, $this->html); + fclose($fp); + */ + + // We search (into mail body this->html), if we find some strings like "... file=xxx.img" + // For example when: + // + $matches = array(); + preg_match_all('/src="data:image\/('.implode('|', $extensions).');base64,([^"]+)"/Ui', $this->html, $matches); // If "xxx.ext" or 'xxx.ext' found + + if (!empty($matches)) { + if (empty($images_dir)) { + // No temp directory provided, so we are not able to support convertion of data:image into physical images. + $this->error = 'NoTempDirProvidedInCMailConstructorSoCantConvertDataImgOnDisk'; + return -1; + } + + $i = 0; + foreach ($matches[1] as $key => $ext) { + // We save the image to send in disk + $filecontent = $matches[2][$key]; + $cid = dol_hash(uniqid(time()), 3); + $destfiletmp = $images_dir.'/'.$cid.'.'.$ext; + + $fhandle = @fopen($destfiletmp, 'w'); + if ($fhandle) { + $nbofbyteswrote = fwrite($fhandle, base64_decode($filecontent)); + fclose($fhandle); + @chmod($destfiletmp, octdec($conf->global->MAIN_UMASK)); + } else { + $this->errors[] = "Failed to open file '".$destfiletmp."' for write"; + return -1; + } + + if (file_exists($destfiletmp)) { + // Image full path + $this->html_images[$i]["fullpath"] = $destfiletmp; + // Image name + $this->html_images[$i]["name"] = basename($destfiletmp); + // Content type + $this->html_images[$i]["content_type"] = $this->image_types[strtolower($ext)]; + // cid + $this->html_images[$i]["cid"] = $cid; + // type + $this->html_images[$i]["type"] = 'cidfromdata'; + + $this->html = preg_replace('/src="data:image\/'.$ext.';base64,'.preg_quote($filecontent, '/').'"/', 'src="cid:'.$this->html_images[$i]["cid"].'"', $this->html); + } + $i++; + } + + return 1; + } else { + return 0; + } + } + /** * Return a formatted address string for SMTP protocol * diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 16302dc3c1a..41cf2482f9a 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1193,7 +1193,7 @@ class FormMail extends Form $out .= "\n"; } else { $out = '\n"; } return $out; diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 06ada5c4911..92b835caf7f 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1577,11 +1577,14 @@ class SMTPs // loop through all attachments foreach ($_content as $_file => $_data) { $content .= "--".$this->_getBoundary('mixed')."\r\n" - . 'Content-Disposition: attachment; filename="'.$_data['fileName'].'"'."\r\n" - . 'Content-Type: '.$_data['mimeType'].'; name="'.$_data['fileName'].'"'."\r\n" - . 'Content-Transfer-Encoding: base64'."\r\n" - . 'Content-Description: '.$_data['fileName']."\r\n"; - + . 'Content-Disposition: attachment; filename="'.$_data['fileName'].'"'."\r\n" + . 'Content-Type: '.$_data['mimeType'].'; name="'.$_data['fileName'].'"'."\r\n" + . 'Content-Transfer-Encoding: base64'."\r\n" + . 'Content-Description: '.$_data['fileName']."\r\n"; + if (!empty($_data['cid'])) { + $content .= "X-Attachment-Id: ".$_data['cid']."\r\n"; + $content .= "Content-ID: <".$_data['cid'].">\r\n"; + } if ($this->getMD5flag()) { $content .= 'Content-MD5: '.$_data['md5']."\r\n"; } @@ -1595,9 +1598,9 @@ class SMTPs $content .= "--".$this->_getBoundary('related')."\r\n"; // always related for an inline image $content .= 'Content-Type: '.$_data['mimeType'].'; name="'.$_data['imageName'].'"'."\r\n" - . 'Content-Transfer-Encoding: base64'."\r\n" - . 'Content-Disposition: inline; filename="'.$_data['imageName'].'"'."\r\n" - . 'Content-ID: <'.$_data['cid'].'> '."\r\n"; + . 'Content-Transfer-Encoding: base64'."\r\n" + . 'Content-Disposition: inline; filename="'.$_data['imageName'].'"'."\r\n" + . 'Content-ID: <'.$_data['cid'].'> '."\r\n"; if ($this->getMD5flag()) { $content .= 'Content-MD5: '.$_data['md5']."\r\n"; @@ -1664,9 +1667,10 @@ class SMTPs * @param string $strContent File data to attach to message * @param string $strFileName File Name to give to attachment * @param string $strMimeType File Mime Type of attachment + * @param string $strCid File Cid of attachment (if defined, to be shown inline) * @return void */ - public function setAttachment($strContent, $strFileName = 'unknown', $strMimeType = 'unknown') + public function setAttachment($strContent, $strFileName = 'unknown', $strMimeType = 'unknown', $strCid = '') { if ($strContent) { $strContent = rtrim(chunk_split(base64_encode($strContent), 76, "\r\n")); // 76 max is defined into http://tools.ietf.org/html/rfc2047 @@ -1674,6 +1678,7 @@ class SMTPs $this->_msgContent['attachment'][$strFileName]['mimeType'] = $strMimeType; $this->_msgContent['attachment'][$strFileName]['fileName'] = $strFileName; $this->_msgContent['attachment'][$strFileName]['data'] = $strContent; + $this->_msgContent['attachment'][$strFileName]['cid'] = $strCid; // If defined, it means this attachment must be shown inline if ($this->getMD5flag()) { $this->_msgContent['attachment'][$strFileName]['md5'] = dol_hash($strContent, 3); From 9f0eaf58a9c88fb956064c1f38ae7330324b9d24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Oct 2022 17:56:54 +0200 Subject: [PATCH 134/176] Remove specialchar button --- htdocs/core/class/doleditor.class.php | 4 ++-- htdocs/theme/eldy/ckeditor/config.js | 8 ++++---- htdocs/theme/md/ckeditor/config.js | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 007210c8888..edaf088e949 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -163,7 +163,7 @@ class DolEditor $skin = 'moono-lisa'; // default with ckeditor 4.6 : moono-lisa } - $pluginstodisable = 'elementspath,save,flash,div,specialchar'; + $pluginstodisable = 'elementspath,save,flash,div,specialchar,anchor'; if (!empty($conf->dol_optimize_smallscreen)) { $pluginstodisable .= ',scayt,wsc,find,undo'; } @@ -198,7 +198,7 @@ class DolEditor htmlEncodeOutput:'.$htmlencode_force.', allowedContent:'.($disallowAnyContent ? 'false' : 'true').', /* Advanced Content Filter (ACF) is own when allowedContent is false */ extraAllowedContent: \'a[target];div{float,display}\', /* Add the style float and display into div to default other allowed tags */ - disallowedContent: '.($disallowAnyContent ? '\'\'' : '\'\'').', /* Tags that are not allowed */ + disallowedContent: '.($disallowAnyContent ? '\'\'' : '\'\'').', /* Tags that are not allowed */ fullPage: '.($fullpage ? 'true' : 'false').', /* if true, the html, header and body tags are kept */ toolbar: \''.$this->toolbarname.'\', toolbarStartupExpanded: '.($this->toolbarstartexpanded ? 'true' : 'false').', diff --git a/htdocs/theme/eldy/ckeditor/config.js b/htdocs/theme/eldy/ckeditor/config.js index 4ec222217a1..d2a87a4a4d8 100644 --- a/htdocs/theme/eldy/ckeditor/config.js +++ b/htdocs/theme/eldy/ckeditor/config.js @@ -46,8 +46,8 @@ CKEDITOR.editorConfig = function( config ) ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['BidiLtr', 'BidiRtl'], - ['Link','Unlink','Anchor'], - ['Image','Table','HorizontalRule','Smiley','SpecialChar'], + ['Link','Unlink'], + ['Image','Table','HorizontalRule','Smiley'], ['Styles','Format','Font','FontSize'], ['TextColor','BGColor'], ['Source'] @@ -64,7 +64,7 @@ CKEDITOR.editorConfig = function( config ) ['Bold','Italic','Underline','Strike','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Anchor','Image','Table','HorizontalRule','SpecialChar'], + ['Link','Unlink','Image','Table','HorizontalRule'], ['Source'] ]; @@ -78,7 +78,7 @@ CKEDITOR.editorConfig = function( config ) ['Bold','Italic','Underline','Strike','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Image','Table','HorizontalRule','SpecialChar'], + ['Link','Unlink','Image','Table','HorizontalRule'], ['Source'] ]; diff --git a/htdocs/theme/md/ckeditor/config.js b/htdocs/theme/md/ckeditor/config.js index 06fa5746e7f..e463e6db9a3 100644 --- a/htdocs/theme/md/ckeditor/config.js +++ b/htdocs/theme/md/ckeditor/config.js @@ -46,8 +46,8 @@ CKEDITOR.editorConfig = function( config ) ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['BidiLtr', 'BidiRtl'], - ['Link','Unlink','Anchor'], - ['Image','Table','HorizontalRule','Smiley','SpecialChar'], + ['Link','Unlink'], + ['Image','Table','HorizontalRule','Smiley'], ['Styles','Format','Font','FontSize'], ['TextColor','BGColor'], ['Source'] @@ -64,7 +64,7 @@ CKEDITOR.editorConfig = function( config ) ['Bold','Italic','Underline','Strike','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Anchor','Image','Table','HorizontalRule','SpecialChar'], + ['Link','Unlink','Image','Table','HorizontalRule'], ['Source'] ]; @@ -78,7 +78,7 @@ CKEDITOR.editorConfig = function( config ) ['Bold','Italic','Underline','Strike','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Image','Table','HorizontalRule','SpecialChar'], + ['Link','Unlink','Image','Table','HorizontalRule'], ['Source'] ]; @@ -91,7 +91,7 @@ CKEDITOR.editorConfig = function( config ) ['Bold','Italic','Underline','Strike','-','TextColor','RemoveFormat'], // ,'Subscript','Superscript' useless ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','SpecialChar'], + ['Link','Unlink'], ['Source'] ]; From 5b22eeab31c6e47dd961ffbc324350ec99222a17 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Oct 2022 20:45:27 +0200 Subject: [PATCH 135/176] Fix support of inline src data --- htdocs/comm/mailing/card.php | 13 ++++++++----- scripts/emailings/mailing-send.php | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index e5c125d14cd..72ec408524c 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -84,6 +84,8 @@ if (empty($user->rights->mailing->lire) || (empty($conf->global->EXTERNAL_USERS_ accessforbidden(); } +$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing'); + /* * Actions @@ -124,8 +126,6 @@ if (empty($reshook)) { setEventMessages($langs->trans("NotEnoughPermissions"), null, 'warnings'); $action = ''; } else { - $upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing'); - if ($object->statut == 0) { dol_print_error('', 'ErrorMailIsNotValidated'); exit; @@ -318,7 +318,8 @@ if (empty($reshook)) { // Mail making $trackid = 'emailing-'.$obj->fk_mailing.'-'.$obj->rowid; - $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, $moreinheader, 'emailing'); + $upload_dir_tmp = $upload_dir; + $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, $moreinheader, 'emailing', '', $upload_dir_tmp); if ($mail->error) { $res = 0; @@ -478,7 +479,8 @@ if (empty($reshook)) { } $trackid = 'emailing-test'; - $mailfile = new CMailFile($tmpsujet, $object->sendto, $object->email_from, $tmpbody, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $object->email_errorsto, $arr_css, $trackid, '', 'emailing'); + $upload_dir_tmp = $upload_dir; + $mailfile = new CMailFile($tmpsujet, $object->sendto, $object->email_from, $tmpbody, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $object->email_errorsto, $arr_css, $trackid, '', 'emailing', '', $upload_dir_tmp); $result = $mailfile->sendfile(); if ($result) { @@ -1265,8 +1267,9 @@ if ($action == 'create') { $out .= '
'; } } else { - $out .= ''.$langs->trans("NoAttachedFiles").'
'; + //$out .= ''.$langs->trans("NoAttachedFiles").'
'; } + // Add link to add file $maxfilesizearray = getMaxFileSizeArray(); $maxmin = $maxfilesizearray['maxmin']; diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index f427e42d8cb..78e4488ec46 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -307,7 +307,8 @@ if ($resql) { } // Fabrication du mail $trackid = 'emailing-'.$obj->fk_mailing.'-'.$obj->rowid; - $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, $moreinheader, 'emailing'); + $upload_dir_tmp = $upload_dir; + $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, $moreinheader, 'emailing', '', $upload_dir_tmp); if ($mail->error) { $res = 0; From 0f8d87da3b5638e44ffaaf85bb40bb3cbe8ebfa5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Oct 2022 21:25:52 +0200 Subject: [PATCH 136/176] Clean code --- htdocs/core/class/html.form.class.php | 27 ++++++++++++++------------- htdocs/langs/en_US/projects.lang | 1 + htdocs/projet/class/project.class.php | 4 ++-- htdocs/ticket/agenda.php | 21 ++++++++++++--------- htdocs/ticket/card.php | 16 ++++++++-------- htdocs/ticket/contact.php | 21 ++++++++++++--------- htdocs/ticket/document.php | 21 ++++++++++++--------- 7 files changed, 61 insertions(+), 50 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0b108d8b759..f7aa1990f13 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5916,19 +5916,20 @@ class Form /** * Output html select to select thirdparty * - * @param string $page Page - * @param string $selected Id preselected - * @param string $htmlname Name of HTML select - * @param string $filter Optional filters criteras. Do not use a filter coming from input of users. - * @param int $showempty Add an empty field - * @param int $showtype Show third party type in combolist (customer, prospect or supplier) - * @param int $forcecombo Force to use combo box - * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) - * @param int $nooutput No print output. Return it only. - * @param array $excludeids Exclude IDs from the select combo + * @param string $page Page + * @param string $selected Id preselected + * @param string $htmlname Name of HTML select + * @param string $filter Optional filters criteras. Do not use a filter coming from input of users. + * @param int $showempty Add an empty field + * @param int $showtype Show third party type in combolist (customer, prospect or supplier) + * @param int $forcecombo Force to use combo box + * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) + * @param int $nooutput No print output. Return it only. + * @param array $excludeids Exclude IDs from the select combo + * @param string $textifnothirdparty Text to show if no thirdparty * @return void|string */ - public function form_thirdparty($page, $selected = '', $htmlname = 'socid', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $events = array(), $nooutput = 0, $excludeids = array()) + public function form_thirdparty($page, $selected = '', $htmlname = 'socid', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $events = array(), $nooutput = 0, $excludeids = array(), $textifnothirdparty = '') { // phpcs:enable global $langs; @@ -5946,9 +5947,9 @@ class Form require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $soc = new Societe($this->db); $soc->fetch($selected); - $out .= $soc->getNomUrl($langs); + $out .= $soc->getNomUrl(0, ''); } else { - $out .= " "; + $out .= ''.$textifnothirdparty.''; } } diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index c61d794fcdc..b6001b2b27b 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -37,6 +37,7 @@ OpportunitiesStatusForOpenedProjects=Leads amount of open projects by status OpportunitiesStatusForProjects=Leads amount of projects by status ShowProject=Show project ShowTask=Show task +SetThirdParty=Set third party SetProject=Set project OutOfProject=Out of project NoProject=No project defined or owned diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 38bb55b5a24..1495df77df7 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1279,7 +1279,7 @@ class Project extends CommonObject $label .= ($label ? '
' : '').''.$langs->trans('Label').': '.$this->title; // The space must be after the : to not being explode when showing the title in img_picto if (isset($this->public)) { $label .= '
'.$langs->trans("Visibility").": "; - $label .= ($this->public ? img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"').$langs->trans("SharedProject") : img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"').$langs->trans("PrivateProject")); + $label .= ($this->public ? img_picto($langs->trans('SharedProject'), 'world', 'class="pictofixedwidth"').$langs->trans("SharedProject") : img_picto($langs->trans('PrivateProject'), 'private', 'class="pictofixedwidth"').$langs->trans("PrivateProject")); } if (!empty($this->thirdparty_name)) { $label .= ($label ? '
' : '').''.$langs->trans('ThirdParty').': '.$this->thirdparty_name; // The space must be after the : to not being explode when showing the title in img_picto @@ -1340,7 +1340,7 @@ class Project extends CommonObject $result .= $linkstart; if ($withpicto) { - $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip pictofixedwidth em088"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="pictofixedwidth"' : '') : 'class="'.(($withpicto != 2) ? 'pictofixedwidth ' : '').'classfortooltip pictofixedwidth em088"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { $result .= $this->ref; diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index eae0ae829e2..ac121045597 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -30,6 +30,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +if (isModEnabled('project')) { + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +} // Load translation files required by the page $langs->loadLangs(array('companies', 'other', 'ticket')); @@ -179,21 +184,18 @@ if ($object->fk_user_create > 0) { // Thirdparty if (isModEnabled("societe")) { $morehtmlref .= '
'; - /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' '; - }*/ - if ($action == 'editcustomer') { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); - } else { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); + $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); + if ($action != 'editcustomer' && 0) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' '; } + $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { + $morehtmlref .= '
'; $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; @@ -201,6 +203,7 @@ if (isModEnabled('project')) { $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { + $morehtmlref .= '
'; $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index eb824beb1d3..650735b7ec0 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -953,24 +953,24 @@ if ($action == 'create' || $action == 'presend') { $morehtmlref .= dol_escape_htmltag($object->origin_email).' - '.$form->textwithpicto($langs->trans("CreatedByPublicPortal"), $htmltooptip, 1, 'help', '', 0, 3, 'tooltip').''; } + $permissiontoedit = $object->status < 8 && !$user->socid && $user->rights->ticket->write; + //$permissiontoedit = 0; + // Thirdparty if (isModEnabled("societe")) { $morehtmlref .= '
'; - if ($action != 'editcustomer' && $object->status < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('Edit'), 0).' '; - } - if ($action == 'editcustomer') { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); - } else { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); + $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); + if ($action != 'editcustomer' && $permissiontoedit) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' '; } + $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); } // Project if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if ($permissiontoedit) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index f045923e75d..5e7cadf07fe 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -34,6 +34,11 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php"; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +if (isModEnabled('project')) { + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +} // Load translation files required by the page $langs->loadLangs(array('companies', 'ticket')); @@ -213,21 +218,18 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { // Thirdparty if (isModEnabled("societe")) { $morehtmlref .= '
'; - /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' '; - }*/ - if ($action == 'editcustomer') { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); - } else { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); + $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); + if ($action != 'editcustomer' && 0) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' '; } + $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { + $morehtmlref .= '
'; $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; @@ -235,6 +237,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { + $morehtmlref .= '
'; $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index daa74536d1a..8a95623444f 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -33,6 +33,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php"; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +if (isModEnabled('project')) { + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +} // Load translation files required by the page $langs->loadLangs(array("companies", "other", "ticket", "mails")); @@ -148,21 +153,18 @@ if ($object->id) { // Thirdparty if (isModEnabled("societe")) { $morehtmlref .= '
'; - /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' '; - }*/ - if ($action == 'editcustomer') { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); - } else { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); + $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); + if ($action != 'editcustomer' && 0) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' '; } + $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { + $morehtmlref .= '
'; $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; @@ -170,6 +172,7 @@ if ($object->id) { $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { + $morehtmlref .= '
'; $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); From 780c6e3ce19c5aaa3ff841c4fca7586092c12ec7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Oct 2022 21:43:00 +0200 Subject: [PATCH 137/176] FIX Debug add event on a ticket --- htdocs/comm/action/card.php | 14 ++++++++------ htdocs/core/lib/ticket.lib.php | 2 +- htdocs/ticket/agenda.php | 2 +- htdocs/ticket/messaging.php | 24 ++++++++++++++---------- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 27d3c049c64..53ac5846628 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -90,6 +90,14 @@ if ($fulldayevent) { $datep = dol_mktime($aphour, $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuserrel'); $datef = dol_mktime($p2hour, $p2min, '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuserrel'); } +$reg = array(); +if (GETPOST('datep')) { + if (GETPOST('datep') == 'now') { + $datep = dol_now(); + } elseif (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/', GETPOST("datep"), $reg)) { // Try to not use this. Use insteead '&datep=now' + $datep = dol_mktime(0, 0, 0, $reg[2], $reg[3], $reg[1], 'tzuser'); + } +} // Security check $socid = GETPOST('socid', 'int'); @@ -1070,7 +1078,6 @@ if (empty($reshook)) { } - /* * View */ @@ -1498,11 +1505,6 @@ if ($action == 'create') { } } - $reg = array(); - if (GETPOST("datep") && preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/', GETPOST("datep"), $reg)) { - $object->datep = dol_mktime(0, 0, 0, $reg[2], $reg[3], $reg[1]); - } - // Priority if (!empty($conf->global->AGENDA_SUPPORT_PRIORITY_IN_EVENTS)) { print '
'; + // Private message (not visible by customer/external user) if (!$user->socid) { print ''; } - print ''; - // Zone to select its email template if (count($modelmail_array) > 0) { print '
'.$langs->trans("MailTopic").'
'; - print $form->editfieldkey("MailTitle", 'title', $object->title, $object, $user->rights->mailing->creer && $object->statut < 3, 'string'); + print $form->editfieldkey("MailTitle", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string'); print ''; - print $form->editfieldval("MailTitle", 'title', $object->title, $object, $user->rights->mailing->creer && $object->statut < 3, 'string'); + print $form->editfieldval("MailTitle", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string'); print '
'; - print $form->editfieldkey("MailFrom", 'email_from', $object->email_from, $object, $user->rights->mailing->creer && $object->statut < 3, 'string'); + print $form->editfieldkey("MailFrom", 'email_from', $object->email_from, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string'); print ''; - print $form->editfieldval("MailFrom", 'email_from', $object->email_from, $object, $user->rights->mailing->creer && $object->statut < 3, 'string'); + print $form->editfieldval("MailFrom", 'email_from', $object->email_from, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string'); $email = CMailFile::getValidAddress($object->email_from, 2); if ($email && !isValidEmail($email)) { $langs->load("errors"); @@ -910,9 +913,9 @@ if ($action == 'create') { // Errors to print '
'; - print $form->editfieldkey("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, $user->rights->mailing->creer && $object->statut < 3, 'string'); + print $form->editfieldkey("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string'); print ''; - print $form->editfieldval("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, $user->rights->mailing->creer && $object->statut < 3, 'string'); + print $form->editfieldval("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string'); $email = CMailFile::getValidAddress($object->email_errorsto, 2); if ($email && !isValidEmail($email)) { $langs->load("errors"); @@ -977,11 +980,11 @@ if ($action == 'create') { if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test'))) { print "\n\n
\n"; - if (($object->statut == 1) && ($user->rights->mailing->valider || $object->user_validation == $user->id)) { + if (($object->statut == 1) && ($user->hasRight('mailing', 'valider') || $object->user_validation == $user->id)) { print ''.$langs->trans("SetToDraft").''; } - if (($object->statut == 0 || $object->statut == 1 || $object->statut == 2) && $user->rights->mailing->creer) { + if (($object->statut == 0 || $object->statut == 1 || $object->statut == 2) && $user->hasRight('mailing', 'creer')) { if (isModEnabled('fckeditor') && !empty($conf->global->FCKEDITOR_ENABLE_MAILING)) { print ''.$langs->trans("EditWithEditor").''; } else { @@ -1011,7 +1014,7 @@ if ($action == 'create') { } } - if (($object->statut == 1 || $object->statut == 2) && $object->nbemail > 0 && $user->rights->mailing->valider) { + if (($object->statut == 1 || $object->statut == 2) && $object->nbemail > 0 && $user->hasRight('mailing', 'valider')) { if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) { print ''.$langs->trans("SendMailing").''; } elseif (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send) { @@ -1021,11 +1024,11 @@ if ($action == 'create') { } } - if ($user->rights->mailing->creer) { + if ($user->hasRight('mailing', 'creer')) { print ''.$langs->trans("ToClone").''; } - if (($object->statut == 2 || $object->statut == 3) && $user->rights->mailing->valider) { + if (($object->statut == 2 || $object->statut == 3) && $user->hasRight('mailing', 'valider')) { if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send) { print ''.$langs->trans("ResetMailing").''; } else { @@ -1033,7 +1036,7 @@ if ($action == 'create') { } } - if (($object->statut <= 1 && $user->rights->mailing->creer) || $user->rights->mailing->supprimer) { + if (($object->statut <= 1 && $user->hasRight('mailing', 'creer')) || $user->hasRight('mailing', 'supprimer')) { if ($object->statut > 0 && (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->delete)) { print ''.$langs->trans("DeleteMailing").''; } else { From c9573510de5e7d792d6b96df04be3cf368f25aea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Oct 2022 15:23:07 +0200 Subject: [PATCH 130/176] css --- htdocs/comm/mailing/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 915a7a7ce9b..e5c125d14cd 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -1275,7 +1275,7 @@ if ($action == 'create') { } $out .= ''; $out .= ' '; - $out .= ''; + $out .= ''; print $out; print '
'.$langs->trans("MailErrorsTo").''; - $out .= ''; + $out .= ''; $out .= "
'.$langs->trans("Priority").''; diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 9223c1c4dd8..42fbc9786cb 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -567,7 +567,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no } } - // Set $out to sow events + // Set $out to show events $out = ''; if (!isModEnabled('agenda')) { diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index ac121045597..d14cff7a474 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -253,7 +253,7 @@ if (!empty($object->id)) { // Show link to add event (if read and not closed) $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; - $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.date('YmdHi').'&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); + $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep=now&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus); print_barre_liste($langs->trans("ActionsOnTicket"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index 6817268eca8..6e5ee567805 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -30,6 +30,11 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +if (isModEnabled('project')) { + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +} // Load translation files required by the page $langs->loadLangs(array('companies', 'other', 'ticket')); @@ -173,14 +178,13 @@ if ($object->fk_user_create > 0) { // Thirdparty if (isModEnabled("societe")) { - $morehtmlref .= '
'; - /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' '; - }*/ - if ($action == 'editcustomer') { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); - } else { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); + if (isModEnabled("societe")) { + $morehtmlref .= '
'; + $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); + if ($action != 'editcustomer' && 0) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' '; + } + $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); } } @@ -188,7 +192,7 @@ if (isModEnabled("societe")) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; @@ -245,7 +249,7 @@ if (!empty($object->id)) { // Show link to add event (if read and not closed) $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; - $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.date('YmdHi').'&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id); + $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep=now&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id); $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus); From 26d11828382d277901782a4372087591ece4ed97 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Oct 2022 22:32:52 +0200 Subject: [PATCH 138/176] FIX Debug ticket module (no double event when sending private message) FIX The backtopage after sending ticket message was ko. --- htdocs/core/class/CMailFile.class.php | 2 +- htdocs/core/class/html.formticket.class.php | 14 +++++++------- htdocs/langs/en_US/ticket.lang | 3 +-- htdocs/public/ticket/view.php | 2 +- htdocs/ticket/card.php | 9 +++------ htdocs/ticket/class/actions_ticket.class.php | 2 +- htdocs/ticket/class/ticket.class.php | 6 +++--- 7 files changed, 17 insertions(+), 21 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index ffd1d6e8e5d..ed2bcef8034 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1772,7 +1772,7 @@ class CMailFile $matches = array(); preg_match_all('/src="data:image\/('.implode('|', $extensions).');base64,([^"]+)"/Ui', $this->html, $matches); // If "xxx.ext" or 'xxx.ext' found - if (!empty($matches)) { + if (!empty($matches) && !empty($matches[1])) { if (empty($images_dir)) { // No temp directory provided, so we are not able to support convertion of data:image into physical images. $this->error = 'NoTempDirProvidedInCMailConstructorSoCantConvertDataImgOnDisk'; diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index ab91cd8867b..216644876ba 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1408,6 +1408,12 @@ class FormTicket $ticketstat = new Ticket($this->db); $res = $ticketstat->fetch('', '', $this->track_id); + print '
'; + $checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : ($conf->global->TICKETS_MESSAGE_FORCE_MAIL?'checked':'')); + print ' '; + print ''; + print '
'; @@ -1418,12 +1424,6 @@ class FormTicket print '
'; - $checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : ($conf->global->TICKETS_MESSAGE_FORCE_MAIL?'checked':'')); - print ' '; - print ''; - print '
'; print '

'; - print ''; + print ''; if ($this->withcancel) { print "     "; print ''; diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 3e1415c3625..1696018db89 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -194,8 +194,7 @@ TicketAssigned=Ticket is now assigned TicketChangeType=Change type TicketChangeCategory=Change analytic code TicketChangeSeverity=Change severity -TicketAddMessage=Add a message -AddMessage=Add a message +TicketAddMessage=Add private message MessageSuccessfullyAdded=Ticket added TicketMessageSuccessfullyAdded=Message successfully added TicketMessagesList=Message list diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 3f137148a89..bab3c501ca3 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -371,7 +371,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a if ($object->dao->fk_statut < Ticket::STATUS_CLOSED) { // New message - print ''; + print ''; // Close ticket if ($object->dao->fk_statut >= Ticket::STATUS_NOT_READ && $object->dao->fk_statut < Ticket::STATUS_CLOSED) { diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 650735b7ec0..12944e4b5ef 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -444,11 +444,7 @@ if (empty($reshook)) { if ($ret > 0) { if (!empty($backtopage)) { - if (empty($id)) { - $url = $backtopage; - } else { - $url = 'card.php?track_id='.urlencode($object->track_id); - } + $url = $backtopage; } else { $url = 'card.php?track_id='.urlencode($object->track_id); } @@ -456,7 +452,7 @@ if (empty($reshook)) { header("Location: ".$url); exit; } else { - setEventMessages($object->error, null, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action = 'presend'; } } @@ -690,6 +686,7 @@ if (empty($reshook)) { $permissiontoadd = $user->rights->ticket->write; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; //var_dump($action);exit; + // Actions to send emails $triggersendname = 'TICKET_SENTBYMAIL'; $paramname = 'id'; diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index 9a01c5cf7d2..133fb72e7f2 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -164,7 +164,7 @@ class ActionsTicket } elseif ($action == 'view') { return $langs->trans("TicketCard"); } elseif ($action == 'add_message') { - return $langs->trans("AddMessage"); + return $langs->trans("TicketAddMessage"); } else { return $langs->trans("TicketsManagement"); } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 4acc9104454..4a03098b57c 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2792,7 +2792,7 @@ class Ticket extends CommonObject if ($result) { // update last_msg_sent date $this->date_last_msg_sent = dol_now(); - $this->update($user); + $this->update($user, 1); // disable trigger when updatin date_last_msg_sent. sendTicketMessageByEmail already create an event in actioncomm table. } } } @@ -2800,8 +2800,8 @@ class Ticket extends CommonObject } } - // Set status to "answered" if not set yet, but only if internal user - if ($object->status < 3 && !$user->socid) { + // Set status to "answered" if not set yet, but only if internal user and not private message + if ($object->status < 3 && !$user->socid && !$private) { $object->setStatut(3); } return 1; From 81813225aa3473f174e70f770de56246812002c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Oct 2022 01:25:50 +0200 Subject: [PATCH 139/176] Look and feel v17 --- htdocs/comm/action/card.php | 2 +- htdocs/comm/action/document.php | 2 +- htdocs/comm/action/info.php | 2 +- htdocs/comm/propal/card.php | 2 +- htdocs/comm/propal/contact.php | 2 +- htdocs/comm/propal/document.php | 2 +- htdocs/comm/propal/info.php | 2 +- htdocs/comm/propal/note.php | 2 +- htdocs/commande/card.php | 2 +- htdocs/commande/contact.php | 2 +- htdocs/commande/document.php | 2 +- htdocs/commande/info.php | 2 +- htdocs/commande/note.php | 2 +- htdocs/compta/facture/card.php | 2 +- htdocs/compta/facture/contact.php | 2 +- htdocs/compta/facture/document.php | 2 +- htdocs/compta/facture/info.php | 2 +- htdocs/compta/facture/note.php | 2 +- htdocs/compta/facture/prelevement.php | 2 +- htdocs/compta/sociales/note.php | 2 +- htdocs/contrat/agenda.php | 2 +- htdocs/contrat/card.php | 2 +- htdocs/contrat/contact.php | 2 +- htdocs/contrat/document.php | 2 +- htdocs/contrat/note.php | 2 +- htdocs/delivery/card.php | 2 +- htdocs/expedition/card.php | 2 +- htdocs/expedition/contact.php | 2 +- htdocs/expedition/document.php | 2 +- htdocs/expedition/note.php | 2 +- htdocs/expedition/shipment.php | 2 +- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/commande/contact.php | 2 +- htdocs/fourn/commande/dispatch.php | 2 +- htdocs/fourn/commande/document.php | 2 +- htdocs/fourn/commande/info.php | 2 +- htdocs/fourn/commande/note.php | 2 +- htdocs/fourn/facture/card.php | 2 +- htdocs/fourn/facture/contact.php | 2 +- htdocs/fourn/facture/document.php | 2 +- htdocs/fourn/facture/info.php | 2 +- htdocs/fourn/facture/note.php | 2 +- htdocs/projet/class/project.class.php | 2 +- htdocs/reception/card.php | 2 +- htdocs/reception/contact.php | 2 +- htdocs/reception/document.php | 2 +- htdocs/reception/note.php | 2 +- htdocs/resource/element_resource.php | 2 +- htdocs/supplier_proposal/contact.php | 2 +- htdocs/ticket/agenda.php | 2 +- htdocs/ticket/card.php | 12 ++++++------ htdocs/ticket/contact.php | 2 +- htdocs/ticket/document.php | 2 +- htdocs/ticket/messaging.php | 2 +- 54 files changed, 59 insertions(+), 59 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 53ac5846628..3aa6a16d3ef 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -2169,7 +2169,7 @@ if ($id > 0) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index f80476c2f9a..b02b2850346 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -176,7 +176,7 @@ if ($object->id > 0) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index e009c9fccf7..749ca6a0c62 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -104,7 +104,7 @@ if (isModEnabled('project')) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 9180be4f99b..648fc6e18c4 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2317,7 +2317,7 @@ if ($action == 'create') { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 835dcc70fd0..42f3f34f8d4 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -156,7 +156,7 @@ if ($object->id > 0) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 799539d97b1..f1d1d7ef644 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -154,7 +154,7 @@ if ($object->id > 0) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php index 26a65f9a66e..986601a91bc 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -101,7 +101,7 @@ if (isModEnabled('project')) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 64fe59edea5..fe4895ad2f8 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -126,7 +126,7 @@ if ($object->id > 0) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 0bffd98e739..786fb1a2ad2 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2346,7 +2346,7 @@ if ($action == 'create' && $usercancreate) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index aa61426e435..04c16e68aa0 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -150,7 +150,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index ef1e1ce1697..0c35c3489f7 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -147,7 +147,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index e319cb95d36..0acc5b793aa 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -101,7 +101,7 @@ if (isModEnabled('project')) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 946902e1a11..e84dd5ad6e1 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -120,7 +120,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a193383836b..10cf7b624fc 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4383,7 +4383,7 @@ if ($action == 'create') { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 7b7dd41ef7e..b367301911d 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -155,7 +155,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index c4b11cea186..5cec55e2439 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -159,7 +159,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index 340c40afa4a..1ea28b295c3 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -115,7 +115,7 @@ if (isModEnabled('project')) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index f6c81bbf800..af08c6163e2 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -137,7 +137,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 172ec0c1120..d475e83c55b 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -375,7 +375,7 @@ if ($object->id > 0) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/compta/sociales/note.php b/htdocs/compta/sociales/note.php index c65b731109d..0f85b6ddf06 100644 --- a/htdocs/compta/sociales/note.php +++ b/htdocs/compta/sociales/note.php @@ -102,7 +102,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($object->fk_project); $morehtmlref .= ' : '.$proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } else { $morehtmlref .= ''; diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index 9ddab3b6487..3a3c5440b30 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -188,7 +188,7 @@ if ($id > 0) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index b2a89ab63ec..802305b6306 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1391,7 +1391,7 @@ if ($action == 'create') { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 3c3bb00baeb..e5557c28a5b 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -172,7 +172,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 477d8818c4b..652738f10b5 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -159,7 +159,7 @@ if ($object->id) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index 1038fe83de3..f17cc11f748 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -128,7 +128,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 0b019bec92c..b98b75015ab 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -345,7 +345,7 @@ if ($action == 'create') { $proj->fetch($objectsrc->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 5e9dc8fb1a7..f002dc8fe27 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1759,7 +1759,7 @@ if ($action == 'create') { $proj->fetch($objectsrc->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index 4ef381dfc9a..48822121fa3 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -165,7 +165,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($objectsrc->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php index 4aca218a611..517c1cea8d2 100644 --- a/htdocs/expedition/document.php +++ b/htdocs/expedition/document.php @@ -157,7 +157,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($objectsrc->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index 2e98169f042..4401af0b20c 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -126,7 +126,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($objectsrc->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index c1b4a04fcee..9394269a03a 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -303,7 +303,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($objectsrc->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index ce85f581859..5dbe81ca4a4 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2068,7 +2068,7 @@ if ($action == 'create') { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index 3a8a5a5c49a..3ca1eca77bf 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -155,7 +155,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 1f63c5a594b..41c15dabb68 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -561,7 +561,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index b7d8ba118a0..b3dfb8b9ece 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -147,7 +147,7 @@ if ($object->id > 0) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index 4129947282f..fc3918a32f3 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -160,7 +160,7 @@ if (isModEnabled('project')) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 27e74006d85..33648dd9817 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -129,7 +129,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index a66f48fc2e0..1738dd69868 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2893,7 +2893,7 @@ if ($action == 'create') { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index 1317fe2f0a7..542b37db092 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -156,7 +156,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 45189f5395e..03012acbcaf 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -132,7 +132,7 @@ if ($object->id > 0) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php index 0dc58debba3..9223d47b791 100644 --- a/htdocs/fourn/facture/info.php +++ b/htdocs/fourn/facture/info.php @@ -98,7 +98,7 @@ if (isModEnabled('project')) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index 0136ee1d11d..1c61fdc8e07 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -128,7 +128,7 @@ if ($object->id > 0) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 1495df77df7..c5dcf0d4bb4 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1347,7 +1347,7 @@ class Project extends CommonObject } $result .= $linkend; if ($withpicto != 2) { - $result .= (($addlabel && $this->title) ? $sep.dol_trunc($this->title, ($addlabel > 1 ? $addlabel : 0)) : ''); + $result .= (($addlabel && $this->title) ? ''.$sep.dol_trunc($this->title, ($addlabel > 1 ? $addlabel : 0)).'' : ''); } global $action; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index d5106a3b5ea..9afa6ec57d8 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1395,7 +1395,7 @@ if ($action == 'create') { $proj->fetch($objectsrc->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index 01ff7218f9e..a03460b1e49 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -179,7 +179,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($objectsrc->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/reception/document.php b/htdocs/reception/document.php index 6ef302f4143..980b5e50a33 100644 --- a/htdocs/reception/document.php +++ b/htdocs/reception/document.php @@ -170,7 +170,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($objectsrc->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/reception/note.php b/htdocs/reception/note.php index 5b04e971702..d916099b872 100644 --- a/htdocs/reception/note.php +++ b/htdocs/reception/note.php @@ -150,7 +150,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($objectsrc->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 7e94465219f..c063e049f44 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -367,7 +367,7 @@ if (!$ret) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/supplier_proposal/contact.php b/htdocs/supplier_proposal/contact.php index 6b01d2af35a..1fa344cbb5e 100644 --- a/htdocs/supplier_proposal/contact.php +++ b/htdocs/supplier_proposal/contact.php @@ -152,7 +152,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index d14cff7a474..9111faedcb7 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -208,7 +208,7 @@ if (isModEnabled('project')) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 12944e4b5ef..1290a9a9a9b 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -968,18 +968,18 @@ if ($action == 'create' || $action == 'presend') { $langs->load("projects"); $morehtmlref .= '
'; if ($permissiontoedit) { - $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + $object->fetch_project(); + $morehtmlref .= img_picto($langs->trans("Project"), 'project'.((is_object($object->project) && $object->project->public) ? 'pub' : ''), 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= $proj->getNomUrl(1); - if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $object->fetch_project(); + $morehtmlref .= $object->project->getNomUrl(1); + if ($object->project->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($object->project->title).''; } } } diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index 5e7cadf07fe..7f5a36faf1b 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -242,7 +242,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index 8a95623444f..8015cb32145 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -177,7 +177,7 @@ if ($object->id) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index 6e5ee567805..f1fd631234b 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -204,7 +204,7 @@ if (isModEnabled('project')) { $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } } From b4218f4c53851e89c465d5ff9c791eb8b631ceaf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Oct 2022 03:07:22 +0200 Subject: [PATCH 140/176] Responsive --- htdocs/compta/facture/list.php | 14 +++++++----- htdocs/core/class/html.form.class.php | 32 ++++++++++++++++++--------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 2618e688698..9b92e9e018e 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1420,13 +1420,13 @@ if ($resql) { // Payment mode if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { print '
'; - print $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 10, 1, '', 1); + print $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 0, 1, 'minwidth100 maxwidth100', 1); print ''; - print $form->getSelectConditionsPaiements($search_paymentterms, 'search_paymentterms', -1, 1, 1); + print $form->getSelectConditionsPaiements($search_paymentterms, 'search_paymentterms', -1, 1, 1, 'minwidth100 maxwidth100'); print ''; - $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1); + $s = $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1, 0, '', 1); + print ''; + print $s; print ''; - $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none'); + $s = $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', -1, -1, 1); + print ''; + print $s; print '
'; - print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1); + print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'maxwidth75'); print '
'.$langs->trans("Categories").''; + print ''; print $form->showCategories($object->id, Categorie::TYPE_CONTACT, 1); print '
'.$langs->trans("ContactByDefaultFor").''; + print ''; print $formcompany->showRoles("roles", $object, 'view', $object->roles); print '
'.$langs->trans("ContactForProposals").''; + print '
'.$langs->trans("ContactForProposals").''; print $object->ref_propal ? $object->ref_propal : $langs->trans("NoContactForAnyProposal"); print '
'; + print '
'; if (isModEnabled("expedition")) { print $langs->trans("ContactForOrdersOrShipments"); } else { print $langs->trans("ContactForOrders"); } - print ''; + print ''; $none = $langs->trans("NoContactForAnyOrder"); if (isModEnabled("expedition")) { $none = $langs->trans("NoContactForAnyOrderOrShipments"); @@ -1515,18 +1514,18 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } if (isModEnabled('contrat')) { - print '
'.$langs->trans("ContactForContracts").''; + print '
'.$langs->trans("ContactForContracts").''; print $object->ref_contrat ? $object->ref_contrat : $langs->trans("NoContactForAnyContract"); print '
'.$langs->trans("ContactForInvoices").''; + print '
'.$langs->trans("ContactForInvoices").''; print $object->ref_facturation ? $object->ref_facturation : $langs->trans("NoContactForAnyInvoice"); print '
'.$langs->trans("DolibarrLogin").''; + print '
'.$langs->trans("DolibarrLogin").''; if ($object->user_id) { $dolibarr_user = new User($db); $result = $dolibarr_user->fetch($object->user_id); From 692be6889aff6a900724cb201b104aefeb791ed0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Oct 2022 11:04:40 +0200 Subject: [PATCH 143/176] Responsive --- htdocs/accountancy/customer/list.php | 2 +- htdocs/accountancy/expensereport/list.php | 2 +- htdocs/accountancy/supplier/list.php | 2 +- htdocs/theme/eldy/global.inc.php | 4 ++-- htdocs/theme/md/style.css.php | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 9dfd94d5729..4def8dfbef6 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -725,7 +725,7 @@ if ($result) { // Suggested accounting account print ''; - print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facture_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); + print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facture_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth150 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; - print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); + print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 4593541e87a..3c4a9e7f46b 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -749,7 +749,7 @@ if ($result) { // Suggested accounting account print ''; - print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); + print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth150 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; - print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'small maxwidth150'); + print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'small maxwidth75'); print '
'; // Ref - if (!empty($conf->global->MAIN_PRODUCT_REF_NOT_EDITABLE)) { - print ''; - } else { + if (empty($conf->global->MAIN_PRODUCT_REF_NOT_EDITABLE)) { print ''; + } else { + print ''; } From 4eeb73276a1f06300ab193deacaf29926b2aeefd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Oct 2022 19:38:38 +0200 Subject: [PATCH 147/176] Close #22650 --- htdocs/install/mysql/migration/16.0.0-17.0.0.sql | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index b10aa69767b..d98840379a9 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -197,6 +197,12 @@ ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_tx double(24,8) N ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN rank rankorder integer; + +-- Rename const to hide public and private notes (fix allow notes const was used to hide) +UPDATE llx_const SET name = 'MAIN_LIST_HIDE_PUBLIC_NOTES' WHERE name = 'MAIN_LIST_ALLOW_PUBLIC_NOTES'; +UPDATE llx_const SET name = 'MAIN_LIST_HIDE_PRIVATE_NOTES' WHERE name = 'MAIN_LIST_ALLOW_PRIVATE_NOTES'; + + ALTER TABLE llx_projet ADD COLUMN date_start_event datetime; ALTER TABLE llx_projet ADD COLUMN date_end_event datetime; ALTER TABLE llx_projet ADD COLUMN location varchar(255); From 2d7348aff861a851d111333c502c4f09d6a92113 Mon Sep 17 00:00:00 2001 From: emilisev Date: Mon, 24 Oct 2022 20:13:43 +0200 Subject: [PATCH 148/176] Fix Undefined variable $num --- htdocs/adherents/type.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index cc3c697e032..fcdb643a006 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -145,6 +145,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) { $sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle='".$db->escape($object->label)."'"; $sql .= " WHERE entity IN (".getEntity('member_type').")"; $result = $db->query($sql); + $num = null; if ($result) { $num = $db->num_rows($result); } From 5a9901e484b09a980e714200556ae5571ecfe3df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Oct 2022 20:28:36 +0200 Subject: [PATCH 149/176] Clean code of module ticket --- htdocs/core/class/html.formticket.class.php | 4 +- htdocs/ticket/card.php | 3 +- htdocs/ticket/class/api_tickets.class.php | 30 ----- htdocs/ticket/class/ticket.class.php | 142 +------------------- 4 files changed, 7 insertions(+), 172 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 216644876ba..d5484f31829 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -670,7 +670,7 @@ class FormTicket /** * Return html list of tickets type * - * @param string|array $selected Id du type pre-selectionne + * @param string|array $selected Id of preselected field or array of Ids * @param string $htmlname Nom de la zone select * @param string $filtertype To filter on field type in llx_c_ticket_type (array('code'=>xx,'label'=>zz)) * @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code @@ -685,7 +685,7 @@ class FormTicket { global $langs, $user; - $selected = is_array($selected) ? $selected : (!empty($selected) ? implode(',', $selected) : array()); + $selected = is_array($selected) ? $selected : (!empty($selected) ? array($selected) : array()); $ticketstat = new Ticket($this->db); dol_syslog(get_class($this) . "::select_types_tickets " . implode(';', $selected) . ", " . $htmlname . ", " . $filtertype . ", " . $format . ", " . $multiselect, LOG_DEBUG); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 1290a9a9a9b..c9ca9b6622f 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -126,6 +126,8 @@ $permissiontoadd = $user->rights->ticket->write; $actionobject = new ActionsTicket($db); +$upload_dir = $conf->ticket->dir_output; + $now = dol_now(); @@ -682,7 +684,6 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once // Actions to build doc - $upload_dir = $conf->ticket->dir_output; $permissiontoadd = $user->rights->ticket->write; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; //var_dump($action);exit; diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 35e01a74f0d..e7930569bdd 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -181,36 +181,6 @@ class Tickets extends DolibarrApi $this->ticket->messages = $messages; } - // History - $history = array(); - $this->ticket->loadCacheLogsTicket(); - if (is_array($this->ticket->cache_logs_ticket) && count($this->ticket->cache_logs_ticket) > 0) { - $num = count($this->ticket->cache_logs_ticket); - $i = 0; - $user_action = new User($this->db); - - while ($i < $num) { - $userstring = ''; - if ($this->ticket->cache_logs_ticket[$i]['fk_user_create'] > 0) { - $user_action->fetch($this->ticket->cache_logs_ticket[$i]['fk_user_create']); - - $userstring = dolGetFirstLastname($user_action->firstname, $user_action->lastname); - } - - // Now define messages - $history[] = array( - 'id' => $this->ticket->cache_logs_ticket[$i]['id'], - 'fk_user_author' => $this->ticket->cache_msgs_ticket[$i]['fk_user_author'], - 'fk_user_action' => $this->ticket->cache_logs_ticket[$i]['fk_user_create'], - 'fk_user_action_string' => $userstring, - 'message' => $this->ticket->cache_logs_ticket[$i]['message'], - 'datec' => $this->ticket->cache_logs_ticket[$i]['datec'], - ); - $i++; - } - $this->ticket->history = $history; - } - if (!DolibarrApi::_checkAccessToResource('ticket', $this->ticket->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 4a03098b57c..276196bc035 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1580,144 +1580,6 @@ class Ticket extends CommonObject } } - - /** - * Send notification of changes by email - * - * @param User $user User that create - * @param string $message Log message - * @return int <0 if KO, >0 if OK (number of emails sent) - */ - private function sendLogByEmail($user, $message) - { - global $conf, $langs; - - $nb_sent = 0; - - $langs->load('ticket'); - - // Retrieve email of all contacts (internal and external) - $contacts = $this->listeContact(-1, 'internal'); - $contacts = array_merge($contacts, $this->listeContact(-1, 'external')); - - /* If origin_email and no socid, we add email to the list * */ - if (!empty($this->origin_email) && empty($this->fk_soc)) { - $array_ext = array(array('firstname' => '', 'lastname' => '', 'email' => $this->origin_email, 'libelle' => $langs->transnoentities('TicketEmailOriginIssuer'), 'socid' => "-1")); - $contacts = array_merge($contacts, $array_ext); - } - - if (!empty($this->fk_soc)) { - $this->fetch_thirdparty($this->fk_soc); - $array_company = array(array('firstname' => '', 'lastname' => $this->client->name, 'email' => $this->client->email, 'libelle' => $langs->transnoentities('Customer'), 'socid' => $this->client->id)); - $contacts = array_merge($contacts, $array_company); - } - - // foreach contact send email with notification message - if (count($contacts) > 0) { - foreach ($contacts as $key => $info_sendto) { - $tmpmessage = ''; - $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNotificationEmailSubject', $this->track_id); - $tmpmessage .= $langs->transnoentities('TicketNotificationEmailBody', $this->track_id)."\n\n"; - $tmpmessage .= $langs->transnoentities('Title').' : '.$this->subject."\n"; - - $recipient_name = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1'); - $recipient = (!empty($recipient_name) ? $recipient_name : $info_sendto['email']).' ('.strtolower($info_sendto['libelle']).')'; - $tmpmessage .= $langs->transnoentities('TicketNotificationRecipient').' : '.$recipient."\n"; - $tmpmessage .= "\n"; - $tmpmessage .= '* '.$langs->transnoentities('TicketNotificationLogMessage').' *'."\n"; - $tmpmessage .= dol_html_entity_decode($message, ENT_QUOTES | ENT_HTML5)."\n"; - - if ($info_sendto['source'] == 'internal') { - $url_internal_ticket = dol_buildpath('/ticket/card.php', 2).'?track_id='.$this->track_id; - $tmpmessage .= "\n".$langs->transnoentities('TicketNotificationEmailBodyInfosTrackUrlinternal').' : '.$this->track_id.''."\n"; - } else { - $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$this->track_id; - $tmpmessage .= "\n".$langs->transnoentities('TicketNewEmailBodyInfosTrackUrlCustomer').' : '.$this->track_id.''."\n"; - } - - $tmpmessage .= "\n"; - $tmpmessage .= $langs->transnoentities('TicketEmailPleaseDoNotReplyToThisEmail')."\n"; - - $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; - $replyto = $from; - - // Init to avoid errors - $filepath = array(); - $filename = array(); - $mimetype = array(); - - $tmpmessage = dol_nl2br($tmpmessage); - - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; - $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; - } - include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $sendtocc = ''; - $deliveryreceipt = 0; - $mailfile = new CMailFile($subject, $info_sendto['email'], $from, $tmpmessage, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, 0); - if ($mailfile->error || !empty($mailfile->errors)) { - setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - } else { - $result = $mailfile->sendfile(); - if ($result > 0) { - $nb_sent++; - } - } - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; - } - } - - setEventMessages($langs->trans('TicketNotificationNumberEmailSent', $nb_sent), null, 'mesgs'); - } - - return $nb_sent; - } - - /** - * Charge la liste des actions sur le ticket - * - * @return int Number of lines loaded, 0 if already loaded, <0 if KO - */ - public function loadCacheLogsTicket() - { - global $langs; - - if (is_array($this->cache_logs_ticket) && count($this->cache_logs_ticket)) { - return 0; - } - // Cache deja charge - - // TODO Read the table llx_actioncomm - /* - $sql = "SELECT rowid, fk_user_create, datec, message"; - $sql .= " FROM " . MAIN_DB_PREFIX . "ticket_logs"; - $sql .= " WHERE fk_track_id ='" . $this->db->escape($this->track_id) . "'"; - $sql .= " ORDER BY datec DESC"; - - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < $num) { - $obj = $this->db->fetch_object($resql); - $this->cache_logs_ticket[$i]['id'] = $obj->rowid; - $this->cache_logs_ticket[$i]['fk_user_create'] = $obj->fk_user_create; - $this->cache_logs_ticket[$i]['datec'] = $this->db->jdate($obj->datec); - $this->cache_logs_ticket[$i]['message'] = $obj->message; - $i++; - } - return $num; - } else { - $this->error = "Error " . $this->db->lasterror(); - dol_syslog(get_class($this) . "::loadCacheLogsTicket " . $this->error, LOG_ERR); - return -1; - }*/ - - return 0; - } - /** * Add message into database * @@ -2869,9 +2731,11 @@ class Ticket extends CommonObject $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; } + $upload_dir_tmp = $conf->user->dir_output."/".$user->id; + include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; $trackid = "tic".$this->id; - $mailfile = new CMailFile($subject, $receiver, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid, '', 'ticket'); + $mailfile = new CMailFile($subject, $receiver, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid, '', 'ticket', '', $upload_dir_tmp); if ($mailfile->error) { setEventMessages($mailfile->error, null, 'errors'); } else { From afc452b2742568de66c795e8b3aa127c56776ecd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Oct 2022 20:30:58 +0200 Subject: [PATCH 150/176] Fix tmp --- htdocs/ticket/class/ticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 276196bc035..3a6adeb6c20 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2731,7 +2731,7 @@ class Ticket extends CommonObject $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; } - $upload_dir_tmp = $conf->user->dir_output."/".$user->id; + $upload_dir_tmp = $conf->user->dir_output."/".$user->id.'/temp'; include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; $trackid = "tic".$this->id; From dba982fcb96c205f239b79ee72ea83f5b5211037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milise=20Prim?= Date: Mon, 24 Oct 2022 21:13:04 +0200 Subject: [PATCH 151/176] FIX Undefined property: stdClass::$email --- htdocs/core/boxes/box_birthdays_members.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/boxes/box_birthdays_members.php b/htdocs/core/boxes/box_birthdays_members.php index 6138664db2d..df8e51f348f 100644 --- a/htdocs/core/boxes/box_birthdays_members.php +++ b/htdocs/core/boxes/box_birthdays_members.php @@ -104,7 +104,6 @@ class box_birthdays_members extends ModeleBoxes $memberstatic->id = $objp->rowid; $memberstatic->firstname = $objp->firstname; $memberstatic->lastname = $objp->lastname; - $memberstatic->email = $objp->email; $dateb = $this->db->jdate($objp->birth); $age = date('Y', dol_now()) - date('Y', $dateb); From c4444e76c9009fc166a7e5508a941f3c19562247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milise=20Prim?= Date: Mon, 24 Oct 2022 21:53:10 +0200 Subject: [PATCH 152/176] FIX Undefined variable $backtopage --- htdocs/core/actions_linkedfiles.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index b89d5bf6cb0..93d1e8463ec 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -160,7 +160,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes' && !empty($permissionto } if (is_object($object) && $object->id > 0) { - if ($backtopage) { + if (isset($backtopage)) { header('Location: '.$backtopage); exit; } else { From 68e1509834ae501c58d9af4646f5d10a7a526595 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Oct 2022 22:38:45 +0200 Subject: [PATCH 153/176] Fix ckeditor --- htdocs/admin/fckeditor.php | 10 ++++++++-- htdocs/langs/en_US/admin.lang | 3 ++- htdocs/langs/fr_FR/admin.lang | 3 ++- htdocs/theme/eldy/ckeditor/config.js | 1 + htdocs/theme/md/ckeditor/config.js | 1 + 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index eeeb5035e16..94b210c627f 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -166,7 +166,12 @@ if (empty($conf->use_javascript_ajax)) { print ''."\n"; print ''; print ''; - print ''; + print ''; print '\n"; - // Signature print ''; print ''; + // Note private + print '\n"; + + // Note private + print '\n"; print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.img_object("", $picto[$const]).''.$langs->trans($desc).''; + print $langs->trans($desc); + if ($const == 'DETAILS') { + print '
'.$langs->trans("FCKeditorForProductDetails2").''; + } + print '
'; $value = (isset($conf->global->$constante) ? $conf->global->$constante : 0); if ($value == 0) { @@ -185,6 +190,7 @@ if (empty($conf->use_javascript_ajax)) { print '
'."\n"; print ''; + print ''; // Skins show_skin(null, 1); @@ -219,7 +225,7 @@ if (empty($conf->use_javascript_ajax)) { print $conf->global->FCKEDITOR_TEST; print ''; } - print $form->buttonsSaveCancel("Save", ''); + print $form->buttonsSaveCancel("Save", '', null, 0, 'reposition'); print '
'; print '
'."\n"; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e8f8f5bac6d..1881ef9a459 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1748,7 +1748,8 @@ FCKeditorForNotePublic=WYSIWIG creation/edition of the field "public notes" of e FCKeditorForNotePrivate=WYSIWIG creation/edition of the field "private notes" of elements FCKeditorForCompany=WYSIWIG creation/edition of the field description of elements (except products/services) FCKeditorForProduct=WYSIWIG creation/edition of the field description of products/services -FCKeditorForProductDetails=WYSIWIG creation/edition of products details lines for all entities (proposals, orders, invoices, etc...). Warning: Using this option for this case is seriously not recommended as it can create problems with special characters and page formatting when building PDF files. +FCKeditorForProductDetails=WYSIWIG creation/edition of products details lines for all entities (proposals, orders, invoices, etc...). +FCKeditorForProductDetails2=Warning: Using this option for this case is seriously not recommended as it can create problems with special characters and page formatting when building PDF files. FCKeditorForMailing= WYSIWIG creation/edition for mass eMailings (Tools->eMailing) FCKeditorForUserSignature=WYSIWIG creation/edition of user signature FCKeditorForMail=WYSIWIG creation/edition for all mail (except Tools->eMailing) diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 3f45fc1643d..8edc331780b 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1747,7 +1747,8 @@ FCKeditorForNotePublic=Création/édition WYSIWIG du champ notes publiques des FCKeditorForNotePrivate=Création/édition WYSIWIG du champ notes privées des éléments FCKeditorForCompany=Création/édition WYSIWIG de la description des éléments (autre que produits/services) FCKeditorForProduct=Création/édition WYSIWIG du champ description des produits/services -FCKeditorForProductDetails=Création/édition WYSIWYG des lignes de détails produits sur tous les éléments (commandes, propales, factures, etc...). Attention: L'utilisation pour ce cas est fortement déconseillée car peut créer des problèmes dans la gestion de caractères et mise en page des fichiers PDF générés. +FCKeditorForProductDetails=Création/édition WYSIWYG des lignes de détails produits sur tous les éléments (commandes, propales, factures, etc...). +FCKeditorForProductDetails2=Attention: L'utilisation pour ce cas est fortement déconseillée car peut créer des problèmes dans la gestion de caractères et mise en page des fichiers PDF générés. FCKeditorForMailing= Création/édition WYSIWIG des emailings (Outils->Emailings) FCKeditorForUserSignature=Création/édition WYSIWIG de la signature des utilisateurs FCKeditorForMail=Création/édition WYSIWIG tous les emails (sauf Outils->Emailings) diff --git a/htdocs/theme/eldy/ckeditor/config.js b/htdocs/theme/eldy/ckeditor/config.js index d2a87a4a4d8..6dce53be431 100644 --- a/htdocs/theme/eldy/ckeditor/config.js +++ b/htdocs/theme/eldy/ckeditor/config.js @@ -100,6 +100,7 @@ CKEDITOR.editorConfig = function( config ) [ ['Maximize'], ['Find'], + ['Image'], ['Source'] ]; }; diff --git a/htdocs/theme/md/ckeditor/config.js b/htdocs/theme/md/ckeditor/config.js index e463e6db9a3..c7e10f9a123 100644 --- a/htdocs/theme/md/ckeditor/config.js +++ b/htdocs/theme/md/ckeditor/config.js @@ -100,6 +100,7 @@ CKEDITOR.editorConfig = function( config ) [ ['Maximize'], ['Find'], + ['Image'], ['Source'] ]; }; From 1618bfc90293947c118768bfb0bd3700b4a2d344 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Oct 2022 10:53:19 +0200 Subject: [PATCH 154/176] Debug v17 --- htdocs/core/lib/usergroups.lib.php | 5 ++++- htdocs/core/tpl/notes.tpl.php | 5 ----- htdocs/user/card.php | 30 +++++++++++++++++++----------- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 868a5af0d51..273e7285273 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -157,7 +157,10 @@ function user_prepare_head(User $object) if (empty($user->socid)) { // Notes $nbNote = 0; - if (!empty($object->note)) { + if (!empty($object->note_public)) { + $nbNote++; + } + if (!empty($object->note_private)) { $nbNote++; } $head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id; diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index 9a9c5866023..a81c95251f4 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -96,11 +96,6 @@ if ($module == 'propal') { } //else dol_print_error('','Bad value '.$module.' for param module'); -if (isModEnabled('fckeditor') && !empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { - $typeofdata = 'ckeditor:dolibarr_notes:100%:200::1:12:95%:0'; // Rem: This var is for all notes, not only thirdparties note. -} else { - $typeofdata = 'textarea:12:95%'; -} if (isModEnabled('fckeditor') && !empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC)) { $typeofdatapub = 'ckeditor:dolibarr_notes:100%:200::1:12:95%:0'; // Rem: This var is for all notes, not only thirdparties note. } else { diff --git a/htdocs/user/card.php b/htdocs/user/card.php index a539dad3505..338a3bbd1e9 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -276,8 +276,8 @@ if (empty($reshook)) { $object->job = GETPOST("job", 'alphanohtml'); $object->signature = GETPOST("signature", 'restricthtml'); $object->accountancy_code = GETPOST("accountancy_code", 'alphanohtml'); - $object->note = GETPOST("note", 'restricthtml'); - $object->note_private = GETPOST("note", 'restricthtml'); + $object->note_public = GETPOST("note_public", 'restricthtml'); + $object->note_private = GETPOST("note_private", 'restricthtml'); $object->ldap_sid = GETPOST("ldap_sid", 'alphanohtml'); $object->fk_user = GETPOST("fk_user", 'int') > 0 ? GETPOST("fk_user", 'int') : 0; $object->fk_user_expense_validator = GETPOST("fk_user_expense_validator", 'int') > 0 ? GETPOST("fk_user_expense_validator", 'int') : 0; @@ -1205,15 +1205,6 @@ if ($action == 'create' || $action == 'adduserldap') { $parameters = array(); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; - // Note - print '
'; - print $langs->trans("Note"); - print ''; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('note', GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : '', '', 120, 'dolibarr_notes', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_SOCIETE'), ROWS_3, '90%'); - $doleditor->Create(); - print "
'.$langs->trans("Signature").''; @@ -1222,6 +1213,23 @@ if ($action == 'create' || $action == 'adduserldap') { print $doleditor->Create(1); print '
'; + print $langs->trans("NotePublic"); + print ''; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor('note_public', GETPOSTISSET('note_public') ? GETPOST('note_public', 'restricthtml') : '', '', 100, 'dolibarr_notes', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_SOCIETE'), ROWS_3, '90%'); + $doleditor->Create(); + print "
'; + print $langs->trans("NotePrivate"); + print ''; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor('note_private', GETPOSTISSET('note_private') ? GETPOST('note_private', 'restricthtml') : '', '', 100, 'dolibarr_notes', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_SOCIETE'), ROWS_3, '90%'); + $doleditor->Create(); + print "

'; From 1f9424a4b314db7c0b9b4930e587170d19056e7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Oct 2022 11:13:34 +0200 Subject: [PATCH 155/176] Clean code/options --- htdocs/adherents/type_translation.php | 4 ++-- htdocs/admin/ticket_public.php | 4 ++-- htdocs/categories/card.php | 2 +- htdocs/categories/traduction.php | 4 ++-- htdocs/core/class/doleditor.class.php | 2 +- htdocs/core/class/html.formticket.class.php | 2 +- htdocs/product/card.php | 5 ++--- htdocs/projet/tasks.php | 18 ++++++--------- htdocs/projet/tasks/task.php | 25 ++++++++++----------- htdocs/user/card.php | 4 ++-- 10 files changed, 32 insertions(+), 38 deletions(-) diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php index 5e1db1233b8..33c93704b80 100644 --- a/htdocs/adherents/type_translation.php +++ b/htdocs/adherents/type_translation.php @@ -226,7 +226,7 @@ if ($action == 'edit') { print '
'; print ''; print ''; print ''; @@ -289,7 +289,7 @@ if ($action == 'create' && $user->rights->adherent->configurer) { print ''; print ''; print ''; diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index 84186e4e226..05938e27d49 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -419,7 +419,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print ''; print ''; print ''; diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 8aecdde63ea..f0f40b4401b 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -267,7 +267,7 @@ if ($action == 'edit') { // Desc $desc = (GETPOST('desc-'.$key) ? GETPOST('desc-'.$key) : $object->multilangs[$key]['description']); print ''; @@ -327,7 +327,7 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service print ''; print ''; print ''; diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index edaf088e949..53a20d6dadd 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -60,7 +60,7 @@ class DolEditor * 'In' = each window has its own toolbar * 'Out:name' = share toolbar into the div called 'name' * @param boolean $toolbarstartexpanded Bar is visible or not at start - * @param int $uselocalbrowser Enabled to add links to local object with local browser. If false, only external images can be added in content. + * @param boolean $uselocalbrowser Enabled to add links to local object with local browser. If false, only external images can be added in content. * @param boolean|string $okforextendededitor True=Allow usage of extended editor tool if qualified (like ckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace. * Warning: If you use 'ace', don't forget to also include ace.js in page header. Also, the button "save" must have class="buttonforacesave". * @param int $rows Size of rows for textarea tool diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index d5484f31829..0e5e6ff9e7c 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1501,7 +1501,7 @@ class FormTicket print ''; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 7c51da5d02a..fdc3b05a82a 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1446,7 +1446,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '"; if (empty($conf->global->PRODUCT_DISABLE_PUBLIC_URL)) { @@ -1620,7 +1619,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '"; @@ -2198,7 +2197,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { print '"; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 18a75449f24..951406b4275 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -774,18 +774,14 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; print ''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 331b29acb96..8b19c8c0519 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -100,8 +100,11 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) { $object->ref = $taskref ? $taskref : GETPOST("ref", 'alpha', 2); $object->label = GETPOST("label", "alphanohtml"); - if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $object->description = GETPOST('description', "alphanohtml"); - else $object->description = GETPOST('description', "restricthtml"); + if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { + $object->description = GETPOST('description', "alphanohtml"); + } else { + $object->description = GETPOST('description', "restricthtml"); + } $object->fk_task_parent = $task_parent; $object->planned_workload = $planned_workload; $object->date_start = dol_mktime(GETPOST('dateohour', 'int'), GETPOST('dateomin', 'int'), 0, GETPOST('dateomonth', 'int'), GETPOST('dateoday', 'int'), GETPOST('dateoyear', 'int')); @@ -491,18 +494,14 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; print ''; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 338a3bbd1e9..905be457810 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1218,7 +1218,7 @@ if ($action == 'create' || $action == 'adduserldap') { print $langs->trans("NotePublic"); print '\n"; @@ -1227,7 +1227,7 @@ if ($action == 'create' || $action == 'adduserldap') { print $langs->trans("NotePrivate"); print '\n"; From 7c892802eb748eb7472ab9eca862eca3f28ad018 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Oct 2022 12:22:43 +0200 Subject: [PATCH 156/176] Debug v17 --- htdocs/core/class/html.form.class.php | 3 ++- htdocs/core/modules/modFckeditor.class.php | 6 +++--- htdocs/core/tpl/objectline_create.tpl.php | 23 +++++++++++---------- htdocs/core/tpl/objectline_edit.tpl.php | 24 ++++++++++++++-------- htdocs/theme/eldy/global.inc.php | 1 + htdocs/theme/md/style.css.php | 1 + 6 files changed, 35 insertions(+), 23 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index daff55c7615..0a1f5f16d6d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6299,7 +6299,7 @@ class Form } if (!$options_only) { - $return .= ''; } $selectedfound = false; @@ -6346,6 +6346,7 @@ class Form if (!$options_only) { $return .= ''; + //$return .= ajax_combobox($htmlname); // This break for the moment dynamic autoselection of a value when selecting a product in object lines } } else { $return .= $this->error; diff --git a/htdocs/core/modules/modFckeditor.class.php b/htdocs/core/modules/modFckeditor.class.php index 8c30d8a0a51..4bfe6c2dd39 100644 --- a/htdocs/core/modules/modFckeditor.class.php +++ b/htdocs/core/modules/modFckeditor.class.php @@ -71,9 +71,9 @@ class modFckeditor extends DolibarrModules $this->const = array(); $this->const[0] = array("FCKEDITOR_ENABLE_SOCIETE", "yesno", "1", "WYSIWIG for the fields descriptions of elements (except products/services)"); $this->const[1] = array("FCKEDITOR_ENABLE_PRODUCTDESC", "yesno", "1", "WYSIWIG for the fields description of products/services"); - $this->const[2] = array("FCKEDITOR_ENABLE_MAILING", "yesno", "1", "WYSIWIG for mass emailings"); - $this->const[3] = array("FCKEDITOR_ENABLE_DETAILS", "yesno", "1", "WYSIWIG for products details lines for all entities"); - $this->const[4] = array("FCKEDITOR_ENABLE_USERSIGN", "yesno", "1", "WYSIWIG for user signature"); + $this->const[2] = array("FCKEDITOR_ENABLE_DETAILS", "yesno", "1", "WYSIWIG for products details lines for all entities"); + $this->const[3] = array("FCKEDITOR_ENABLE_USERSIGN", "yesno", "1", "WYSIWIG for user signature"); + $this->const[4] = array("FCKEDITOR_ENABLE_MAILING", "yesno", "1", "WYSIWIG for mass emailings"); $this->const[5] = array("FCKEDITOR_ENABLE_MAIL", "yesno", "1", "WYSIWIG for products details lines for all entities"); $this->const[6] = array("FCKEDITOR_SKIN", "string", "moono-lisa", "Skin by default for fckeditor"); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 4ec5fcc02c6..381683cf62c 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -413,13 +413,14 @@ if ($nolinesbefore) { $coldisplay++; ?> - global->PRODUCT_USE_UNITS)) { @@ -434,11 +435,12 @@ if ($nolinesbefore) { } $coldisplay++; ?> - + + situation_cycle_ref) && $this->situation_cycle_ref) { $coldisplay++; - print ''; + print ''; $coldisplay++; print ''; } @@ -456,11 +458,11 @@ if ($nolinesbefore) { global->DISPLAY_MARGIN_RATES)) { - echo ''; + echo ''; $coldisplay++; } if (!empty($conf->global->DISPLAY_MARK_RATES)) { - echo ''; + echo ''; $coldisplay++; } } @@ -498,7 +500,6 @@ if ((isModEnabled("service") || ($object->element == 'contrat')) && $dateSelecto } } - if (!empty($object->element) && $object->element == 'contrat') { print $langs->trans("DateStartPlanned").' '; print $form->selectDate($date_start, "date_start", $usehm, $usehm, 1, "addproduct"); @@ -521,8 +522,8 @@ if ((isModEnabled("service") || ($object->element == 'contrat')) && $dateSelecto ?> function prefill_service_dates() { - $('#date_start').val("").trigger('change'); - $('#date_end').val("").trigger('change'); + $('#date_start').val("").trigger('change'); + $('#date_end').val("").trigger('change'); return false; // Prevent default link behaviour (which is go to href URL) } @@ -735,7 +736,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) { // Get the HT price for the product and display it console.log("Load unit price without tax and set it into #price_ht for product id="+$(this).val()+" socid=socid; ?>"); $.post('/product/ajax/products.php?action=fetch', - { 'id': $(this).val(), 'socid': socid; ?> }, + { 'id': $(this).val(), 'socid': socid; ?>, 'token': '' }, function(data) { console.log("objectline_create.tpl Load unit price end, we got value ht="+data.price_ht+" ttc="+data.price_ttc+" pricebasetype="+data.pricebasetype); @@ -875,7 +876,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) { } options += ''; }); - options += ''; + options += ''; console.log("finally selected defaultkey="+defaultkey+" defaultprice for buying price="+defaultprice); diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index c8188c82bb8..1a9f028c263 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -200,9 +200,12 @@ $coldisplay++; '.$form->load_tva('tva_tx', GETPOSTISSET('tva_tx') ? GETPOST('tva_tx', 'alpha') : ($line->tva_tx.($line->vat_src_code ? (' ('.$line->vat_src_code.')') : '')), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1).''; + print ''; } else { print ''; } @@ -266,24 +269,29 @@ $coldisplay++; ?> + situation_cycle_ref) { $coldisplay++; print ''; $coldisplay++; print ''; } + if (!empty($usemargins)) { if (!empty($user->rights->margins->creer)) { $coldisplay++; @@ -303,9 +311,9 @@ $coldisplay++; $margin_rate = (GETPOSTISSET("np_marginRate") ? GETPOST("np_marginRate", "alpha", 2) : (($line->pa_ht == 0) ? '' : price($line->marge_tx))); // if credit note, dont allow to modify margin if ($line->subprice < 0) { - echo ''; + echo ''; } else { - echo ''; + echo ''; } $coldisplay++; } @@ -313,9 +321,9 @@ $coldisplay++; $mark_rate = (GETPOSTISSET("np_markRate") ? GETPOST("np_markRate", 'alpha', 2) : price($line->marque_tx)); // if credit note, dont allow to modify margin if ($line->subprice < 0) { - echo ''; + echo ''; } else { - echo ''; + echo ''; } $coldisplay++; } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 05f00488123..d2395cc6f02 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1583,6 +1583,7 @@ table[summary="list_of_modules"] .fa-cog { .widthauto { width: auto; } .width20 { width: 20px; } .width25 { width: 25px; } +.width40 { width: 40px; } .width50 { width: 50px; } .width75 { width: 75px; } .width100 { width: 100px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index df1bd11dc4f..da4b905e329 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1677,6 +1677,7 @@ tr.nobottom td { .widthauto { width: auto; } .width20 { width: 20px; } .width25 { width: 25px; } +.width40 { width: 40px; } .width50 { width: 50px; } .width75 { width: 75px; } .width100 { width: 100px; } From 1954e5a1aba0c651c56c35515184ffa2b45ff50d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Oct 2022 14:39:19 +0200 Subject: [PATCH 157/176] Update actions_linkedfiles.inc.php --- htdocs/core/actions_linkedfiles.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 93d1e8463ec..4e2cd2873b6 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -160,7 +160,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes' && !empty($permissionto } if (is_object($object) && $object->id > 0) { - if (isset($backtopage)) { + if (!empty($backtopage)) { header('Location: '.$backtopage); exit; } else { From 3059bfdd6055d5392b9fef84c82b11f87bda4dce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Oct 2022 16:33:25 +0200 Subject: [PATCH 158/176] Better responsive --- htdocs/admin/fckeditor.php | 2 +- htdocs/theme/eldy/global.inc.php | 4 +++- htdocs/theme/md/style.css.php | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 94b210c627f..f43ddb281bd 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -51,7 +51,7 @@ $modules = array( 'NOTE_PUBLIC' => 'FCKeditorForNotePublic', 'NOTE_PRIVATE' => 'FCKeditorForNotePrivate', 'SOCIETE' => 'FCKeditorForCompany', - 'PRODUCTDESC' => 'FCKeditorForProduct', + //'PRODUCTDESC' => 'FCKeditorForProduct', 'DETAILS' => 'FCKeditorForProductDetails', 'USERSIGN' => 'FCKeditorForUserSignature', 'MAILING' => 'FCKeditorForMailing', diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index d2395cc6f02..f2cea00230d 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5618,7 +5618,9 @@ a.cke_dialog_ui_button .cke_dialog_ui_hbox_first { vertical-align: middle !important; } - +.cke_combo_text { + width: 40px !important; +} /* .cke_editable { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index da4b905e329..002166968cd 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5461,6 +5461,9 @@ a.cke_dialog_ui_button { vertical-align: bottom !important; } +.cke_combo_text { + width: 40px !important; +} /* .cke_editable { From 013d2429430d8aa35d7f2d91300c126b7ea00ec4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Oct 2022 17:16:14 +0200 Subject: [PATCH 159/176] Merge FCKEDITOR_ENABLE_DETAILS and FCKEDITOR_ENABLE_PRODUCTDESC. The 2 options has similar effect, only one in code is required. --- htdocs/core/modules/modFckeditor.class.php | 1 - htdocs/langs/en_US/admin.lang | 3 +-- htdocs/product/card.php | 4 ++-- htdocs/product/fournisseurs.php | 2 +- htdocs/product/traduction.php | 8 ++++---- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/modFckeditor.class.php b/htdocs/core/modules/modFckeditor.class.php index 4bfe6c2dd39..fa3a66c37cc 100644 --- a/htdocs/core/modules/modFckeditor.class.php +++ b/htdocs/core/modules/modFckeditor.class.php @@ -70,7 +70,6 @@ class modFckeditor extends DolibarrModules // Constants $this->const = array(); $this->const[0] = array("FCKEDITOR_ENABLE_SOCIETE", "yesno", "1", "WYSIWIG for the fields descriptions of elements (except products/services)"); - $this->const[1] = array("FCKEDITOR_ENABLE_PRODUCTDESC", "yesno", "1", "WYSIWIG for the fields description of products/services"); $this->const[2] = array("FCKEDITOR_ENABLE_DETAILS", "yesno", "1", "WYSIWIG for products details lines for all entities"); $this->const[3] = array("FCKEDITOR_ENABLE_USERSIGN", "yesno", "1", "WYSIWIG for user signature"); $this->const[4] = array("FCKEDITOR_ENABLE_MAILING", "yesno", "1", "WYSIWIG for mass emailings"); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 1881ef9a459..90ca6c15362 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1747,8 +1747,7 @@ ActivateFCKeditor=Activate advanced editor for: FCKeditorForNotePublic=WYSIWIG creation/edition of the field "public notes" of elements FCKeditorForNotePrivate=WYSIWIG creation/edition of the field "private notes" of elements FCKeditorForCompany=WYSIWIG creation/edition of the field description of elements (except products/services) -FCKeditorForProduct=WYSIWIG creation/edition of the field description of products/services -FCKeditorForProductDetails=WYSIWIG creation/edition of products details lines for all entities (proposals, orders, invoices, etc...). +FCKeditorForProductDetails=WYSIWIG creation/edition of products description or lines for objects (lines of proposals, orders, invoices, etc...). FCKeditorForProductDetails2=Warning: Using this option for this case is seriously not recommended as it can create problems with special characters and page formatting when building PDF files. FCKeditorForMailing= WYSIWIG creation/edition for mass eMailings (Tools->eMailing) FCKeditorForUserSignature=WYSIWIG creation/edition of user signature diff --git a/htdocs/product/card.php b/htdocs/product/card.php index fdc3b05a82a..c1be61741bb 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1444,7 +1444,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Description (used in invoice, propal...) print '"; @@ -2006,7 +2006,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '"; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 034fa97f86f..2ccdc7409f3 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -821,7 +821,7 @@ END; print ''; print ''; diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 3f536b6761a..ba4dc956d08 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -265,12 +265,12 @@ if ($action == 'edit') { print '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; - $doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_3, '90%'); + $doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_3, '90%'); $doleditor->Create(); print '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; - $doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_3, '90%'); + $doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, ROWS_3, '90%'); $doleditor->Create(); print '
'.$langs->trans("TicketPublicInterfaceTextHomeLabelAdmin").''; print ''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_2, 70); + $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_TICKET'), ROWS_2, 70); $doleditor->Create(); print ''; @@ -431,7 +431,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print '
'.$langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin").''; print ''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message, '100%', 180, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_2, 70); + $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message, '100%', 180, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_TICKET'), ROWS_2, 70); $doleditor->Create(); print ''; diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index 7f04c6d1005..c94e464a762 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -247,7 +247,7 @@ if ($user->rights->categorie->creer) { // Description print '
'.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('description', $description, '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_5, '90%'); + $doleditor = new DolEditor('description', $description, '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_5, '90%'); $doleditor->Create(); print '
'.$langs->trans('Description').''; - $doleditor = new DolEditor("desc-$key", $desc, '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_3, '90%'); + $doleditor = new DolEditor("desc-$key", $desc, '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_3, '90%'); $doleditor->Create(); print '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; - $doleditor = new DolEditor('desc', GETPOST('desc', 'restricthtml'), '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_3, '90%'); + $doleditor = new DolEditor('desc', GETPOST('desc', 'restricthtml'), '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_3, '90%'); $doleditor->Create(); print '
'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('mail_intro', $mail_intro, '100%', 90, 'dolibarr_details', '', false, $uselocalbrowser, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_2, 70); + $doleditor = new DolEditor('mail_intro', $mail_intro, '100%', 90, 'dolibarr_details', '', false, $uselocalbrowser, getDolGlobalInt('FCKEDITOR_ENABLE_TICKET'), ROWS_2, 70); $doleditor->Create(); print '
'.$langs->trans("Description").''; $doleditor = new DolEditor('desc', GETPOST('desc', 'restricthtml'), '', 160, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_4, '90%'); $doleditor->Create(); - print "
'.$langs->trans("NoteNotVisibleOnBill").''; // We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF. - $doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 140, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_8, '90%'); + $doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 140, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_8, '90%'); $doleditor->Create(); print "
'.$langs->trans("NoteNotVisibleOnBill").''; - $doleditor = new DolEditor('note_private', $object->note_private, '', 140, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_4, '90%'); + $doleditor = new DolEditor('note_private', $object->note_private, '', 140, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_4, '90%'); $doleditor->Create(); print "
'.$langs->trans("Description").''; - if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { - print ''; - } else { - // WYSIWYG editor - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); - if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { - $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; - } - $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); - print $doleditor->Create(); + // WYSIWYG editor + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_SOCIETE) ? $conf->global->FCKEDITOR_ENABLE_SOCIETE : 0); + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { + $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; } + $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); + print $doleditor->Create(); print '
'.$langs->trans("Description").''; - if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { - print ''; - } else { - // WYSIWYG editor - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); - if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { - $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; - } - $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); - print $doleditor->Create(); + // WYSIWYG editor + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_SOCIETE) ? $conf->global->FCKEDITOR_ENABLE_SOCIETE : 0); + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { + $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; } + $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); + print $doleditor->Create(); print '
'.$langs->trans("Budget").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('note_public', GETPOSTISSET('note_public') ? GETPOST('note_public', 'restricthtml') : '', '', 100, 'dolibarr_notes', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_SOCIETE'), ROWS_3, '90%'); + $doleditor = new DolEditor('note_public', GETPOSTISSET('note_public') ? GETPOST('note_public', 'restricthtml') : '', '', 100, 'dolibarr_notes', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC'), ROWS_3, '90%'); $doleditor->Create(); print "
'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('note_private', GETPOSTISSET('note_private') ? GETPOST('note_private', 'restricthtml') : '', '', 100, 'dolibarr_notes', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_SOCIETE'), ROWS_3, '90%'); + $doleditor = new DolEditor('note_private', GETPOSTISSET('note_private') ? GETPOST('note_private', 'restricthtml') : '', '', 100, 'dolibarr_notes', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_3, '90%'); $doleditor->Create(); print "
- "> + "> "> + + "> ">%">% %% %%%%'; + print $form->load_tva('tva_tx', GETPOSTISSET('tva_tx') ? GETPOST('tva_tx', 'alpha') : ($line->tva_tx.($line->vat_src_code ? (' ('.$line->vat_src_code.')') : '')), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1); + print '% - info_bits & 2) != 2) { - print '%'; + print '>%'; } else { ?>   %'.$margin_rate.'%'.$margin_rate.'%%%'.$mark_rate.'%'.$mark_rate.'%%%
'.$langs->trans("Description").''; - $doleditor = new DolEditor('desc', GETPOST('desc', 'restricthtml'), '', 160, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_4, '90%'); + $doleditor = new DolEditor('desc', GETPOST('desc', 'restricthtml'), '', 160, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_DETAILS'), ROWS_4, '90%'); $doleditor->Create(); print "
'.$langs->trans("Description").''; // We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF. - $doleditor = new DolEditor('desc', GETPOSTISSET('desc') ? GETPOST('desc', 'restricthtml') : $object->description, '', 160, 'dolibarr_details', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_4, '90%'); + $doleditor = new DolEditor('desc', GETPOSTISSET('desc') ? GETPOST('desc', 'restricthtml') : $object->description, '', 160, 'dolibarr_details', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_DETAILS'), ROWS_4, '90%'); $doleditor->Create(); print "
'.$langs->trans('ProductSupplierDescription').''; - $doleditor = new DolEditor('supplier_description', $object->desc_supplier, '', 160, 'dolibarr_details', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_4, '90%'); + $doleditor = new DolEditor('supplier_description', $object->desc_supplier, '', 160, 'dolibarr_details', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_DETAILS'), ROWS_4, '90%'); $doleditor->Create(); print '
'; print ''; print ''; if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { print ''; @@ -336,13 +336,13 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service print ''; print ''; print ''; // Other field (not used) if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { print ''; } From 06fcf5312fca7d9fdcb0cf76458407be422ee1c4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Oct 2022 17:30:50 +0200 Subject: [PATCH 160/176] Close #22512 manually due to error in sticket (missing space after cast) --- .../install/mysql/tables/llx_emailcollector_emailcollector.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql b/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql index f13fff71a6f..4119e7aac08 100644 --- a/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql +++ b/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql @@ -28,7 +28,7 @@ CREATE TABLE llx_emailcollector_emailcollector( acces_type integer DEFAULT 0, oauth_service varchar(128), password varchar(128), - source_directory varchar(255) NOT NULL, + source_directory varchar(255) DEFAULT 'Inbox' NOT NULL, target_directory varchar(255), maxemailpercollect integer DEFAULT 100, datelastresult datetime, From 1e8f5b475397be5a6102f4bdcc3c9cad4c4983d5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Oct 2022 19:39:59 +0200 Subject: [PATCH 161/176] Rename page of agenda to follow same naming than other elements --- htdocs/core/lib/functions.lib.php | 3 ++- htdocs/core/lib/project.lib.php | 2 +- htdocs/projet/{info.php => agenda.php} | 2 +- htdocs/projet/messaging.php | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) rename htdocs/projet/{info.php => agenda.php} (99%) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 14f43f24034..46a61e60a61 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11470,6 +11470,7 @@ function getActionCommEcmList($object) } + /** * Show html area with actions in messaging format. * Note: Global parameter $param must be defined. @@ -11766,7 +11767,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n } } - // Set $out to sow events + // Set $out to show events $out = ''; if (!isModEnabled('agenda')) { diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index a7cd6520abb..d427f87189a 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -311,7 +311,7 @@ function project_prepare_head(Project $project, $moreparam = '') $h++; } - $head[$h][0] = DOL_URL_ROOT.'/projet/info.php?id='.$project->id; + $head[$h][0] = DOL_URL_ROOT.'/projet/messaging.php?id='.$project->id; $head[$h][1] = $langs->trans("Events"); if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { $head[$h][1] .= '/'; diff --git a/htdocs/projet/info.php b/htdocs/projet/agenda.php similarity index 99% rename from htdocs/projet/info.php rename to htdocs/projet/agenda.php index f8ac6301f99..a3c120d0a23 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/agenda.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/projet/info.php + * \file htdocs/projet/agenda.php * \ingroup project * \brief Page with events on project */ diff --git a/htdocs/projet/messaging.php b/htdocs/projet/messaging.php index 9200d802794..7fe5b4a0b9d 100644 --- a/htdocs/projet/messaging.php +++ b/htdocs/projet/messaging.php @@ -132,7 +132,7 @@ $morehtmlref = '
'; $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; @@ -180,7 +180,7 @@ if (!empty($object->id)) { $morehtmlcenter .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 2); // Show link to change view in agenda - $messagingUrl = DOL_URL_ROOT.'/projet/info.php?id='.$object->id; + $messagingUrl = DOL_URL_ROOT.'/projet/agenda.php?id='.$object->id; $morehtmlcenter .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1); From f2993f7c0f096181eda79425e06007e11182b1be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Oct 2022 19:54:57 +0200 Subject: [PATCH 162/176] Better fix for #22589 --- htdocs/product/stock/class/mouvementstock.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index b1e184c3fe2..282f09e276e 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -976,11 +976,10 @@ class MouvementStock extends CommonObject if ($origin_type) { // Separate originetype with "@" : left part is class name, right part is module name $origin_type_array = explode('@', $origin_type); - $classname = strtolower($origin_type_array[0]); - $modulename = empty($origin_type_array[1]) ? $classname : $origin_type_array[1]; + $classname = ucfirst($origin_type_array[0]); + $modulename = empty($origin_type_array[1]) ? strtolower($classname) : $origin_type_array[1]; $result = dol_include_once('/'.$modulename.'/class/'.strtolower($classname).'.class.php'); if ($result) { - $classname = ucfirst($classname); $origin = new $classname($this->db); } } From 94800e2d0f3c720d043600dc9206ce4e4d2ecbbe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Oct 2022 19:58:53 +0200 Subject: [PATCH 163/176] Update objectline_edit.tpl.php --- htdocs/core/tpl/objectline_edit.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 64404081e54..a92aaef85a2 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -186,7 +186,7 @@ $coldisplay++; ?>
fk_fournprice.'">'); + print ''; } $coldisplay++; From 0e4a4b9e5893aed02c2b5f8d6545d8f92d9de20b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Oct 2022 21:16:29 +0200 Subject: [PATCH 164/176] Fix phpcs error --- htdocs/core/lib/ticket.lib.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index f82c57a0418..5d0d691228e 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -268,4 +268,3 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $ print '
'; } - From 36a9ac414d1fe9c71b2f5f6abbdd946370aa6046 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Oct 2022 00:38:32 +0200 Subject: [PATCH 165/176] FIX The break of option in setup page was not working correctly --- htdocs/admin/workflow.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 10f32eed97d..d18cf067a23 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -79,7 +79,7 @@ $workflowcodes = array( 'picto'=>'ticket' ), - 'separator1'=>array('family'=>'separator', 'position'=>25, 'title'=>''), + 'separator1'=>array('family'=>'separator', 'position'=>25, 'title'=>'', 'enabled'=>((isModEnabled("propal") && isModEnabled('commande')) || (isModEnabled('commande') && isModEnabled('facture')) || (isModEnabled('ticket') && isModEnabled('ficheinter')))), // Automatic classification of proposal 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array( @@ -118,8 +118,6 @@ $workflowcodes = array( 'warning'=>'' ), // For this option, if module invoice is disabled, it does not exists, so "Classify billed" for order must be done manually from order card. - 'separator2'=>array('family'=>'separator', 'position'=>50), - // Automatic classification supplier proposal 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array( 'family'=>'classify_supplier_proposal', @@ -170,17 +168,19 @@ $workflowcodes = array( 'picto' => 'shipment' ), + 'separator2'=>array('family'=>'separator', 'position'=>400, 'enabled' => (isModEnabled('ticket') && isModEnabled('contract'))), + // Automatic link ticket -> contract 'WORKFLOW_TICKET_LINK_CONTRACT' => array( 'family' => 'link_ticket', - 'position' => 75, - 'enabled' => isModEnabled('ticket') && !empty($conf->contract->enabled), + 'position' => 500, + 'enabled' => (isModEnabled('ticket') && isModEnabled('contract')), 'picto' => 'ticket' ), 'WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS' => array( 'family' => 'link_ticket', - 'position' => 76, - 'enabled' => isModEnabled('ticket') && !empty($conf->contract->enabled), + 'position' => 501, + 'enabled' => (isModEnabled('ticket') && isModEnabled('contract')), 'picto' => 'ticket' ), ); From c7e4ca2437329fb226da9991b296e54c5216bb21 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Oct 2022 00:40:41 +0200 Subject: [PATCH 166/176] Right alignement of button --- htdocs/admin/workflow.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index d18cf067a23..2e3473d4a99 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -235,6 +235,7 @@ foreach ($workflowcodes as $key => $params) { continue; } + $reg = array(); if ($oldfamily != $params['family']) { if ($params['family'] == 'create') { $header = $langs->trans("AutomaticCreation"); @@ -269,7 +270,7 @@ foreach ($workflowcodes as $key => $params) { print '
'; print ''; - print ''; + print ''; print ''; $oldfamily = $params['family']; @@ -286,7 +287,7 @@ foreach ($workflowcodes as $key => $params) { print ''; - print '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; - $doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_3, '90%'); + $doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_DETAILS'), ROWS_3, '90%'); $doleditor->Create(); print '
'.$langs->trans('Other').' ('.$langs->trans("NotUsed").')'; - $doleditor = new DolEditor("other-$key", $object->multilangs[$key]["other"], '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_3, '90%'); + $doleditor = new DolEditor("other-$key", $object->multilangs[$key]["other"], '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_DETAILS'), ROWS_3, '90%'); $doleditor->Create(); } print '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; - $doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_3, '90%'); + $doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_DETAILS'), ROWS_3, '90%'); $doleditor->Create(); print '
'.$langs->trans('Other').' ('.$langs->trans("NotUsed").''; - $doleditor = new DolEditor('other', '', '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_3, '90%'); + $doleditor = new DolEditor('other', '', '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_DETAILS'), ROWS_3, '90%'); $doleditor->Create(); print '
'.$header.''.$langs->trans("Status").''.$langs->trans("Status").'
'; + print ''; if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff($key); From fde8d2865fe96fe29374a8fba4bb74bb36736521 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Oct 2022 02:06:02 +0200 Subject: [PATCH 167/176] Add a line into log --- htdocs/public/payment/newpayment.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 0941446b4fc..1c74e3836be 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -342,9 +342,9 @@ $creditor = $mysoc->name; $paramcreditor = 'ONLINE_PAYMENT_CREDITOR'; $paramcreditorlong = 'ONLINE_PAYMENT_CREDITOR_'.$suffix; if (!empty($conf->global->$paramcreditorlong)) { - $creditor = $conf->global->$paramcreditorlong; + $creditor = $conf->global->$paramcreditorlong; // use label long of the seller to show } elseif (!empty($conf->global->$paramcreditor)) { - $creditor = $conf->global->$paramcreditor; + $creditor = $conf->global->$paramcreditor; // use label short of the seller to show } $mesg = ''; @@ -356,6 +356,8 @@ $mesg = ''; // Action dopayment is called after clicking/choosing the payment mode if ($action == 'dopayment') { + dol_syslog("--- newpayment.php Execute action = ".$action." paymentmethod=".$paymentmethod.' amount='.$amount.' newamount='.GETPOST("newamount", 'alpha'), LOG_DEBUG, 0, '_stripe'); + if ($paymentmethod == 'paypal') { $PAYPAL_API_PRICE = price2num(GETPOST("newamount", 'alpha'), 'MT'); $PAYPAL_PAYMENT_TYPE = 'Sale'; From 4b7655b784c155ead43b0a754eb0175156ccd929 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Oct 2022 02:21:04 +0200 Subject: [PATCH 168/176] Fix log --- htdocs/public/payment/newpayment.php | 64 ++++++++++++++-------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 1c74e3836be..0a70c6c5204 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -356,7 +356,7 @@ $mesg = ''; // Action dopayment is called after clicking/choosing the payment mode if ($action == 'dopayment') { - dol_syslog("--- newpayment.php Execute action = ".$action." paymentmethod=".$paymentmethod.' amount='.$amount.' newamount='.GETPOST("newamount", 'alpha'), LOG_DEBUG, 0, '_stripe'); + dol_syslog("--- newpayment.php Execute action = ".$action." paymentmethod=".$paymentmethod.' amount='.$amount.' newamount='.GETPOST("newamount", 'alpha'), LOG_DEBUG, 0, '_payment'); if ($paymentmethod == 'paypal') { $PAYPAL_API_PRICE = price2num(GETPOST("newamount", 'alpha'), 'MT'); @@ -493,9 +493,9 @@ if ($action == 'charge' && isModEnabled('stripe')) { $amountstripe = $amountstripe * 100; } - dol_syslog("--- newpayment.php Execute action = ".$action." STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=".getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION'), LOG_DEBUG, 0, '_stripe'); - dol_syslog("GET=".var_export($_GET, true), LOG_DEBUG, 0, '_stripe'); - dol_syslog("POST=".var_export($_POST, true), LOG_DEBUG, 0, '_stripe'); + dol_syslog("--- newpayment.php Execute action = ".$action." STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=".getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION'), LOG_DEBUG, 0, '_payment'); + dol_syslog("GET=".var_export($_GET, true), LOG_DEBUG, 0, '_payment'); + dol_syslog("POST=".var_export($_POST, true), LOG_DEBUG, 0, '_payment'); $stripeToken = GETPOST("stripeToken", 'alpha'); $email = GETPOST("email", 'alpha'); @@ -505,10 +505,10 @@ if ($action == 'charge' && isModEnabled('stripe')) { $vatnumber = GETPOST('vatnumber', 'alpha'); $savesource = GETPOSTISSET('savesource') ? GETPOST('savesource', 'int') : 1; - dol_syslog("POST stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe'); - dol_syslog("POST email = ".$email, LOG_DEBUG, 0, '_stripe'); - dol_syslog("POST thirdparty_id = ".$thirdparty_id, LOG_DEBUG, 0, '_stripe'); - dol_syslog("POST vatnumber = ".$vatnumber, LOG_DEBUG, 0, '_stripe'); + dol_syslog("POST stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_payment'); + dol_syslog("POST email = ".$email, LOG_DEBUG, 0, '_payment'); + dol_syslog("POST thirdparty_id = ".$thirdparty_id, LOG_DEBUG, 0, '_payment'); + dol_syslog("POST vatnumber = ".$vatnumber, LOG_DEBUG, 0, '_payment'); $error = 0; $errormessage = ''; @@ -529,7 +529,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { } if ($thirdparty_id > 0) { - dol_syslog("Search existing Stripe customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0, '_stripe'); + dol_syslog("Search existing Stripe customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0, '_payment'); $service = 'StripeTest'; $servicestatus = 0; @@ -548,7 +548,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1); if (empty($customer)) { $error++; - dol_syslog('Failed to get/create stripe customer for thirdparty id = '.$thirdparty_id.' and servicestatus = '.$servicestatus.': '.$stripe->error, LOG_ERR, 0, '_stripe'); + dol_syslog('Failed to get/create stripe customer for thirdparty id = '.$thirdparty_id.' and servicestatus = '.$servicestatus.': '.$stripe->error, LOG_ERR, 0, '_payment'); setEventMessages('Failed to get/create stripe customer for thirdparty id = '.$thirdparty_id.' and servicestatus = '.$servicestatus.': '.$stripe->error, null, 'errors'); $action = ''; } @@ -563,7 +563,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { if (empty($card)) { $error++; - dol_syslog('Failed to create card record', LOG_WARNING, 0, '_stripe'); + dol_syslog('Failed to create card record', LOG_WARNING, 0, '_payment'); setEventMessages('Failed to create card record', null, 'errors'); $action = ''; } else { @@ -577,7 +577,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { $metadata["dol_type"] = $dol_type; } - dol_syslog("Create charge on card ".$card->id, LOG_DEBUG, 0, '_stripe'); + dol_syslog("Create charge on card ".$card->id, LOG_DEBUG, 0, '_payment'); $charge = \Stripe\Charge::create(array( 'amount' => price2num($amountstripe, 'MU'), 'currency' => $currency, @@ -591,7 +591,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) if (empty($charge)) { $error++; - dol_syslog('Failed to charge card', LOG_WARNING, 0, '_stripe'); + dol_syslog('Failed to charge card', LOG_WARNING, 0, '_payment'); setEventMessages('Failed to charge card', null, 'errors'); $action = ''; } @@ -609,7 +609,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { if (empty($vatcleaned)) $taxinfo=null; */ - dol_syslog("Create anonymous customer card profile", LOG_DEBUG, 0, '_stripe'); + dol_syslog("Create anonymous customer card profile", LOG_DEBUG, 0, '_payment'); $customer = \Stripe\Customer::create(array( 'email' => $email, @@ -646,7 +646,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { // The customer was just created with a source, so we can make a charge // with no card defined, the source just used for customer creation will be used. - dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe'); + dol_syslog("Create charge", LOG_DEBUG, 0, '_payment'); $charge = \Stripe\Charge::create(array( 'customer' => $customer->id, 'amount' => price2num($amountstripe, 'MU'), @@ -659,7 +659,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) if (empty($charge)) { $error++; - dol_syslog('Failed to charge card', LOG_WARNING, 0, '_stripe'); + dol_syslog('Failed to charge card', LOG_WARNING, 0, '_payment'); setEventMessages('Failed to charge card', null, 'errors'); $action = ''; } @@ -678,21 +678,21 @@ if ($action == 'charge' && isModEnabled('stripe')) { $error++; $errormessage = "ErrorCard ".$e->getMessage()." err=".var_export($err, true); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; } catch (\Stripe\Error\RateLimit $e) { // Too many requests made to the API too quickly $error++; $errormessage = "ErrorRateLimit ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; } catch (\Stripe\Error\InvalidRequest $e) { // Invalid parameters were supplied to Stripe's API $error++; $errormessage = "ErrorInvalidRequest ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; } catch (\Stripe\Error\Authentication $e) { @@ -700,14 +700,14 @@ if ($action == 'charge' && isModEnabled('stripe')) { // (maybe you changed API keys recently) $error++; $errormessage = "ErrorAuthentication ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; } catch (\Stripe\Error\ApiConnection $e) { // Network communication with Stripe failed $error++; $errormessage = "ErrorApiConnection ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; } catch (\Stripe\Error\Base $e) { @@ -715,14 +715,14 @@ if ($action == 'charge' && isModEnabled('stripe')) { // yourself an email $error++; $errormessage = "ErrorBase ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; } catch (Exception $e) { // Something else happened, completely unrelated to Stripe $error++; $errormessage = "ErrorException ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; } @@ -757,7 +757,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { } catch (Exception $e) { $error++; $errormessage = "CantRetrievePaymentIntent ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; } @@ -765,13 +765,13 @@ if ($action == 'charge' && isModEnabled('stripe')) { if ($paymentintent->status != 'succeeded') { $error++; $errormessage = "StatusOfRetrievedIntent is not succeeded: ".$paymentintent->status; - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($paymentintent->status, null, 'errors'); $action = ''; } else { // TODO We can also record the payment mode into llx_societe_rib with stripe $paymentintent->payment_method // Note that with other old Stripe architecture (using Charge API), the payment mode was not recorded, so it is not mandatory to do it here. - //dol_syslog("Create payment_method for ".$paymentintent->payment_method, LOG_DEBUG, 0, '_stripe'); + //dol_syslog("Create payment_method for ".$paymentintent->payment_method, LOG_DEBUG, 0, '_payment'); // Get here amount and currency used for payment and force value into $amount and $currency so the real amount is saved into session instead // of the amount and currency retreived from the POST. @@ -801,11 +801,11 @@ if ($action == 'charge' && isModEnabled('stripe')) { $_SESSION['TRANSACTIONID'] = (is_object($charge) ? $charge->id : (is_object($paymentintent) ? $paymentintent->id : '')); $_SESSION['errormessage'] = $errormessage; - dol_syslog("Action charge stripe STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=".getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION')." ip=".$remoteip, LOG_DEBUG, 0, '_stripe'); - dol_syslog("onlinetoken=".$_SESSION["onlinetoken"]." FinalPaymentAmt=".$_SESSION["FinalPaymentAmt"]." currencyCodeType=".$_SESSION["currencyCodeType"]." payerID=".$_SESSION['payerID']." TRANSACTIONID=".$_SESSION['TRANSACTIONID'], LOG_DEBUG, 0, '_stripe'); - dol_syslog("FULLTAG=".$FULLTAG, LOG_DEBUG, 0, '_stripe'); - dol_syslog("error=".$error." errormessage=".$errormessage, LOG_DEBUG, 0, '_stripe'); - dol_syslog("Now call the redirect to paymentok or paymentko, URL = ".($error ? $urlko : $urlok), LOG_DEBUG, 0, '_stripe'); + dol_syslog("Action charge stripe STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=".getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION')." ip=".$remoteip, LOG_DEBUG, 0, '_payment'); + dol_syslog("onlinetoken=".$_SESSION["onlinetoken"]." FinalPaymentAmt=".$_SESSION["FinalPaymentAmt"]." currencyCodeType=".$_SESSION["currencyCodeType"]." payerID=".$_SESSION['payerID']." TRANSACTIONID=".$_SESSION['TRANSACTIONID'], LOG_DEBUG, 0, '_payment'); + dol_syslog("FULLTAG=".$FULLTAG, LOG_DEBUG, 0, '_payment'); + dol_syslog("error=".$error." errormessage=".$errormessage, LOG_DEBUG, 0, '_payment'); + dol_syslog("Now call the redirect to paymentok or paymentko, URL = ".($error ? $urlko : $urlok), LOG_DEBUG, 0, '_payment'); if ($error) { header("Location: ".$urlko); @@ -834,6 +834,8 @@ $conf->dol_hide_leftmenu = 1; $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); +dol_syslog("newpayment.php show page paymentmethod=".$paymentmethod.' amount='.$amount.' newamount='.GETPOST("newamount", 'alpha'), LOG_DEBUG, 0, '_payment'); + // Check link validity if ($source && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', 'donation_ref', ''))) { $langs->load("errors"); From fb9ec11ffb3e1fbafd4364cdd2f17af42ea57382 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Oct 2022 02:37:08 +0200 Subject: [PATCH 169/176] Deprecated method set_billed() on shipment and reception class has been removed. Use setBilled() instead. --- ChangeLog | 1 + htdocs/admin/workflow.php | 16 ++++++++-------- htdocs/expedition/class/expedition.class.php | 15 --------------- htdocs/reception/class/reception.class.php | 15 --------------- 4 files changed, 9 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2376592a12f..9432bdea4d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,7 @@ Following changes may create regressions for some external modules, but were nec * Trigger ORDER_SUPPLIER_DISPATCH is removed, use ORDER_SUPPLIER_RECEIVE and/or LINEORDER_SUPPLIER_DISPATCH instead. * All functions fetch_all() are deprecated for naming consitency, use fetchAll() instead * Code standardization: $user->rights->propale is now $user->rights->propal everywhere. +* Deprecated method set_billed() on shipment and reception class has been removed. Use setBilled() instead. ***** ChangeLog for 16.0.1 compared to 16.0.0 ***** diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 2e3473d4a99..675815f1dbb 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -152,14 +152,6 @@ $workflowcodes = array( 'warning'=>'' ), - // Automatic classification reception - 'WORKFLOW_BILL_ON_RECEPTION'=>array( - 'family'=>'classify_reception', - 'position'=>80, - 'enabled'=>(isModEnabled("reception") && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), - 'picto'=>'reception' - ), - // Automatic classification shipping 'WORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE' => array( 'family' => 'classify_shipping', @@ -168,6 +160,14 @@ $workflowcodes = array( 'picto' => 'shipment' ), + // Automatic classification reception + 'WORKFLOW_BILL_ON_RECEPTION'=>array( + 'family'=>'classify_reception', + 'position'=>95, + 'enabled'=>(isModEnabled("reception") && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), + 'picto'=>'reception' + ), + 'separator2'=>array('family'=>'separator', 'position'=>400, 'enabled' => (isModEnabled('ticket') && isModEnabled('contract'))), // Automatic link ticket -> contract diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 82ba1d36040..d3981dcf264 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -2243,21 +2243,6 @@ class Expedition extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on) - * - * @deprecated - * @see setBilled() - * @return int <0 if ko, >0 if ok - */ - public function set_billed() - { - // phpcs:enable - dol_syslog(get_class($this)."::set_billed is deprecated, use setBilled instead", LOG_NOTICE); - return $this->setBilled(); - } - /** * Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on) * diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 47b4bcdeb0d..912f2cae93f 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1641,21 +1641,6 @@ class Reception extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Classify the reception as invoiced (used when WORKFLOW_BILL_ON_RECEPTION is on) - * - * @deprecated - * @see setBilled() - * @return int <0 if ko, >0 if ok - */ - public function set_billed() - { - // phpcs:enable - dol_syslog(get_class($this)."::set_billed is deprecated, use setBilled instead", LOG_NOTICE); - return $this->setBilled(); - } - /** * Classify the reception as invoiced (used when WORKFLOW_BILL_ON_RECEPTION is on) * From 035c08536c9cdbca5af4055728081a2aadd6f317 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Oct 2022 03:32:03 +0200 Subject: [PATCH 170/176] Standardization of the name of some constant (customer match supplier) --- htdocs/admin/workflow.php | 2 +- htdocs/core/modules/modWorkflow.class.php | 1 - ...e_20_modWorkflow_WorkflowManager.class.php | 25 +++++++++++++------ htdocs/langs/en_US/workflow.lang | 4 +-- htdocs/reception/class/reception.class.php | 2 +- 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 675815f1dbb..cf55c7b9127 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -161,7 +161,7 @@ $workflowcodes = array( ), // Automatic classification reception - 'WORKFLOW_BILL_ON_RECEPTION'=>array( + 'WORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE'=>array( 'family'=>'classify_reception', 'position'=>95, 'enabled'=>(isModEnabled("reception") && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), diff --git a/htdocs/core/modules/modWorkflow.class.php b/htdocs/core/modules/modWorkflow.class.php index cc7e478e379..58da4876d32 100644 --- a/htdocs/core/modules/modWorkflow.class.php +++ b/htdocs/core/modules/modWorkflow.class.php @@ -93,7 +93,6 @@ class modWorkflow extends DolibarrModules 6=>array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 0, 'current', 0), 7=>array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 0, 'current', 0), 8=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0), - 9=>array('WORKFLOW_BILL_ON_RECEPTION', 'chaine', '1', 'WORKFLOW_BILL_ON_RECEPTION', 0, 'current', 0), 10=>array('WORKFLOW_TICKET_LINK_CONTRACT', 'chaine', '0', 'Automatically link a ticket to available contracts', 0, 'current', 0), 11=>array('WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS', 'chaine', '0', 'Search among parent companies contracts when automatically linking a ticket to available contracts', 0, 'current', 0), 11=>array('WORKFLOW_TICKET_CREATE_INTERVENTION', 'chaine', '1', 'WORKFLOW_TICKET_CREATE_INTERVENTION', 0, 'current', 0) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 119a0122cb6..abaadfc85a8 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -181,14 +181,23 @@ class InterfaceWorkflowManager extends DolibarrTriggers } if (isModEnabled("expedition") && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE)) { - /** @var Facture $object */ $object->fetchObjectLinked('', 'shipping', $object->id, $object->element); - if (!empty($object->linkedObjects)) { - /** @var Expedition $shipment */ - $shipment = array_shift($object->linkedObjects['shipping']); - - $ret = $shipment->setClosed(); + $totalonlinkedelements = 0; + foreach ($object->linkedObjects['shipping'] as $element) { + if ($element->statut == Expedition::STATUS_VALIDATED) { + $totalonlinkedelements += $element->total_ht; + } + } + dol_syslog("Amount of linked shipment = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG); + if ($totalonlinkedelements == $object->total_ht) { + foreach ($object->linkedObjects['shipping'] as $element) { + $ret = $element->setClosed(); + if ($ret < 0) { + return $ret; + } + } + } } } @@ -244,8 +253,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } - // Then set reception to "Billed" if WORKFLOW_BILL_ON_RECEPTION is set - if (isModEnabled("reception") && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) { + // Then set reception to "Billed" if WORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE is set + if (isModEnabled("reception") && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE)) { $object->fetchObjectLinked('', 'reception', $object->id, $object->element); if (!empty($object->linkedObjects)) { $totalonlinkedelements = 0; diff --git a/htdocs/langs/en_US/workflow.lang b/htdocs/langs/en_US/workflow.lang index 803a31c9646..a2b6b4c1f95 100644 --- a/htdocs/langs/en_US/workflow.lang +++ b/htdocs/langs/en_US/workflow.lang @@ -22,7 +22,7 @@ descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER=Classify linked sourc descWORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION=Classify linked source purchase order as received when a reception is validated (and if the quantity received by all receptions is the same as in the purchase order to update) descWORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED=Classify linked source purchase order as received when a reception is closed (and if the quantity received by all rceptions is the same as in the purchase order to update) # Autoclassify purchase invoice -descWORKFLOW_BILL_ON_RECEPTION=Classify receptions to "billed" when a linked supplier order is validated +descWORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE=Classify receptions to "billed" when a linked purchase invoice is validated (and if the amount of the invoice is the same as the total amount of the linked receptions) # Automatically link ticket to contract descWORKFLOW_TICKET_LINK_CONTRACT=When creating a ticket, link available contracts of matching thirdparty descWORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS=When linking contracts, search among those of parents companies @@ -31,6 +31,6 @@ descWORKFLOW_TICKET_CLOSE_INTERVENTION=Close all interventions linked to the tic AutomaticCreation=Automatic creation AutomaticClassification=Automatic classification # Autoclassify shipment -descWORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE=Classify linked source shipment as closed when customer invoice is validated +descWORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE=Classify linked source shipment as closed when customer invoice is validated (and if the amount of the invoice is the same as the total amount of the linked shipments) AutomaticClosing=Automatic closing AutomaticLinking=Automatic linking diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 912f2cae93f..1abfb49fb4c 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1642,7 +1642,7 @@ class Reception extends CommonObject } /** - * Classify the reception as invoiced (used when WORKFLOW_BILL_ON_RECEPTION is on) + * Classify the reception as invoiced (used when WORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE is on) * * @return int <0 if ko, >0 if ok */ From 9792d4e0aa4a369a539794a589362929ecbb0fb0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Oct 2022 01:40:32 +0200 Subject: [PATCH 171/176] Fix missing picto in combo list --- htdocs/expedition/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index e697c0be6c3..81e0adb15aa 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -526,7 +526,7 @@ $param .= $hookmanager->resPrint; $arrayofmassactions = array( 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), - 'classifyclose'=>$langs->trans("Close"), + 'classifyclose' => img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("Close"), 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); if (in_array($massaction, array('presend'))) { From a0203af926ec8dd6f5b83d39e096780ca819fecd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Oct 2022 02:49:57 +0200 Subject: [PATCH 172/176] Code comment --- htdocs/core/modules/syslog/mod_syslog_file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index e99e16ef649..04d1de3fbbd 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -116,7 +116,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 1) { // file depend on session key name (Note that session name is same for all users and is not a per user value) $suffixinfilename .= '_'.session_name(); } - if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 2) { // file depend on session value sor per user + if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 2) { // file depend on session name + ip so nearly per user $suffixinfilename .= '_'.session_name().'_'.$_SERVER["REMOTE_ADDR"]; } } From b268f630a12d64b9989a882d3034e739cebcc8d8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Oct 2022 02:53:41 +0200 Subject: [PATCH 173/176] NEW conf->global->SYSLOG_FILE_ONEPERSESSION accept a string --- htdocs/core/modules/syslog/mod_syslog_file.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index 04d1de3fbbd..265741f35c6 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -113,11 +113,15 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface } if (!empty($conf->global->SYSLOG_FILE_ONEPERSESSION)) { - if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 1) { // file depend on session key name (Note that session name is same for all users and is not a per user value) - $suffixinfilename .= '_'.session_name(); - } - if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 2) { // file depend on session name + ip so nearly per user - $suffixinfilename .= '_'.session_name().'_'.$_SERVER["REMOTE_ADDR"]; + if (is_numeric($conf->global->SYSLOG_FILE_ONEPERSESSION)) { + if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 1) { // file depend on instance session key name (Note that session name is same for the instance so for all users and is not a per user value) + $suffixinfilename .= '_'.session_name(); + } + if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 2) { // file depend on instance session key name + ip so nearly per user + $suffixinfilename .= '_'.session_name().'_'.$_SERVER["REMOTE_ADDR"]; + } + } else { + $suffixinfilename .= '_'.$conf->global->SYSLOG_FILE_ONEPERSESSION; } } From f682edb4f2e6225d9dc566e9761be08139d85c34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Oct 2022 03:37:01 +0200 Subject: [PATCH 174/176] Missing some info in log file --- htdocs/core/class/CMailFile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index ed2bcef8034..8327addc260 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -212,7 +212,7 @@ class CMailFile // On defini alternative_boundary $this->alternative_boundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3); // Force md5 hash (does not contains special chars) - dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); + dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext upload_dir_tmp=$upload_dir_tmp", LOG_DEBUG); dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); if (empty($subject)) { From d1cd43c9d8564e059d72b3f4483509cb0ddc2e4c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Oct 2022 04:02:42 +0200 Subject: [PATCH 175/176] Fix same file content = same hash --- htdocs/core/class/CMailFile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 8327addc260..49269b47f2c 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1783,7 +1783,7 @@ class CMailFile foreach ($matches[1] as $key => $ext) { // We save the image to send in disk $filecontent = $matches[2][$key]; - $cid = dol_hash(uniqid(time()), 3); + $cid = dol_hash($this->html, 'md5'); $destfiletmp = $images_dir.'/'.$cid.'.'.$ext; $fhandle = @fopen($destfiletmp, 'w'); From c9f43dc7a6232ab25327ac92c2f28dc366a4320b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Oct 2022 04:20:54 +0200 Subject: [PATCH 176/176] Fix error too large regex in memory --- htdocs/core/class/CMailFile.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 49269b47f2c..e21a288e53e 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1761,7 +1761,7 @@ class CMailFile /* global $dolibarr_main_data_root; $outputfile = $dolibarr_main_data_root."/dolibarr_mail.log"; - $fp = fopen($outputfile, "w"); + $fp = fopen($outputfile, "w+"); fwrite($fp, $this->html); fclose($fp); */ @@ -1808,7 +1808,7 @@ class CMailFile // type $this->html_images[$i]["type"] = 'cidfromdata'; - $this->html = preg_replace('/src="data:image\/'.$ext.';base64,'.preg_quote($filecontent, '/').'"/', 'src="cid:'.$this->html_images[$i]["cid"].'"', $this->html); + $this->html = str_replace('src="data:image/'.$ext.';base64,'.$filecontent.'"', 'src="cid:'.$this->html_images[$i]["cid"].'"', $this->html); } $i++; }