67 public function form_select_status_action($formname, $selected, $canedit = 1, $htmlname =
'complete', $showempty = 0, $onlyselect = 0, $morecss =
'maxwidth100')
72 $listofstatus = array(
73 '-1' => $langs->trans(
"ActionNotApplicable"),
74 '0' => $langs->trans(
"ActionsToDoShort"),
75 '50' => $langs->trans(
"ActionRunningShort"),
76 '100' => $langs->trans(
"ActionDoneShort")
80 if (!empty($conf->use_javascript_ajax))
83 print "<script type=\"text/javascript\">
84 var htmlname = '".$htmlname.
"';
86 $(document).ready(function () {
89 $('#select' + htmlname).change(function() {
92 // FIXME use another method for update combobox
93 //$('#val' + htmlname).change(function() {
98 function select_status() {
99 var defaultvalue = $('#select' + htmlname).val();
100 var percentage = $('input[name=percentage]');
101 var selected = '".(isset($selected) ? $selected :
'').
"';
102 var value = (selected>0?selected:(defaultvalue>=0?defaultvalue:''));
104 percentage.val(value);
106 if (defaultvalue == -1) {
107 percentage.prop('disabled', true);
108 $('.hideifna').hide();
110 else if (defaultvalue == 0) {
112 percentage.removeAttr('disabled'); /* Not disabled, we want to change it to higher value */
113 $('.hideifna').show();
115 else if (defaultvalue == 100) {
117 percentage.prop('disabled', true);
118 $('.hideifna').show();
121 if (defaultvalue == 50 && (percentage.val() == 0 || percentage.val() == 100)) { percentage.val(50) };
122 percentage.removeAttr('disabled');
123 $('.hideifna').show();
128 if (!empty($conf->use_javascript_ajax) || $onlyselect)
131 if ($selected ==
'done') $selected =
'100';
132 print '<select '.($canedit ?
'' :
'disabled ').
'name="'.$htmlname.
'" id="select'.$htmlname.
'" class="flat'.($morecss ?
' '.$morecss :
'').
'">';
133 if ($showempty)
print '<option value=""'.($selected ==
'' ?
' selected' :
'').
'></option>';
134 foreach ($listofstatus as $key => $val)
136 print '<option value="'.$key.
'"'.(($selected == $key && strlen($selected) == strlen($key)) || (($selected > 0 && $selected < 100) && $key ==
'50') ?
' selected' :
'').
'>'.$val.
'</option>';
137 if ($key ==
'50' && $onlyselect == 2)
139 print '<option value="todo"'.($selected ==
'todo' ?
' selected' :
'').
'>'.$langs->trans(
"ActionUncomplete").
' ('.$langs->trans(
"ActionsToDoShort").
"+".$langs->trans(
"ActionRunningShort").
')</option>';
143 if ($selected == 0 || $selected == 100) $canedit = 0;
145 if (empty($onlyselect))
147 print ' <input type="text" id="val'.$htmlname.
'" name="percentage" class="flat hideifna" value="'.($selected >= 0 ? $selected :
'').
'" size="2"'.($canedit && ($selected >= 0) ?
'' :
' disabled').
'>';
148 print '<span class="hideonsmartphone hideifna">%</span>';
151 print ' <input type="text" id="val'.$htmlname.
'" name="percentage" class="flat" value="'.($selected >= 0 ? $selected :
'').
'" size="2"'.($canedit ?
'' :
' disabled').
'>%';
169 public function showactions($object, $typeelement, $socid = 0, $forceshowtitle = 0, $morecss =
'listactions', $max = 0, $moreparambacktopage =
'', $morehtmlcenter =
'')
171 global $langs, $conf, $user;
173 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
175 $sortfield =
'a.datep,a.id';
176 $sortorder =
'DESC,DESC';
178 $listofactions =
ActionComm::getActions($this->
db, $socid, $object->id, $typeelement,
'', $sortfield, $sortorder, ($max ? ($max + 1) : 0));
181 $num = count($listofactions);
182 if ($num || $forceshowtitle)
184 if ($typeelement ==
'invoice') $title = $langs->trans(
'ActionsOnBill');
185 elseif ($typeelement ==
'invoice_supplier' || $typeelement ==
'supplier_invoice') $title = $langs->trans(
'ActionsOnBill');
186 elseif ($typeelement ==
'propal') $title = $langs->trans(
'ActionsOnPropal');
187 elseif ($typeelement ==
'supplier_proposal') $title = $langs->trans(
'ActionsOnSupplierProposal');
188 elseif ($typeelement ==
'order') $title = $langs->trans(
'ActionsOnOrder');
189 elseif ($typeelement ==
'order_supplier' || $typeelement ==
'supplier_order') $title = $langs->trans(
'ActionsOnOrder');
190 elseif ($typeelement ==
'shipping') $title = $langs->trans(
'ActionsOnShipping');
191 elseif ($typeelement ==
'fichinter') $title = $langs->trans(
'ActionsOnFicheInter');
192 elseif ($typeelement ==
'project') $title = $langs->trans(
'LatestLinkedEvents', $max ? $max :
'');
193 elseif ($typeelement ==
'task') $title = $langs->trans(
'LatestLinkedEvents', $max ? $max :
'');
194 elseif ($typeelement ==
'member') $title = $langs->trans(
'LatestLinkedEvents', $max ? $max :
'');
195 else $title = $langs->trans(
"LatestLinkedEvents", $max ? $max :
'');
197 $urlbacktopage =
$_SERVER[
'PHP_SELF'].
'?id='.$object->id.($moreparambacktopage ?
'&'.$moreparambacktopage :
'');
199 $projectid = $object->fk_project;
200 if ($typeelement ==
'project') $projectid = $object->id;
203 if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create))
205 $newcardbutton .=
dolGetButtonTitle($langs->trans(
"AddEvent"),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/comm/action/card.php?action=create&datep='.urlencode(
dol_print_date(
dol_now(),
'dayhourlog',
'tzuser')).
'&origin='.urlencode($typeelement).
'&originid='.$object->id.($object->socid > 0 ?
'&socid='.$object->socid : ($socid > 0 ?
'&socid='.$socid :
'')).($projectid > 0 ?
'&projectid='.$projectid :
'').
'&backtopage='.urlencode($urlbacktopage));
209 print '<!-- formactions->showactions -->'.
"\n";
212 $page = 0; $param =
'';
214 print '<div class="div-table-responsive-no-min">';
215 print '<table class="centpercent noborder'.($morecss ?
' '.$morecss :
'').
'">';
216 print '<tr class="liste_titre">';
217 print
getTitleFieldOfList(
'Ref', 0,
$_SERVER[
"PHP_SELF"],
'', $page, $param,
'', $sortfield, $sortorder,
'', 1);
218 print
getTitleFieldOfList(
'By', 0,
$_SERVER[
"PHP_SELF"],
'', $page, $param,
'', $sortfield, $sortorder,
'', 1);
219 print
getTitleFieldOfList(
'Type', 0,
$_SERVER[
"PHP_SELF"],
'', $page, $param,
'', $sortfield, $sortorder,
'', 1);
220 print
getTitleFieldOfList(
'Title', 0,
$_SERVER[
"PHP_SELF"],
'', $page, $param,
'', $sortfield, $sortorder,
'', 1);
221 print
getTitleFieldOfList(
'Date', 0,
$_SERVER[
"PHP_SELF"],
'a.datep', $page, $param,
'', $sortfield, $sortorder,
'center ', 1);
222 print
getTitleFieldOfList(
'', 0,
$_SERVER[
"PHP_SELF"],
'', $page, $param,
'', $sortfield, $sortorder,
'right ', 1);
226 if (is_array($listofactions) && count($listofactions))
228 $cacheusers = array();
231 foreach ($listofactions as $actioncomm)
233 if ($max && $cursorevent >= $max)
break;
235 $ref = $actioncomm->getNomUrl(1, -1);
236 $label = $actioncomm->getNomUrl(0, 36);
238 print
'<tr class="oddeven">';
241 print
'<td class="nowraponall">'.$ref.
'</td>';
244 print
'<td class="nowraponall tdoverflowmax125">';
245 if (!empty($actioncomm->userownerid))
247 if (is_object($cacheusers[$actioncomm->userownerid]))
249 $tmpuser = $cacheusers[$actioncomm->userownerid];
251 $tmpuser =
new User($this->
db);
252 $tmpuser->fetch($actioncomm->userownerid);
253 $cacheusers[$actioncomm->userownerid] = $tmpuser;
255 if ($tmpuser->id > 0)
257 print $tmpuser->getNomUrl(-1,
'', 0, 0, 16, 0,
'firstelselast',
'');
266 if (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
268 if ($actioncomm->type_picto) {
269 $imgpicto =
img_picto(
'', $actioncomm->type_picto);
271 if ($actioncomm->type_code ==
'AC_RDV') $imgpicto =
img_picto(
'',
'object_group',
'',
false, 0, 0,
'',
'paddingright');
272 elseif ($actioncomm->type_code ==
'AC_TEL') $imgpicto =
img_picto(
'',
'object_phoning',
'',
false, 0, 0,
'',
'paddingright');
273 elseif ($actioncomm->type_code ==
'AC_FAX') $imgpicto =
img_picto(
'',
'object_phoning_fax',
'',
false, 0, 0,
'',
'paddingright');
274 elseif ($actioncomm->type_code ==
'AC_EMAIL') $imgpicto =
img_picto(
'',
'object_email',
'',
false, 0, 0,
'',
'paddingright');
275 elseif ($actioncomm->type_code ==
'AC_INT') $imgpicto =
img_picto(
'',
'object_intervention',
'',
false, 0, 0,
'',
'paddingright');
276 elseif ($actioncomm->type_code ==
'AC_OTH' && $actioncomm->code ==
'TICKET_MSG') $imgpicto =
img_picto(
'',
'object_conversation',
'',
false, 0, 0,
'',
'paddingright');
277 elseif (!preg_match(
'/_AUTO/', $actioncomm->type_code)) $imgpicto =
img_picto(
'',
'object_action',
'',
false, 0, 0,
'',
'paddingright');
281 if ($actioncomm->type_code ==
'AC_OTH' && $actioncomm->code ==
'TICKET_MSG') {
282 print $langs->trans(
"Message");
284 print $actioncomm->type_short ? $actioncomm->type_short : $actioncomm->type;
289 print
'<td>'.$label.
'</td>';
292 print
'<td class="center">'.dol_print_date($actioncomm->datep,
'dayhour',
'tzuserrel');
293 if ($actioncomm->datef)
297 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year'])
299 if ($tmpa[
'hours'] != $tmpb[
'hours'] || $tmpa[
'minutes'] != $tmpb[
'minutes'] && $tmpa[
'seconds'] != $tmpb[
'seconds']) print
'-'.dol_print_date($actioncomm->datef,
'hour',
'tzuserrel');
300 }
else print
'-'.dol_print_date($actioncomm->datef,
'dayhour',
'tzuserrel');
303 print
'<td class="right">';
304 print $actioncomm->getLibStatut(3);
311 print
'<tr class="oddeven"><td colspan="6" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
314 if ($max && $num > $max)
316 print
'<tr class="oddeven"><td colspan="6" class="opacitymedium">'.$langs->trans(
"More").
'...</td></tr>';
341 public function select_type_actions($selected =
'', $htmlname =
'actioncode', $excludetype =
'', $onlyautoornot = 0, $hideinfohelp = 0, $multiselect = 0, $nooutput = 0, $morecss =
'')
344 global $langs, $user, $form, $conf;
346 if (!is_object($form)) $form =
new Form($this->
db);
348 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/cactioncomm.class.php';
349 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
353 $arraylist = $caction->liste_array(1,
'code', $excludetype, $onlyautoornot);
354 if (empty($multiselect)) {
356 array_unshift($arraylist,
' ');
360 if ($selected ==
'manual') $selected =
'AC_OTH';
361 if ($selected ==
'auto') $selected =
'AC_OTH_AUTO';
363 if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO)) unset($arraylist[
'AC_OTH_AUTO']);
367 if (!empty($multiselect))
369 if (!is_array($selected) && !empty($selected)) $selected = explode(
',', $selected);
370 $out .= $form->multiselectarray($htmlname, $arraylist, $selected, 0, 0,
'centpercent', 0, 0);
372 $out .= $form->selectarray($htmlname, $arraylist, $selected, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth200'.($morecss ?
' '.$morecss :
''), 1);
375 if ($user->admin && empty($onlyautoornot) && $hideinfohelp <= 0)
377 $out .=
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup").($hideinfohelp == -1 ?
". ".$langs->trans(
"YouCanSetDefaultValueInModuleSetup") :
''), 1);
380 if ($nooutput)
return $out;
Class to manage different types of events.
dolGetButtonTitle($label, $helpText= '', $iconClass= 'fa fa-file', $url= '', $id= '', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
$conf db
API class for accounts.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_getdate($timestamp, $fast=false, $forcetimezone= '')
Return an array with locale date info.
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
static getActions($db, $socid=0, $fk_element=0, $elementtype= '', $filter= '', $sortfield= 'a.datep', $sortorder= 'DESC', $limit=0)
Load all objects with filters.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip= '', $forcenowrapcolumntitle=0)
Get title line of an array.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin= '1', $morecss= '', $textfordropdown= '')
Show information for admin users or standard users.