diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index d24bf74e99f..64ebfc4a873 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -120,6 +120,12 @@ $parameters = array('socid' => $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'); +$TRemindTypes = array(); +if (!empty($conf->global->AGENDA_REMINDER_EMAIL)) $TRemindTypes['email'] = $langs->trans('EMail'); +if (!empty($conf->global->AGENDA_REMINDER_BROWSER)) $TRemindTypes['browser'] = $langs->trans('BrowserPush'); + +$TDurationTypes = array('y'=>$langs->trans('Years'), 'm'=>$langs->trans('Month'), 'w'=>$langs->trans('Weeks'), 'd'=>$langs->trans('Days'), 'h'=>$langs->trans('Hours'), 'i'=>$langs->trans('Minutes')); + /* * Actions @@ -789,6 +795,7 @@ if (empty($reshook)) { } + /* * View */ @@ -796,6 +803,13 @@ if (empty($reshook)) { $form = new Form($db); $formproject = new FormProjets($db); +$arrayrecurrulefreq = array( + 'no'=>$langs->trans("OnceOnly"), + 'MONTHLY'=>$langs->trans("EveryMonth"), + 'WEEKLY'=>$langs->trans("EveryWeek"), + //'DAYLY'=>$langs->trans("EveryDay") +); + $help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda'; llxHeader('', $langs->trans("Agenda"), $help_url); @@ -945,14 +959,8 @@ if ($action == 'create') if ($userepeatevent) { // Repeat - print ''.$langs->trans("RepeatEvent").''; + print ''; print ''; - $arrayrecurrulefreq = array( - 'no'=>$langs->trans("No"), - 'MONTHLY'=>$langs->trans("EveryMonth"), - 'WEEKLY'=>$langs->trans("EveryWeek"), - //'DAYLY'=>$langs->trans("EveryDay") - ); $selectedrecurrulefreq = 'no'; $selectedrecurrulebymonthday = ''; $selectedrecurrulebyday = ''; @@ -1013,7 +1021,7 @@ if ($action == 'create') // Location if (empty($conf->global->AGENDA_DISABLE_LOCATION)) { - print ''.$langs->trans("Location").''; + print ''.$langs->trans("Location").''; } // Assigned to @@ -1082,9 +1090,9 @@ if ($action == 'create') $events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); //For external user force the company to user company if (!empty($user->socid)) { - print $form->select_company($user->socid, 'socid', '', 1, 1, 0, $events, 0, 'minwidth300'); + print img_picto('', 'company', 'class="paddingrightonly"').$form->select_company($user->socid, 'socid', '', 1, 1, 0, $events, 0, 'minwidth300'); } else { - print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, $events, 0, 'minwidth300'); + print img_picto('', 'company', 'class="paddingrightonly"').$form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, $events, 0, 'minwidth300'); } } print ''; @@ -1093,7 +1101,7 @@ if ($action == 'create') print ''.$langs->trans("ActionOnContact").''; $preselectedids = GETPOST('socpeopleassigned', 'array'); if (GETPOST('contactid', 'int')) $preselectedids[GETPOST('contactid', 'int')] = GETPOST('contactid', 'int'); - print $form->selectcontacts(GETPOST('socid', 'int'), $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid'); + print img_picto('', 'contact', 'class="paddingrightonly"').$form->selectcontacts(GETPOST('socid', 'int'), $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid'); print ''; } @@ -1105,7 +1113,7 @@ if ($action == 'create') $projectid = GETPOST('projectid', 'int'); print ''.$langs->trans("Project").''; - + print img_picto('', 'project', 'class="paddingrightonly"'); $numproject = $formproject->select_projects((!empty($societe->id) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500'); print ' '; @@ -1128,7 +1136,7 @@ if ($action == 'create') print ''; print ''.$langs->trans("Task").''; - + print img_picto('', 'projecttask', 'class="paddingrightonly"'); $projectsListId = false; if (!empty($projectid)) { $projectsListId = $projectid; } $tid = GETPOST("projecttaskid") ?GETPOST("projecttaskid") : ''; @@ -1164,7 +1172,7 @@ if ($action == 'create') // Description print ''.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('note', (GETPOSTISSET('note') ? GETPOST('note', 'none') : $object->note_private), '', 180, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_4, '90%'); + $doleditor = new DolEditor('note', (GETPOSTISSET('note') ? GETPOST('note', 'none') : $object->note_private), '', 120, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_4, '90%'); $doleditor->Create(); print ''; @@ -1205,9 +1213,6 @@ if ($action == 'create') print ''; //Reminder Type - $TRemindTypes = array(); - if (!empty($conf->global->AGENDA_REMINDER_EMAIL)) $TRemindTypes['email'] = $langs->trans('EMail'); - if (!empty($conf->global->AGENDA_REMINDER_BROWSER)) $TRemindTypes['browser'] = $langs->trans('BrowserPush'); print ''.$langs->trans("ReminderType").''; print $form->selectarray('selectremindertype', $TRemindTypes); print ''; @@ -1389,7 +1394,7 @@ if ($id > 0) print ''.$langs->trans("EventOnFullDay").'fulldayevent ? ' checked' : '').'>'; // Date start - print ''.$langs->trans("DateActionStart").''; + print ''.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").''; if (GETPOST("afaire") == 1) { print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart'); } elseif (GETPOST("afaire") == 2) { @@ -1397,9 +1402,7 @@ if ($id > 0) } else { print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart'); } - print ''; - // Date end - print ''.$langs->trans("DateActionEnd").''; + print ' - '; if (GETPOST("afaire") == 1) { print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend'); } elseif (GETPOST("afaire") == 2) { @@ -1414,14 +1417,8 @@ if ($id > 0) if ($userepeatevent) { // Repeat - print ''.$langs->trans("RepeatEvent").''; + print ''; print ''; - $arrayrecurrulefreq = array( - 'no'=>$langs->trans("No"), - 'MONTHLY'=>$langs->trans("EveryMonth"), - 'WEEKLY'=>$langs->trans("EveryWeek"), - //'DAYLY'=>$langs->trans("EveryDay"), - ); $selectedrecurrulefreq = 'no'; $selectedrecurrulebymonthday = ''; $selectedrecurrulebyday = ''; @@ -1469,7 +1466,7 @@ if ($id > 0) // Status print ''.$langs->trans("Status").' / '.$langs->trans("Percentage").''; $percent = GETPOST("percentage") ? GETPOST("percentage") : $object->percentage; - $formactions->form_select_status_action('formaction', $percent, 1); + $formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200'); print ''; // Location @@ -1554,7 +1551,7 @@ if ($id > 0) print '


'; - print ''; + print '
'; if ($conf->societe->enabled) { @@ -1566,14 +1563,14 @@ if ($id > 0) $events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); // TODO Refresh also list of project if $conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY not defined with list linked to socid ? // FIXME If we change company, we may get a project that does not match - print $form->select_company($object->socid, 'socid', '', 'SelectThirdParty', 1, 0, $events, 0, 'minwidth200'); + print img_picto('', 'company', 'class="paddingrightonly"').$form->select_company($object->socid, 'socid', '', 'SelectThirdParty', 1, 0, $events, 0, 'minwidth200'); print ''; print ''; // related contact print ''; print ''; @@ -1585,6 +1582,7 @@ if ($id > 0) $langs->load("projects"); print '
'.$langs->trans("ActionOnContact").''; print '
'; - print $form->selectcontacts($object->socid, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 1, 'quatrevingtpercent', false, 0, 0, array(), 'multiple', 'contactid'); + print img_picto('', 'contact', 'class="paddingrightonly"').$form->selectcontacts($object->socid, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 1, 'quatrevingtpercent', false, 0, 0, array(), 'multiple', 'contactid'); print '
'; print '
'.$langs->trans("Project").''; + print img_picto('', 'project', 'class="paddingrightonly"'); $numprojet = $formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth500'); if ($numprojet == 0) { @@ -1661,6 +1659,29 @@ if ($id > 0) print '
'; + // Reminders + if ($conf->global->AGENDA_REMINDER_EMAIL || $conf->global->AGENDA_REMINDER_BROWSER) + { + $object->loadReminders(); + + if (count($object->reminders) > 0) { + //checkbox create reminder + print '
'; + + print ''; + + print ''; + + print '
'.$langs->trans("Reminders").''; + + foreach($object->reminders as $actioncommreminderid => $actioncommreminder) { + print $TRemindTypes[$actioncommreminder->typeremind].' - '.$actioncommreminder->offsetvalue.' '.$TDurationTypes[$actioncommreminder->offsetunit]; + } + + print '
'; + } + } + dol_fiche_end(); print '
'; @@ -1750,6 +1771,7 @@ if ($id > 0) dol_banner_tab($object, 'id', $linkback, ($user->socid ? 0 : 1), 'id', 'ref', $morehtmlref); print '
'; + print '
'; print '
'; @@ -1759,17 +1781,17 @@ if ($id > 0) // Type if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - print ''.$langs->trans("Type").''.$langs->trans($object->type).''; + print ''.$langs->trans("Type").''.$langs->trans($object->type).''; } // Full day event - print ''.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent, 3).''; + print ''.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent, 3).''; $rowspan = 4; if (empty($conf->global->AGENDA_DISABLE_LOCATION)) $rowspan++; // Date start - print ''.$langs->trans("DateActionStart").''; + print ''.$langs->trans("DateActionStart").''; if (!$object->fulldayevent) print dol_print_date($object->datep, 'dayhour'); else print dol_print_date($object->datep, 'day'); if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); @@ -1777,7 +1799,7 @@ if ($id > 0) print ''; // Date end - print ''.$langs->trans("DateActionEnd").''; + print ''.$langs->trans("DateActionEnd").''; if (!$object->fulldayevent) print dol_print_date($object->datef, 'dayhour'); else print dol_print_date($object->datef, 'day'); if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) print img_warning($langs->trans("Late")); @@ -1786,11 +1808,11 @@ if ($id > 0) // Location if (empty($conf->global->AGENDA_DISABLE_LOCATION)) { - print ''.$langs->trans("Location").''.$object->location.''; + print ''.$langs->trans("Location").''.$object->location.''; } // Assigned to - print ''.$langs->trans("ActionAssignedTo").''; + print ''.$langs->trans("ActionAssignedTo").''; $listofuserid = array(); if (empty($donotclearsession)) { @@ -1840,7 +1862,7 @@ if ($id > 0) // Done by if ($conf->global->AGENDA_ENABLE_DONEBY) { - print ''.$langs->trans("ActionDoneBy").''; + print ''.$langs->trans("ActionDoneBy").''; if ($object->userdoneid > 0) { $tmpuser = new User($db); @@ -1852,14 +1874,16 @@ if ($id > 0) // Categories if ($conf->categorie->enabled) { - print ''.$langs->trans("Categories").''; + print ''.$langs->trans("Categories").''; print $form->showCategories($object->id, Categorie::TYPE_ACTIONCOMM, 1); print ""; } print ''; - print '
'; + print '
'; + + print '
'; print '
'; print ''; @@ -1867,7 +1891,7 @@ if ($id > 0) if ($conf->societe->enabled) { // Related company - print ''; - print ''; @@ -1918,24 +1942,43 @@ if ($id > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; print ''; $link = dolGetElementUrl($object->fk_element, $object->elementtype, 1); - print ''; } // Description - print ''; // Other attributes - $cols = 3; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + // Reminders + if ($conf->global->AGENDA_REMINDER_EMAIL || $conf->global->AGENDA_REMINDER_BROWSER) + { + $object->loadReminders(); + + if (count($object->reminders) > 0) { + //checkbox create reminder + + print ''; + } + } + print '
'.$langs->trans("ActionOnCompany").''.($object->thirdparty->id ? $object->thirdparty->getNomUrl(1) : (''.$langs->trans("None").'')); + print '
'.$langs->trans("ActionOnCompany").''.($object->thirdparty->id ? $object->thirdparty->getNomUrl(1) : (''.$langs->trans("None").'')); if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL') { if ($object->thirdparty->fetch($object->thirdparty->id)) @@ -1879,7 +1903,7 @@ if ($id > 0) // Related contact print '
'.$langs->trans("ActionOnContact").''; + print ''; if (!empty($object->socpeopleassigned)) { @@ -1907,7 +1931,7 @@ if ($id > 0) } // Priority - print '
'.$langs->trans("Priority").''; + print '
'.$langs->trans("Priority").''; print ($object->priority ? $object->priority : ''); print '
'.$langs->trans("LinkedObject").''; + print ''; if (empty($link)) print ''.$langs->trans("ObjectDeleted").''; else print $link; print '
'.$langs->trans("Description").''; + print '
'.$langs->trans("Description").''; print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_private)); print '
'.$langs->trans("Reminders").''; + + foreach($object->reminders as $actioncommreminderid => $actioncommreminder) { + print $TRemindTypes[$actioncommreminder->typeremind].' - '.$actioncommreminder->offsetvalue.' '.$TDurationTypes[$actioncommreminder->offsetunit]; + } + + print '
'; print '
'; + print '
'; + print '
'; dol_fiche_end(); } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index dc82c0cfaa4..56bfa01555e 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -226,6 +226,10 @@ class ActionComm extends CommonObject */ public $otherassigned = array(); + /** + * @var array Array of reminders + */ + public $reminders = array(); /** * @var User Object user of owner @@ -1949,6 +1953,54 @@ class ActionComm extends CommonObject } + /** + * Load event reminder of events + * + * @param string $type Type of reminder 'browser' or 'email' + * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) + */ + public function loadReminders($type = '') + { + global $conf, $langs, $user; + + $error = 0; + + $this->reminders = array(); + + //Select all action comm reminders for event + $sql = "SELECT rowid as id, typeremind, dateremind, status, offsetvalue, offsetunit"; + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm_reminder"; + $sql .= " WHERE fk_actioncomm = ".$this->id." AND dateremind <= '".$this->db->idate(dol_now())."'"; + if ($type) { + $sql .= " AND typeremind ='".$this->db->escape($type)."'"; + } + if (empty($conf->global->AGENDA_REMINDER_EMAIL)) $sql .= " AND typeremind != 'email'"; + if (empty($conf->global->AGENDA_REMINDER_BROWSER)) $sql .= " AND typeremind != 'browser'"; + + $sql .= $this->db->order("dateremind", "ASC"); + $resql = $this->db->query($sql); + + if ($resql) { + while ($obj = $this->db->fetch_object($resql)) { + $tmpactioncommreminder = new ActionCommReminder($this->db); + $tmpactioncommreminder->id = $obj->id; + $tmpactioncommreminder->typeremind = $obj->typeremind; + $tmpactioncommreminder->dateremind = $obj->dateremind; + $tmpactioncommreminder->offsetvalue = $obj->offsetvalue; + $tmpactioncommreminder->offsetunit = $obj->offsetunit; + $tmpactioncommreminder->status = $obj->status; + + $this->reminders[$obj->id] = $tmpactioncommreminder; + } + } else { + $this->error = $this->db->lasterror(); + $error++; + } + + return count($this->reminders); + } + + /** * Send reminders by emails * CAN BE A CRON TASK diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 5c53f6715a2..15785060809 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1508,7 +1508,7 @@ if ($action == 'create') } } else { print ''; - print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); + print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500'); // reload page to retrieve customer informations if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3350507e543..2c2e4041923 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1834,18 +1834,7 @@ class Form $userstatic = new User($this->db); $out = ''; - // Method with no ajax - //$out.='
'; - if ($action == 'view') - { - $out .= ''; - } else { - $out .= ''; - $out .= ''; - $out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); - $out .= ' '; - $out .= '
'; - } + $assignedtouser = array(); if (!empty($_SESSION['assignedtouser'])) { @@ -1853,7 +1842,7 @@ class Form } $nbassignetouser = count($assignedtouser); - if ($nbassignetouser && $action != 'view') $out .= '
'; + //if ($nbassignetouser && $action != 'view') $out .= '
'; if ($nbassignetouser) $out .= ''; - //$out.='
'; + // Method with no ajax + if ($action != 'view') + { + $out .= ''; + $out .= ''; + $out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); + $out .= ' '; + $out .= '
'; + } + return $out; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 22f1990799b..033e34822ad 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3038,7 +3038,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'generic', 'home', 'hrm', 'members', 'products', 'invoicing', 'payment', 'pencil-ruler', 'preview', 'project', 'projectpub', 'refresh', 'supplier_invoice', 'ticket', 'error', 'warning', - 'recruitmentcandidature', 'recruitmentjobposition', + 'recruitmentcandidature', 'recruitmentjobposition', 'resource', 'supplier_proposal', 'supplier_order', 'supplier_invoice', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda' ) diff --git a/htdocs/core/tpl/resource_view.tpl.php b/htdocs/core/tpl/resource_view.tpl.php index 50eb0167f36..ed54b4a2d00 100644 --- a/htdocs/core/tpl/resource_view.tpl.php +++ b/htdocs/core/tpl/resource_view.tpl.php @@ -73,11 +73,11 @@ if ((array) $linked_resources && count($linked_resources) > 0) print '
'; print '
'; - print ''; + print ''; print img_edit(); print ''; print ' '; - print ''; + print ''; print img_picto($langs->trans("Unlink"), 'unlink'); print ''; print '
'; diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 7b716d8050d..aff922c4c23 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -152,6 +152,7 @@ ActionType=Event type DateActionBegin=Start event date ConfirmCloneEvent=Are you sure you want to clone the event %s? RepeatEvent=Repeat event +OnceOnly=Once only EveryWeek=Every week EveryMonth=Every month DayOfMonth=Day of month diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 0fc5d256541..43756f84405 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -922,7 +922,7 @@ class Dolresource extends CommonObject global $conf, $langs; $result = ''; - $label = img_picto('', $this->picto).' '.$langs->trans("ShowResource").''; + $label = img_picto('', $this->picto).' '.$langs->trans("Resource").''; $label .= '
'; $label .= ''.$langs->trans('Ref').': '.$this->ref; /*if (isset($this->status)) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 1e4f278afc0..0c59a2354ab 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1239,7 +1239,7 @@ table[summary="list_of_modules"] .fa-cog { margin-bottom: 15px !important; } - select.minwidth100imp, select.minwidth100, select.minwidth200, .widthcentpercentminusx { + select.minwidth100imp, select.minwidth100, select.minwidth200, select.minwidth300, .widthcentpercentminusx { width: calc(100% - 50px) !important; display: inline-block; }