diff --git a/ChangeLog b/ChangeLog index a8211da486a..0f568ff5359 100644 --- a/ChangeLog +++ b/ChangeLog @@ -109,6 +109,13 @@ NEW: External backups can be downloaded from the "About info page". NEW: Add massaction to switch status on sale / on purchase of a product. + Modules +NEW: Stable module Knowledge Management +NEW: Experimental module Event Organization Management +NEW: Experimental module Workstations Management +NEW: Development of module Partnership Management + + For developers: --------------- diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index 06309a2706e..8edc61bf255 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/eventorganization.lib.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Translations -$langs->loadLangs(array("admin", "eventorganization")); +$langs->loadLangs(array("admin", "eventorganization", "categories")); // Parameters $action = GETPOST('action', 'aZ09'); @@ -54,11 +54,11 @@ $arrayofparameters = array( 'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), - 'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), - 'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), - 'EVENTORGANIZATION_SECUREKEY'=>array('type'=>'securekey', 'enabled'=>1), + //'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), + //'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), 'SERVICE_BOOTH_LOCATION'=>array('type'=>'product', 'enabled'=>1), 'SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION'=>array('type'=>'product', 'enabled'=>1), + 'EVENTORGANIZATION_SECUREKEY'=>array('type'=>'securekey', 'enabled'=>1), ); $error = 0; diff --git a/htdocs/admin/tools/export_files.php b/htdocs/admin/tools/export_files.php index 0b9272c2418..36be1f273ff 100644 --- a/htdocs/admin/tools/export_files.php +++ b/htdocs/admin/tools/export_files.php @@ -137,7 +137,7 @@ $dirtocompress = basename($fulldirtocompress); if ($compression == 'zip') { $file .= '.zip'; - $excludefiles = '/(\.back|\.old|\.log|[\/\\\]temp[\/\\\]|documents[\/\\\]admin[\/\\\]documents[\/\\\])/i'; + $excludefiles = '/(\.back|\.old|\.log|\.pdf_preview-.*\.png|[\/\\\]temp[\/\\\]|documents[\/\\\]admin[\/\\\]documents[\/\\\])/i'; //var_dump($fulldirtocompress); //var_dump($outputdir."/".$file);exit; @@ -173,7 +173,7 @@ if ($compression == 'zip') { // We also exclude '/temp/' dir and 'documents/admin/documents' // We make escapement here and call executeCLI without escapement because we don't want to have the '*.log' escaped. - $cmd = "tar -cf ".escapeshellcmd($outputdir."/".$file)." --exclude-vcs --exclude-caches-all --exclude='temp' --exclude='*.log' --exclude='documents/admin/documents' -C '".escapeshellcmd(dol_sanitizePathName($dirtoswitch))."' '".escapeshellcmd(dol_sanitizeFileName($dirtocompress))."'"; + $cmd = "tar -cf ".escapeshellcmd($outputdir."/".$file)." --exclude-vcs --exclude-caches-all --exclude='temp' --exclude='*.log' --exclude='*.pdf_preview-*.png' --exclude='documents/admin/documents' -C '".escapeshellcmd(dol_sanitizePathName($dirtoswitch))."' '".escapeshellcmd(dol_sanitizeFileName($dirtocompress))."'"; $result = $utils->executeCLI($cmd, $outputfile, 0, null, 1); diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 5f161f88bfb..602897d34f9 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -81,7 +81,7 @@ if (!$error && $massaction == 'confirm_presend') { $listofobjectref = array(); $contactidtosend = array(); $attachedfilesThirdpartyObj = array(); - $oneemailperrecipient = (GETPOST('oneemailperrecipient') == 'on' ? 1 : 0); + $oneemailperrecipient = (GETPOST('oneemailperrecipient', 'int') ? 1 : 0); if (!$error) { $thirdparty = new Societe($db); diff --git a/htdocs/core/boxes/box_validated_projects.php b/htdocs/core/boxes/box_validated_projects.php index 574ee7b7d80..e57bb1f14d9 100644 --- a/htdocs/core/boxes/box_validated_projects.php +++ b/htdocs/core/boxes/box_validated_projects.php @@ -26,6 +26,7 @@ */ include_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; + /** * Class to manage the box to show last projet */ @@ -63,7 +64,7 @@ class box_validated_projects extends ModeleBoxes $langs->loadLangs(array('boxes', 'projects')); $this->db = $db; - $this->boxlabel = "ProjectsWithTask"; + $this->boxlabel = "ProjectTasksWithoutTimeSpent"; $this->hidden = !($user->rights->projet->lire); @@ -116,7 +117,7 @@ class box_validated_projects extends ModeleBoxes $sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_contact as ec ON ec.element_id = t.rowid AND fk_c_type_contact IN (-1, -2, -3)"; $sql .= " WHERE p.fk_statut = 1"; // Only open projects if ($projectsListId) { - $sql .= ' AND p.rowid IN ('.$this->db->sanitize($projectsListId).')'; // Only project are allowed + $sql .= ' AND p.rowid IN ('.$this->db->sanitize($projectsListId).')'; // Only projects that are allowed } $sql .= " AND t.rowid NOT IN (SELECT fk_task FROM ".MAIN_DB_PREFIX."projet_task_time WHERE fk_user = ".((int) $user->id).")"; $sql .= " GROUP BY p.rowid, p.ref, p.fk_soc, p.dateo"; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 7ceca2f373b..72b4050f9b3 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -157,6 +157,7 @@ class FormMail extends Form public $lines_model; + // -1 suggest the checkbox 'one email per recipient' not checked, 0 = no suggestion, 1 = suggest and checked public $withoptiononeemailperrecipient; @@ -357,7 +358,7 @@ class FormMail extends Form // phpcs:enable global $conf, $langs, $user, $hookmanager, $form; - // Required to show preview of mail attachments + // Required to show preview wof mail attachments require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; $formfile = new Formfile($this->db); @@ -366,7 +367,7 @@ class FormMail extends Form } // Load translation files required by the page - $langs->loadLangs(array('other', 'mails')); + $langs->loadLangs(array('other', 'mails', 'members')); // Clear temp files. Must be done before call of triggers, at beginning (mode = init), or when we select a new template if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelselected') && GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) { @@ -464,11 +465,10 @@ class FormMail extends Form $modelmail_array = array(); if ($this->param['models'] != 'none') { $result = $this->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs); - if ($result < 0) { setEventMessages($this->error, $this->errors, 'errors'); } - $langs->trans("members"); + foreach ($this->lines_model as $line) { $reg = array(); if (preg_match('/\((.*)\)/', $line->label, $reg)) { @@ -503,7 +503,7 @@ class FormMail extends Form } $out .= '   '; - $out .= ''; + $out .= ''; $out .= '   '; $out .= ''; } elseif (!empty($this->param['models']) && in_array($this->param['models'], array( @@ -526,7 +526,7 @@ class FormMail extends Form } - $out .= ''."\n"; + $out .= '
'."\n"; // Substitution array/string $helpforsubstitution = ''; @@ -688,16 +688,20 @@ class FormMail extends Form // With option one email per recipient if (!empty($this->withoptiononeemailperrecipient)) { - $out .= ''; + if (abs($this->withoptiononeemailperrecipient) == 1) { + $out .= ''; + } else { + $out .= ''; + } } // CC @@ -813,8 +817,7 @@ class FormMail extends Form $out .= '
'; } } elseif (empty($this->withmaindocfile)) { - // Do not show message if we asked to show the checkbox - $out .= $langs->trans("NoAttachedFiles").'
'; + $out .= ''.$langs->trans("NoAttachedFiles").'
'; } if ($this->withfile == 2) { // Can add other files @@ -1217,6 +1220,7 @@ class FormMail extends Form global $conf, $langs, $form; $defaulttopic = GETPOST('subject', 'restricthtml'); + if (!GETPOST('modelselected', 'alpha') || GETPOST('modelmailselected') != '-1') { if ($arraydefaultmessage && $arraydefaultmessage->topic) { $defaulttopic = $arraydefaultmessage->topic; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 7f5daf77c4a..90a67991413 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -823,7 +823,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } } - if (count($arrayfields) > 0 && !empty($arrayfields['c.budget_amount']['checked'])) { + if (count($arrayfields) > 0 && !empty($arrayfields['t.budget_amount']['checked'])) { print '
'; - $out .= $langs->trans("GroupEmails"); - $out .= ''; - $out .= ' withoptiononeemailperrecipient > 0 ? ' checked="checked"' : '').'> '; - $out .= ''; - $out .= ''; - $out .= ' - '; - $out .= $langs->trans("WarningIfYouCheckOneRecipientPerEmail"); - $out .= ''; - $out .= '
'; + $out .= $langs->trans("GroupEmails"); + $out .= ''; + $out .= ' withoptiononeemailperrecipient > 0 ? ' checked="checked"' : '').'> '; + $out .= ''; + $out .= ''; + $out .= ' - '; + $out .= $langs->trans("WarningIfYouCheckOneRecipientPerEmail"); + $out .= ''; + $out .= '
'; print price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0, $conf->currency); $total_budget_amount += $lines[$i]->budget_amount; diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index 6ab1c8acb89..96ee96efae2 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -55,7 +55,7 @@ class modEventOrganization extends DolibarrModules $this->description = "EventOrganizationDescription"; $this->descriptionlong = "EventOrganizationDescriptionLong"; - $this->version = 'development'; + $this->version = 'experimental'; // Key used in llx_const table to save module status enabled/disabled (where EVENTORGANIZATION is value of property name of module in uppercase) diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index 7ad49fdb01e..7fff122ec57 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -170,7 +170,10 @@ class doc_generic_product_odt extends ModelePDFProduct $texte .= '
'; // Show list of found files foreach ($listoffiles as $file) { - $texte .= '- '.$file['name'].' '.img_picto('', 'listlight').'
'; + $texte .= '- '.$file['name']; + $texte .= ' '.img_picto('', 'listlight').''; + $texte .= '   '.img_picto('', 'delete').''; + $texte .= '
'; } $texte .= '
'; } diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 8ead9003f95..aaa9c03c6e7 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -163,7 +163,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc // Show list of found files foreach ($listoffiles as $file) { $texte .= '- '.$file['name'].'   '.img_picto('', 'listlight').''; - $texte .= '   '.img_picto('', 'delete').''; + $texte .= '   '.img_picto('', 'delete').''; $texte .= '
'; } $texte .= ''; diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index e1f56974483..b3a40ba3582 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -19,12 +19,17 @@ */ // Following var must be set: +// $action // $arrayofselected = array of id selected -// $object -// $objecttmp=new Propal($db); +// $objecttmp = new MyObject($db); // $topicmail="SendSupplierProposalRef"; // $modelmail="supplier_proposal_send"; -// $trackid='ord'.$object->id; +// $trackid='ord'.$objecttmp->id; +// +// Following var can be set +// $object = Object fetched; +// $sendto +// $withmaindocfilemail if ($massaction == 'predeletedraft') { @@ -41,6 +46,7 @@ if ($massaction == 'preaffecttag') { $categ_types = array(); $categ_type_array = $categ->getMapList(); foreach ($categ_type_array as $categdef) { + // Test on $object (should be useless, we already check on $objecttmp just after) if (isset($object) && $categdef['obj_table'] == $object->table_element) { if (!array_key_exists($categdef['code'], $categ_types)) { $categ_types[$categdef['code']] = array('code'=>$categdef['code'], 'label'=>$langs->trans($categdef['obj_class'])); @@ -76,7 +82,7 @@ if ($massaction == 'presend') { $langs->load("mails"); $listofselectedid = array(); - $listofselectedthirdparties = array(); + $listofselectedrecipientobjid = array(); $listofselectedref = array(); if (!GETPOST('cancel', 'alpha')) { @@ -84,14 +90,19 @@ if ($massaction == 'presend') { $result = $objecttmp->fetch($toselectid); if ($result > 0) { $listofselectedid[$toselectid] = $toselectid; - $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid); - if ($objecttmp->element == 'societe') { + $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid); // For proposal, order, invoice, conferenceorbooth, ... + if (in_array($objecttmp->element, array('societe', 'conferenceorboothattendee'))) { $thirdpartyid = $objecttmp->id; } if ($objecttmp->element == 'expensereport') { $thirdpartyid = $objecttmp->fk_user_author; } - $listofselectedthirdparties[$thirdpartyid] = $thirdpartyid; + if (empty($thirdpartyid)) { + $thirdpartyid = 0; + } + if ($thirdpartyid) { + $listofselectedrecipientobjid[$thirdpartyid] = $thirdpartyid; + } $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref; } } @@ -113,9 +124,9 @@ if ($massaction == 'presend') { $formmail->trackid = $trackid; $formmail->withfrom = 1; $liste = $langs->trans("AllRecipientSelected", count($arrayofselected)); - if (count($listofselectedthirdparties) == 1) { // Only 1 different recipient selected, we can suggest contacts + if (count($listofselectedrecipientobjid) == 1) { // Only 1 different recipient selected, we can suggest contacts $liste = array(); - $thirdpartyid = array_shift($listofselectedthirdparties); + $thirdpartyid = array_shift($listofselectedrecipientobjid); if ($objecttmp->element == 'expensereport') { $fuser = new User($db); $fuser->fetch($thirdpartyid); @@ -136,19 +147,31 @@ if ($massaction == 'presend') { $formmail->withtoreadonly = 1; } - $formmail->withoptiononeemailperrecipient = ((count($listofselectedref) == 1 && count(reset($listofselectedref)) == 1) || empty($liste)) ? 0 : ((GETPOST('oneemailperrecipient') == 'on') ? 1 : -1); + + $formmail->withoptiononeemailperrecipient = ((count($listofselectedref) == 1 && count(reset($listofselectedref)) == 1) || empty($liste)) ? 0 : (GETPOST('oneemailperrecipient', 'int') ? 1 : -1); + if (in_array($objecttmp->element, array('conferenceorboothattendee'))) { + $formmail->withoptiononeemailperrecipient = 0; + } $formmail->withto = empty($liste) ? (GETPOST('sendto', 'alpha') ?GETPOST('sendto', 'alpha') : array()) : $liste; $formmail->withtofree = empty($liste) ? 1 : 0; $formmail->withtocc = 1; $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; - $formmail->withtopic = $langs->transnoentities($topicmail, '__REF__', '__REF_CLIENT__'); - $formmail->withfile = 1; - // $formmail->withfile = 2; Not yet supported in mass action - $formmail->withmaindocfile = 1; // Add a checkbox "Attach also main document" - if ($objecttmp->element != 'societe') { - $formmail->withfile = ''.$langs->trans("OnlyPDFattachmentSupported").''; - $formmail->withmaindocfile = - 1; // Add a checkbox "Attach also main document" but not checked by default + if (!empty($topicmail)) { + $formmail->withtopic = $langs->transnoentities($topicmail, '__REF__', '__REF_CLIENT__'); + } else { + $formmail->withtopic = 1; + } + $formmail->withfile = 1; // $formmail->withfile = 2 to allow to upload files is not yet supported in mass action + // Add a checkbox "Attach also main document" + if (isset($withmaindocfilemail)) { + $formmail->withmaindocfile = $withmaindocfilemail; + } else { // Do an automatic definition of $formmail->withmaindocfile + $formmail->withmaindocfile = 1; + if ($objecttmp->element != 'societe') { + $formmail->withfile = ''.$langs->trans("OnlyPDFattachmentSupported").''; + $formmail->withmaindocfile = -1; // Add a checkbox "Attach also main document" but not checked by default + } } $formmail->withbody = 1; $formmail->withdeliveryreceipt = 1; @@ -167,16 +190,16 @@ if ($massaction == 'presend') { ); complete_substitutions_array($substitutionarray, $langs, $object, $parameters); - // Tableau des substitutions + // Array of substitutions $formmail->substit = $substitutionarray; // Tableau des parametres complementaires du post $formmail->param['action'] = $action; - $formmail->param['models'] = $modelmail; - $formmail->param['models_id'] = GETPOST('modelmailselected', 'int'); + $formmail->param['models'] = $modelmail; // the filter to know which kind of template emails to show. 'none' means no template suggested. + $formmail->param['models_id'] = GETPOST('modelmailselected', 'int') ? GETPOST('modelmailselected', 'int') : '-1'; $formmail->param['id'] = join(',', $arrayofselected); // $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; - if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedthirdparties) > $conf->global->MAILING_LIMIT_SENDBYWEB) { + if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedrecipientobjid) > $conf->global->MAILING_LIMIT_SENDBYWEB) { $langs->load("errors"); print img_warning().' '.$langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB); print ' - '.$langs->trans("GoBack").''; diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 5980bfa6132..d105ad05c43 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -621,8 +621,8 @@ $arrayofmassactions = array( //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"), //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), - 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' - '.$langs->trans("ConferenceOrBooth"), - 'presend_attendees'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' - '.$langs->trans("Attendees"), + 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' ('.$langs->trans("ToSpeakers").')', + //'presend_attendees'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' - '.$langs->trans("Attendees"), ); if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); @@ -650,12 +650,13 @@ $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle' print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); + // Add code for pre mass action (confirmation or email presend form) -$topicmail = $object->ref; +$topicmail = $projectstatic->title; $modelmail = "conferenceorbooth"; $objecttmp = new ConferenceOrBooth($db); $trackid = 'conferenceorbooth_'.$object->id; -include DOL_DOCUMENT_ROOT.'/eventorganization/tpl/massactions_mail_pre.tpl.php'; +$withmaindocfilemail = 0; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; @@ -689,6 +690,7 @@ $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''."\n"; diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 9cc7e882631..e084c68cfe7 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -182,8 +182,8 @@ if (GETPOST('cancel', 'alpha')) { $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' -&& $massaction != 'presend_attendees' -&& $massaction != 'confirm_presend_attendees') { +&& $massaction != 'presend' +&& $massaction != 'confirm_presend') { $massaction = ''; } @@ -676,8 +676,7 @@ $arrayofmassactions = array( //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"), //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), - //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), - 'presend_attendees'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' - '.$langs->trans("Attendees"), + 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); @@ -706,14 +705,16 @@ $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle' print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); + // Add code for pre mass action (confirmation or email presend form) -$topicmail = "SendConferenceOrBoothAttendeeRef"; -$modelmail = "conferenceorboothattendee"; +$topicmail = $projectstatic->title; +$modelmail = "conferenceorbooth"; $objecttmp = new ConferenceOrBoothAttendee($db); -$trackid = 'xxxx'.$object->id; -include DOL_DOCUMENT_ROOT.'/eventorganization/tpl/massactions_mail_pre.tpl.php'; +$trackid = 'conferenceorbooth_'.$object->id; +$withmaindocfilemail = 0; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + if ($search_all) { foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); diff --git a/htdocs/eventorganization/core/actions_massactions_mail.inc.php b/htdocs/eventorganization/core/actions_massactions_mail.inc.php index 5fcada893f9..afdee363f24 100644 --- a/htdocs/eventorganization/core/actions_massactions_mail.inc.php +++ b/htdocs/eventorganization/core/actions_massactions_mail.inc.php @@ -78,7 +78,7 @@ if (!$error && $massaction == 'confirm_presend_attendees') { $listofobjectid = array(); $listofobjectref = array(); - $oneemailperrecipient = (GETPOST('oneemailperrecipient') == 'on' ? 1 : 0); + $oneemailperrecipient = (GETPOST('oneemailperrecipient', 'int') ? 1 : 0); if (!$error) { require_once DOL_DOCUMENT_ROOT . '/eventorganization/class/conferenceorboothattendee.class.php'; diff --git a/htdocs/eventorganization/tpl/massactions_mail_pre.tpl.php b/htdocs/eventorganization/tpl/massactions_mail_pre.tpl.php deleted file mode 100644 index 8d0836b080e..00000000000 --- a/htdocs/eventorganization/tpl/massactions_mail_pre.tpl.php +++ /dev/null @@ -1,126 +0,0 @@ - - * Copyright (C) 2013-2014 Laurent Destailleur - * 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 . - * or see https://www.gnu.org/ - */ - -// Following var must be set: -// $arrayofselected = array of id selected -// $object -// $objecttmp=new Propal($db); -// $topicmail="SendSupplierProposalRef"; -// $modelmail="supplier_proposal_send"; -// $trackid='ord'.$object->id; - -if ($massaction == 'presend_attendees') { - $langs->load("mails"); - require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; - $attendee = new ConferenceOrBoothAttendee($db); - $listofselectedid = array(); - $listofselectedref = array(); - - if (!GETPOST('cancel', 'alpha')) { - foreach ($arrayofselected as $toselectid) { - $result = $objecttmp->fetch($toselectid); - if ($result > 0) { - $attendees = $attendee->fetchAll(); - if (is_array($attendees) && count($attendees)>0) { - foreach ($attendees as $attmail) { - if (!empty($attmail->email)) { - $listofselectedid[$attmail->email] = $attmail->id; - $listofselectedref[$attmail->id][$toselectid] = $objecttmp->ref; - } - } - } - } - } - } - - print ''; - print ''; - - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - print dol_get_fiche_head(null, '', ''); - - // Create form for email - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - $formmail->withform = -1; - $formmail->fromtype = (GETPOST('fromtype') ? GETPOST('fromtype') : (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user')); - - if ($formmail->fromtype === 'user') { - $formmail->fromid = $user->id; - } - $formmail->trackid = $trackid; - $formmail->withfrom = 1; - $liste = $langs->trans("AllRecipientSelected", count($listofselectedid)); - $formmail->withtoreadonly = 1; - - $formmail->withoptiononeemailperrecipient = ((count($listofselectedref) == 1 && count(reset($listofselectedref)) == 1) || empty($liste)) ? 0 : ((GETPOST('oneemailperrecipient') == 'on') ? 1 : -1); - - $formmail->withto = empty($liste) ? (GETPOST('sendto', 'alpha') ?GETPOST('sendto', 'alpha') : array()) : $liste; - $formmail->withtofree = empty($liste) ? 1 : 0; - $formmail->withtocc = 1; - $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; - $formmail->withtopic = $langs->transnoentities($topicmail, '__REF__', '__REF_CLIENT__'); - $formmail->withfile = 0; - // $formmail->withfile = 2; Not yet supported in mass action - $formmail->withmaindocfile = 0; // Add a checkbox "Attach also main document" - $formmail->withbody = 1; - $formmail->withdeliveryreceipt = 1; - $formmail->withcancel = 1; - - // Make substitution in email content - $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object); - - $substitutionarray['__EMAIL__'] = $sendto; - $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : ''; - $substitutionarray['__PERSONALIZED__'] = ''; // deprecated - $substitutionarray['__CONTACTCIVNAME__'] = ''; - - $parameters = array( - 'mode' => 'formemail' - ); - complete_substitutions_array($substitutionarray, $langs, $object, $parameters); - - // Tableau des substitutions - $formmail->substit = $substitutionarray; - - // Tableau des parametres complementaires du post - $formmail->param['action'] = $action; - $formmail->param['models'] = $modelmail; - $formmail->param['models_id'] = empty(GETPOST('modelmailselected', 'int'))?$conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES:GETPOST('modelmailselected', 'int'); - $formmail->param['id'] = join(',', $arrayofselected); - // $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; - if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedid) > $conf->global->MAILING_LIMIT_SENDBYWEB) { - $langs->load("errors"); - print img_warning().' '.$langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB); - print ' - '.$langs->trans("GoBack").''; - $arrayofmassactions = array(); - } else { - print $formmail->get_form(); - } - - print dol_get_fiche_end(); -} -// Allow Pre-Mass-Action hook (eg for confirmation dialog) -$parameters = array( - 'toselect' => $toselect, - 'uploaddir' => isset($uploaddir) ? $uploaddir : null -); diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 50342bc6917..f383c706653 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -72,11 +72,14 @@ ALTER TABLE llx_salary_extrafields ADD INDEX idx_salary_extrafields (fk_object); 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); +UPDATE llx_c_email_templates SET label = '(EventOrganizationEmailBoothPayment)' WHERE label = '(EventOrganizationEmailSubsBooth)'; +UPDATE llx_c_email_templates SET label = '(EventOrganizationEmailRegistrationPayment)' WHERE label = '(EventOrganizationEmailSubsEvent)'; + --Fix bad sign on multicompany column for customer invoice lines UPDATE llx_facturedet SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and subprice > 0) OR (multicurrency_subprice > 0 and subprice < 0)); diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 88415022bde..bc334fe08cf 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -42,12 +42,12 @@ EVENTORGANIZATION_CATEG_THIRDPARTY_CONF = Category to add to third-parties autom EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH = Category to add to third-parties automatically created when they suggests a booth EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF = Template of email to send after receiving a suggestion of a conference. EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH = Template of email to send after receiving a suggestion of a booth. -EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH = Template of email to send after a registration to a booth has been paid. +EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH = Template of email to send after a registration to a booth has been paid. EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT = Template of email to send after a registration to an event has been paid. -EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER = Template of email of massaction to attendes -EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES = Template of email of massaction to speakers -EVENTORGANIZATION_FILTERATTENDEES_CAT = Filter thirdpartie's select list in attendees creation card/form with category -EVENTORGANIZATION_FILTERATTENDEES_TYPE = Filter thirdpartie's select list in attendees creation card/form with customer type +EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER = Template of email to use when sending emails from the massaction "Send emails" to speakers +EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES = Template of email to use when sending emails from the massaction "Send emails" on attendee list +EVENTORGANIZATION_FILTERATTENDEES_CAT = In the form to create/add an attendee, restricts the list of thirdparties to thirdparties in the category +EVENTORGANIZATION_FILTERATTENDEES_TYPE = In the form to create/add an attendee, restricts the list of thirdparties to thirdparties with the nature # # Object @@ -71,6 +71,7 @@ EventOrganizationEmailBoothPayment = Payment of your booth EventOrganizationEmailRegistrationPayment = Registration for an event EventOrganizationMassEmailAttendees = Communication to attendees EventOrganizationMassEmailSpeakers = Communication to speakers +ToSpeakers=To speakers # # Event @@ -83,14 +84,14 @@ PriceOfRegistration=Price of registration PriceOfRegistrationHelp=Price to pay to register or participate in the event PriceOfBooth=Subscription price to stand a booth PriceOfBoothHelp=Subscription price to stand a booth -EventOrganizationICSLink=Link ICS for events +EventOrganizationICSLink=Link ICS for conferences ConferenceOrBoothInformation=Conference Or Booth informations Attendees=Attendees ListOfAttendeesOfEvent=List of attendees of the event project DownloadICSLink = Download ICS link -EVENTORGANIZATION_SECUREKEY = Secure Key of the public registration link to a conference +EVENTORGANIZATION_SECUREKEY = Seed to secure the key for the public registration page to suggest a conference SERVICE_BOOTH_LOCATION = Service used for the invoice row about a booth location -SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION = Service used for the invoice row about an attendee subscription to a conference +SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION = Service used for the invoice row about an attendee subscription to an event NbVotes=Number of votes # # Status diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 5348ea32520..c9eb9043084 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -71,6 +71,7 @@ if (!$user->admin) { // Parameters $action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); +$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php $value = GETPOST('value', 'alpha'); $label = GETPOST('label', 'alpha'); diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index 913609ba821..8040c13d606 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -175,7 +175,10 @@ class doc_generic_myobject_odt extends ModelePDFMyObject if ($nbofiles) { $texte .= ''; } diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 4f6094e1787..2d7d99a9ab3 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -46,6 +46,8 @@ if (!$user->admin || (empty($conf->product->enabled) && empty($conf->service->en $action = GETPOST('action', 'aZ09'); $value = GETPOST('value', 'alpha'); +$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php + $label = GETPOST('label', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha'); $type = 'product'; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index dc482c1c60c..64d134a7254 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -850,8 +850,8 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third $moreforfilter = ''; if (count($tasksarray) > 0) { $moreforfilter .= '
'; - $moreforfilter .= $langs->trans("TasksAssignedTo").': '; - $moreforfilter .= $form->select_dolusers($tmpuser->id > 0 ? $tmpuser->id : '', 'search_user_id', 1); + $moreforfilter .= img_picto('', 'user', 'class="pictofixedwidth"'); + $moreforfilter .= $form->select_dolusers($tmpuser->id > 0 ? $tmpuser->id : '', 'search_user_id', $langs->trans("TasksAssignedTo"), null, 0, '', ''); $moreforfilter .= '
'; } if ($moreforfilter) { diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index bbf33b620c4..bc6ec7d15cf 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -74,13 +74,6 @@ $search_task_label = GETPOST('search_task_label', 'alpha'); $search_user = GETPOST('search_user', 'int'); $search_valuebilled = GETPOST('search_valuebilled', 'int'); -// Security check -$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. -if (!$user->rights->projet->lire) { - accessforbidden(); -} - $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); @@ -98,6 +91,8 @@ if (!$sortorder) { $sortorder = 'DESC,DESC,DESC'; } +$childids = $user->getAllChildIds(1); + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context //$object = new TaskTime($db); $hookmanager->initHooks(array('projecttasktime', 'globalcard')); @@ -113,11 +108,19 @@ if ($id > 0 || $ref) { $object->fetch($id, $ref); } + +// Security check +$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. +if (!$user->rights->projet->lire) { + accessforbidden(); +} + if ($object->fk_project > 0) { restrictedArea($user, 'projet', $object->fk_project, 'projet&project'); } else { restrictedArea($user, 'projet', null, 'projet&project'); - // We check user has permission to see all taks of all users + // We check user has permission to see all tasks of all users if (empty($projectid) && !$user->hasRight('projet', 'all', 'lire')) { $search_user = $user->id; } @@ -246,10 +249,14 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us $id = GETPOST('taskid', 'int'); $object->fetchTimeSpent(GETPOST('lineid', 'int')); - // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) - $result = $object->delTimeSpent($user); + + $result = 0; + if (in_array($object->timespent_fk_user, $childids) || $user->rights->projet->all->creer) { + $result = $object->delTimeSpent($user); + } $object->fetch($id, $ref); + $object->timespent_note = GETPOST("timespent_note_line", 'alpha'); $object->timespent_old_duration = GETPOST("old_duration"); $object->timespent_duration = GETPOSTINT("new_durationhour") * 60 * 60; // We store duration in seconds @@ -261,7 +268,12 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); } $object->timespent_fk_user = GETPOST("userid_line", 'int'); - $result = $object->addTimeSpent($user); + + $result = 0; + if (in_array($object->timespent_fk_user, $childids) || $user->rights->projet->all->creer) { + $result = $object->addTimeSpent($user); + } + if ($result >= 0) { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); } else { @@ -270,7 +282,6 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us } } else { $object->fetch($id, $ref); - // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) $object->timespent_id = GETPOST("lineid", 'int'); $object->timespent_note = GETPOST("timespent_note_line"); @@ -285,12 +296,16 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us } $object->timespent_fk_user = GETPOST("userid_line", 'int'); - $result = $object->updateTimeSpent($user); - if ($result >= 0) { - setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans($object->error), null, 'errors'); - $error++; + $result = 0; + if (in_array($object->timespent_fk_user, $childids) || $user->rights->projet->all->creer) { + $result = $object->updateTimeSpent($user); + + if ($result >= 0) { + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans($object->error), null, 'errors'); + $error++; + } } } } else { @@ -298,18 +313,20 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us } } -if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->lire) { - $object->fetchTimeSpent(GETPOST('lineid', 'int')); - // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) - $result = $object->delTimeSpent($user); +if ($action == 'confirm_deleteline' && $confirm == "yes" && $user->rights->projet->lire) { + $object->fetchTimeSpent(GETPOST('lineid', 'int')); // load properties like $object->timespent_id - if ($result < 0) { - $langs->load("errors"); - setEventMessages($langs->trans($object->error), null, 'errors'); - $error++; - $action = ''; - } else { - setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); + if (in_array($object->timespent_fk_user, $childids) || $user->rights->projet->all->creer) { + $result = $object->delTimeSpent($user); // delete line with $object->timespent_id + + if ($result < 0) { + $langs->load("errors"); + setEventMessages($langs->trans($object->error), null, 'errors'); + $error++; + $action = ''; + } else { + setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); + } } } @@ -888,7 +905,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } } - $linktocreatetime = dolGetButtonTitle($langs->trans('AddTimeSpent'), $linktocreatetimeHelpText, 'fa fa-plus-circle', $linktocreatetimeUrl, '', $linktocreatetimeBtnStatus); + $paramsbutton = array('morecss'=>'reposition'); + $linktocreatetime = dolGetButtonTitle($langs->trans('AddTimeSpent'), $linktocreatetimeHelpText, 'fa fa-plus-circle', $linktocreatetimeUrl, '', $linktocreatetimeBtnStatus, $paramsbutton); } $massactionbutton = ''; @@ -915,7 +933,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print dol_get_fiche_head($head, 'task_time', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition'); if ($action == 'deleteline') { - print $form->formconfirm($_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST("lineid", 'int').($withproject ? '&withproject=1' : ''), $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_delete", '', '', 1); + print $form->formconfirm($_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST("lineid", 'int').($withproject ? '&withproject=1' : ''), $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); } $param = ($withproject ? '&withproject=1' : ''); @@ -1014,7 +1032,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if ($projectstatic->id > 0 || $allprojectforuser > 0) { if ($action == 'deleteline' && !empty($projectidforalltimes)) { - print $form->formconfirm($_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST('lineid', 'int').($withproject ? '&withproject=1' : ''), $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_delete", '', '', 1); + print $form->formconfirm($_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST('lineid', 'int').($withproject ? '&withproject=1' : ''), $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); } // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array @@ -1579,8 +1597,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $i = 0; - $childids = $user->getAllChildIds(); - $total = 0; $totalvalue = 0; $totalarray = array(); @@ -1796,7 +1812,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print '
'; print ''; } elseif ($user->rights->projet->lire || $user->rights->projet->all->creer) { // Read project and enter time consumed on assigned tasks - if ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids) || $user->rights->projet->all->creer) { + if (in_array($task_time->fk_user, $childids) || $user->rights->projet->all->creer) { if ($conf->MAIN_FEATURES_LEVEL >= 2) { print ' '; print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; diff --git a/htdocs/recruitment/admin/setup.php b/htdocs/recruitment/admin/setup.php index b6f03d38b76..6091da86b09 100644 --- a/htdocs/recruitment/admin/setup.php +++ b/htdocs/recruitment/admin/setup.php @@ -68,6 +68,7 @@ if (!$user->admin) { // Parameters $action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); +$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php $value = GETPOST('value', 'alpha'); $label = GETPOST('label', 'alpha'); diff --git a/htdocs/recruitment/admin/setup_candidatures.php b/htdocs/recruitment/admin/setup_candidatures.php index 60bd0494ebc..726e24e89b1 100644 --- a/htdocs/recruitment/admin/setup_candidatures.php +++ b/htdocs/recruitment/admin/setup_candidatures.php @@ -68,6 +68,7 @@ if (!$user->admin) { // Parameters $action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); +$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php $value = GETPOST('value', 'alpha'); $label = GETPOST('label', 'alpha'); diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php index 3b9840f9155..e818a0816a9 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php @@ -174,7 +174,10 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi if ($nbofiles) { $texte .= ''; } diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 42ee366ad4e..95e1d5e47cb 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -34,7 +34,7 @@ $langs->loadLangs(array("admin", "companies", "other")); $action = GETPOST('action', 'aZ09'); $value = GETPOST('value', 'alpha'); -$modulepart = GETPOST('modulepart', 'aZ09'); +$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php if (!$user->admin) { accessforbidden(); diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index a6d9f6d2df9..716ca7eac27 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -101,10 +101,11 @@ if (!defined('ISLOADEDBYSTEELSHEET')) { font-size: 25px; line-height: 92px; } -.opened-dash-board-wrap .info-box-sm .info-box-icon { - border-radius: 0 0 0 20px; +.opened-dash-board-wrap .info-box .info-box-icon { + font-size: 2em; } .opened-dash-board-wrap .info-box-sm .info-box-icon { + border-radius: 0 0 0 20px; line-height: 80px; } .info-box-module .info-box-icon { diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index cedfab31df8..33dde512fc0 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -198,6 +198,9 @@ a.info-box-text-a i.fa.fa-exclamation-triangle { font-size: 25px; line-height: 92px; } +.opened-dash-board-wrap .info-box .info-box-icon { + font-size: 2em; +} .opened-dash-board-wrap .info-box-sm .info-box-icon { line-height: 80px; } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 4d748cd6946..c5103278dda 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -505,6 +505,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("ErrorLoginAlreadyExists", $object->login), null, 'errors'); } else { setEventMessages($object->error, $object->errors, 'errors'); + $action = 'edit'; } } } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index f4c7a7352ea..a6b6b5af1e6 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1907,8 +1907,8 @@ class User extends CommonObject if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted) { // Si mot de passe saisi et different de celui en base $result = $this->setPassword($user, $this->pass, 0, $notrigger, $nosyncmemberpass); - if (!$nbrowsaffected) { - $nbrowsaffected++; + if ($result < 0) { + return -5; } } } @@ -2148,6 +2148,7 @@ class User extends CommonObject } } + // Now, we encrypt the new password $password_crypted = dol_hash($password); } diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 4571ed48884..6e28a77b5bc 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -292,6 +292,72 @@ if ($user->admin) { } print ''."\n"; + +// Fix bad value for module_position in table +// ------------------------------------------ +$sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault"; +$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r"; +$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" +$sql .= " AND r.entity = ".((int) $entity); +$sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id"; + +$result = $db->query($sql); +if ($result) { + $num = $db->num_rows($result); + $i = 0; + $oldmod = ''; + + while ($i < $num) { + $obj = $db->fetch_object($result); + + // If line is for a module that does not exist anymore (absent of includes/module), we ignore it + if (empty($modules[$obj->module])) { + $i++; + continue; + } + + // Special cases + if (!empty($conf->reception->enabled)) { + // The 2 permissions in fournisseur modules are replaced by permissions into reception module + if ($obj->module == 'fournisseur' && $obj->perms == 'commande' && $obj->subperms == 'receptionner') { + $i++; + continue; + } + if ($obj->module == 'fournisseur' && $obj->perms == 'commande_advance' && $obj->subperms == 'check') { + $i++; + continue; + } + } + + $objMod = $modules[$obj->module]; + + // Save field module_position in database if value is wrong + if (empty($obj->module_position) || (is_object($objMod) && $objMod->isCoreOrExternalModule() == 'external' && $obj->module_position < 100000)) { + if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0)) { + // TODO Define familyposition + //$familyposition = $modules[$obj->module]->family_position; + $familyposition = 0; + + $newmoduleposition = $modules[$obj->module]->module_position; + + // Correct $newmoduleposition position for external modules + $objMod = $modules[$obj->module]; + if (is_object($objMod) && $objMod->isCoreOrExternalModule() == 'external' && $newmoduleposition < 100000) { + $newmoduleposition += 100000; + } + + $sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."rights_def SET module_position = ".((int) $newmoduleposition).","; + $sqlupdate .= " family_position = ".((int) $familyposition); + $sqlupdate .= " WHERE module_position = ".((int) $obj->module_position)." AND module = '".$db->escape($obj->module)."'"; + + $db->query($sqlupdate); + } + } + } +} + + + //print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS; $sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault"; $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r"; @@ -333,6 +399,7 @@ if ($result) { $objMod = $modules[$obj->module]; // Save field module_position in database if value is wrong + /* if (empty($obj->module_position) || (is_object($objMod) && $objMod->isCoreOrExternalModule() == 'external' && $obj->module_position < 100000)) { if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0)) { // TODO Define familyposition @@ -354,6 +421,7 @@ if ($result) { $db->query($sqlupdate); } } + */ // Break found, it's a new module to catch if (isset($obj->module) && ($oldmod <> $obj->module)) {