@@ -8,12 +8,16 @@ |
||
8 | 8 | } |
9 | 9 | |
10 | 10 | // Loop to complete $param for extrafields |
11 | -if (! empty($search_array_options)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
11 | +if (! empty($search_array_options)) { |
|
12 | + // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
12 | 13 | { |
13 | 14 | foreach ($search_array_options as $key => $val) |
14 | 15 | { |
15 | 16 | $crit=$val; |
16 | - $tmpkey=preg_replace('/search_options_/','',$key); |
|
17 | - if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); |
|
18 | 17 | } |
18 | + $tmpkey=preg_replace('/search_options_/','',$key); |
|
19 | + if ($val != '') { |
|
20 | + $param.='&search_options_'.$tmpkey.'='.urlencode($val); |
|
21 | + } |
|
22 | + } |
|
19 | 23 | } |
@@ -7,10 +7,13 @@ discard block |
||
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element; |
|
10 | +if (empty($extrafieldsobjectkey) && is_object($object)) { |
|
11 | + $extrafieldsobjectkey=$object->table_element; |
|
12 | +} |
|
11 | 13 | |
12 | 14 | // Loop to show all columns of extrafields for the title line |
13 | -if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
15 | +if (! empty($extrafieldsobjectkey)) { |
|
16 | + // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
14 | 17 | { |
15 | 18 | if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) |
16 | 19 | { |
@@ -19,10 +22,16 @@ discard block |
||
19 | 22 | if (! empty($arrayfields["ef.".$key]['checked'])) |
20 | 23 | { |
21 | 24 | $align=$extrafields->getAlignFlag($key); |
25 | +} |
|
22 | 26 | $sortonfield = "ef.".$key; |
23 | - if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield=''; |
|
24 | - if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>'; |
|
25 | - else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n"; |
|
27 | + if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) { |
|
28 | + $sortonfield=''; |
|
29 | + } |
|
30 | + if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') { |
|
31 | + print '<th class="liste_titre thseparator"></th>'; |
|
32 | + } else { |
|
33 | + print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n"; |
|
34 | + } |
|
26 | 35 | } |
27 | 36 | } |
28 | 37 | } |
@@ -38,15 +38,24 @@ discard block |
||
38 | 38 | foreach($object->fields as $key => $val) |
39 | 39 | { |
40 | 40 | // Discard if extrafield is a hidden field on form |
41 | - if (abs($val['visible']) != 1) continue; |
|
41 | + if (abs($val['visible']) != 1) { |
|
42 | + continue; |
|
43 | + } |
|
42 | 44 | |
43 | - if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field |
|
45 | + if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) { |
|
46 | + continue; |
|
47 | + } |
|
48 | + // We don't want this field |
|
44 | 49 | |
45 | 50 | print '<tr id="field_'.$key.'">'; |
46 | 51 | print '<td'; |
47 | 52 | print ' class="titlefieldcreate'; |
48 | - if ($val['notnull'] > 0) print ' fieldrequired'; |
|
49 | - if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; |
|
53 | + if ($val['notnull'] > 0) { |
|
54 | + print ' fieldrequired'; |
|
55 | + } |
|
56 | + if ($val['type'] == 'text' || $val['type'] == 'html') { |
|
57 | + print ' tdtop'; |
|
58 | + } |
|
50 | 59 | print '"'; |
51 | 60 | print '>'; |
52 | 61 | print $langs->trans($val['label']); |
@@ -55,9 +64,13 @@ discard block |
||
55 | 64 | } |
56 | 65 | print '</td>'; |
57 | 66 | print '<td>'; |
58 | - if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int'); |
|
59 | - elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none'); |
|
60 | - else $value = GETPOST($key, 'alpha'); |
|
67 | + if (in_array($val['type'], array('int', 'integer'))) { |
|
68 | + $value = GETPOST($key, 'int'); |
|
69 | + } elseif ($val['type'] == 'text' || $val['type'] == 'html') { |
|
70 | + $value = GETPOST($key, 'none'); |
|
71 | + } else { |
|
72 | + $value = GETPOST($key, 'alpha'); |
|
73 | + } |
|
61 | 74 | print $object->showInputField($val, $key, $value, '', '', '', 0); |
62 | 75 | print '</td>'; |
63 | 76 | print '</tr>'; |
@@ -31,19 +31,31 @@ discard block |
||
31 | 31 | exit; |
32 | 32 | } |
33 | 33 | |
34 | -if (! is_object($form)) $form=new Form($db); |
|
34 | +if (! is_object($form)) { |
|
35 | + $form=new Form($db); |
|
36 | +} |
|
35 | 37 | |
36 | 38 | |
37 | 39 | ?> |
38 | 40 | <!-- BEGIN PHP TEMPLATE extrafields_view.tpl.php --> |
39 | 41 | <?php |
40 | -if (! is_array($parameters)) $parameters = array(); |
|
41 | -if (! empty($cols)) $parameters['colspan'] = ' colspan="'.$cols.'"'; |
|
42 | -if (! empty($cols)) $parameters['cols'] = $cols; |
|
43 | -if (! empty($object->fk_soc)) $parameters['socid'] = $object->fk_soc; |
|
42 | +if (! is_array($parameters)) { |
|
43 | + $parameters = array(); |
|
44 | +} |
|
45 | +if (! empty($cols)) { |
|
46 | + $parameters['colspan'] = ' colspan="'.$cols.'"'; |
|
47 | +} |
|
48 | +if (! empty($cols)) { |
|
49 | + $parameters['cols'] = $cols; |
|
50 | +} |
|
51 | +if (! empty($object->fk_soc)) { |
|
52 | + $parameters['socid'] = $object->fk_soc; |
|
53 | +} |
|
44 | 54 | $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); |
45 | 55 | print $hookmanager->resPrint; |
46 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
56 | +if ($reshook < 0) { |
|
57 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
58 | +} |
|
47 | 59 | |
48 | 60 | |
49 | 61 | //var_dump($extrafields->attributes[$object->table_element]); |
@@ -70,25 +82,34 @@ discard block |
||
70 | 82 | } |
71 | 83 | //print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].'<br>'."\n"; |
72 | 84 | |
73 | - if (empty($enabled)) continue; // 0 = Never visible field |
|
74 | - if (abs($enabled) != 1 && abs($enabled) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list |
|
75 | - if (empty($perms)) continue; // 0 = Not visible |
|
85 | + if (empty($enabled)) { |
|
86 | + continue; |
|
87 | + } |
|
88 | + // 0 = Never visible field |
|
89 | + if (abs($enabled) != 1 && abs($enabled) != 3) { |
|
90 | + continue; |
|
91 | + } |
|
92 | + // <> -1 and <> 1 and <> 3 = not visible on forms, only on list |
|
93 | + if (empty($perms)) { |
|
94 | + continue; |
|
95 | + } |
|
96 | + // 0 = Not visible |
|
76 | 97 | |
77 | 98 | // Load language if required |
78 | - if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]); |
|
99 | + if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) { |
|
100 | + $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]); |
|
101 | + } |
|
79 | 102 | if ($action == 'edit_extras') |
80 | 103 | { |
81 | 104 | $value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options["options_" . $key]); |
82 | - } |
|
83 | - else |
|
105 | + } else |
|
84 | 106 | { |
85 | 107 | $value = $object->array_options["options_" . $key]; |
86 | 108 | } |
87 | 109 | if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') |
88 | 110 | { |
89 | 111 | print $extrafields->showSeparator($key, $object); |
90 | - } |
|
91 | - else |
|
112 | + } else |
|
92 | 113 | { |
93 | 114 | print '<tr>'; |
94 | 115 | print '<td class="titlefield">'; |
@@ -98,30 +119,53 @@ discard block |
||
98 | 119 | print ' class="'; |
99 | 120 | //var_dump($action);exit; |
100 | 121 | |
101 | - if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' fieldrequired'; |
|
122 | + if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) { |
|
123 | + print ' fieldrequired'; |
|
124 | + } |
|
102 | 125 | print '">'; |
103 | - if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key])); |
|
104 | - else print $langs->trans($label); |
|
126 | + if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) { |
|
127 | + print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key])); |
|
128 | + } else { |
|
129 | + print $langs->trans($label); |
|
130 | + } |
|
105 | 131 | print '</td>'; |
106 | 132 | |
107 | 133 | //TODO Improve element and rights detection |
108 | 134 | //var_dump($user->rights); |
109 | 135 | $permok=false; |
110 | 136 | $keyforperm=$object->element; |
111 | - if ($object->element == 'fichinter') $keyforperm='ficheinter'; |
|
112 | - if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write; |
|
113 | - if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer; |
|
114 | - if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer; |
|
115 | - if ($object->element=='shipping') $permok=$user->rights->expedition->creer; |
|
116 | - if ($object->element=='delivery') $permok=$user->rights->expedition->livraison->creer; |
|
117 | - if ($object->element=='productlot') $permok=$user->rights->stock->creer; |
|
118 | - if ($object->element=='facturerec') $permok=$user->rights->facture->creer; |
|
137 | + if ($object->element == 'fichinter') { |
|
138 | + $keyforperm='ficheinter'; |
|
139 | + } |
|
140 | + if (isset($user->rights->$keyforperm)) { |
|
141 | + $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write; |
|
142 | + } |
|
143 | + if ($object->element=='order_supplier') { |
|
144 | + $permok=$user->rights->fournisseur->commande->creer; |
|
145 | + } |
|
146 | + if ($object->element=='invoice_supplier') { |
|
147 | + $permok=$user->rights->fournisseur->facture->creer; |
|
148 | + } |
|
149 | + if ($object->element=='shipping') { |
|
150 | + $permok=$user->rights->expedition->creer; |
|
151 | + } |
|
152 | + if ($object->element=='delivery') { |
|
153 | + $permok=$user->rights->expedition->livraison->creer; |
|
154 | + } |
|
155 | + if ($object->element=='productlot') { |
|
156 | + $permok=$user->rights->stock->creer; |
|
157 | + } |
|
158 | + if ($object->element=='facturerec') { |
|
159 | + $permok=$user->rights->facture->creer; |
|
160 | + } |
|
119 | 161 | if (($object->statut == 0 || ! empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key])) |
120 | 162 | && $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key) |
121 | 163 | && empty($extrafields->attributes[$object->table_element]['computed'][$key])) |
122 | 164 | { |
123 | 165 | $fieldid='id'; |
124 | - if ($object->table_element == 'societe') $fieldid='socid'; |
|
166 | + if ($object->table_element == 'societe') { |
|
167 | + $fieldid='socid'; |
|
168 | + } |
|
125 | 169 | print '<td align="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?'.$fieldid.'=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>'; |
126 | 170 | } |
127 | 171 | print '</tr></table>'; |
@@ -136,10 +180,12 @@ discard block |
||
136 | 180 | { |
137 | 181 | $datenotinstring = $object->array_options['options_' . $key]; |
138 | 182 | // print 'X'.$object->array_options['options_' . $key].'-'.$datenotinstring.'x'; |
139 | - if (! is_numeric($object->array_options['options_' . $key])) // For backward compatibility |
|
183 | + if (! is_numeric($object->array_options['options_' . $key])) { |
|
184 | + // For backward compatibility |
|
140 | 185 | { |
141 | 186 | $datenotinstring = $db->jdate($datenotinstring); |
142 | 187 | } |
188 | + } |
|
143 | 189 | //print 'x'.$object->array_options['options_' . $key].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour'); |
144 | 190 | $value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $datenotinstring; |
145 | 191 | } |
@@ -147,7 +193,9 @@ discard block |
||
147 | 193 | if ($action == 'edit_extras' && $permok && GETPOST('attribute','none') == $key) |
148 | 194 | { |
149 | 195 | $fieldid='id'; |
150 | - if ($object->table_element == 'societe') $fieldid='socid'; |
|
196 | + if ($object->table_element == 'societe') { |
|
197 | + $fieldid='socid'; |
|
198 | + } |
|
151 | 199 | print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formextra">'; |
152 | 200 | print '<input type="hidden" name="action" value="update_extras">'; |
153 | 201 | print '<input type="hidden" name="attribute" value="' . $key . '">'; |
@@ -159,8 +207,7 @@ discard block |
||
159 | 207 | print '<input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '">'; |
160 | 208 | |
161 | 209 | print '</form>'; |
162 | - } |
|
163 | - else |
|
210 | + } else |
|
164 | 211 | { |
165 | 212 | //print $key.'-'.$value.'-'.$object->table_element; |
166 | 213 | print $extrafields->showOutputField($key, $value, '', $object->table_element); |
@@ -7,27 +7,39 @@ |
||
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element; |
|
10 | +if (empty($extrafieldsobjectkey) && is_object($object)) { |
|
11 | + $extrafieldsobjectkey=$object->table_element; |
|
12 | +} |
|
11 | 13 | |
12 | 14 | // Loop to complete the sql search criterias from extrafields |
13 | -if (! empty($extrafieldsobjectkey) && ! empty($search_array_options) && is_array($search_array_options)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
15 | +if (! empty($extrafieldsobjectkey) && ! empty($search_array_options) && is_array($search_array_options)) { |
|
16 | + // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
14 | 17 | { |
15 | 18 | foreach ($search_array_options as $key => $val) |
16 | 19 | { |
17 | 20 | $crit=$val; |
21 | +} |
|
18 | 22 | $tmpkey=preg_replace('/search_options_/','',$key); |
19 | 23 | $typ=$extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey]; |
20 | 24 | |
21 | 25 | if ($crit != '' && in_array($typ, array('date', 'datetime', 'timestamp'))) |
22 | 26 | { |
23 | 27 | $sql .= " AND ef.".$tmpkey." = '".$db->idate($crit)."'"; |
24 | - } |
|
25 | - elseif ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) |
|
28 | + } elseif ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) |
|
26 | 29 | { |
27 | 30 | $mode_search=0; |
28 | - if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric |
|
29 | - if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int |
|
30 | - if (in_array($typ, array('chkbxlst','checkbox'))) $mode_search=4; // Search on a multiselect field with sql type = text |
|
31 | + if (in_array($typ, array('int','double','real'))) { |
|
32 | + $mode_search=1; |
|
33 | + } |
|
34 | + // Search on a numeric |
|
35 | + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') { |
|
36 | + $mode_search=2; |
|
37 | + } |
|
38 | + // Search on a foreign key int |
|
39 | + if (in_array($typ, array('chkbxlst','checkbox'))) { |
|
40 | + $mode_search=4; |
|
41 | + } |
|
42 | + // Search on a multiselect field with sql type = text |
|
31 | 43 | |
32 | 44 | $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); |
33 | 45 | } |
@@ -54,10 +54,12 @@ discard block |
||
54 | 54 | { |
55 | 55 | $listofselectedid[$toselectid] = $toselectid; |
56 | 56 | $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid); |
57 | - if ($objecttmp->element == 'societe') |
|
58 | - $thirdpartyid = $objecttmp->id; |
|
59 | - if ($objecttmp->element == 'expensereport') |
|
60 | - $thirdpartyid = $objecttmp->fk_user_author; |
|
57 | + if ($objecttmp->element == 'societe') { |
|
58 | + $thirdpartyid = $objecttmp->id; |
|
59 | + } |
|
60 | + if ($objecttmp->element == 'expensereport') { |
|
61 | + $thirdpartyid = $objecttmp->fk_user_author; |
|
62 | + } |
|
61 | 63 | $listofselectedthirdparties[$thirdpartyid] = $thirdpartyid; |
62 | 64 | $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref; |
63 | 65 | } |
@@ -82,24 +84,27 @@ discard block |
||
82 | 84 | $formmail->fromid = $user->id; |
83 | 85 | } |
84 | 86 | $formmail->trackid = $trackid; |
85 | - if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set |
|
87 | + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) { |
|
88 | + // If bit 2 is set |
|
86 | 89 | { |
87 | 90 | include DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; |
91 | + } |
|
88 | 92 | $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); |
89 | 93 | } |
90 | 94 | $formmail->withfrom = 1; |
91 | 95 | $liste = $langs->trans("AllRecipientSelected", count($arrayofselected)); |
92 | - if (count($listofselectedthirdparties) == 1) // Only 1 different recipient selected, we can suggest contacts |
|
96 | + if (count($listofselectedthirdparties) == 1) { |
|
97 | + // Only 1 different recipient selected, we can suggest contacts |
|
93 | 98 | { |
94 | 99 | $liste = array(); |
100 | + } |
|
95 | 101 | $thirdpartyid = array_shift($listofselectedthirdparties); |
96 | 102 | if ($objecttmp->element == 'expensereport') |
97 | 103 | { |
98 | 104 | $fuser = new User($db); |
99 | 105 | $fuser->fetch($thirdpartyid); |
100 | 106 | $liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">"; |
101 | - } |
|
102 | - else |
|
107 | + } else |
|
103 | 108 | { |
104 | 109 | $soc = new Societe($db); |
105 | 110 | $soc->fetch($thirdpartyid); |
@@ -156,8 +161,7 @@ discard block |
||
156 | 161 | print img_warning() . ' ' . $langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB); |
157 | 162 | print ' - <a href="javascript: window.history.go(-1)">' . $langs->trans("GoBack") . '</a>'; |
158 | 163 | $arrayofmassactions = array(); |
159 | - } |
|
160 | - else |
|
164 | + } else |
|
161 | 165 | { |
162 | 166 | print $formmail->get_form(); |
163 | 167 | } |
@@ -29,14 +29,26 @@ discard block |
||
29 | 29 | header('Cache-Control: Public, must-revalidate'); |
30 | 30 | header("Content-type: text/html; charset=".$conf->file->character_set_client); |
31 | 31 | |
32 | -if (GETPOST('dol_hide_topmenu')) $conf->dol_hide_topmenu=1; |
|
33 | -if (GETPOST('dol_hide_leftmenu')) $conf->dol_hide_leftmenu=1; |
|
34 | -if (GETPOST('dol_optimize_smallscreen')) $conf->dol_optimize_smallscreen=1; |
|
35 | -if (GETPOST('dol_no_mouse_hover')) $conf->dol_no_mouse_hover=1; |
|
36 | -if (GETPOST('dol_use_jmobile')) $conf->dol_use_jmobile=1; |
|
32 | +if (GETPOST('dol_hide_topmenu')) { |
|
33 | + $conf->dol_hide_topmenu=1; |
|
34 | +} |
|
35 | +if (GETPOST('dol_hide_leftmenu')) { |
|
36 | + $conf->dol_hide_leftmenu=1; |
|
37 | +} |
|
38 | +if (GETPOST('dol_optimize_smallscreen')) { |
|
39 | + $conf->dol_optimize_smallscreen=1; |
|
40 | +} |
|
41 | +if (GETPOST('dol_no_mouse_hover')) { |
|
42 | + $conf->dol_no_mouse_hover=1; |
|
43 | +} |
|
44 | +if (GETPOST('dol_use_jmobile')) { |
|
45 | + $conf->dol_use_jmobile=1; |
|
46 | +} |
|
37 | 47 | |
38 | 48 | // If we force to use jmobile, then we reenable javascript |
39 | -if (! empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax=1; |
|
49 | +if (! empty($conf->dol_use_jmobile)) { |
|
50 | + $conf->use_javascript_ajax=1; |
|
51 | +} |
|
40 | 52 | |
41 | 53 | $php_self = $_SERVER['PHP_SELF']; |
42 | 54 | $php_self.= dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):''; |
@@ -47,7 +59,9 @@ discard block |
||
47 | 59 | |
48 | 60 | |
49 | 61 | $colorbackhmenu1='60,70,100'; // topmenu |
50 | -if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1=$colorbackhmenu1; |
|
62 | +if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) { |
|
63 | + $conf->global->THEME_ELDY_TOPMENU_BACK1=$colorbackhmenu1; |
|
64 | +} |
|
51 | 65 | $colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1); |
52 | 66 | $colorbackhmenu1=join(',',colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z' |
53 | 67 | |
@@ -77,9 +91,13 @@ discard block |
||
77 | 91 | <!-- Title with version --> |
78 | 92 | <div class="login_table_title center" title="<?php echo dol_escape_htmltag($title); ?>"> |
79 | 93 | <?php |
80 | -if ($disablenofollow) echo '<a class="login_table_title" href="https://www.dolibarr.org" target="_blank">'; |
|
94 | +if ($disablenofollow) { |
|
95 | + echo '<a class="login_table_title" href="https://www.dolibarr.org" target="_blank">'; |
|
96 | +} |
|
81 | 97 | echo dol_escape_htmltag($title); |
82 | -if ($disablenofollow) echo '</a>'; |
|
98 | +if ($disablenofollow) { |
|
99 | + echo '</a>'; |
|
100 | +} |
|
83 | 101 | ?> |
84 | 102 | </div> |
85 | 103 | |
@@ -119,8 +137,7 @@ discard block |
||
119 | 137 | echo $option; |
120 | 138 | } |
121 | 139 | } |
122 | - } |
|
123 | - else { |
|
140 | + } else { |
|
124 | 141 | echo '<!-- Option by hook -->'; |
125 | 142 | echo $morelogincontent; |
126 | 143 | } |
@@ -130,8 +147,11 @@ discard block |
||
130 | 147 | <?php if ($captcha) { |
131 | 148 | // Add a variable param to force not using cache (jmobile) |
132 | 149 | $php_self = preg_replace('/[&\?]time=(\d+)/','',$php_self); // Remove param time |
133 | - if (preg_match('/\?/',$php_self)) $php_self.='&time='.dol_print_date(dol_now(),'dayhourlog'); |
|
134 | - else $php_self.='?time='.dol_print_date(dol_now(),'dayhourlog'); |
|
150 | + if (preg_match('/\?/',$php_self)) { |
|
151 | + $php_self.='&time='.dol_print_date(dol_now(),'dayhourlog'); |
|
152 | + } else { |
|
153 | + $php_self.='?time='.dol_print_date(dol_now(),'dayhourlog'); |
|
154 | + } |
|
135 | 155 | ?> |
136 | 156 | <!-- Captcha --> |
137 | 157 | <div class="trinputlogin"> |
@@ -168,10 +188,18 @@ discard block |
||
168 | 188 | <div align="center" style="margin-top: 15px;"> |
169 | 189 | <?php |
170 | 190 | $moreparam=''; |
171 | - if (! empty($conf->dol_hide_topmenu)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_topmenu='.$conf->dol_hide_topmenu; |
|
172 | - if (! empty($conf->dol_hide_leftmenu)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_leftmenu='.$conf->dol_hide_leftmenu; |
|
173 | - if (! empty($conf->dol_no_mouse_hover)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_no_mouse_hover='.$conf->dol_no_mouse_hover; |
|
174 | - if (! empty($conf->dol_use_jmobile)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$conf->dol_use_jmobile; |
|
191 | + if (! empty($conf->dol_hide_topmenu)) { |
|
192 | + $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_topmenu='.$conf->dol_hide_topmenu; |
|
193 | + } |
|
194 | + if (! empty($conf->dol_hide_leftmenu)) { |
|
195 | + $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_leftmenu='.$conf->dol_hide_leftmenu; |
|
196 | + } |
|
197 | + if (! empty($conf->dol_no_mouse_hover)) { |
|
198 | + $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_no_mouse_hover='.$conf->dol_no_mouse_hover; |
|
199 | + } |
|
200 | + if (! empty($conf->dol_use_jmobile)) { |
|
201 | + $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$conf->dol_use_jmobile; |
|
202 | + } |
|
175 | 203 | |
176 | 204 | print '<a class="alogin" href="'.$dol_url_root.'/index.php'.$moreparam.'">'.$langs->trans('BackToLoginPage').'</a>'; |
177 | 205 | ?> |
@@ -189,7 +217,7 @@ discard block |
||
189 | 217 | <span class="passwordmessagedesc"> |
190 | 218 | <?php echo $langs->trans('SendNewPasswordDesc'); ?> |
191 | 219 | </span> |
192 | -<?php }else{ ?> |
|
220 | +<?php } else{ ?> |
|
193 | 221 | <div class="warning" align="center"> |
194 | 222 | <?php echo $langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode); ?> |
195 | 223 | </div> |
@@ -213,8 +241,7 @@ discard block |
||
213 | 241 | echo $option."\n"; |
214 | 242 | } |
215 | 243 | } |
216 | -} |
|
217 | -else if (! empty($moreloginextracontent)) { |
|
244 | +} else if (! empty($moreloginextracontent)) { |
|
218 | 245 | echo '<!-- Javascript by hook -->'; |
219 | 246 | echo $moreloginextracontent; |
220 | 247 | } |
@@ -40,21 +40,41 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | $usemargins=0; |
43 | -if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1; |
|
43 | +if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) { |
|
44 | + $usemargins=1; |
|
45 | +} |
|
44 | 46 | |
45 | 47 | global $forceall, $senderissupplier, $inputalsopricewithtax; |
46 | -if (empty($dateSelector)) $dateSelector=0; |
|
47 | -if (empty($forceall)) $forceall=0; |
|
48 | -if (empty($senderissupplier)) $senderissupplier=0; |
|
49 | -if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; |
|
48 | +if (empty($dateSelector)) { |
|
49 | + $dateSelector=0; |
|
50 | +} |
|
51 | +if (empty($forceall)) { |
|
52 | + $forceall=0; |
|
53 | +} |
|
54 | +if (empty($senderissupplier)) { |
|
55 | + $senderissupplier=0; |
|
56 | +} |
|
57 | +if (empty($inputalsopricewithtax)) { |
|
58 | + $inputalsopricewithtax=0; |
|
59 | +} |
|
50 | 60 | |
51 | 61 | |
52 | 62 | // Define colspan for button Add |
53 | 63 | $colspan = 3; // Col total ht + col edit + col delete |
54 | -if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc |
|
55 | -if (in_array($object->element,array('propal','supplier_proposal','facture','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button |
|
56 | -if (empty($user->rights->margins->creer)) $colspan++; |
|
57 | -if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2; |
|
64 | +if (! empty($inputalsopricewithtax)) { |
|
65 | + $colspan++; |
|
66 | +} |
|
67 | +// We add 1 if col total ttc |
|
68 | +if (in_array($object->element,array('propal','supplier_proposal','facture','invoice','commande','order','order_supplier','invoice_supplier'))) { |
|
69 | + $colspan++; |
|
70 | +} |
|
71 | +// With this, there is a column move button |
|
72 | +if (empty($user->rights->margins->creer)) { |
|
73 | + $colspan++; |
|
74 | +} |
|
75 | +if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { |
|
76 | + $colspan+=2; |
|
77 | +} |
|
58 | 78 | ?> |
59 | 79 | |
60 | 80 | <!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php --> |
@@ -78,8 +98,11 @@ discard block |
||
78 | 98 | |
79 | 99 | <a href="<?php echo DOL_URL_ROOT.'/product/card.php?id='.$line->fk_product; ?>"> |
80 | 100 | <?php |
81 | - if ($line->product_type==1) echo img_object($langs->trans('ShowService'),'service'); |
|
82 | - else print img_object($langs->trans('ShowProduct'),'product'); |
|
101 | + if ($line->product_type==1) { |
|
102 | + echo img_object($langs->trans('ShowService'),'service'); |
|
103 | + } else { |
|
104 | + print img_object($langs->trans('ShowProduct'),'product'); |
|
105 | + } |
|
83 | 106 | echo ' '.$line->ref; |
84 | 107 | ?> |
85 | 108 | </a> |
@@ -105,10 +128,14 @@ discard block |
||
105 | 128 | // editeur wysiwyg |
106 | 129 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
107 | 130 | $nbrows=ROWS_2; |
108 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
131 | + if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
|
132 | + $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
133 | + } |
|
109 | 134 | $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
110 | 135 | $toolbarname='dolibarr_details'; |
111 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
136 | + if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) { |
|
137 | + $toolbarname='dolibarr_notes'; |
|
138 | + } |
|
112 | 139 | $doleditor=new DolEditor('product_desc',$line->description,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%'); |
113 | 140 | $doleditor->Create(); |
114 | 141 | } else { |
@@ -130,10 +157,13 @@ discard block |
||
130 | 157 | </td> |
131 | 158 | |
132 | 159 | <?php |
133 | - if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
|
160 | + if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
|
161 | + // We must have same test in printObjectLines |
|
134 | 162 | { |
135 | 163 | ?> |
136 | - <td align="right"><input id="fourn_ref" name="fourn_ref" class="flat minwidth75" value="<?php echo ($line->ref_supplier ? $line->ref_supplier : $line->ref_fourn); ?>"></td> |
|
164 | + <td align="right"><input id="fourn_ref" name="fourn_ref" class="flat minwidth75" value="<?php echo ($line->ref_supplier ? $line->ref_supplier : $line->ref_fourn); |
|
165 | + } |
|
166 | + ?>"></td> |
|
137 | 167 | <?php |
138 | 168 | } |
139 | 169 | |
@@ -146,7 +176,9 @@ discard block |
||
146 | 176 | |
147 | 177 | $coldisplay++; |
148 | 178 | print '<td align="right"><input type="text" class="flat right" size="5" id="price_ht" name="price_ht" value="' . (isset($line->pu_ht)?price($line->pu_ht,0,'',0):price($line->subprice,0,'',0)) . '"'; |
149 | - if ($this->situation_counter > 1) print ' readonly'; |
|
179 | + if ($this->situation_counter > 1) { |
|
180 | + print ' readonly'; |
|
181 | + } |
|
150 | 182 | print '></td>'; |
151 | 183 | |
152 | 184 | if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { |
@@ -157,7 +189,9 @@ discard block |
||
157 | 189 | { |
158 | 190 | $coldisplay++; |
159 | 191 | print '<td align="right"><input type="text" class="flat right" size="5" id="price_ttc" name="price_ttc" value="'.(isset($line->pu_ttc)?price($line->pu_ttc,0,'',0):'').'"'; |
160 | - if ($this->situation_counter > 1) print ' readonly'; |
|
192 | + if ($this->situation_counter > 1) { |
|
193 | + print ' readonly'; |
|
194 | + } |
|
161 | 195 | print '></td>'; |
162 | 196 | } |
163 | 197 | ?> |
@@ -168,7 +202,9 @@ discard block |
||
168 | 202 | // must also not be output for most entities (proposal, intervention, ...) |
169 | 203 | //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; |
170 | 204 | print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="' . $line->qty . '"'; |
171 | - if ($this->situation_counter > 1) print ' readonly'; |
|
205 | + if ($this->situation_counter > 1) { |
|
206 | + print ' readonly'; |
|
207 | + } |
|
172 | 208 | print '>'; |
173 | 209 | } else { ?> |
174 | 210 | |
@@ -187,7 +223,9 @@ discard block |
||
187 | 223 | <td align="right" class="nowrap"><?php $coldisplay++; ?> |
188 | 224 | <?php if (($line->info_bits & 2) != 2) { |
189 | 225 | print '<input size="1" type="text" class="flat right" name="remise_percent" id="remise_percent" value="' . $line->remise_percent . '"'; |
190 | - if ($this->situation_counter > 1) print ' readonly'; |
|
226 | + if ($this->situation_counter > 1) { |
|
227 | + print ' readonly'; |
|
228 | + } |
|
191 | 229 | print '>%'; |
192 | 230 | } else { ?> |
193 | 231 | |
@@ -216,20 +254,21 @@ discard block |
||
216 | 254 | { |
217 | 255 | $margin_rate = (isset($_POST["np_marginRate"])?GETPOST("np_marginRate","alpha",2):(($line->pa_ht == 0)?'':price($line->marge_tx))); |
218 | 256 | // if credit note, dont allow to modify margin |
219 | - if ($line->subprice < 0) |
|
220 | - echo '<td align="right" class="nowrap margininfos">'.$margin_rate.'<span class="hideonsmartphone">%</span></td>'; |
|
221 | - else |
|
222 | - echo '<td align="right" class="nowrap margininfos"><input class="right" type="text" size="2" name="np_marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>'; |
|
257 | + if ($line->subprice < 0) { |
|
258 | + echo '<td align="right" class="nowrap margininfos">'.$margin_rate.'<span class="hideonsmartphone">%</span></td>'; |
|
259 | + } else { |
|
260 | + echo '<td align="right" class="nowrap margininfos"><input class="right" type="text" size="2" name="np_marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>'; |
|
261 | + } |
|
223 | 262 | $coldisplay++; |
224 | - } |
|
225 | - elseif (! empty($conf->global->DISPLAY_MARK_RATES)) |
|
263 | + } elseif (! empty($conf->global->DISPLAY_MARK_RATES)) |
|
226 | 264 | { |
227 | 265 | $mark_rate = (isset($_POST["np_markRate"])?GETPOST("np_markRate",'alpha',2):price($line->marque_tx)); |
228 | 266 | // if credit note, dont allow to modify margin |
229 | - if ($line->subprice < 0) |
|
230 | - echo '<td align="right" class="nowrap margininfos">'.$mark_rate.'<span class="hideonsmartphone">%</span></td>'; |
|
231 | - else |
|
232 | - echo '<td align="right" class="nowrap margininfos"><input class="right" type="text" size="2" name="np_markRate" value="'.$mark_rate.'"><span class="hideonsmartphone">%</span></td>'; |
|
267 | + if ($line->subprice < 0) { |
|
268 | + echo '<td align="right" class="nowrap margininfos">'.$mark_rate.'<span class="hideonsmartphone">%</span></td>'; |
|
269 | + } else { |
|
270 | + echo '<td align="right" class="nowrap margininfos"><input class="right" type="text" size="2" name="np_markRate" value="'.$mark_rate.'"><span class="hideonsmartphone">%</span></td>'; |
|
271 | + } |
|
233 | 272 | $coldisplay++; |
234 | 273 | } |
235 | 274 | } |
@@ -172,8 +172,7 @@ discard block |
||
172 | 172 | $param_chain .= $key.','.$value."\n"; |
173 | 173 | } |
174 | 174 | } |
175 | -} |
|
176 | -elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($type == 'password')) |
|
175 | +} elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($type == 'password')) |
|
177 | 176 | { |
178 | 177 | $paramlist=array_keys($param['options']); |
179 | 178 | $param_chain = $paramlist[0]; |
@@ -204,13 +203,17 @@ discard block |
||
204 | 203 | foreach($type2label as $key => $val) |
205 | 204 | { |
206 | 205 | $selected=''; |
207 | - if ($key == (GETPOST('type','alpha')?GETPOST('type','alpha'):$type)) $selected=' selected="selected"'; |
|
208 | - if (in_array($key, $typewecanchangeinto[$type])) print '<option value="'.$key.'"'.$selected.'>'.$val.'</option>'; |
|
209 | - else print '<option value="'.$key.'" disabled="disabled"'.$selected.'>'.$val.'</option>'; |
|
206 | + if ($key == (GETPOST('type','alpha')?GETPOST('type','alpha'):$type)) { |
|
207 | + $selected=' selected="selected"'; |
|
208 | + } |
|
209 | + if (in_array($key, $typewecanchangeinto[$type])) { |
|
210 | + print '<option value="'.$key.'"'.$selected.'>'.$val.'</option>'; |
|
211 | + } else { |
|
212 | + print '<option value="'.$key.'" disabled="disabled"'.$selected.'>'.$val.'</option>'; |
|
213 | + } |
|
210 | 214 | } |
211 | 215 | print '</select>'; |
212 | -} |
|
213 | -else |
|
216 | +} else |
|
214 | 217 | { |
215 | 218 | print $type2label[$type]; |
216 | 219 | print '<input type="hidden" name="type" id="type" value="'.$type.'">'; |