@@ -28,8 +28,8 @@ |
||
28 | 28 | // Protection to avoid direct call of template |
29 | 29 | if (empty($object) || ! is_object($object)) |
30 | 30 | { |
31 | - print "Error, template page can't be called as URL"; |
|
32 | - exit; |
|
31 | + print "Error, template page can't be called as URL"; |
|
32 | + exit; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | ?> |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | |
28 | 28 | // Protection to avoid direct call of template |
29 | -if (empty($object) || ! is_object($object)) |
|
29 | +if (empty($object) || !is_object($object)) |
|
30 | 30 | { |
31 | 31 | print "Error, template page can't be called as URL"; |
32 | 32 | exit; |
@@ -36,15 +36,15 @@ discard block |
||
36 | 36 | |
37 | 37 | <!-- BEGIN PHP TEMPLATE AJAXROW.TPL.PHP - Script to enable drag and drop on lines of a table --> |
38 | 38 | <?php |
39 | -$id=$object->id; |
|
40 | -$fk_element=empty($object->fk_element)?$fk_element:$object->fk_element; |
|
41 | -$table_element_line=(empty($table_element_line)?$object->table_element_line:$table_element_line); |
|
42 | -$nboflines=(isset($object->lines)?count($object->lines):(isset($tasksarray)?count($tasksarray):(empty($nboflines)?0:$nboflines))); |
|
43 | -$forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
44 | -$tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
45 | -$filepath=(empty($filepath)?'':$filepath); |
|
39 | +$id = $object->id; |
|
40 | +$fk_element = empty($object->fk_element) ? $fk_element : $object->fk_element; |
|
41 | +$table_element_line = (empty($table_element_line) ? $object->table_element_line : $table_element_line); |
|
42 | +$nboflines = (isset($object->lines) ?count($object->lines) : (isset($tasksarray) ?count($tasksarray) : (empty($nboflines) ? 0 : $nboflines))); |
|
43 | +$forcereloadpage = empty($conf->global->MAIN_FORCE_RELOAD_PAGE) ? 0 : 1; |
|
44 | +$tagidfortablednd = (empty($tagidfortablednd) ? 'tablelines' : $tagidfortablednd); |
|
45 | +$filepath = (empty($filepath) ? '' : $filepath); |
|
46 | 46 | |
47 | -if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) { ?> |
|
47 | +if (GETPOST('action', 'aZ09') != 'editline' && $nboflines > 1) { ?> |
|
48 | 48 | <script type="text/javascript"> |
49 | 49 | $(document).ready(function(){ |
50 | 50 | $(".imgupforline").hide(); |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | // Protection to avoid direct call of template |
30 | 30 | if (empty($conf) || ! is_object($conf)) |
31 | 31 | { |
32 | - print "Error, template page can't be called as URL"; |
|
33 | - exit; |
|
32 | + print "Error, template page can't be called as URL"; |
|
33 | + exit; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -54,17 +54,17 @@ discard block |
||
54 | 54 | var list = jQuery("#list"); |
55 | 55 | var totalizable = jQuery("#totalizable"); |
56 | 56 | <?php |
57 | - if((GETPOST('type','alpha') != "select") && (GETPOST('type','alpha') != "sellist")) |
|
58 | - { |
|
59 | - print 'jQuery("#value_choice").hide();'; |
|
60 | - } |
|
57 | + if((GETPOST('type','alpha') != "select") && (GETPOST('type','alpha') != "sellist")) |
|
58 | + { |
|
59 | + print 'jQuery("#value_choice").hide();'; |
|
60 | + } |
|
61 | 61 | |
62 | - if (GETPOST('type','alpha') == "separate") |
|
63 | - { |
|
64 | - print "jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);"; |
|
65 | - print 'jQuery("#value_choice").hide();'; |
|
66 | - } |
|
67 | - ?> |
|
62 | + if (GETPOST('type','alpha') == "separate") |
|
63 | + { |
|
64 | + print "jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);"; |
|
65 | + print 'jQuery("#value_choice").hide();'; |
|
66 | + } |
|
67 | + ?> |
|
68 | 68 | |
69 | 69 | // Case of computed field |
70 | 70 | if (type == 'varchar' || type == 'int' || type == 'double' || type == 'price') { |
@@ -164,19 +164,19 @@ discard block |
||
164 | 164 | |
165 | 165 | if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param)) |
166 | 166 | { |
167 | - $param_chain = ''; |
|
168 | - foreach ($param['options'] as $key => $value) |
|
169 | - { |
|
170 | - if(strlen($key)) |
|
171 | - { |
|
172 | - $param_chain .= $key.','.$value."\n"; |
|
173 | - } |
|
174 | - } |
|
167 | + $param_chain = ''; |
|
168 | + foreach ($param['options'] as $key => $value) |
|
169 | + { |
|
170 | + if(strlen($key)) |
|
171 | + { |
|
172 | + $param_chain .= $key.','.$value."\n"; |
|
173 | + } |
|
174 | + } |
|
175 | 175 | } |
176 | 176 | elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($type == 'password')) |
177 | 177 | { |
178 | - $paramlist=array_keys($param['options']); |
|
179 | - $param_chain = $paramlist[0]; |
|
178 | + $paramlist=array_keys($param['options']); |
|
179 | + $param_chain = $paramlist[0]; |
|
180 | 180 | } |
181 | 181 | ?> |
182 | 182 | <!-- Label --> |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | <?php |
189 | 189 | // Define list of possible type transition |
190 | 190 | $typewecanchangeinto=array( |
191 | - 'varchar'=>array('varchar', 'phone', 'mail', 'url', 'select', 'password', 'text', 'html'), |
|
192 | - 'text'=>array('text','html'), |
|
193 | - 'html'=>array('text','html'), |
|
194 | - 'password'=>array('password', 'varchar'), |
|
195 | - 'mail'=>array('varchar', 'phone', 'mail', 'url', 'select'), |
|
191 | + 'varchar'=>array('varchar', 'phone', 'mail', 'url', 'select', 'password', 'text', 'html'), |
|
192 | + 'text'=>array('text','html'), |
|
193 | + 'html'=>array('text','html'), |
|
194 | + 'password'=>array('password', 'varchar'), |
|
195 | + 'mail'=>array('varchar', 'phone', 'mail', 'url', 'select'), |
|
196 | 196 | 'url'=>array('varchar', 'phone', 'mail', 'url', 'select'), |
197 | 197 | 'phone'=>array('varchar', 'phone', 'mail', 'url', 'select'), |
198 | 198 | 'select'=>array('varchar', 'phone', 'mail', 'url', 'select') |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | } |
213 | 213 | else |
214 | 214 | { |
215 | - print $type2label[$type]; |
|
215 | + print $type2label[$type]; |
|
216 | 216 | print '<input type="hidden" name="type" id="type" value="'.$type.'">'; |
217 | 217 | } |
218 | 218 | ?> |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | |
29 | 29 | // Protection to avoid direct call of template |
30 | -if (empty($conf) || ! is_object($conf)) |
|
30 | +if (empty($conf) || !is_object($conf)) |
|
31 | 31 | { |
32 | 32 | print "Error, template page can't be called as URL"; |
33 | 33 | exit; |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | var list = jQuery("#list"); |
55 | 55 | var totalizable = jQuery("#totalizable"); |
56 | 56 | <?php |
57 | - if((GETPOST('type','alpha') != "select") && (GETPOST('type','alpha') != "sellist")) |
|
57 | + if ((GETPOST('type', 'alpha') != "select") && (GETPOST('type', 'alpha') != "sellist")) |
|
58 | 58 | { |
59 | 59 | print 'jQuery("#value_choice").hide();'; |
60 | 60 | } |
61 | 61 | |
62 | - if (GETPOST('type','alpha') == "separate") |
|
62 | + if (GETPOST('type', 'alpha') == "separate") |
|
63 | 63 | { |
64 | 64 | print "jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);"; |
65 | 65 | print 'jQuery("#value_choice").hide();'; |
@@ -145,37 +145,37 @@ discard block |
||
145 | 145 | <table summary="listofattributes" class="border centpercent"> |
146 | 146 | |
147 | 147 | <?php |
148 | -$label=$extrafields->attributes[$elementtype]['label'][$attrname]; |
|
149 | -$type=$extrafields->attributes[$elementtype]['type'][$attrname]; |
|
150 | -$size=$extrafields->attributes[$elementtype]['size'][$attrname]; |
|
151 | -$computed=$extrafields->attributes[$elementtype]['computed'][$attrname]; |
|
152 | -$default=$extrafields->attributes[$elementtype]['default'][$attrname]; |
|
153 | -$unique=$extrafields->attributes[$elementtype]['unique'][$attrname]; |
|
154 | -$required=$extrafields->attributes[$elementtype]['required'][$attrname]; |
|
155 | -$pos=$extrafields->attributes[$elementtype]['pos'][$attrname]; |
|
156 | -$alwayseditable=$extrafields->attributes[$elementtype]['alwayseditable'][$attrname]; |
|
157 | -$param=$extrafields->attributes[$elementtype]['param'][$attrname]; |
|
158 | -$perms=$extrafields->attributes[$elementtype]['perms'][$attrname]; |
|
159 | -$langfile=$extrafields->attributes[$elementtype]['langfile'][$attrname]; |
|
160 | -$list=$extrafields->attributes[$elementtype]['list'][$attrname]; |
|
148 | +$label = $extrafields->attributes[$elementtype]['label'][$attrname]; |
|
149 | +$type = $extrafields->attributes[$elementtype]['type'][$attrname]; |
|
150 | +$size = $extrafields->attributes[$elementtype]['size'][$attrname]; |
|
151 | +$computed = $extrafields->attributes[$elementtype]['computed'][$attrname]; |
|
152 | +$default = $extrafields->attributes[$elementtype]['default'][$attrname]; |
|
153 | +$unique = $extrafields->attributes[$elementtype]['unique'][$attrname]; |
|
154 | +$required = $extrafields->attributes[$elementtype]['required'][$attrname]; |
|
155 | +$pos = $extrafields->attributes[$elementtype]['pos'][$attrname]; |
|
156 | +$alwayseditable = $extrafields->attributes[$elementtype]['alwayseditable'][$attrname]; |
|
157 | +$param = $extrafields->attributes[$elementtype]['param'][$attrname]; |
|
158 | +$perms = $extrafields->attributes[$elementtype]['perms'][$attrname]; |
|
159 | +$langfile = $extrafields->attributes[$elementtype]['langfile'][$attrname]; |
|
160 | +$list = $extrafields->attributes[$elementtype]['list'][$attrname]; |
|
161 | 161 | $totalizable = $extrafields->attributes[$elementtype]['totalizable'][$attrname]; |
162 | -$help=$extrafields->attributes[$elementtype]['help'][$attrname]; |
|
163 | -$entitycurrentorall=$extrafields->attributes[$elementtype]['entityid'][$attrname]; |
|
162 | +$help = $extrafields->attributes[$elementtype]['help'][$attrname]; |
|
163 | +$entitycurrentorall = $extrafields->attributes[$elementtype]['entityid'][$attrname]; |
|
164 | 164 | |
165 | -if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param)) |
|
165 | +if ((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param)) |
|
166 | 166 | { |
167 | 167 | $param_chain = ''; |
168 | 168 | foreach ($param['options'] as $key => $value) |
169 | 169 | { |
170 | - if(strlen($key)) |
|
170 | + if (strlen($key)) |
|
171 | 171 | { |
172 | 172 | $param_chain .= $key.','.$value."\n"; |
173 | 173 | } |
174 | 174 | } |
175 | 175 | } |
176 | -elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($type == 'password')) |
|
176 | +elseif (($type == 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($type == 'password')) |
|
177 | 177 | { |
178 | - $paramlist=array_keys($param['options']); |
|
178 | + $paramlist = array_keys($param['options']); |
|
179 | 179 | $param_chain = $paramlist[0]; |
180 | 180 | } |
181 | 181 | ?> |
@@ -187,10 +187,10 @@ discard block |
||
187 | 187 | <tr><td class="fieldrequired"><?php echo $langs->trans("Type"); ?></td><td class="valeur"> |
188 | 188 | <?php |
189 | 189 | // Define list of possible type transition |
190 | -$typewecanchangeinto=array( |
|
190 | +$typewecanchangeinto = array( |
|
191 | 191 | 'varchar'=>array('varchar', 'phone', 'mail', 'url', 'select', 'password', 'text', 'html'), |
192 | - 'text'=>array('text','html'), |
|
193 | - 'html'=>array('text','html'), |
|
192 | + 'text'=>array('text', 'html'), |
|
193 | + 'html'=>array('text', 'html'), |
|
194 | 194 | 'password'=>array('password', 'varchar'), |
195 | 195 | 'mail'=>array('varchar', 'phone', 'mail', 'url', 'select'), |
196 | 196 | 'url'=>array('varchar', 'phone', 'mail', 'url', 'select'), |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | ); |
200 | 200 | if (in_array($type, array_keys($typewecanchangeinto))) |
201 | 201 | { |
202 | - $newarray=array(); |
|
202 | + $newarray = array(); |
|
203 | 203 | print '<select id="type" class="flat type" name="type">'; |
204 | - foreach($type2label as $key => $val) |
|
204 | + foreach ($type2label as $key => $val) |
|
205 | 205 | { |
206 | - $selected=''; |
|
207 | - if ($key == (GETPOST('type','alpha')?GETPOST('type','alpha'):$type)) $selected=' selected="selected"'; |
|
206 | + $selected = ''; |
|
207 | + if ($key == (GETPOST('type', 'alpha') ?GETPOST('type', 'alpha') : $type)) $selected = ' selected="selected"'; |
|
208 | 208 | if (in_array($key, $typewecanchangeinto[$type])) print '<option value="'.$key.'"'.$selected.'>'.$val.'</option>'; |
209 | 209 | else print '<option value="'.$key.'" disabled="disabled"'.$selected.'>'.$val.'</option>'; |
210 | 210 | } |
@@ -229,37 +229,37 @@ discard block |
||
229 | 229 | <tr><td> |
230 | 230 | <textarea name="param" id="param" cols="80" rows="<?php echo ROWS_4 ?>"><?php echo dol_htmlcleanlastbr($param_chain); ?></textarea> |
231 | 231 | </td><td> |
232 | - <span id="helpselect"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0,'', 0, 2, 'helpvalue1')?></span> |
|
233 | - <span id="helpsellist"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0,'', 0, 2, 'helpvalue2')?></span> |
|
234 | - <span id="helpchkbxlst"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0,'', 0, 2, 'helpvalue3')?></span> |
|
235 | - <span id="helplink"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelplink"),1,0,'', 0, 2, 'helpvalue4')?></span> |
|
236 | - <span id="helppassword"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpPassword"),1,0,'', 0, 2, 'helpvalue5')?></span> |
|
232 | + <span id="helpselect"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"), 1, 0, '', 0, 2, 'helpvalue1')?></span> |
|
233 | + <span id="helpsellist"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"), 1, 0, '', 0, 2, 'helpvalue2')?></span> |
|
234 | + <span id="helpchkbxlst"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"), 1, 0, '', 0, 2, 'helpvalue3')?></span> |
|
235 | + <span id="helplink"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelplink"), 1, 0, '', 0, 2, 'helpvalue4')?></span> |
|
236 | + <span id="helppassword"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpPassword"), 1, 0, '', 0, 2, 'helpvalue5')?></span> |
|
237 | 237 | </td></tr> |
238 | 238 | </table> |
239 | 239 | </td> |
240 | 240 | </tr> |
241 | 241 | <!-- Position --> |
242 | -<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo dol_escape_htmltag($pos); ?>"></td></tr> |
|
242 | +<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo dol_escape_htmltag($pos); ?>"></td></tr> |
|
243 | 243 | <!-- Language file --> |
244 | -<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag($langfile); ?>"></td></tr> |
|
244 | +<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag($langfile); ?>"></td></tr> |
|
245 | 245 | <!-- Computed value --> |
246 | 246 | <tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" class="quatrevingtpercent" type="text" name="computed_value" value="<?php echo dol_escape_htmltag($computed); ?>"></td></tr> |
247 | 247 | <!-- Default Value (at sql setup level) --> |
248 | 248 | <tr class="extra_default_value"><td><?php echo $langs->trans("DefaultValue").' ('.$langs->trans("Database").')'; ?></td><td class="valeur"><input id="default_value" type="text" name="default_value" size="5" value="<?php echo dol_escape_htmltag($default); ?>"></td></tr> |
249 | 249 | <!-- Unique --> |
250 | -<tr class="extra_unique"><td><?php echo $langs->trans("Unique"); ?></td><td class="valeur"><input id="unique" type="checkbox" name="unique"<?php echo ($unique?' checked':''); ?>></td></tr> |
|
250 | +<tr class="extra_unique"><td><?php echo $langs->trans("Unique"); ?></td><td class="valeur"><input id="unique" type="checkbox" name="unique"<?php echo ($unique ? ' checked' : ''); ?>></td></tr> |
|
251 | 251 | <!-- Required --> |
252 | -<tr class="extra_required"><td><?php echo $langs->trans("Required"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required"<?php echo ($required?' checked':''); ?>></td></tr> |
|
252 | +<tr class="extra_required"><td><?php echo $langs->trans("Required"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required"<?php echo ($required ? ' checked' : ''); ?>></td></tr> |
|
253 | 253 | <!-- Always editable --> |
254 | -<tr class="extra_alwayseditable"><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable"<?php echo ($alwayseditable?' checked':''); ?>></td></tr> |
|
254 | +<tr class="extra_alwayseditable"><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable"<?php echo ($alwayseditable ? ' checked' : ''); ?>></td></tr> |
|
255 | 255 | <tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc")); ?> |
256 | -</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo ($list!=''?$list:'1'); ?>"></td></tr> |
|
257 | -<tr class="extra_totalizable"><td><?php echo $form->textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo ($totalizable?' checked':''); ?>></td></tr> |
|
256 | +</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo ($list != '' ? $list : '1'); ?>"></td></tr> |
|
257 | +<tr class="extra_totalizable"><td><?php echo $form->textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo ($totalizable ? ' checked' : ''); ?>></td></tr> |
|
258 | 258 | <!-- Help tooltip --> |
259 | 259 | <tr class="help"><td><?php echo $form->textwithpicto($langs->trans("HelpOnTooltip"), $langs->trans("HelpOnTooltipDesc")); ?></td><td class="valeur"><input id="help" class="quatrevingtpercent" type="text" name="help" value="<?php echo dol_escape_htmltag($help); ?>"></td></tr> |
260 | 260 | <?php if ($conf->multicompany->enabled) { ?> |
261 | 261 | <!-- Multicompany entity --> |
262 | - <tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (empty($entitycurrentorall) ?' checked':''); ?>></td></tr> |
|
262 | + <tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (empty($entitycurrentorall) ? ' checked' : ''); ?>></td></tr> |
|
263 | 263 | <?php } ?> |
264 | 264 | <!-- Visibility --> |
265 | 265 | </table> |
@@ -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.'">'; |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | // Protection to avoid direct call of template |
28 | 28 | if (empty($langs) || ! is_object($langs)) |
29 | 29 | { |
30 | - print "Error, template page can't be called as URL"; |
|
31 | - exit; |
|
30 | + print "Error, template page can't be called as URL"; |
|
31 | + exit; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -51,16 +51,16 @@ discard block |
||
51 | 51 | |
52 | 52 | if ($action == 'delete') |
53 | 53 | { |
54 | - $langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles |
|
55 | - print $form->formconfirm( |
|
56 | - $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int') . (empty($param)?'':$param), |
|
57 | - $langs->trans('DeleteFile'), |
|
58 | - $langs->trans('ConfirmDeleteFile'), |
|
59 | - 'confirm_deletefile', |
|
60 | - '', |
|
61 | - 0, |
|
62 | - 1 |
|
63 | - ); |
|
54 | + $langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles |
|
55 | + print $form->formconfirm( |
|
56 | + $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int') . (empty($param)?'':$param), |
|
57 | + $langs->trans('DeleteFile'), |
|
58 | + $langs->trans('ConfirmDeleteFile'), |
|
59 | + 'confirm_deletefile', |
|
60 | + '', |
|
61 | + 0, |
|
62 | + 1 |
|
63 | + ); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | $formfile=new FormFile($db); |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | $savingdocmask=''; |
70 | 70 | if (empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX)) |
71 | 71 | { |
72 | - //var_dump($modulepart); |
|
73 | - if (in_array($modulepart,array('facture_fournisseur','commande_fournisseur','facture','commande','propal','supplier_proposal','ficheinter','contract','expedition','project','project_task','expensereport','tax', 'produit', 'product_batch'))) |
|
74 | - { |
|
75 | - $savingdocmask=dol_sanitizeFileName($object->ref).'-__file__'; |
|
76 | - } |
|
77 | - /*if (in_array($modulepart,array('member'))) |
|
72 | + //var_dump($modulepart); |
|
73 | + if (in_array($modulepart,array('facture_fournisseur','commande_fournisseur','facture','commande','propal','supplier_proposal','ficheinter','contract','expedition','project','project_task','expensereport','tax', 'produit', 'product_batch'))) |
|
74 | + { |
|
75 | + $savingdocmask=dol_sanitizeFileName($object->ref).'-__file__'; |
|
76 | + } |
|
77 | + /*if (in_array($modulepart,array('member'))) |
|
78 | 78 | { |
79 | 79 | $savingdocmask=$object->login.'___file__'; |
80 | 80 | }*/ |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | $permission, |
90 | 90 | $conf->browser->layout == 'phone' ? 40 : 60, |
91 | 91 | $object, |
92 | - '', |
|
93 | - 1, |
|
94 | - $savingdocmask |
|
92 | + '', |
|
93 | + 1, |
|
94 | + $savingdocmask |
|
95 | 95 | ); |
96 | 96 | |
97 | 97 | // List of document |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | // $param = param to add to download links |
26 | 26 | |
27 | 27 | // Protection to avoid direct call of template |
28 | -if (empty($langs) || ! is_object($langs)) |
|
28 | +if (empty($langs) || !is_object($langs)) |
|
29 | 29 | { |
30 | 30 | print "Error, template page can't be called as URL"; |
31 | 31 | exit; |
@@ -33,15 +33,15 @@ discard block |
||
33 | 33 | |
34 | 34 | |
35 | 35 | $langs->load("link"); |
36 | -if (empty($relativepathwithnofile)) $relativepathwithnofile=''; |
|
37 | -if (empty($permtoedit)) $permtoedit=-1; |
|
36 | +if (empty($relativepathwithnofile)) $relativepathwithnofile = ''; |
|
37 | +if (empty($permtoedit)) $permtoedit = -1; |
|
38 | 38 | |
39 | 39 | // Drag and drop for up and down allowed on product, thirdparty, ... |
40 | 40 | // The drag and drop call the page core/ajax/row.php |
41 | 41 | // If you enable the move up/down of files here, check that page that include template set its sortorder on 'position_name' instead of 'name' |
42 | 42 | // Also the object->fk_element must be defined. |
43 | -$disablemove=1; |
|
44 | -if (in_array($modulepart, array('product', 'produit', 'societe', 'user', 'ticket', 'holiday', 'expensereport'))) $disablemove=0; |
|
43 | +$disablemove = 1; |
|
44 | +if (in_array($modulepart, array('product', 'produit', 'societe', 'user', 'ticket', 'holiday', 'expensereport'))) $disablemove = 0; |
|
45 | 45 | |
46 | 46 | |
47 | 47 | |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | |
52 | 52 | if ($action == 'delete') |
53 | 53 | { |
54 | - $langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles |
|
54 | + $langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles |
|
55 | 55 | print $form->formconfirm( |
56 | - $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int') . (empty($param)?'':$param), |
|
56 | + $_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode(GETPOST("urlfile")).'&linkid='.GETPOST('linkid', 'int').(empty($param) ? '' : $param), |
|
57 | 57 | $langs->trans('DeleteFile'), |
58 | 58 | $langs->trans('ConfirmDeleteFile'), |
59 | 59 | 'confirm_deletefile', |
@@ -63,16 +63,16 @@ discard block |
||
63 | 63 | ); |
64 | 64 | } |
65 | 65 | |
66 | -$formfile=new FormFile($db); |
|
66 | +$formfile = new FormFile($db); |
|
67 | 67 | |
68 | 68 | // We define var to enable the feature to add prefix of uploaded files |
69 | -$savingdocmask=''; |
|
69 | +$savingdocmask = ''; |
|
70 | 70 | if (empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX)) |
71 | 71 | { |
72 | 72 | //var_dump($modulepart); |
73 | - if (in_array($modulepart,array('facture_fournisseur','commande_fournisseur','facture','commande','propal','supplier_proposal','ficheinter','contract','expedition','project','project_task','expensereport','tax', 'produit', 'product_batch'))) |
|
73 | + if (in_array($modulepart, array('facture_fournisseur', 'commande_fournisseur', 'facture', 'commande', 'propal', 'supplier_proposal', 'ficheinter', 'contract', 'expedition', 'project', 'project_task', 'expensereport', 'tax', 'produit', 'product_batch'))) |
|
74 | 74 | { |
75 | - $savingdocmask=dol_sanitizeFileName($object->ref).'-__file__'; |
|
75 | + $savingdocmask = dol_sanitizeFileName($object->ref).'-__file__'; |
|
76 | 76 | } |
77 | 77 | /*if (in_array($modulepart,array('member'))) |
78 | 78 | { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | // Show upload form (document and links) |
84 | 84 | $formfile->form_attach_new_file( |
85 | - $_SERVER["PHP_SELF"].'?id='.$object->id.(empty($withproject)?'':'&withproject=1'), |
|
85 | + $_SERVER["PHP_SELF"].'?id='.$object->id.(empty($withproject) ? '' : '&withproject=1'), |
|
86 | 86 | '', |
87 | 87 | 0, |
88 | 88 | 0, |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $modulepart, |
102 | 102 | $param, |
103 | 103 | 0, |
104 | - $relativepathwithnofile, // relative path with no file. For example "0/1" |
|
104 | + $relativepathwithnofile, // relative path with no file. For example "0/1" |
|
105 | 105 | $permission, |
106 | 106 | 0, |
107 | 107 | '', |
@@ -33,15 +33,21 @@ |
||
33 | 33 | |
34 | 34 | |
35 | 35 | $langs->load("link"); |
36 | -if (empty($relativepathwithnofile)) $relativepathwithnofile=''; |
|
37 | -if (empty($permtoedit)) $permtoedit=-1; |
|
36 | +if (empty($relativepathwithnofile)) { |
|
37 | + $relativepathwithnofile=''; |
|
38 | +} |
|
39 | +if (empty($permtoedit)) { |
|
40 | + $permtoedit=-1; |
|
41 | +} |
|
38 | 42 | |
39 | 43 | // Drag and drop for up and down allowed on product, thirdparty, ... |
40 | 44 | // The drag and drop call the page core/ajax/row.php |
41 | 45 | // If you enable the move up/down of files here, check that page that include template set its sortorder on 'position_name' instead of 'name' |
42 | 46 | // Also the object->fk_element must be defined. |
43 | 47 | $disablemove=1; |
44 | -if (in_array($modulepart, array('product', 'produit', 'societe', 'user', 'ticket', 'holiday', 'expensereport'))) $disablemove=0; |
|
48 | +if (in_array($modulepart, array('product', 'produit', 'societe', 'user', 'ticket', 'holiday', 'expensereport'))) { |
|
49 | + $disablemove=0; |
|
50 | +} |
|
45 | 51 | |
46 | 52 | |
47 | 53 |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | // Protection to avoid direct call of template |
36 | 36 | if (empty($object) || ! is_object($object)) |
37 | 37 | { |
38 | - print "Error, template page can't be called as URL"; |
|
39 | - exit; |
|
38 | + print "Error, template page can't be called as URL"; |
|
39 | + exit; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -65,30 +65,30 @@ discard block |
||
65 | 65 | $objectline = null; |
66 | 66 | if (!empty($extrafieldsline)) |
67 | 67 | { |
68 | - if ($this->table_element_line=='commandedet') { |
|
69 | - $objectline = new OrderLine($this->db); |
|
70 | - } |
|
71 | - elseif ($this->table_element_line=='propaldet') { |
|
72 | - $objectline = new PropaleLigne($this->db); |
|
73 | - } |
|
74 | - elseif ($this->table_element_line=='supplier_proposaldet') { |
|
75 | - $objectline = new SupplierProposalLine($this->db); |
|
76 | - } |
|
77 | - elseif ($this->table_element_line=='facturedet') { |
|
78 | - $objectline = new FactureLigne($this->db); |
|
79 | - } |
|
80 | - elseif ($this->table_element_line=='contratdet') { |
|
81 | - $objectline = new ContratLigne($this->db); |
|
82 | - } |
|
83 | - elseif ($this->table_element_line=='commande_fournisseurdet') { |
|
84 | - $objectline = new CommandeFournisseurLigne($this->db); |
|
85 | - } |
|
86 | - elseif ($this->table_element_line=='facture_fourn_det') { |
|
87 | - $objectline = new SupplierInvoiceLine($this->db); |
|
88 | - } |
|
89 | - elseif ($this->table_element_line=='facturedet_rec') { |
|
90 | - $objectline = new FactureLigneRec($this->db); |
|
91 | - } |
|
68 | + if ($this->table_element_line=='commandedet') { |
|
69 | + $objectline = new OrderLine($this->db); |
|
70 | + } |
|
71 | + elseif ($this->table_element_line=='propaldet') { |
|
72 | + $objectline = new PropaleLigne($this->db); |
|
73 | + } |
|
74 | + elseif ($this->table_element_line=='supplier_proposaldet') { |
|
75 | + $objectline = new SupplierProposalLine($this->db); |
|
76 | + } |
|
77 | + elseif ($this->table_element_line=='facturedet') { |
|
78 | + $objectline = new FactureLigne($this->db); |
|
79 | + } |
|
80 | + elseif ($this->table_element_line=='contratdet') { |
|
81 | + $objectline = new ContratLigne($this->db); |
|
82 | + } |
|
83 | + elseif ($this->table_element_line=='commande_fournisseurdet') { |
|
84 | + $objectline = new CommandeFournisseurLigne($this->db); |
|
85 | + } |
|
86 | + elseif ($this->table_element_line=='facture_fourn_det') { |
|
87 | + $objectline = new SupplierInvoiceLine($this->db); |
|
88 | + } |
|
89 | + elseif ($this->table_element_line=='facturedet_rec') { |
|
90 | + $objectline = new FactureLigneRec($this->db); |
|
91 | + } |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | ?> |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | <div id="add"></div><span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine'); ?></span><?php // echo $langs->trans("FreeZone"); ?> |
107 | 107 | </td> |
108 | 108 | <?php |
109 | - if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
|
110 | - { |
|
111 | - ?> |
|
109 | + if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
|
110 | + { |
|
111 | + ?> |
|
112 | 112 | <td class="linecolrefsupplier"><span id="title_fourn_ref"><?php echo $langs->trans('SupplierRef'); ?></span></td> |
113 | 113 | <?php } ?> |
114 | 114 | <td class="linecolvat" align="right"><span id="title_vat"><?php echo $langs->trans('VAT'); ?></span></td> |
@@ -121,39 +121,39 @@ discard block |
||
121 | 121 | <?php } ?> |
122 | 122 | <td class="linecolqty" align="right"><?php echo $langs->trans('Qty'); ?></td> |
123 | 123 | <?php |
124 | - if($conf->global->PRODUCT_USE_UNITS) |
|
125 | - { |
|
126 | - print '<td class="linecoluseunit" align="left">'; |
|
127 | - print '<span id="title_units">'; |
|
128 | - print $langs->trans('Unit'); |
|
129 | - print '</span></td>'; |
|
130 | - } |
|
131 | - ?> |
|
124 | + if($conf->global->PRODUCT_USE_UNITS) |
|
125 | + { |
|
126 | + print '<td class="linecoluseunit" align="left">'; |
|
127 | + print '<span id="title_units">'; |
|
128 | + print $langs->trans('Unit'); |
|
129 | + print '</span></td>'; |
|
130 | + } |
|
131 | + ?> |
|
132 | 132 | <td class="linecoldiscount" align="right"><?php echo $langs->trans('ReductionShort'); ?></td> |
133 | 133 | <?php |
134 | - if ($this->situation_cycle_ref) { |
|
135 | - print '<td class="linecolcycleref" align="right">' . $langs->trans('Progress') . '</td>'; |
|
136 | - } |
|
137 | - if (! empty($usemargins)) |
|
138 | - { |
|
139 | - if (!empty($user->rights->margins->creer)) { |
|
140 | - ?> |
|
134 | + if ($this->situation_cycle_ref) { |
|
135 | + print '<td class="linecolcycleref" align="right">' . $langs->trans('Progress') . '</td>'; |
|
136 | + } |
|
137 | + if (! empty($usemargins)) |
|
138 | + { |
|
139 | + if (!empty($user->rights->margins->creer)) { |
|
140 | + ?> |
|
141 | 141 | <td align="right" class="margininfos linecolmargin1"> |
142 | 142 | <?php |
143 | - } |
|
144 | - else $colspan++; |
|
143 | + } |
|
144 | + else $colspan++; |
|
145 | 145 | |
146 | - if ($conf->global->MARGIN_TYPE == "1") |
|
147 | - echo $langs->trans('BuyingPrice'); |
|
148 | - else |
|
149 | - echo $langs->trans('CostPrice'); |
|
150 | - ?> |
|
146 | + if ($conf->global->MARGIN_TYPE == "1") |
|
147 | + echo $langs->trans('BuyingPrice'); |
|
148 | + else |
|
149 | + echo $langs->trans('CostPrice'); |
|
150 | + ?> |
|
151 | 151 | </td> |
152 | 152 | <?php |
153 | - if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td align="right" class="margininfos linecolmargin2"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>'; |
|
154 | - if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARK_RATES)) echo '<td align="right" class="margininfos linecolmargin2"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>'; |
|
155 | - } |
|
156 | - ?> |
|
153 | + if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td align="right" class="margininfos linecolmargin2"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>'; |
|
154 | + if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARK_RATES)) echo '<td align="right" class="margininfos linecolmargin2"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>'; |
|
155 | + } |
|
156 | + ?> |
|
157 | 157 | <td class="linecoledit" colspan="<?php echo $colspan; ?>"> </td> |
158 | 158 | </tr> |
159 | 159 | <?php |
@@ -163,13 +163,13 @@ discard block |
||
163 | 163 | <?php |
164 | 164 | // Adds a line numbering column |
165 | 165 | if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { |
166 | - $coldisplay=2; |
|
167 | - ?> |
|
166 | + $coldisplay=2; |
|
167 | + ?> |
|
168 | 168 | <td class="nobottom linecolnum" align="center" width="5"></td> |
169 | 169 | <?php |
170 | 170 | } |
171 | 171 | else { |
172 | - $coldisplay=0; |
|
172 | + $coldisplay=0; |
|
173 | 173 | } |
174 | 174 | ?> |
175 | 175 | |
@@ -177,172 +177,172 @@ discard block |
||
177 | 177 | |
178 | 178 | <?php |
179 | 179 | |
180 | - $freelines = false; |
|
181 | - if (empty($conf->global->MAIN_DISABLE_FREE_LINES)) |
|
182 | - { |
|
183 | - $freelines = true; |
|
184 | - $forceall=1; // We always force all type for free lines (module product or service means we use predefined product or service) |
|
185 | - if ($object->element == 'contrat') |
|
186 | - { |
|
187 | - if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=-1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set |
|
188 | - else if (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=3; |
|
189 | - } |
|
180 | + $freelines = false; |
|
181 | + if (empty($conf->global->MAIN_DISABLE_FREE_LINES)) |
|
182 | + { |
|
183 | + $freelines = true; |
|
184 | + $forceall=1; // We always force all type for free lines (module product or service means we use predefined product or service) |
|
185 | + if ($object->element == 'contrat') |
|
186 | + { |
|
187 | + if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=-1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set |
|
188 | + else if (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=3; |
|
189 | + } |
|
190 | 190 | |
191 | - // Free line |
|
192 | - echo '<span class="prod_entry_mode_free">'; |
|
193 | - // Show radio free line |
|
194 | - if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) |
|
195 | - { |
|
196 | - echo '<label for="prod_entry_mode_free">'; |
|
197 | - echo '<input type="radio" class="prod_entry_mode_free" name="prod_entry_mode" id="prod_entry_mode_free" value="free"'; |
|
198 | - //echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : ((empty($forceall) && (empty($conf->product->enabled) || empty($conf->service->enabled)))?' checked':'') ); |
|
199 | - echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : ''); |
|
200 | - echo '> '; |
|
201 | - // Show type selector |
|
202 | - echo $langs->trans("FreeLineOfType"); |
|
203 | - echo '</label>'; |
|
204 | - echo ' '; |
|
205 | - } |
|
206 | - else |
|
207 | - { |
|
208 | - echo '<input type="hidden" id="prod_entry_mode_free" name="prod_entry_mode" value="free">'; |
|
209 | - // Show type selector |
|
210 | - if ($forceall >= 0) |
|
211 | - { |
|
212 | - if (empty($conf->product->enabled) || empty($conf->service->enabled)) echo $langs->trans("Type"); |
|
213 | - else echo $langs->trans("FreeLineOfType"); |
|
214 | - echo ' '; |
|
215 | - } |
|
216 | - } |
|
191 | + // Free line |
|
192 | + echo '<span class="prod_entry_mode_free">'; |
|
193 | + // Show radio free line |
|
194 | + if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) |
|
195 | + { |
|
196 | + echo '<label for="prod_entry_mode_free">'; |
|
197 | + echo '<input type="radio" class="prod_entry_mode_free" name="prod_entry_mode" id="prod_entry_mode_free" value="free"'; |
|
198 | + //echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : ((empty($forceall) && (empty($conf->product->enabled) || empty($conf->service->enabled)))?' checked':'') ); |
|
199 | + echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : ''); |
|
200 | + echo '> '; |
|
201 | + // Show type selector |
|
202 | + echo $langs->trans("FreeLineOfType"); |
|
203 | + echo '</label>'; |
|
204 | + echo ' '; |
|
205 | + } |
|
206 | + else |
|
207 | + { |
|
208 | + echo '<input type="hidden" id="prod_entry_mode_free" name="prod_entry_mode" value="free">'; |
|
209 | + // Show type selector |
|
210 | + if ($forceall >= 0) |
|
211 | + { |
|
212 | + if (empty($conf->product->enabled) || empty($conf->service->enabled)) echo $langs->trans("Type"); |
|
213 | + else echo $langs->trans("FreeLineOfType"); |
|
214 | + echo ' '; |
|
215 | + } |
|
216 | + } |
|
217 | 217 | |
218 | - echo $form->select_type_of_lines(isset($_POST["type"])?GETPOST("type",'alpha',2):-1,'type',1,1,$forceall); |
|
218 | + echo $form->select_type_of_lines(isset($_POST["type"])?GETPOST("type",'alpha',2):-1,'type',1,1,$forceall); |
|
219 | 219 | |
220 | - echo '</span>'; |
|
221 | - } |
|
220 | + echo '</span>'; |
|
221 | + } |
|
222 | 222 | |
223 | - // Predefined product/service |
|
224 | - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) |
|
225 | - { |
|
226 | - if ($forceall >= 0 && $freelines) echo '<br>'; |
|
227 | - echo '<span class="prod_entry_mode_predef">'; |
|
228 | - echo '<label for="prod_entry_mode_predef">'; |
|
229 | - echo '<input type="radio" class="prod_entry_mode_predef" name="prod_entry_mode" id="prod_entry_mode_predef" value="predef"'.(GETPOST('prod_entry_mode')=='predef'?' checked':'').'> '; |
|
230 | - if (empty($senderissupplier)) |
|
231 | - { |
|
232 | - if (! empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans('PredefinedProductsToSell'); |
|
233 | - else if ((empty($conf->product->enabled) && ! empty($conf->service->enabled)) || ($object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS))) echo $langs->trans('PredefinedServicesToSell'); |
|
234 | - else echo $langs->trans('PredefinedProductsAndServicesToSell'); |
|
235 | - } |
|
236 | - else |
|
237 | - { |
|
238 | - if (! empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans('PredefinedProductsToPurchase'); |
|
239 | - else if (empty($conf->product->enabled) && ! empty($conf->service->enabled)) echo $langs->trans('PredefinedServicesToPurchase'); |
|
240 | - else echo $langs->trans('PredefinedProductsAndServicesToPurchase'); |
|
241 | - } |
|
242 | - echo '</label>'; |
|
243 | - echo ' '; |
|
223 | + // Predefined product/service |
|
224 | + if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) |
|
225 | + { |
|
226 | + if ($forceall >= 0 && $freelines) echo '<br>'; |
|
227 | + echo '<span class="prod_entry_mode_predef">'; |
|
228 | + echo '<label for="prod_entry_mode_predef">'; |
|
229 | + echo '<input type="radio" class="prod_entry_mode_predef" name="prod_entry_mode" id="prod_entry_mode_predef" value="predef"'.(GETPOST('prod_entry_mode')=='predef'?' checked':'').'> '; |
|
230 | + if (empty($senderissupplier)) |
|
231 | + { |
|
232 | + if (! empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans('PredefinedProductsToSell'); |
|
233 | + else if ((empty($conf->product->enabled) && ! empty($conf->service->enabled)) || ($object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS))) echo $langs->trans('PredefinedServicesToSell'); |
|
234 | + else echo $langs->trans('PredefinedProductsAndServicesToSell'); |
|
235 | + } |
|
236 | + else |
|
237 | + { |
|
238 | + if (! empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans('PredefinedProductsToPurchase'); |
|
239 | + else if (empty($conf->product->enabled) && ! empty($conf->service->enabled)) echo $langs->trans('PredefinedServicesToPurchase'); |
|
240 | + else echo $langs->trans('PredefinedProductsAndServicesToPurchase'); |
|
241 | + } |
|
242 | + echo '</label>'; |
|
243 | + echo ' '; |
|
244 | 244 | |
245 | - $filtertype=''; |
|
246 | - if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1'; |
|
245 | + $filtertype=''; |
|
246 | + if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1'; |
|
247 | 247 | |
248 | - if (empty($senderissupplier)) |
|
249 | - { |
|
250 | - if (! empty($conf->global->ENTREPOT_EXTRA_STATUS)) |
|
251 | - { |
|
252 | - // hide products in closed warehouse, but show products for internal transfer |
|
253 | - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); |
|
254 | - } |
|
255 | - else |
|
256 | - { |
|
257 | - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, '', GETPOST('combinations', 'array')); |
|
258 | - } |
|
259 | - } |
|
260 | - else |
|
261 | - { |
|
262 | - // $senderissupplier=2 is same than 1 but disable test on minimum qty and disable autofill qty with minimum |
|
263 | - if ($senderissupplier != 2) |
|
264 | - { |
|
265 | - $ajaxoptions=array( |
|
266 | - 'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key |
|
267 | - 'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done |
|
268 | - 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for exemple shown we select a disabled option into combo) |
|
269 | - ); |
|
270 | - $alsoproductwithnosupplierprice=0; |
|
271 | - } |
|
272 | - else |
|
273 | - { |
|
274 | - $ajaxoptions = array(); |
|
275 | - $alsoproductwithnosupplierprice=1; |
|
276 | - } |
|
277 | - |
|
278 | - $form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1, $alsoproductwithnosupplierprice); |
|
279 | - } |
|
280 | - echo '<input type="hidden" name="pbq" id="pbq" value="">'; |
|
281 | - echo '</span>'; |
|
282 | - } |
|
248 | + if (empty($senderissupplier)) |
|
249 | + { |
|
250 | + if (! empty($conf->global->ENTREPOT_EXTRA_STATUS)) |
|
251 | + { |
|
252 | + // hide products in closed warehouse, but show products for internal transfer |
|
253 | + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); |
|
254 | + } |
|
255 | + else |
|
256 | + { |
|
257 | + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, '', GETPOST('combinations', 'array')); |
|
258 | + } |
|
259 | + } |
|
260 | + else |
|
261 | + { |
|
262 | + // $senderissupplier=2 is same than 1 but disable test on minimum qty and disable autofill qty with minimum |
|
263 | + if ($senderissupplier != 2) |
|
264 | + { |
|
265 | + $ajaxoptions=array( |
|
266 | + 'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key |
|
267 | + 'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done |
|
268 | + 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for exemple shown we select a disabled option into combo) |
|
269 | + ); |
|
270 | + $alsoproductwithnosupplierprice=0; |
|
271 | + } |
|
272 | + else |
|
273 | + { |
|
274 | + $ajaxoptions = array(); |
|
275 | + $alsoproductwithnosupplierprice=1; |
|
276 | + } |
|
283 | 277 | |
284 | - if (is_object($hookmanager) && empty($senderissupplier)) |
|
285 | - { |
|
286 | - $parameters=array('fk_parent_line'=>GETPOST('fk_parent_line','int')); |
|
287 | - $reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action); |
|
288 | - if (!empty($hookmanager->resPrint)) { |
|
289 | - print $hookmanager->resPrint; |
|
290 | - } |
|
291 | - } |
|
292 | - if (is_object($hookmanager) && ! empty($senderissupplier)) |
|
293 | - { |
|
294 | - $parameters=array('htmlname'=>'addproduct'); |
|
295 | - $reshook=$hookmanager->executeHooks('formCreateProductSupplierOptions',$parameters,$object,$action); |
|
296 | - if (!empty($hookmanager->resPrint)) { |
|
297 | - print $hookmanager->resPrint; |
|
298 | - } |
|
299 | - } |
|
278 | + $form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1, $alsoproductwithnosupplierprice); |
|
279 | + } |
|
280 | + echo '<input type="hidden" name="pbq" id="pbq" value="">'; |
|
281 | + echo '</span>'; |
|
282 | + } |
|
300 | 283 | |
284 | + if (is_object($hookmanager) && empty($senderissupplier)) |
|
285 | + { |
|
286 | + $parameters=array('fk_parent_line'=>GETPOST('fk_parent_line','int')); |
|
287 | + $reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action); |
|
288 | + if (!empty($hookmanager->resPrint)) { |
|
289 | + print $hookmanager->resPrint; |
|
290 | + } |
|
291 | + } |
|
292 | + if (is_object($hookmanager) && ! empty($senderissupplier)) |
|
293 | + { |
|
294 | + $parameters=array('htmlname'=>'addproduct'); |
|
295 | + $reshook=$hookmanager->executeHooks('formCreateProductSupplierOptions',$parameters,$object,$action); |
|
296 | + if (!empty($hookmanager->resPrint)) { |
|
297 | + print $hookmanager->resPrint; |
|
298 | + } |
|
299 | + } |
|
301 | 300 | |
302 | - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { |
|
303 | 301 | |
304 | - if (!empty($conf->variants->enabled)) { |
|
305 | - echo '<div id="attributes_box"></div>'; |
|
306 | - } |
|
302 | + if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { |
|
307 | 303 | |
308 | - echo '<br>'; |
|
309 | - } |
|
304 | + if (!empty($conf->variants->enabled)) { |
|
305 | + echo '<div id="attributes_box"></div>'; |
|
306 | + } |
|
310 | 307 | |
311 | - // Editor wysiwyg |
|
312 | - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
313 | - $nbrows=ROWS_2; |
|
314 | - $enabled=(! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
|
315 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
316 | - $toolbarname='dolibarr_details'; |
|
317 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
318 | - $doleditor=new DolEditor('dp_desc',GETPOST('dp_desc'),'',100,$toolbarname,'',false,true,$enabled,$nbrows,'98%'); |
|
319 | - $doleditor->Create(); |
|
320 | - |
|
321 | - // Show autofill date for recuring invoices |
|
322 | - if (! empty($conf->service->enabled) && $object->element == 'facturerec') |
|
323 | - { |
|
324 | - echo '<div class="divlinefordates"><br>'; |
|
325 | - echo $langs->trans('AutoFillDateFrom').' '; |
|
326 | - echo $form->selectyesno('date_start_fill', $line->date_start_fill, 1); |
|
327 | - echo ' - '; |
|
328 | - echo $langs->trans('AutoFillDateTo').' '; |
|
329 | - echo $form->selectyesno('date_end_fill', $line->date_end_fill, 1); |
|
330 | - echo '</div>'; |
|
331 | - } |
|
332 | - ?> |
|
308 | + echo '<br>'; |
|
309 | + } |
|
310 | + |
|
311 | + // Editor wysiwyg |
|
312 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
313 | + $nbrows=ROWS_2; |
|
314 | + $enabled=(! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
|
315 | + if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
316 | + $toolbarname='dolibarr_details'; |
|
317 | + if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
318 | + $doleditor=new DolEditor('dp_desc',GETPOST('dp_desc'),'',100,$toolbarname,'',false,true,$enabled,$nbrows,'98%'); |
|
319 | + $doleditor->Create(); |
|
320 | + |
|
321 | + // Show autofill date for recuring invoices |
|
322 | + if (! empty($conf->service->enabled) && $object->element == 'facturerec') |
|
323 | + { |
|
324 | + echo '<div class="divlinefordates"><br>'; |
|
325 | + echo $langs->trans('AutoFillDateFrom').' '; |
|
326 | + echo $form->selectyesno('date_start_fill', $line->date_start_fill, 1); |
|
327 | + echo ' - '; |
|
328 | + echo $langs->trans('AutoFillDateTo').' '; |
|
329 | + echo $form->selectyesno('date_end_fill', $line->date_end_fill, 1); |
|
330 | + echo '</div>'; |
|
331 | + } |
|
332 | + ?> |
|
333 | 333 | </td> |
334 | 334 | |
335 | 335 | <?php |
336 | - if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
|
337 | - { |
|
338 | - ?> |
|
336 | + if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
|
337 | + { |
|
338 | + ?> |
|
339 | 339 | <td class="nobottom linecolresupplier"><input id="fourn_ref" name="fourn_ref" class="flat maxwidth75" value="<?php echo (isset($_POST["fourn_ref"])?GETPOST("fourn_ref",'alpha',2):''); ?>"></td> |
340 | 340 | <?php } ?> |
341 | 341 | |
342 | 342 | <td class="nobottom linecolvat" align="right"><?php |
343 | - if ($seller->tva_assuj == "0") echo '<input type="hidden" name="tva_tx" id="tva_tx" value="0">'.vatrate(0, true); |
|
344 | - else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?GETPOST("tva_tx",'alpha',2):-1), $seller, $buyer, 0, 0, '', false, 1); |
|
345 | - ?> |
|
343 | + if ($seller->tva_assuj == "0") echo '<input type="hidden" name="tva_tx" id="tva_tx" value="0">'.vatrate(0, true); |
|
344 | + else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?GETPOST("tva_tx",'alpha',2):-1), $seller, $buyer, 0, 0, '', false, 1); |
|
345 | + ?> |
|
346 | 346 | </td> |
347 | 347 | <td class="nobottom linecoluht" align="right"> |
348 | 348 | <input type="text" size="5" name="price_ht" id="price_ht" class="flat right" value="<?php echo (isset($_POST["price_ht"])?GETPOST("price_ht",'alpha',2):''); ?>"> |
@@ -362,27 +362,27 @@ discard block |
||
362 | 362 | <td class="nobottom linecolqty" align="right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="<?php echo (isset($_POST["qty"])?GETPOST("qty",'alpha',2):1); ?>"> |
363 | 363 | </td> |
364 | 364 | <?php |
365 | - if($conf->global->PRODUCT_USE_UNITS) |
|
366 | - { |
|
367 | - print '<td class="nobottom linecoluseunit" align="left">'; |
|
368 | - print $form->selectUnits($line->fk_unit, "units"); |
|
369 | - print '</td>'; |
|
370 | - } |
|
371 | - $remise_percent = $buyer->remise_percent; |
|
372 | - if($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
|
373 | - $remise_percent = $seller->remise_supplier_percent; |
|
374 | - } |
|
375 | - ?> |
|
365 | + if($conf->global->PRODUCT_USE_UNITS) |
|
366 | + { |
|
367 | + print '<td class="nobottom linecoluseunit" align="left">'; |
|
368 | + print $form->selectUnits($line->fk_unit, "units"); |
|
369 | + print '</td>'; |
|
370 | + } |
|
371 | + $remise_percent = $buyer->remise_percent; |
|
372 | + if($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
|
373 | + $remise_percent = $seller->remise_supplier_percent; |
|
374 | + } |
|
375 | + ?> |
|
376 | 376 | <td class="nobottom nowrap linecoldiscount" align="right"><input type="text" size="1" name="remise_percent" id="remise_percent" class="flat right" value="<?php echo (isset($_POST["remise_percent"])?GETPOST("remise_percent",'alpha',2):$remise_percent); ?>"><span class="hideonsmartphone">%</span></td> |
377 | 377 | <?php |
378 | - if ($this->situation_cycle_ref) { |
|
379 | - $coldisplay++; |
|
380 | - print '<td class="nobottom nowrap" align="right"><input class="falt right" type="text" size="1" value="0" name="progress">%</td>'; |
|
381 | - } |
|
382 | - if (! empty($usemargins)) |
|
383 | - { |
|
384 | - if (!empty($user->rights->margins->creer)) { |
|
385 | - ?> |
|
378 | + if ($this->situation_cycle_ref) { |
|
379 | + $coldisplay++; |
|
380 | + print '<td class="nobottom nowrap" align="right"><input class="falt right" type="text" size="1" value="0" name="progress">%</td>'; |
|
381 | + } |
|
382 | + if (! empty($usemargins)) |
|
383 | + { |
|
384 | + if (!empty($user->rights->margins->creer)) { |
|
385 | + ?> |
|
386 | 386 | <td align="right" class="nobottom margininfos linecolmargin"> |
387 | 387 | <!-- For predef product --> |
388 | 388 | <?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?> |
@@ -392,29 +392,29 @@ discard block |
||
392 | 392 | <input type="text" size="5" id="buying_price" name="buying_price" class="flat right" value="<?php echo (isset($_POST["buying_price"])?GETPOST("buying_price",'alpha',2):''); ?>"> |
393 | 393 | </td> |
394 | 394 | <?php |
395 | - $coldisplay++; |
|
396 | - } |
|
395 | + $coldisplay++; |
|
396 | + } |
|
397 | 397 | |
398 | - if ($user->rights->margins->creer) |
|
399 | - { |
|
400 | - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) |
|
401 | - { |
|
402 | - echo '<td align="right" class="nobottom nowrap margininfos"><input class="flat right" type="text" size="2" id="np_marginRate" name="np_marginRate" value="'.(isset($_POST["np_marginRate"])?GETPOST("np_marginRate",'alpha',2):'').'"><span class="np_marginRate hideonsmartphone">%</span></td>'; |
|
403 | - $coldisplay++; |
|
404 | - } |
|
405 | - if (! empty($conf->global->DISPLAY_MARK_RATES)) |
|
406 | - { |
|
407 | - echo '<td align="right" class="nobottom nowrap margininfos"><input class="flat right" type="text" size="2" id="np_markRate" name="np_markRate" value="'.(isset($_POST["np_markRate"])?GETPOST("np_markRate",'alpha',2):'').'"><span class="np_markRate hideonsmartphone">%</span></td>'; |
|
408 | - $coldisplay++; |
|
409 | - } |
|
410 | - } |
|
411 | - else |
|
412 | - { |
|
413 | - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $coldisplay++; |
|
414 | - if (! empty($conf->global->DISPLAY_MARK_RATES)) $coldisplay++; |
|
415 | - } |
|
416 | - } |
|
417 | - ?> |
|
398 | + if ($user->rights->margins->creer) |
|
399 | + { |
|
400 | + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) |
|
401 | + { |
|
402 | + echo '<td align="right" class="nobottom nowrap margininfos"><input class="flat right" type="text" size="2" id="np_marginRate" name="np_marginRate" value="'.(isset($_POST["np_marginRate"])?GETPOST("np_marginRate",'alpha',2):'').'"><span class="np_marginRate hideonsmartphone">%</span></td>'; |
|
403 | + $coldisplay++; |
|
404 | + } |
|
405 | + if (! empty($conf->global->DISPLAY_MARK_RATES)) |
|
406 | + { |
|
407 | + echo '<td align="right" class="nobottom nowrap margininfos"><input class="flat right" type="text" size="2" id="np_markRate" name="np_markRate" value="'.(isset($_POST["np_markRate"])?GETPOST("np_markRate",'alpha',2):'').'"><span class="np_markRate hideonsmartphone">%</span></td>'; |
|
408 | + $coldisplay++; |
|
409 | + } |
|
410 | + } |
|
411 | + else |
|
412 | + { |
|
413 | + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $coldisplay++; |
|
414 | + if (! empty($conf->global->DISPLAY_MARK_RATES)) $coldisplay++; |
|
415 | + } |
|
416 | + } |
|
417 | + ?> |
|
418 | 418 | <td class="nobottom linecoledit" align="center" valign="middle" colspan="<?php echo $colspan; ?>"> |
419 | 419 | <input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline" id="addline"> |
420 | 420 | </td> |
@@ -422,98 +422,98 @@ discard block |
||
422 | 422 | |
423 | 423 | <?php |
424 | 424 | if (is_object($objectline)) { |
425 | - print $objectline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay+8), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); |
|
425 | + print $objectline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay+8), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); |
|
426 | 426 | } |
427 | 427 | ?> |
428 | 428 | |
429 | 429 | <?php |
430 | 430 | if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required |
431 | 431 | { |
432 | - $colspan = 6; |
|
433 | - |
|
434 | - if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
|
435 | - { |
|
436 | - $colspan++; |
|
437 | - } |
|
438 | - if ($this->situation_cycle_ref) { |
|
439 | - $colspan++; |
|
440 | - } |
|
441 | - // We add 1 if col total ttc |
|
442 | - if (!empty($inputalsopricewithtax)) { |
|
443 | - $colspan++; |
|
444 | - } |
|
445 | - if ($conf->global->PRODUCT_USE_UNITS) { |
|
446 | - $colspan++; |
|
447 | - } |
|
448 | - if (count($object->lines)) { |
|
449 | - //There will be an edit and a delete button |
|
450 | - $colspan += 2; |
|
451 | - |
|
452 | - // With this, there is a column move button ONLY if lines > 1 |
|
453 | - if (in_array($object->element, array( |
|
454 | - 'propal', |
|
455 | - 'supplier_proposal', |
|
456 | - 'facture', |
|
457 | - 'facturerec', |
|
458 | - 'invoice', |
|
459 | - 'commande', |
|
460 | - 'order', |
|
461 | - 'order_supplier', |
|
462 | - 'invoice_supplier' |
|
463 | - ))) { |
|
464 | - $colspan++; |
|
465 | - } |
|
466 | - } |
|
432 | + $colspan = 6; |
|
433 | + |
|
434 | + if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
|
435 | + { |
|
436 | + $colspan++; |
|
437 | + } |
|
438 | + if ($this->situation_cycle_ref) { |
|
439 | + $colspan++; |
|
440 | + } |
|
441 | + // We add 1 if col total ttc |
|
442 | + if (!empty($inputalsopricewithtax)) { |
|
443 | + $colspan++; |
|
444 | + } |
|
445 | + if ($conf->global->PRODUCT_USE_UNITS) { |
|
446 | + $colspan++; |
|
447 | + } |
|
448 | + if (count($object->lines)) { |
|
449 | + //There will be an edit and a delete button |
|
450 | + $colspan += 2; |
|
451 | + |
|
452 | + // With this, there is a column move button ONLY if lines > 1 |
|
453 | + if (in_array($object->element, array( |
|
454 | + 'propal', |
|
455 | + 'supplier_proposal', |
|
456 | + 'facture', |
|
457 | + 'facturerec', |
|
458 | + 'invoice', |
|
459 | + 'commande', |
|
460 | + 'order', |
|
461 | + 'order_supplier', |
|
462 | + 'invoice_supplier' |
|
463 | + ))) { |
|
464 | + $colspan++; |
|
465 | + } |
|
466 | + } |
|
467 | 467 | |
468 | - if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2; |
|
468 | + if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2; |
|
469 | 469 | |
470 | - if (! empty($usemargins)) |
|
471 | - { |
|
472 | - if (!empty($user->rights->margins->creer)) $colspan++; // For the buying price |
|
473 | - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
474 | - if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
475 | - } |
|
476 | - ?> |
|
470 | + if (! empty($usemargins)) |
|
471 | + { |
|
472 | + if (!empty($user->rights->margins->creer)) $colspan++; // For the buying price |
|
473 | + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
474 | + if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
475 | + } |
|
476 | + ?> |
|
477 | 477 | |
478 | 478 | <tr id="trlinefordates" <?php echo $bcnd[$var]; ?>> |
479 | 479 | <?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { print '<td></td>'; } ?> |
480 | 480 | <td colspan="<?php echo $colspan; ?>"> |
481 | 481 | <?php |
482 | - $date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); |
|
483 | - $date_end=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); |
|
484 | - if (! empty($object->element) && $object->element == 'contrat') |
|
485 | - { |
|
486 | - print $langs->trans("DateStartPlanned").' '; |
|
487 | - print $form->selectDate($date_start,"date_start",$usehm,$usehm,1,"addproduct"); |
|
488 | - print ' '.$langs->trans("DateEndPlanned").' '; |
|
489 | - print $form->selectDate($date_end,"date_end",$usehm,$usehm,1,"addproduct"); |
|
490 | - } |
|
491 | - else |
|
492 | - { |
|
493 | - echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; |
|
494 | - print $form->selectDate($date_start, 'date_start', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, 1, "addproduct", 1, 0); |
|
495 | - echo ' '.$langs->trans('to').' '; |
|
496 | - print $form->selectDate($date_end, 'date_end', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, 1, "addproduct", 1, 0); |
|
497 | - }; |
|
498 | - print '<script type="text/javascript">'; |
|
499 | - if (!$date_start) { |
|
500 | - if (isset($conf->global->MAIN_DEFAULT_DATE_START_HOUR)) { |
|
501 | - print 'jQuery("#date_starthour").val("'.$conf->global->MAIN_DEFAULT_DATE_START_HOUR.'");'; |
|
502 | - } |
|
503 | - if (isset($conf->global->MAIN_DEFAULT_DATE_START_MIN)) { |
|
504 | - print 'jQuery("#date_startmin").val("'.$conf->global->MAIN_DEFAULT_DATE_START_MIN.'");'; |
|
505 | - } |
|
506 | - } |
|
507 | - if (!$date_end) { |
|
508 | - if (isset($conf->global->MAIN_DEFAULT_DATE_END_HOUR)) { |
|
509 | - print 'jQuery("#date_endhour").val("'.$conf->global->MAIN_DEFAULT_DATE_END_HOUR.'");'; |
|
510 | - } |
|
511 | - if (isset($conf->global->MAIN_DEFAULT_DATE_END_MIN)) { |
|
512 | - print 'jQuery("#date_endmin").val("'.$conf->global->MAIN_DEFAULT_DATE_END_MIN.'");'; |
|
513 | - } |
|
514 | - } |
|
515 | - print '</script>' |
|
516 | - ?> |
|
482 | + $date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); |
|
483 | + $date_end=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); |
|
484 | + if (! empty($object->element) && $object->element == 'contrat') |
|
485 | + { |
|
486 | + print $langs->trans("DateStartPlanned").' '; |
|
487 | + print $form->selectDate($date_start,"date_start",$usehm,$usehm,1,"addproduct"); |
|
488 | + print ' '.$langs->trans("DateEndPlanned").' '; |
|
489 | + print $form->selectDate($date_end,"date_end",$usehm,$usehm,1,"addproduct"); |
|
490 | + } |
|
491 | + else |
|
492 | + { |
|
493 | + echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; |
|
494 | + print $form->selectDate($date_start, 'date_start', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, 1, "addproduct", 1, 0); |
|
495 | + echo ' '.$langs->trans('to').' '; |
|
496 | + print $form->selectDate($date_end, 'date_end', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, 1, "addproduct", 1, 0); |
|
497 | + }; |
|
498 | + print '<script type="text/javascript">'; |
|
499 | + if (!$date_start) { |
|
500 | + if (isset($conf->global->MAIN_DEFAULT_DATE_START_HOUR)) { |
|
501 | + print 'jQuery("#date_starthour").val("'.$conf->global->MAIN_DEFAULT_DATE_START_HOUR.'");'; |
|
502 | + } |
|
503 | + if (isset($conf->global->MAIN_DEFAULT_DATE_START_MIN)) { |
|
504 | + print 'jQuery("#date_startmin").val("'.$conf->global->MAIN_DEFAULT_DATE_START_MIN.'");'; |
|
505 | + } |
|
506 | + } |
|
507 | + if (!$date_end) { |
|
508 | + if (isset($conf->global->MAIN_DEFAULT_DATE_END_HOUR)) { |
|
509 | + print 'jQuery("#date_endhour").val("'.$conf->global->MAIN_DEFAULT_DATE_END_HOUR.'");'; |
|
510 | + } |
|
511 | + if (isset($conf->global->MAIN_DEFAULT_DATE_END_MIN)) { |
|
512 | + print 'jQuery("#date_endmin").val("'.$conf->global->MAIN_DEFAULT_DATE_END_MIN.'");'; |
|
513 | + } |
|
514 | + } |
|
515 | + print '</script>' |
|
516 | + ?> |
|
517 | 517 | </td> |
518 | 518 | </tr> |
519 | 519 | <?php |
@@ -530,19 +530,19 @@ discard block |
||
530 | 530 | /* Some js test when we click on button "Add" */ |
531 | 531 | jQuery(document).ready(function() { |
532 | 532 | <?php |
533 | - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { ?> |
|
533 | + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { ?> |
|
534 | 534 | $("input[name='np_marginRate']:first").blur(function(e) { |
535 | 535 | return checkFreeLine(e, "np_marginRate"); |
536 | 536 | }); |
537 | 537 | <?php |
538 | - } |
|
539 | - if (! empty($conf->global->DISPLAY_MARK_RATES)) { ?> |
|
538 | + } |
|
539 | + if (! empty($conf->global->DISPLAY_MARK_RATES)) { ?> |
|
540 | 540 | $("input[name='np_markRate']:first").blur(function(e) { |
541 | 541 | return checkFreeLine(e, "np_markRate"); |
542 | 542 | }); |
543 | 543 | <?php |
544 | - } |
|
545 | - ?> |
|
544 | + } |
|
545 | + ?> |
|
546 | 546 | }); |
547 | 547 | |
548 | 548 | /* TODO This does not work for number with thousand separator that is , */ |
@@ -633,11 +633,11 @@ discard block |
||
633 | 633 | }); |
634 | 634 | |
635 | 635 | <?php |
636 | - if(!$freelines) { ?> |
|
636 | + if(!$freelines) { ?> |
|
637 | 637 | $("#prod_entry_mode_predef").click(); |
638 | 638 | <?php |
639 | - } |
|
640 | - ?> |
|
639 | + } |
|
640 | + ?> |
|
641 | 641 | |
642 | 642 | /* When changing predefined product, we reload list of supplier prices required for margin combo */ |
643 | 643 | $("#idprod, #idprodfournprice").change(function() |
@@ -649,10 +649,10 @@ discard block |
||
649 | 649 | jQuery('#trlinefordates').show(); |
650 | 650 | |
651 | 651 | <?php |
652 | - if (! empty($usemargins) && $user->rights->margins->creer) |
|
653 | - { |
|
654 | - $langs->load('stocks'); |
|
655 | - ?> |
|
652 | + if (! empty($usemargins) && $user->rights->margins->creer) |
|
653 | + { |
|
654 | + $langs->load('stocks'); |
|
655 | + ?> |
|
656 | 656 | |
657 | 657 | /* Code for margin */ |
658 | 658 | $("#fournprice_predef").find("option").remove(); |
@@ -673,12 +673,12 @@ discard block |
||
673 | 673 | |
674 | 674 | /* setup of margin calculation */ |
675 | 675 | var defaultbuyprice = '<?php |
676 | - if (isset($conf->global->MARGIN_TYPE)) |
|
677 | - { |
|
678 | - if ($conf->global->MARGIN_TYPE == '1') print 'bestsupplierprice'; |
|
679 | - if ($conf->global->MARGIN_TYPE == 'pmp') print 'pmp'; |
|
680 | - if ($conf->global->MARGIN_TYPE == 'costprice') print 'costprice'; |
|
681 | - } ?>'; |
|
676 | + if (isset($conf->global->MARGIN_TYPE)) |
|
677 | + { |
|
678 | + if ($conf->global->MARGIN_TYPE == '1') print 'bestsupplierprice'; |
|
679 | + if ($conf->global->MARGIN_TYPE == 'pmp') print 'pmp'; |
|
680 | + if ($conf->global->MARGIN_TYPE == 'costprice') print 'costprice'; |
|
681 | + } ?>'; |
|
682 | 682 | console.log("we will set the field for margin. defaultbuyprice="+defaultbuyprice); |
683 | 683 | |
684 | 684 | var i = 0; |
@@ -33,60 +33,60 @@ discard block |
||
33 | 33 | */ |
34 | 34 | |
35 | 35 | // Protection to avoid direct call of template |
36 | -if (empty($object) || ! is_object($object)) |
|
36 | +if (empty($object) || !is_object($object)) |
|
37 | 37 | { |
38 | 38 | print "Error, template page can't be called as URL"; |
39 | 39 | exit; |
40 | 40 | } |
41 | 41 | |
42 | 42 | |
43 | -$usemargins=0; |
|
44 | -if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) |
|
43 | +$usemargins = 0; |
|
44 | +if (!empty($conf->margin->enabled) && !empty($object->element) && in_array($object->element, array('facture', 'propal', 'commande'))) |
|
45 | 45 | { |
46 | - $usemargins=1; |
|
46 | + $usemargins = 1; |
|
47 | 47 | } |
48 | 48 | |
49 | -if (! isset($dateSelector)) global $dateSelector; // Take global var only if not already defined into function calling (for example formAddObjectLine) |
|
49 | +if (!isset($dateSelector)) global $dateSelector; // Take global var only if not already defined into function calling (for example formAddObjectLine) |
|
50 | 50 | global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax; |
51 | 51 | |
52 | -if (! isset($dateSelector)) $dateSelector=1; // For backward compatibility |
|
53 | -elseif (empty($dateSelector)) $dateSelector=0; |
|
54 | -if (empty($forceall)) $forceall=0; |
|
55 | -if (empty($senderissupplier)) $senderissupplier=0; |
|
56 | -if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; |
|
52 | +if (!isset($dateSelector)) $dateSelector = 1; // For backward compatibility |
|
53 | +elseif (empty($dateSelector)) $dateSelector = 0; |
|
54 | +if (empty($forceall)) $forceall = 0; |
|
55 | +if (empty($senderissupplier)) $senderissupplier = 0; |
|
56 | +if (empty($inputalsopricewithtax)) $inputalsopricewithtax = 0; |
|
57 | 57 | |
58 | 58 | |
59 | 59 | // Define colspan for button Add |
60 | -$colspan = 3; // Col total ht + col edit + col delete |
|
61 | -if (in_array($object->element,array('propal','commande','order','facture','facturerec','invoice','supplier_proposal','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button |
|
60 | +$colspan = 3; // Col total ht + col edit + col delete |
|
61 | +if (in_array($object->element, array('propal', 'commande', 'order', 'facture', 'facturerec', 'invoice', 'supplier_proposal', 'order_supplier', 'invoice_supplier'))) $colspan++; // With this, there is a column move button |
|
62 | 62 | //print $object->element; |
63 | 63 | |
64 | 64 | // Lines for extrafield |
65 | 65 | $objectline = null; |
66 | 66 | if (!empty($extrafieldsline)) |
67 | 67 | { |
68 | - if ($this->table_element_line=='commandedet') { |
|
68 | + if ($this->table_element_line == 'commandedet') { |
|
69 | 69 | $objectline = new OrderLine($this->db); |
70 | 70 | } |
71 | - elseif ($this->table_element_line=='propaldet') { |
|
71 | + elseif ($this->table_element_line == 'propaldet') { |
|
72 | 72 | $objectline = new PropaleLigne($this->db); |
73 | 73 | } |
74 | - elseif ($this->table_element_line=='supplier_proposaldet') { |
|
74 | + elseif ($this->table_element_line == 'supplier_proposaldet') { |
|
75 | 75 | $objectline = new SupplierProposalLine($this->db); |
76 | 76 | } |
77 | - elseif ($this->table_element_line=='facturedet') { |
|
77 | + elseif ($this->table_element_line == 'facturedet') { |
|
78 | 78 | $objectline = new FactureLigne($this->db); |
79 | 79 | } |
80 | - elseif ($this->table_element_line=='contratdet') { |
|
80 | + elseif ($this->table_element_line == 'contratdet') { |
|
81 | 81 | $objectline = new ContratLigne($this->db); |
82 | 82 | } |
83 | - elseif ($this->table_element_line=='commande_fournisseurdet') { |
|
83 | + elseif ($this->table_element_line == 'commande_fournisseurdet') { |
|
84 | 84 | $objectline = new CommandeFournisseurLigne($this->db); |
85 | 85 | } |
86 | - elseif ($this->table_element_line=='facture_fourn_det') { |
|
86 | + elseif ($this->table_element_line == 'facture_fourn_det') { |
|
87 | 87 | $objectline = new SupplierInvoiceLine($this->db); |
88 | 88 | } |
89 | - elseif ($this->table_element_line=='facturedet_rec') { |
|
89 | + elseif ($this->table_element_line == 'facturedet_rec') { |
|
90 | 90 | $objectline = new FactureLigneRec($this->db); |
91 | 91 | } |
92 | 92 | } |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | |
96 | 96 | <!-- BEGIN PHP TEMPLATE objectline_create.tpl.php --> |
97 | 97 | <?php |
98 | -$nolinesbefore=(count($this->lines) == 0 || $forcetoshowtitlelines); |
|
98 | +$nolinesbefore = (count($this->lines) == 0 || $forcetoshowtitlelines); |
|
99 | 99 | if ($nolinesbefore) { |
100 | 100 | ?> |
101 | -<tr class="liste_titre<?php echo (($nolinesbefore || $object->element=='contrat')?'':' liste_titre_add_') ?> nodrag nodrop"> |
|
102 | - <?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> |
|
101 | +<tr class="liste_titre<?php echo (($nolinesbefore || $object->element == 'contrat') ? '' : ' liste_titre_add_') ?> nodrag nodrop"> |
|
102 | + <?php if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> |
|
103 | 103 | <td class="linecolnum" align="center"></td> |
104 | 104 | <?php } ?> |
105 | 105 | <td class="linecoldescription minwidth500imp"> |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | <?php } ?> |
114 | 114 | <td class="linecolvat" align="right"><span id="title_vat"><?php echo $langs->trans('VAT'); ?></span></td> |
115 | 115 | <td class="linecoluht" align="right"><span id="title_up_ht"><?php echo $langs->trans('PriceUHT'); ?></span></td> |
116 | - <?php if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { $colspan++;?> |
|
116 | + <?php if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { $colspan++; ?> |
|
117 | 117 | <td class="linecoluht_currency" align="right"><span id="title_up_ht_currency"><?php echo $langs->trans('PriceUHTCurrency'); ?></span></td> |
118 | 118 | <?php } ?> |
119 | - <?php if (! empty($inputalsopricewithtax)) { ?> |
|
119 | + <?php if (!empty($inputalsopricewithtax)) { ?> |
|
120 | 120 | <td class="linecoluttc" align="right"><span id="title_up_ttc"><?php echo $langs->trans('PriceUTTC'); ?></span></td> |
121 | 121 | <?php } ?> |
122 | 122 | <td class="linecolqty" align="right"><?php echo $langs->trans('Qty'); ?></td> |
123 | 123 | <?php |
124 | - if($conf->global->PRODUCT_USE_UNITS) |
|
124 | + if ($conf->global->PRODUCT_USE_UNITS) |
|
125 | 125 | { |
126 | 126 | print '<td class="linecoluseunit" align="left">'; |
127 | 127 | print '<span id="title_units">'; |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | <td class="linecoldiscount" align="right"><?php echo $langs->trans('ReductionShort'); ?></td> |
133 | 133 | <?php |
134 | 134 | if ($this->situation_cycle_ref) { |
135 | - print '<td class="linecolcycleref" align="right">' . $langs->trans('Progress') . '</td>'; |
|
135 | + print '<td class="linecolcycleref" align="right">'.$langs->trans('Progress').'</td>'; |
|
136 | 136 | } |
137 | - if (! empty($usemargins)) |
|
137 | + if (!empty($usemargins)) |
|
138 | 138 | { |
139 | 139 | if (!empty($user->rights->margins->creer)) { |
140 | 140 | ?> |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | ?> |
151 | 151 | </td> |
152 | 152 | <?php |
153 | - if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td align="right" class="margininfos linecolmargin2"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>'; |
|
154 | - if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARK_RATES)) echo '<td align="right" class="margininfos linecolmargin2"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>'; |
|
153 | + if ($user->rights->margins->creer && !empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td align="right" class="margininfos linecolmargin2"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>'; |
|
154 | + if ($user->rights->margins->creer && !empty($conf->global->DISPLAY_MARK_RATES)) echo '<td align="right" class="margininfos linecolmargin2"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>'; |
|
155 | 155 | } |
156 | 156 | ?> |
157 | 157 | <td class="linecoledit" colspan="<?php echo $colspan; ?>"> </td> |
@@ -159,17 +159,17 @@ discard block |
||
159 | 159 | <?php |
160 | 160 | } |
161 | 161 | ?> |
162 | -<tr class="pair nodrag nodrop nohoverpair<?php echo ($nolinesbefore || $object->element=='contrat')?'':' liste_titre_create'; ?>"> |
|
162 | +<tr class="pair nodrag nodrop nohoverpair<?php echo ($nolinesbefore || $object->element == 'contrat') ? '' : ' liste_titre_create'; ?>"> |
|
163 | 163 | <?php |
164 | 164 | // Adds a line numbering column |
165 | -if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { |
|
166 | - $coldisplay=2; |
|
165 | +if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { |
|
166 | + $coldisplay = 2; |
|
167 | 167 | ?> |
168 | 168 | <td class="nobottom linecolnum" align="center" width="5"></td> |
169 | 169 | <?php |
170 | 170 | } |
171 | 171 | else { |
172 | - $coldisplay=0; |
|
172 | + $coldisplay = 0; |
|
173 | 173 | } |
174 | 174 | ?> |
175 | 175 | |
@@ -181,22 +181,22 @@ discard block |
||
181 | 181 | if (empty($conf->global->MAIN_DISABLE_FREE_LINES)) |
182 | 182 | { |
183 | 183 | $freelines = true; |
184 | - $forceall=1; // We always force all type for free lines (module product or service means we use predefined product or service) |
|
184 | + $forceall = 1; // We always force all type for free lines (module product or service means we use predefined product or service) |
|
185 | 185 | if ($object->element == 'contrat') |
186 | 186 | { |
187 | - if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=-1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set |
|
188 | - else if (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=3; |
|
187 | + if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall = -1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set |
|
188 | + else if (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall = 3; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | // Free line |
192 | 192 | echo '<span class="prod_entry_mode_free">'; |
193 | 193 | // Show radio free line |
194 | - if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) |
|
194 | + if ($forceall >= 0 && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) |
|
195 | 195 | { |
196 | 196 | echo '<label for="prod_entry_mode_free">'; |
197 | 197 | echo '<input type="radio" class="prod_entry_mode_free" name="prod_entry_mode" id="prod_entry_mode_free" value="free"'; |
198 | 198 | //echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : ((empty($forceall) && (empty($conf->product->enabled) || empty($conf->service->enabled)))?' checked':'') ); |
199 | - echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : ''); |
|
199 | + echo (GETPOST('prod_entry_mode') == 'free' ? ' checked' : ''); |
|
200 | 200 | echo '> '; |
201 | 201 | // Show type selector |
202 | 202 | echo $langs->trans("FreeLineOfType"); |
@@ -215,39 +215,39 @@ discard block |
||
215 | 215 | } |
216 | 216 | } |
217 | 217 | |
218 | - echo $form->select_type_of_lines(isset($_POST["type"])?GETPOST("type",'alpha',2):-1,'type',1,1,$forceall); |
|
218 | + echo $form->select_type_of_lines(isset($_POST["type"]) ?GETPOST("type", 'alpha', 2) : -1, 'type', 1, 1, $forceall); |
|
219 | 219 | |
220 | 220 | echo '</span>'; |
221 | 221 | } |
222 | 222 | |
223 | 223 | // Predefined product/service |
224 | - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) |
|
224 | + if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) |
|
225 | 225 | { |
226 | 226 | if ($forceall >= 0 && $freelines) echo '<br>'; |
227 | 227 | echo '<span class="prod_entry_mode_predef">'; |
228 | 228 | echo '<label for="prod_entry_mode_predef">'; |
229 | - echo '<input type="radio" class="prod_entry_mode_predef" name="prod_entry_mode" id="prod_entry_mode_predef" value="predef"'.(GETPOST('prod_entry_mode')=='predef'?' checked':'').'> '; |
|
229 | + echo '<input type="radio" class="prod_entry_mode_predef" name="prod_entry_mode" id="prod_entry_mode_predef" value="predef"'.(GETPOST('prod_entry_mode') == 'predef' ? ' checked' : '').'> '; |
|
230 | 230 | if (empty($senderissupplier)) |
231 | 231 | { |
232 | - if (! empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans('PredefinedProductsToSell'); |
|
233 | - else if ((empty($conf->product->enabled) && ! empty($conf->service->enabled)) || ($object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS))) echo $langs->trans('PredefinedServicesToSell'); |
|
232 | + if (!empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans('PredefinedProductsToSell'); |
|
233 | + else if ((empty($conf->product->enabled) && !empty($conf->service->enabled)) || ($object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS))) echo $langs->trans('PredefinedServicesToSell'); |
|
234 | 234 | else echo $langs->trans('PredefinedProductsAndServicesToSell'); |
235 | 235 | } |
236 | 236 | else |
237 | 237 | { |
238 | - if (! empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans('PredefinedProductsToPurchase'); |
|
239 | - else if (empty($conf->product->enabled) && ! empty($conf->service->enabled)) echo $langs->trans('PredefinedServicesToPurchase'); |
|
238 | + if (!empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans('PredefinedProductsToPurchase'); |
|
239 | + else if (empty($conf->product->enabled) && !empty($conf->service->enabled)) echo $langs->trans('PredefinedServicesToPurchase'); |
|
240 | 240 | else echo $langs->trans('PredefinedProductsAndServicesToPurchase'); |
241 | 241 | } |
242 | 242 | echo '</label>'; |
243 | 243 | echo ' '; |
244 | 244 | |
245 | - $filtertype=''; |
|
246 | - if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1'; |
|
245 | + $filtertype = ''; |
|
246 | + if (!empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype = '1'; |
|
247 | 247 | |
248 | 248 | if (empty($senderissupplier)) |
249 | 249 | { |
250 | - if (! empty($conf->global->ENTREPOT_EXTRA_STATUS)) |
|
250 | + if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) |
|
251 | 251 | { |
252 | 252 | // hide products in closed warehouse, but show products for internal transfer |
253 | 253 | $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); |
@@ -262,17 +262,17 @@ discard block |
||
262 | 262 | // $senderissupplier=2 is same than 1 but disable test on minimum qty and disable autofill qty with minimum |
263 | 263 | if ($senderissupplier != 2) |
264 | 264 | { |
265 | - $ajaxoptions=array( |
|
266 | - 'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key |
|
267 | - 'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done |
|
265 | + $ajaxoptions = array( |
|
266 | + 'update' => array('qty'=>'qty', 'remise_percent' => 'discount', 'idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key |
|
267 | + 'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done |
|
268 | 268 | 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for exemple shown we select a disabled option into combo) |
269 | 269 | ); |
270 | - $alsoproductwithnosupplierprice=0; |
|
270 | + $alsoproductwithnosupplierprice = 0; |
|
271 | 271 | } |
272 | 272 | else |
273 | 273 | { |
274 | 274 | $ajaxoptions = array(); |
275 | - $alsoproductwithnosupplierprice=1; |
|
275 | + $alsoproductwithnosupplierprice = 1; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | $form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1, $alsoproductwithnosupplierprice); |
@@ -283,23 +283,23 @@ discard block |
||
283 | 283 | |
284 | 284 | if (is_object($hookmanager) && empty($senderissupplier)) |
285 | 285 | { |
286 | - $parameters=array('fk_parent_line'=>GETPOST('fk_parent_line','int')); |
|
287 | - $reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action); |
|
286 | + $parameters = array('fk_parent_line'=>GETPOST('fk_parent_line', 'int')); |
|
287 | + $reshook = $hookmanager->executeHooks('formCreateProductOptions', $parameters, $object, $action); |
|
288 | 288 | if (!empty($hookmanager->resPrint)) { |
289 | 289 | print $hookmanager->resPrint; |
290 | 290 | } |
291 | 291 | } |
292 | - if (is_object($hookmanager) && ! empty($senderissupplier)) |
|
292 | + if (is_object($hookmanager) && !empty($senderissupplier)) |
|
293 | 293 | { |
294 | - $parameters=array('htmlname'=>'addproduct'); |
|
295 | - $reshook=$hookmanager->executeHooks('formCreateProductSupplierOptions',$parameters,$object,$action); |
|
294 | + $parameters = array('htmlname'=>'addproduct'); |
|
295 | + $reshook = $hookmanager->executeHooks('formCreateProductSupplierOptions', $parameters, $object, $action); |
|
296 | 296 | if (!empty($hookmanager->resPrint)) { |
297 | 297 | print $hookmanager->resPrint; |
298 | 298 | } |
299 | 299 | } |
300 | 300 | |
301 | 301 | |
302 | - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { |
|
302 | + if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { |
|
303 | 303 | |
304 | 304 | if (!empty($conf->variants->enabled)) { |
305 | 305 | echo '<div id="attributes_box"></div>'; |
@@ -310,16 +310,16 @@ discard block |
||
310 | 310 | |
311 | 311 | // Editor wysiwyg |
312 | 312 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
313 | - $nbrows=ROWS_2; |
|
314 | - $enabled=(! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
|
315 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
316 | - $toolbarname='dolibarr_details'; |
|
317 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
318 | - $doleditor=new DolEditor('dp_desc',GETPOST('dp_desc'),'',100,$toolbarname,'',false,true,$enabled,$nbrows,'98%'); |
|
313 | + $nbrows = ROWS_2; |
|
314 | + $enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
|
315 | + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
316 | + $toolbarname = 'dolibarr_details'; |
|
317 | + if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname = 'dolibarr_notes'; |
|
318 | + $doleditor = new DolEditor('dp_desc', GETPOST('dp_desc'), '', 100, $toolbarname, '', false, true, $enabled, $nbrows, '98%'); |
|
319 | 319 | $doleditor->Create(); |
320 | 320 | |
321 | 321 | // Show autofill date for recuring invoices |
322 | - if (! empty($conf->service->enabled) && $object->element == 'facturerec') |
|
322 | + if (!empty($conf->service->enabled) && $object->element == 'facturerec') |
|
323 | 323 | { |
324 | 324 | echo '<div class="divlinefordates"><br>'; |
325 | 325 | echo $langs->trans('AutoFillDateFrom').' '; |
@@ -336,60 +336,60 @@ discard block |
||
336 | 336 | if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
337 | 337 | { |
338 | 338 | ?> |
339 | - <td class="nobottom linecolresupplier"><input id="fourn_ref" name="fourn_ref" class="flat maxwidth75" value="<?php echo (isset($_POST["fourn_ref"])?GETPOST("fourn_ref",'alpha',2):''); ?>"></td> |
|
339 | + <td class="nobottom linecolresupplier"><input id="fourn_ref" name="fourn_ref" class="flat maxwidth75" value="<?php echo (isset($_POST["fourn_ref"]) ?GETPOST("fourn_ref", 'alpha', 2) : ''); ?>"></td> |
|
340 | 340 | <?php } ?> |
341 | 341 | |
342 | 342 | <td class="nobottom linecolvat" align="right"><?php |
343 | 343 | if ($seller->tva_assuj == "0") echo '<input type="hidden" name="tva_tx" id="tva_tx" value="0">'.vatrate(0, true); |
344 | - else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?GETPOST("tva_tx",'alpha',2):-1), $seller, $buyer, 0, 0, '', false, 1); |
|
344 | + else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"]) ?GETPOST("tva_tx", 'alpha', 2) : -1), $seller, $buyer, 0, 0, '', false, 1); |
|
345 | 345 | ?> |
346 | 346 | </td> |
347 | 347 | <td class="nobottom linecoluht" align="right"> |
348 | - <input type="text" size="5" name="price_ht" id="price_ht" class="flat right" value="<?php echo (isset($_POST["price_ht"])?GETPOST("price_ht",'alpha',2):''); ?>"> |
|
348 | + <input type="text" size="5" name="price_ht" id="price_ht" class="flat right" value="<?php echo (isset($_POST["price_ht"]) ?GETPOST("price_ht", 'alpha', 2) : ''); ?>"> |
|
349 | 349 | </td> |
350 | 350 | |
351 | - <?php if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { $colspan++;?> |
|
351 | + <?php if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { $colspan++; ?> |
|
352 | 352 | <td class="nobottom linecoluht_currency" align="right"> |
353 | - <input type="text" size="5" name="multicurrency_price_ht" id="multicurrency_price_ht" class="flat right" value="<?php echo (isset($_POST["multicurrency_price_ht"])?GETPOST("multicurrency_price_ht",'alpha',2):''); ?>"> |
|
353 | + <input type="text" size="5" name="multicurrency_price_ht" id="multicurrency_price_ht" class="flat right" value="<?php echo (isset($_POST["multicurrency_price_ht"]) ?GETPOST("multicurrency_price_ht", 'alpha', 2) : ''); ?>"> |
|
354 | 354 | </td> |
355 | 355 | <?php } ?> |
356 | 356 | |
357 | - <?php if (! empty($inputalsopricewithtax)) { ?> |
|
357 | + <?php if (!empty($inputalsopricewithtax)) { ?> |
|
358 | 358 | <td class="nobottom linecoluttc" align="right"> |
359 | - <input type="text" size="5" name="price_ttc" id="price_ttc" class="flat" value="<?php echo (isset($_POST["price_ttc"])?GETPOST("price_ttc",'alpha',2):''); ?>"> |
|
359 | + <input type="text" size="5" name="price_ttc" id="price_ttc" class="flat" value="<?php echo (isset($_POST["price_ttc"]) ?GETPOST("price_ttc", 'alpha', 2) : ''); ?>"> |
|
360 | 360 | </td> |
361 | 361 | <?php } ?> |
362 | - <td class="nobottom linecolqty" align="right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="<?php echo (isset($_POST["qty"])?GETPOST("qty",'alpha',2):1); ?>"> |
|
362 | + <td class="nobottom linecolqty" align="right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="<?php echo (isset($_POST["qty"]) ?GETPOST("qty", 'alpha', 2) : 1); ?>"> |
|
363 | 363 | </td> |
364 | 364 | <?php |
365 | - if($conf->global->PRODUCT_USE_UNITS) |
|
365 | + if ($conf->global->PRODUCT_USE_UNITS) |
|
366 | 366 | { |
367 | 367 | print '<td class="nobottom linecoluseunit" align="left">'; |
368 | 368 | print $form->selectUnits($line->fk_unit, "units"); |
369 | 369 | print '</td>'; |
370 | 370 | } |
371 | 371 | $remise_percent = $buyer->remise_percent; |
372 | - if($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
|
372 | + if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
|
373 | 373 | $remise_percent = $seller->remise_supplier_percent; |
374 | 374 | } |
375 | 375 | ?> |
376 | - <td class="nobottom nowrap linecoldiscount" align="right"><input type="text" size="1" name="remise_percent" id="remise_percent" class="flat right" value="<?php echo (isset($_POST["remise_percent"])?GETPOST("remise_percent",'alpha',2):$remise_percent); ?>"><span class="hideonsmartphone">%</span></td> |
|
376 | + <td class="nobottom nowrap linecoldiscount" align="right"><input type="text" size="1" name="remise_percent" id="remise_percent" class="flat right" value="<?php echo (isset($_POST["remise_percent"]) ?GETPOST("remise_percent", 'alpha', 2) : $remise_percent); ?>"><span class="hideonsmartphone">%</span></td> |
|
377 | 377 | <?php |
378 | 378 | if ($this->situation_cycle_ref) { |
379 | 379 | $coldisplay++; |
380 | 380 | print '<td class="nobottom nowrap" align="right"><input class="falt right" type="text" size="1" value="0" name="progress">%</td>'; |
381 | 381 | } |
382 | - if (! empty($usemargins)) |
|
382 | + if (!empty($usemargins)) |
|
383 | 383 | { |
384 | 384 | if (!empty($user->rights->margins->creer)) { |
385 | 385 | ?> |
386 | 386 | <td align="right" class="nobottom margininfos linecolmargin"> |
387 | 387 | <!-- For predef product --> |
388 | - <?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?> |
|
388 | + <?php if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { ?> |
|
389 | 389 | <select id="fournprice_predef" name="fournprice_predef" class="flat" style="display: none;"></select> |
390 | 390 | <?php } ?> |
391 | 391 | <!-- For free product --> |
392 | - <input type="text" size="5" id="buying_price" name="buying_price" class="flat right" value="<?php echo (isset($_POST["buying_price"])?GETPOST("buying_price",'alpha',2):''); ?>"> |
|
392 | + <input type="text" size="5" id="buying_price" name="buying_price" class="flat right" value="<?php echo (isset($_POST["buying_price"]) ?GETPOST("buying_price", 'alpha', 2) : ''); ?>"> |
|
393 | 393 | </td> |
394 | 394 | <?php |
395 | 395 | $coldisplay++; |
@@ -397,21 +397,21 @@ discard block |
||
397 | 397 | |
398 | 398 | if ($user->rights->margins->creer) |
399 | 399 | { |
400 | - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) |
|
400 | + if (!empty($conf->global->DISPLAY_MARGIN_RATES)) |
|
401 | 401 | { |
402 | - echo '<td align="right" class="nobottom nowrap margininfos"><input class="flat right" type="text" size="2" id="np_marginRate" name="np_marginRate" value="'.(isset($_POST["np_marginRate"])?GETPOST("np_marginRate",'alpha',2):'').'"><span class="np_marginRate hideonsmartphone">%</span></td>'; |
|
402 | + echo '<td align="right" class="nobottom nowrap margininfos"><input class="flat right" type="text" size="2" id="np_marginRate" name="np_marginRate" value="'.(isset($_POST["np_marginRate"]) ?GETPOST("np_marginRate", 'alpha', 2) : '').'"><span class="np_marginRate hideonsmartphone">%</span></td>'; |
|
403 | 403 | $coldisplay++; |
404 | 404 | } |
405 | - if (! empty($conf->global->DISPLAY_MARK_RATES)) |
|
405 | + if (!empty($conf->global->DISPLAY_MARK_RATES)) |
|
406 | 406 | { |
407 | - echo '<td align="right" class="nobottom nowrap margininfos"><input class="flat right" type="text" size="2" id="np_markRate" name="np_markRate" value="'.(isset($_POST["np_markRate"])?GETPOST("np_markRate",'alpha',2):'').'"><span class="np_markRate hideonsmartphone">%</span></td>'; |
|
407 | + echo '<td align="right" class="nobottom nowrap margininfos"><input class="flat right" type="text" size="2" id="np_markRate" name="np_markRate" value="'.(isset($_POST["np_markRate"]) ?GETPOST("np_markRate", 'alpha', 2) : '').'"><span class="np_markRate hideonsmartphone">%</span></td>'; |
|
408 | 408 | $coldisplay++; |
409 | 409 | } |
410 | 410 | } |
411 | 411 | else |
412 | 412 | { |
413 | - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $coldisplay++; |
|
414 | - if (! empty($conf->global->DISPLAY_MARK_RATES)) $coldisplay++; |
|
413 | + if (!empty($conf->global->DISPLAY_MARGIN_RATES)) $coldisplay++; |
|
414 | + if (!empty($conf->global->DISPLAY_MARK_RATES)) $coldisplay++; |
|
415 | 415 | } |
416 | 416 | } |
417 | 417 | ?> |
@@ -422,12 +422,12 @@ discard block |
||
422 | 422 | |
423 | 423 | <?php |
424 | 424 | if (is_object($objectline)) { |
425 | - print $objectline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay+8), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); |
|
425 | + print $objectline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay + 8), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); |
|
426 | 426 | } |
427 | 427 | ?> |
428 | 428 | |
429 | 429 | <?php |
430 | -if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required |
|
430 | +if ((!empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required |
|
431 | 431 | { |
432 | 432 | $colspan = 6; |
433 | 433 | |
@@ -465,35 +465,35 @@ discard block |
||
465 | 465 | } |
466 | 466 | } |
467 | 467 | |
468 | - if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2; |
|
468 | + if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan += 2; |
|
469 | 469 | |
470 | - if (! empty($usemargins)) |
|
470 | + if (!empty($usemargins)) |
|
471 | 471 | { |
472 | 472 | if (!empty($user->rights->margins->creer)) $colspan++; // For the buying price |
473 | - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
474 | - if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
473 | + if (!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
474 | + if (!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
475 | 475 | } |
476 | 476 | ?> |
477 | 477 | |
478 | 478 | <tr id="trlinefordates" <?php echo $bcnd[$var]; ?>> |
479 | - <?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { print '<td></td>'; } ?> |
|
479 | + <?php if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { print '<td></td>'; } ?> |
|
480 | 480 | <td colspan="<?php echo $colspan; ?>"> |
481 | 481 | <?php |
482 | - $date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); |
|
483 | - $date_end=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); |
|
484 | - if (! empty($object->element) && $object->element == 'contrat') |
|
482 | + $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); |
|
483 | + $date_end = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); |
|
484 | + if (!empty($object->element) && $object->element == 'contrat') |
|
485 | 485 | { |
486 | 486 | print $langs->trans("DateStartPlanned").' '; |
487 | - print $form->selectDate($date_start,"date_start",$usehm,$usehm,1,"addproduct"); |
|
487 | + print $form->selectDate($date_start, "date_start", $usehm, $usehm, 1, "addproduct"); |
|
488 | 488 | print ' '.$langs->trans("DateEndPlanned").' '; |
489 | - print $form->selectDate($date_end,"date_end",$usehm,$usehm,1,"addproduct"); |
|
489 | + print $form->selectDate($date_end, "date_end", $usehm, $usehm, 1, "addproduct"); |
|
490 | 490 | } |
491 | 491 | else |
492 | 492 | { |
493 | 493 | echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; |
494 | - print $form->selectDate($date_start, 'date_start', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, 1, "addproduct", 1, 0); |
|
494 | + print $form->selectDate($date_start, 'date_start', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, 1, "addproduct", 1, 0); |
|
495 | 495 | echo ' '.$langs->trans('to').' '; |
496 | - print $form->selectDate($date_end, 'date_end', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, 1, "addproduct", 1, 0); |
|
496 | + print $form->selectDate($date_end, 'date_end', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, 1, "addproduct", 1, 0); |
|
497 | 497 | }; |
498 | 498 | print '<script type="text/javascript">'; |
499 | 499 | if (!$date_start) { |
@@ -523,20 +523,20 @@ discard block |
||
523 | 523 | <script type="text/javascript"> |
524 | 524 | |
525 | 525 | <?php |
526 | -if (! empty($usemargins) && $user->rights->margins->creer) |
|
526 | +if (!empty($usemargins) && $user->rights->margins->creer) |
|
527 | 527 | { |
528 | 528 | ?> |
529 | 529 | |
530 | 530 | /* Some js test when we click on button "Add" */ |
531 | 531 | jQuery(document).ready(function() { |
532 | 532 | <?php |
533 | - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { ?> |
|
533 | + if (!empty($conf->global->DISPLAY_MARGIN_RATES)) { ?> |
|
534 | 534 | $("input[name='np_marginRate']:first").blur(function(e) { |
535 | 535 | return checkFreeLine(e, "np_marginRate"); |
536 | 536 | }); |
537 | 537 | <?php |
538 | 538 | } |
539 | - if (! empty($conf->global->DISPLAY_MARK_RATES)) { ?> |
|
539 | + if (!empty($conf->global->DISPLAY_MARK_RATES)) { ?> |
|
540 | 540 | $("input[name='np_markRate']:first").blur(function(e) { |
541 | 541 | return checkFreeLine(e, "np_markRate"); |
542 | 542 | }); |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | }); |
634 | 634 | |
635 | 635 | <?php |
636 | - if(!$freelines) { ?> |
|
636 | + if (!$freelines) { ?> |
|
637 | 637 | $("#prod_entry_mode_predef").click(); |
638 | 638 | <?php |
639 | 639 | } |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | jQuery('#trlinefordates').show(); |
650 | 650 | |
651 | 651 | <?php |
652 | - if (! empty($usemargins) && $user->rights->margins->creer) |
|
652 | + if (!empty($usemargins) && $user->rights->margins->creer) |
|
653 | 653 | { |
654 | 654 | $langs->load('stocks'); |
655 | 655 | ?> |
@@ -46,19 +46,36 @@ discard block |
||
46 | 46 | $usemargins=1; |
47 | 47 | } |
48 | 48 | |
49 | -if (! isset($dateSelector)) global $dateSelector; // Take global var only if not already defined into function calling (for example formAddObjectLine) |
|
49 | +if (! isset($dateSelector)) { |
|
50 | + global $dateSelector; |
|
51 | +} |
|
52 | +// Take global var only if not already defined into function calling (for example formAddObjectLine) |
|
50 | 53 | global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax; |
51 | 54 | |
52 | -if (! isset($dateSelector)) $dateSelector=1; // For backward compatibility |
|
53 | -elseif (empty($dateSelector)) $dateSelector=0; |
|
54 | -if (empty($forceall)) $forceall=0; |
|
55 | -if (empty($senderissupplier)) $senderissupplier=0; |
|
56 | -if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; |
|
55 | +if (! isset($dateSelector)) { |
|
56 | + $dateSelector=1; |
|
57 | +} |
|
58 | +// For backward compatibility |
|
59 | +elseif (empty($dateSelector)) { |
|
60 | + $dateSelector=0; |
|
61 | +} |
|
62 | +if (empty($forceall)) { |
|
63 | + $forceall=0; |
|
64 | +} |
|
65 | +if (empty($senderissupplier)) { |
|
66 | + $senderissupplier=0; |
|
67 | +} |
|
68 | +if (empty($inputalsopricewithtax)) { |
|
69 | + $inputalsopricewithtax=0; |
|
70 | +} |
|
57 | 71 | |
58 | 72 | |
59 | 73 | // Define colspan for button Add |
60 | 74 | $colspan = 3; // Col total ht + col edit + col delete |
61 | -if (in_array($object->element,array('propal','commande','order','facture','facturerec','invoice','supplier_proposal','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button |
|
75 | +if (in_array($object->element,array('propal','commande','order','facture','facturerec','invoice','supplier_proposal','order_supplier','invoice_supplier'))) { |
|
76 | + $colspan++; |
|
77 | +} |
|
78 | +// With this, there is a column move button |
|
62 | 79 | //print $object->element; |
63 | 80 | |
64 | 81 | // Lines for extrafield |
@@ -67,26 +84,19 @@ discard block |
||
67 | 84 | { |
68 | 85 | if ($this->table_element_line=='commandedet') { |
69 | 86 | $objectline = new OrderLine($this->db); |
70 | - } |
|
71 | - elseif ($this->table_element_line=='propaldet') { |
|
87 | + } elseif ($this->table_element_line=='propaldet') { |
|
72 | 88 | $objectline = new PropaleLigne($this->db); |
73 | - } |
|
74 | - elseif ($this->table_element_line=='supplier_proposaldet') { |
|
89 | + } elseif ($this->table_element_line=='supplier_proposaldet') { |
|
75 | 90 | $objectline = new SupplierProposalLine($this->db); |
76 | - } |
|
77 | - elseif ($this->table_element_line=='facturedet') { |
|
91 | + } elseif ($this->table_element_line=='facturedet') { |
|
78 | 92 | $objectline = new FactureLigne($this->db); |
79 | - } |
|
80 | - elseif ($this->table_element_line=='contratdet') { |
|
93 | + } elseif ($this->table_element_line=='contratdet') { |
|
81 | 94 | $objectline = new ContratLigne($this->db); |
82 | - } |
|
83 | - elseif ($this->table_element_line=='commande_fournisseurdet') { |
|
95 | + } elseif ($this->table_element_line=='commande_fournisseurdet') { |
|
84 | 96 | $objectline = new CommandeFournisseurLigne($this->db); |
85 | - } |
|
86 | - elseif ($this->table_element_line=='facture_fourn_det') { |
|
97 | + } elseif ($this->table_element_line=='facture_fourn_det') { |
|
87 | 98 | $objectline = new SupplierInvoiceLine($this->db); |
88 | - } |
|
89 | - elseif ($this->table_element_line=='facturedet_rec') { |
|
99 | + } elseif ($this->table_element_line=='facturedet_rec') { |
|
90 | 100 | $objectline = new FactureLigneRec($this->db); |
91 | 101 | } |
92 | 102 | } |
@@ -106,10 +116,13 @@ discard block |
||
106 | 116 | <div id="add"></div><span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine'); ?></span><?php // echo $langs->trans("FreeZone"); ?> |
107 | 117 | </td> |
108 | 118 | <?php |
109 | - if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
|
119 | + if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
|
120 | + // We must have same test in printObjectLines |
|
110 | 121 | { |
111 | 122 | ?> |
112 | - <td class="linecolrefsupplier"><span id="title_fourn_ref"><?php echo $langs->trans('SupplierRef'); ?></span></td> |
|
123 | + <td class="linecolrefsupplier"><span id="title_fourn_ref"><?php echo $langs->trans('SupplierRef'); |
|
124 | + } |
|
125 | + ?></span></td> |
|
113 | 126 | <?php } ?> |
114 | 127 | <td class="linecolvat" align="right"><span id="title_vat"><?php echo $langs->trans('VAT'); ?></span></td> |
115 | 128 | <td class="linecoluht" align="right"><span id="title_up_ht"><?php echo $langs->trans('PriceUHT'); ?></span></td> |
@@ -140,18 +153,24 @@ discard block |
||
140 | 153 | ?> |
141 | 154 | <td align="right" class="margininfos linecolmargin1"> |
142 | 155 | <?php |
156 | + } else { |
|
157 | + $colspan++; |
|
143 | 158 | } |
144 | - else $colspan++; |
|
145 | 159 | |
146 | - if ($conf->global->MARGIN_TYPE == "1") |
|
147 | - echo $langs->trans('BuyingPrice'); |
|
148 | - else |
|
149 | - echo $langs->trans('CostPrice'); |
|
160 | + if ($conf->global->MARGIN_TYPE == "1") { |
|
161 | + echo $langs->trans('BuyingPrice'); |
|
162 | + } else { |
|
163 | + echo $langs->trans('CostPrice'); |
|
164 | + } |
|
150 | 165 | ?> |
151 | 166 | </td> |
152 | 167 | <?php |
153 | - if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td align="right" class="margininfos linecolmargin2"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>'; |
|
154 | - if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARK_RATES)) echo '<td align="right" class="margininfos linecolmargin2"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>'; |
|
168 | + if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARGIN_RATES)) { |
|
169 | + echo '<td align="right" class="margininfos linecolmargin2"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>'; |
|
170 | + } |
|
171 | + if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARK_RATES)) { |
|
172 | + echo '<td align="right" class="margininfos linecolmargin2"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>'; |
|
173 | + } |
|
155 | 174 | } |
156 | 175 | ?> |
157 | 176 | <td class="linecoledit" colspan="<?php echo $colspan; ?>"> </td> |
@@ -167,8 +186,7 @@ discard block |
||
167 | 186 | ?> |
168 | 187 | <td class="nobottom linecolnum" align="center" width="5"></td> |
169 | 188 | <?php |
170 | -} |
|
171 | -else { |
|
189 | +} else { |
|
172 | 190 | $coldisplay=0; |
173 | 191 | } |
174 | 192 | ?> |
@@ -184,8 +202,13 @@ discard block |
||
184 | 202 | $forceall=1; // We always force all type for free lines (module product or service means we use predefined product or service) |
185 | 203 | if ($object->element == 'contrat') |
186 | 204 | { |
187 | - if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=-1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set |
|
188 | - else if (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=3; |
|
205 | + if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) { |
|
206 | + $forceall=-1; |
|
207 | + } |
|
208 | + // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set |
|
209 | + else if (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) { |
|
210 | + $forceall=3; |
|
211 | + } |
|
189 | 212 | } |
190 | 213 | |
191 | 214 | // Free line |
@@ -202,15 +225,17 @@ discard block |
||
202 | 225 | echo $langs->trans("FreeLineOfType"); |
203 | 226 | echo '</label>'; |
204 | 227 | echo ' '; |
205 | - } |
|
206 | - else |
|
228 | + } else |
|
207 | 229 | { |
208 | 230 | echo '<input type="hidden" id="prod_entry_mode_free" name="prod_entry_mode" value="free">'; |
209 | 231 | // Show type selector |
210 | 232 | if ($forceall >= 0) |
211 | 233 | { |
212 | - if (empty($conf->product->enabled) || empty($conf->service->enabled)) echo $langs->trans("Type"); |
|
213 | - else echo $langs->trans("FreeLineOfType"); |
|
234 | + if (empty($conf->product->enabled) || empty($conf->service->enabled)) { |
|
235 | + echo $langs->trans("Type"); |
|
236 | + } else { |
|
237 | + echo $langs->trans("FreeLineOfType"); |
|
238 | + } |
|
214 | 239 | echo ' '; |
215 | 240 | } |
216 | 241 | } |
@@ -223,27 +248,38 @@ discard block |
||
223 | 248 | // Predefined product/service |
224 | 249 | if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) |
225 | 250 | { |
226 | - if ($forceall >= 0 && $freelines) echo '<br>'; |
|
251 | + if ($forceall >= 0 && $freelines) { |
|
252 | + echo '<br>'; |
|
253 | + } |
|
227 | 254 | echo '<span class="prod_entry_mode_predef">'; |
228 | 255 | echo '<label for="prod_entry_mode_predef">'; |
229 | 256 | echo '<input type="radio" class="prod_entry_mode_predef" name="prod_entry_mode" id="prod_entry_mode_predef" value="predef"'.(GETPOST('prod_entry_mode')=='predef'?' checked':'').'> '; |
230 | 257 | if (empty($senderissupplier)) |
231 | 258 | { |
232 | - if (! empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans('PredefinedProductsToSell'); |
|
233 | - else if ((empty($conf->product->enabled) && ! empty($conf->service->enabled)) || ($object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS))) echo $langs->trans('PredefinedServicesToSell'); |
|
234 | - else echo $langs->trans('PredefinedProductsAndServicesToSell'); |
|
235 | - } |
|
236 | - else |
|
259 | + if (! empty($conf->product->enabled) && empty($conf->service->enabled)) { |
|
260 | + echo $langs->trans('PredefinedProductsToSell'); |
|
261 | + } else if ((empty($conf->product->enabled) && ! empty($conf->service->enabled)) || ($object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS))) { |
|
262 | + echo $langs->trans('PredefinedServicesToSell'); |
|
263 | + } else { |
|
264 | + echo $langs->trans('PredefinedProductsAndServicesToSell'); |
|
265 | + } |
|
266 | + } else |
|
237 | 267 | { |
238 | - if (! empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans('PredefinedProductsToPurchase'); |
|
239 | - else if (empty($conf->product->enabled) && ! empty($conf->service->enabled)) echo $langs->trans('PredefinedServicesToPurchase'); |
|
240 | - else echo $langs->trans('PredefinedProductsAndServicesToPurchase'); |
|
268 | + if (! empty($conf->product->enabled) && empty($conf->service->enabled)) { |
|
269 | + echo $langs->trans('PredefinedProductsToPurchase'); |
|
270 | + } else if (empty($conf->product->enabled) && ! empty($conf->service->enabled)) { |
|
271 | + echo $langs->trans('PredefinedServicesToPurchase'); |
|
272 | + } else { |
|
273 | + echo $langs->trans('PredefinedProductsAndServicesToPurchase'); |
|
274 | + } |
|
241 | 275 | } |
242 | 276 | echo '</label>'; |
243 | 277 | echo ' '; |
244 | 278 | |
245 | 279 | $filtertype=''; |
246 | - if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1'; |
|
280 | + if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) { |
|
281 | + $filtertype='1'; |
|
282 | + } |
|
247 | 283 | |
248 | 284 | if (empty($senderissupplier)) |
249 | 285 | { |
@@ -251,13 +287,11 @@ discard block |
||
251 | 287 | { |
252 | 288 | // hide products in closed warehouse, but show products for internal transfer |
253 | 289 | $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); |
254 | - } |
|
255 | - else |
|
290 | + } else |
|
256 | 291 | { |
257 | 292 | $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, '', GETPOST('combinations', 'array')); |
258 | 293 | } |
259 | - } |
|
260 | - else |
|
294 | + } else |
|
261 | 295 | { |
262 | 296 | // $senderissupplier=2 is same than 1 but disable test on minimum qty and disable autofill qty with minimum |
263 | 297 | if ($senderissupplier != 2) |
@@ -268,8 +302,7 @@ discard block |
||
268 | 302 | 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for exemple shown we select a disabled option into combo) |
269 | 303 | ); |
270 | 304 | $alsoproductwithnosupplierprice=0; |
271 | - } |
|
272 | - else |
|
305 | + } else |
|
273 | 306 | { |
274 | 307 | $ajaxoptions = array(); |
275 | 308 | $alsoproductwithnosupplierprice=1; |
@@ -312,9 +345,13 @@ discard block |
||
312 | 345 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
313 | 346 | $nbrows=ROWS_2; |
314 | 347 | $enabled=(! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
315 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
348 | + if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
|
349 | + $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
350 | + } |
|
316 | 351 | $toolbarname='dolibarr_details'; |
317 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
352 | + if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) { |
|
353 | + $toolbarname='dolibarr_notes'; |
|
354 | + } |
|
318 | 355 | $doleditor=new DolEditor('dp_desc',GETPOST('dp_desc'),'',100,$toolbarname,'',false,true,$enabled,$nbrows,'98%'); |
319 | 356 | $doleditor->Create(); |
320 | 357 | |
@@ -333,15 +370,21 @@ discard block |
||
333 | 370 | </td> |
334 | 371 | |
335 | 372 | <?php |
336 | - if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
|
373 | + if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
|
374 | + // We must have same test in printObjectLines |
|
337 | 375 | { |
338 | 376 | ?> |
339 | - <td class="nobottom linecolresupplier"><input id="fourn_ref" name="fourn_ref" class="flat maxwidth75" value="<?php echo (isset($_POST["fourn_ref"])?GETPOST("fourn_ref",'alpha',2):''); ?>"></td> |
|
377 | + <td class="nobottom linecolresupplier"><input id="fourn_ref" name="fourn_ref" class="flat maxwidth75" value="<?php echo (isset($_POST["fourn_ref"])?GETPOST("fourn_ref",'alpha',2):''); |
|
378 | + } |
|
379 | + ?>"></td> |
|
340 | 380 | <?php } ?> |
341 | 381 | |
342 | 382 | <td class="nobottom linecolvat" align="right"><?php |
343 | - if ($seller->tva_assuj == "0") echo '<input type="hidden" name="tva_tx" id="tva_tx" value="0">'.vatrate(0, true); |
|
344 | - else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?GETPOST("tva_tx",'alpha',2):-1), $seller, $buyer, 0, 0, '', false, 1); |
|
383 | + if ($seller->tva_assuj == "0") { |
|
384 | + echo '<input type="hidden" name="tva_tx" id="tva_tx" value="0">'.vatrate(0, true); |
|
385 | + } else { |
|
386 | + echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?GETPOST("tva_tx",'alpha',2):-1), $seller, $buyer, 0, 0, '', false, 1); |
|
387 | + } |
|
345 | 388 | ?> |
346 | 389 | </td> |
347 | 390 | <td class="nobottom linecoluht" align="right"> |
@@ -407,11 +450,14 @@ discard block |
||
407 | 450 | echo '<td align="right" class="nobottom nowrap margininfos"><input class="flat right" type="text" size="2" id="np_markRate" name="np_markRate" value="'.(isset($_POST["np_markRate"])?GETPOST("np_markRate",'alpha',2):'').'"><span class="np_markRate hideonsmartphone">%</span></td>'; |
408 | 451 | $coldisplay++; |
409 | 452 | } |
410 | - } |
|
411 | - else |
|
453 | + } else |
|
412 | 454 | { |
413 | - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $coldisplay++; |
|
414 | - if (! empty($conf->global->DISPLAY_MARK_RATES)) $coldisplay++; |
|
455 | + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { |
|
456 | + $coldisplay++; |
|
457 | + } |
|
458 | + if (! empty($conf->global->DISPLAY_MARK_RATES)) { |
|
459 | + $coldisplay++; |
|
460 | + } |
|
415 | 461 | } |
416 | 462 | } |
417 | 463 | ?> |
@@ -427,14 +473,18 @@ discard block |
||
427 | 473 | ?> |
428 | 474 | |
429 | 475 | <?php |
430 | -if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required |
|
476 | +if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') { |
|
477 | + // We show date field if required |
|
431 | 478 | { |
432 | 479 | $colspan = 6; |
480 | +} |
|
433 | 481 | |
434 | - if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
|
482 | + if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
|
483 | + // We must have same test in printObjectLines |
|
435 | 484 | { |
436 | 485 | $colspan++; |
437 | 486 | } |
487 | + } |
|
438 | 488 | if ($this->situation_cycle_ref) { |
439 | 489 | $colspan++; |
440 | 490 | } |
@@ -465,13 +515,22 @@ discard block |
||
465 | 515 | } |
466 | 516 | } |
467 | 517 | |
468 | - if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2; |
|
518 | + if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { |
|
519 | + $colspan+=2; |
|
520 | + } |
|
469 | 521 | |
470 | 522 | if (! empty($usemargins)) |
471 | 523 | { |
472 | - if (!empty($user->rights->margins->creer)) $colspan++; // For the buying price |
|
473 | - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
474 | - if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
524 | + if (!empty($user->rights->margins->creer)) { |
|
525 | + $colspan++; |
|
526 | + } |
|
527 | + // For the buying price |
|
528 | + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { |
|
529 | + $colspan++; |
|
530 | + } |
|
531 | + if (! empty($conf->global->DISPLAY_MARK_RATES)) { |
|
532 | + $colspan++; |
|
533 | + } |
|
475 | 534 | } |
476 | 535 | ?> |
477 | 536 | |
@@ -487,8 +546,7 @@ discard block |
||
487 | 546 | print $form->selectDate($date_start,"date_start",$usehm,$usehm,1,"addproduct"); |
488 | 547 | print ' '.$langs->trans("DateEndPlanned").' '; |
489 | 548 | print $form->selectDate($date_end,"date_end",$usehm,$usehm,1,"addproduct"); |
490 | - } |
|
491 | - else |
|
549 | + } else |
|
492 | 550 | { |
493 | 551 | echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; |
494 | 552 | print $form->selectDate($date_start, 'date_start', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, 1, "addproduct", 1, 0); |
@@ -675,9 +733,15 @@ discard block |
||
675 | 733 | var defaultbuyprice = '<?php |
676 | 734 | if (isset($conf->global->MARGIN_TYPE)) |
677 | 735 | { |
678 | - if ($conf->global->MARGIN_TYPE == '1') print 'bestsupplierprice'; |
|
679 | - if ($conf->global->MARGIN_TYPE == 'pmp') print 'pmp'; |
|
680 | - if ($conf->global->MARGIN_TYPE == 'costprice') print 'costprice'; |
|
736 | + if ($conf->global->MARGIN_TYPE == '1') { |
|
737 | + print 'bestsupplierprice'; |
|
738 | + } |
|
739 | + if ($conf->global->MARGIN_TYPE == 'pmp') { |
|
740 | + print 'pmp'; |
|
741 | + } |
|
742 | + if ($conf->global->MARGIN_TYPE == 'costprice') { |
|
743 | + print 'costprice'; |
|
744 | + } |
|
681 | 745 | } ?>'; |
682 | 746 | console.log("we will set the field for margin. defaultbuyprice="+defaultbuyprice); |
683 | 747 |
@@ -20,8 +20,8 @@ |
||
20 | 20 | // Protection to avoid direct call of template |
21 | 21 | if (empty($blocname)) |
22 | 22 | { |
23 | - print "Error, template page can't be called as URL"; |
|
24 | - exit; |
|
23 | + print "Error, template page can't be called as URL"; |
|
24 | + exit; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | $hide = true; // Hide by default |
@@ -24,8 +24,8 @@ |
||
24 | 24 | exit; |
25 | 25 | } |
26 | 26 | |
27 | -$hide = true; // Hide by default |
|
28 | -if (isset($parameters['showblocbydefault'])) $hide=(empty($parameters['showblocbydefault']) ? true : false); |
|
27 | +$hide = true; // Hide by default |
|
28 | +if (isset($parameters['showblocbydefault'])) $hide = (empty($parameters['showblocbydefault']) ? true : false); |
|
29 | 29 | if (isset($object->extraparams[$blocname]['showhide'])) $hide = (empty($object->extraparams[$blocname]['showhide']) ? true : false); |
30 | 30 | |
31 | 31 | ?> |
@@ -25,8 +25,12 @@ |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | $hide = true; // Hide by default |
28 | -if (isset($parameters['showblocbydefault'])) $hide=(empty($parameters['showblocbydefault']) ? true : false); |
|
29 | -if (isset($object->extraparams[$blocname]['showhide'])) $hide = (empty($object->extraparams[$blocname]['showhide']) ? true : false); |
|
28 | +if (isset($parameters['showblocbydefault'])) { |
|
29 | + $hide=(empty($parameters['showblocbydefault']) ? true : false); |
|
30 | +} |
|
31 | +if (isset($object->extraparams[$blocname]['showhide'])) { |
|
32 | + $hide = (empty($object->extraparams[$blocname]['showhide']) ? true : false); |
|
33 | +} |
|
30 | 34 | |
31 | 35 | ?> |
32 | 36 | <!-- BEGIN PHP TEMPLATE bloc_showhide.tpl.php --> |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | // Protection to avoid direct call of template |
4 | 4 | if (empty($conf) || ! is_object($conf)) |
5 | 5 | { |
6 | - print "Error, template page can't be called as URL"; |
|
7 | - exit; |
|
6 | + print "Error, template page can't be called as URL"; |
|
7 | + exit; |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element; |
@@ -12,34 +12,34 @@ discard block |
||
12 | 12 | // Loop to show all columns of extrafields from $obj, $extrafields and $db |
13 | 13 | if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
14 | 14 | { |
15 | - if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) |
|
16 | - { |
|
17 | - foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) |
|
18 | - { |
|
19 | - if (! empty($arrayfields["ef.".$key]['checked'])) |
|
20 | - { |
|
21 | - $align=$extrafields->getAlignFlag($key, $extrafieldsobjectkey); |
|
22 | - print '<td'; |
|
23 | - if ($align) print ' align="'.$align.'"'; |
|
24 | - print '>'; |
|
25 | - $tmpkey='options_'.$key; |
|
26 | - if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp')) && !is_numeric($obj->$tmpkey)) |
|
27 | - { |
|
28 | - $datenotinstring = $obj->$tmpkey; |
|
29 | - if (! is_numeric($obj->$tmpkey)) // For backward compatibility |
|
30 | - { |
|
31 | - $datenotinstring = $db->jdate($datenotinstring); |
|
32 | - } |
|
33 | - $value = $datenotinstring; |
|
34 | - } |
|
35 | - else |
|
36 | - { |
|
37 | - $value = $obj->$tmpkey; |
|
38 | - } |
|
15 | + if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) |
|
16 | + { |
|
17 | + foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) |
|
18 | + { |
|
19 | + if (! empty($arrayfields["ef.".$key]['checked'])) |
|
20 | + { |
|
21 | + $align=$extrafields->getAlignFlag($key, $extrafieldsobjectkey); |
|
22 | + print '<td'; |
|
23 | + if ($align) print ' align="'.$align.'"'; |
|
24 | + print '>'; |
|
25 | + $tmpkey='options_'.$key; |
|
26 | + if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp')) && !is_numeric($obj->$tmpkey)) |
|
27 | + { |
|
28 | + $datenotinstring = $obj->$tmpkey; |
|
29 | + if (! is_numeric($obj->$tmpkey)) // For backward compatibility |
|
30 | + { |
|
31 | + $datenotinstring = $db->jdate($datenotinstring); |
|
32 | + } |
|
33 | + $value = $datenotinstring; |
|
34 | + } |
|
35 | + else |
|
36 | + { |
|
37 | + $value = $obj->$tmpkey; |
|
38 | + } |
|
39 | 39 | |
40 | - print $extrafields->showOutputField($key, $value, '', $extrafieldsobjectkey); |
|
41 | - print '</td>'; |
|
42 | - if (! $i) $totalarray['nbfield']++; |
|
40 | + print $extrafields->showOutputField($key, $value, '', $extrafieldsobjectkey); |
|
41 | + print '</td>'; |
|
42 | + if (! $i) $totalarray['nbfield']++; |
|
43 | 43 | |
44 | 44 | if ($extrafields->attributes[$extrafieldsobjectkey]['totalizable'][$key]) { |
45 | 45 | if (! $i) { |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | } |
49 | 49 | $totalarray['totalizable'][$key]['total'] += $obj->$tmpkey; |
50 | 50 | } |
51 | - if (! empty($val['isameasure'])) |
|
52 | - { |
|
53 | - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey; |
|
54 | - $totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey; |
|
55 | - } |
|
56 | - } |
|
57 | - } |
|
58 | - } |
|
51 | + if (! empty($val['isameasure'])) |
|
52 | + { |
|
53 | + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey; |
|
54 | + $totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey; |
|
55 | + } |
|
56 | + } |
|
57 | + } |
|
58 | + } |
|
59 | 59 | } |
@@ -1,32 +1,32 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Protection to avoid direct call of template |
4 | -if (empty($conf) || ! is_object($conf)) |
|
4 | +if (empty($conf) || !is_object($conf)) |
|
5 | 5 | { |
6 | 6 | print "Error, template page can't be called as URL"; |
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)) $extrafieldsobjectkey = $object->table_element; |
|
11 | 11 | |
12 | 12 | // Loop to show all columns of extrafields from $obj, $extrafields and $db |
13 | -if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
13 | +if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
14 | 14 | { |
15 | 15 | if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) |
16 | 16 | { |
17 | - foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) |
|
17 | + foreach ($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) |
|
18 | 18 | { |
19 | - if (! empty($arrayfields["ef.".$key]['checked'])) |
|
19 | + if (!empty($arrayfields["ef.".$key]['checked'])) |
|
20 | 20 | { |
21 | - $align=$extrafields->getAlignFlag($key, $extrafieldsobjectkey); |
|
21 | + $align = $extrafields->getAlignFlag($key, $extrafieldsobjectkey); |
|
22 | 22 | print '<td'; |
23 | 23 | if ($align) print ' align="'.$align.'"'; |
24 | 24 | print '>'; |
25 | - $tmpkey='options_'.$key; |
|
25 | + $tmpkey = 'options_'.$key; |
|
26 | 26 | if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp')) && !is_numeric($obj->$tmpkey)) |
27 | 27 | { |
28 | 28 | $datenotinstring = $obj->$tmpkey; |
29 | - if (! is_numeric($obj->$tmpkey)) // For backward compatibility |
|
29 | + if (!is_numeric($obj->$tmpkey)) // For backward compatibility |
|
30 | 30 | { |
31 | 31 | $datenotinstring = $db->jdate($datenotinstring); |
32 | 32 | } |
@@ -39,18 +39,18 @@ discard block |
||
39 | 39 | |
40 | 40 | print $extrafields->showOutputField($key, $value, '', $extrafieldsobjectkey); |
41 | 41 | print '</td>'; |
42 | - if (! $i) $totalarray['nbfield']++; |
|
42 | + if (!$i) $totalarray['nbfield']++; |
|
43 | 43 | |
44 | 44 | if ($extrafields->attributes[$extrafieldsobjectkey]['totalizable'][$key]) { |
45 | - if (! $i) { |
|
45 | + if (!$i) { |
|
46 | 46 | // we keep position for the first line |
47 | 47 | $totalarray['totalizable'][$key]['pos'] = $totalarray['nbfield']; |
48 | 48 | } |
49 | 49 | $totalarray['totalizable'][$key]['total'] += $obj->$tmpkey; |
50 | 50 | } |
51 | - if (! empty($val['isameasure'])) |
|
51 | + if (!empty($val['isameasure'])) |
|
52 | 52 | { |
53 | - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey; |
|
53 | + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'ef.'.$tmpkey; |
|
54 | 54 | $totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey; |
55 | 55 | } |
56 | 56 | } |
@@ -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 from $obj, $extrafields and $db |
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,27 +22,33 @@ discard block |
||
19 | 22 | if (! empty($arrayfields["ef.".$key]['checked'])) |
20 | 23 | { |
21 | 24 | $align=$extrafields->getAlignFlag($key, $extrafieldsobjectkey); |
25 | +} |
|
22 | 26 | print '<td'; |
23 | - if ($align) print ' align="'.$align.'"'; |
|
27 | + if ($align) { |
|
28 | + print ' align="'.$align.'"'; |
|
29 | + } |
|
24 | 30 | print '>'; |
25 | 31 | $tmpkey='options_'.$key; |
26 | 32 | if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp')) && !is_numeric($obj->$tmpkey)) |
27 | 33 | { |
28 | 34 | $datenotinstring = $obj->$tmpkey; |
29 | - if (! is_numeric($obj->$tmpkey)) // For backward compatibility |
|
35 | + if (! is_numeric($obj->$tmpkey)) { |
|
36 | + // For backward compatibility |
|
30 | 37 | { |
31 | 38 | $datenotinstring = $db->jdate($datenotinstring); |
32 | 39 | } |
40 | + } |
|
33 | 41 | $value = $datenotinstring; |
34 | - } |
|
35 | - else |
|
42 | + } else |
|
36 | 43 | { |
37 | 44 | $value = $obj->$tmpkey; |
38 | 45 | } |
39 | 46 | |
40 | 47 | print $extrafields->showOutputField($key, $value, '', $extrafieldsobjectkey); |
41 | 48 | print '</td>'; |
42 | - if (! $i) $totalarray['nbfield']++; |
|
49 | + if (! $i) { |
|
50 | + $totalarray['nbfield']++; |
|
51 | + } |
|
43 | 52 | |
44 | 53 | if ($extrafields->attributes[$extrafieldsobjectkey]['totalizable'][$key]) { |
45 | 54 | if (! $i) { |
@@ -50,7 +59,9 @@ discard block |
||
50 | 59 | } |
51 | 60 | if (! empty($val['isameasure'])) |
52 | 61 | { |
53 | - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey; |
|
62 | + if (! $i) { |
|
63 | + $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey; |
|
64 | + } |
|
54 | 65 | $totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey; |
55 | 66 | } |
56 | 67 | } |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | // Protection to avoid direct call of template |
25 | 25 | if (empty($object) || ! is_object($object)) |
26 | 26 | { |
27 | - print "Error, template page can't be called as URL"; |
|
28 | - exit; |
|
27 | + print "Error, template page can't be called as URL"; |
|
28 | + exit; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | elseif ($module == 'project_task') { $permission=$user->rights->projet->creer; } |
47 | 47 | elseif (! isset($permission) && isset($user->rights->$module->creer)) |
48 | 48 | { |
49 | - $permission=$user->rights->$module->creer; |
|
49 | + $permission=$user->rights->$module->creer; |
|
50 | 50 | } |
51 | 51 | elseif (! isset($permission) && isset($user->rights->$module->write)) |
52 | 52 | { |
53 | - $permission=$user->rights->$module->write; |
|
53 | + $permission=$user->rights->$module->write; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $formcompany= new FormCompany($db); |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | |
80 | 80 | <?php |
81 | 81 | |
82 | - if (empty($hideaddcontactforuser)) |
|
83 | - { |
|
82 | + if (empty($hideaddcontactforuser)) |
|
83 | + { |
|
84 | 84 | |
85 | - ?> |
|
85 | + ?> |
|
86 | 86 | <form class="tagtr impair" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST"> |
87 | 87 | <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" /> |
88 | 88 | <input type="hidden" name="id" value="<?php echo $object->id; ?>" /> |
@@ -94,21 +94,21 @@ discard block |
||
94 | 94 | <div class="tagtd maxwidthonsmartphone"><?php echo $form->select_dolusers($user->id, 'userid', 0, (! empty($userAlreadySelected)?$userAlreadySelected:null), 0, null, null, 0, 56, '', 0, '', 'minwidth200imp'); ?></div> |
95 | 95 | <div class="tagtd maxwidthonsmartphone"> |
96 | 96 | <?php |
97 | - $tmpobject=$object; |
|
98 | - if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc; |
|
99 | - echo $formcompany->selectTypeContact($tmpobject, '', 'type','internal'); |
|
100 | - ?></div> |
|
97 | + $tmpobject=$object; |
|
98 | + if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc; |
|
99 | + echo $formcompany->selectTypeContact($tmpobject, '', 'type','internal'); |
|
100 | + ?></div> |
|
101 | 101 | <div class="tagtd"> </div> |
102 | 102 | <div class="tagtd center"><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>"></div> |
103 | 103 | </form> |
104 | 104 | |
105 | 105 | <?php |
106 | - } |
|
106 | + } |
|
107 | 107 | |
108 | - if (empty($hideaddcontactforthirdparty)) |
|
109 | - { |
|
108 | + if (empty($hideaddcontactforthirdparty)) |
|
109 | + { |
|
110 | 110 | |
111 | - ?> |
|
111 | + ?> |
|
112 | 112 | |
113 | 113 | <form class="tagtr pair" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST"> |
114 | 114 | <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" /> |
@@ -120,12 +120,12 @@ discard block |
||
120 | 120 | <div class="tagtd nowrap maxwidthonsmartphone noborderbottom"> |
121 | 121 | <?php $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$object->socid; ?> |
122 | 122 | <?php |
123 | - // add company icon before select list |
|
124 | - if ($selectedCompany) |
|
125 | - { |
|
126 | - echo img_object('', 'company', 'class="hideonsmartphone"'); |
|
127 | - } |
|
128 | - ?> |
|
123 | + // add company icon before select list |
|
124 | + if ($selectedCompany) |
|
125 | + { |
|
126 | + echo img_object('', 'company', 'class="hideonsmartphone"'); |
|
127 | + } |
|
128 | + ?> |
|
129 | 129 | <?php $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); ?> |
130 | 130 | </div> |
131 | 131 | <div class="tagtd maxwidthonsmartphone noborderbottom"> |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | </div> |
134 | 134 | <div class="tagtd maxwidthonsmartphone noborderbottom"> |
135 | 135 | <?php |
136 | - $tmpobject=$object; |
|
137 | - if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc; |
|
138 | - $formcompany->selectTypeContact($tmpobject, '', 'type','external', 'position', 0, 'minwidth100imp'); ?> |
|
136 | + $tmpobject=$object; |
|
137 | + if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc; |
|
138 | + $formcompany->selectTypeContact($tmpobject, '', 'type','external', 'position', 0, 'minwidth100imp'); ?> |
|
139 | 139 | </div> |
140 | 140 | <div class="tagtd noborderbottom"> </div> |
141 | 141 | <div class="tagtd center noborderbottom"> |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | </form> |
145 | 145 | |
146 | 146 | <?php |
147 | - } |
|
147 | + } |
|
148 | 148 | } |
149 | 149 | ?> |
150 | 150 | |
@@ -158,18 +158,18 @@ discard block |
||
158 | 158 | </form> |
159 | 159 | |
160 | 160 | <?php |
161 | - $arrayofsource=array('internal','external'); // Show both link to user and thirdparties contacts |
|
162 | - foreach($arrayofsource as $source) { |
|
161 | + $arrayofsource=array('internal','external'); // Show both link to user and thirdparties contacts |
|
162 | + foreach($arrayofsource as $source) { |
|
163 | 163 | |
164 | - $tmpobject=$object; |
|
165 | - if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc; |
|
164 | + $tmpobject=$object; |
|
165 | + if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc; |
|
166 | 166 | |
167 | - $tab = $tmpobject->liste_contact(-1,$source); |
|
168 | - $num=count($tab); |
|
167 | + $tab = $tmpobject->liste_contact(-1,$source); |
|
168 | + $num=count($tab); |
|
169 | 169 | |
170 | - $i = 0; |
|
171 | - while ($i < $num) { |
|
172 | - ?> |
|
170 | + $i = 0; |
|
171 | + while ($i < $num) { |
|
172 | + ?> |
|
173 | 173 | |
174 | 174 | <form class="tagtr oddeven"> |
175 | 175 | <div class="tagtd" align="left"> |
@@ -178,50 +178,50 @@ discard block |
||
178 | 178 | </div> |
179 | 179 | <div class="tagtd" align="left"> |
180 | 180 | <?php |
181 | - if ($tab[$i]['socid'] > 0) |
|
182 | - { |
|
183 | - $companystatic->fetch($tab[$i]['socid']); |
|
184 | - echo $companystatic->getNomUrl(1); |
|
185 | - } |
|
186 | - if ($tab[$i]['socid'] < 0) |
|
187 | - { |
|
188 | - echo $conf->global->MAIN_INFO_SOCIETE_NOM; |
|
189 | - } |
|
190 | - if (! $tab[$i]['socid']) |
|
191 | - { |
|
192 | - echo ' '; |
|
193 | - } |
|
194 | - ?> |
|
181 | + if ($tab[$i]['socid'] > 0) |
|
182 | + { |
|
183 | + $companystatic->fetch($tab[$i]['socid']); |
|
184 | + echo $companystatic->getNomUrl(1); |
|
185 | + } |
|
186 | + if ($tab[$i]['socid'] < 0) |
|
187 | + { |
|
188 | + echo $conf->global->MAIN_INFO_SOCIETE_NOM; |
|
189 | + } |
|
190 | + if (! $tab[$i]['socid']) |
|
191 | + { |
|
192 | + echo ' '; |
|
193 | + } |
|
194 | + ?> |
|
195 | 195 | </div> |
196 | 196 | <div class="tagtd"> |
197 | 197 | <?php |
198 | - $statusofcontact = $tab[$i]['status']; |
|
199 | - |
|
200 | - if ($tab[$i]['source']=='internal') |
|
201 | - { |
|
202 | - $userstatic->fetch($tab[$i]['id']); |
|
203 | - echo $userstatic->getNomUrl(-1, '', 0, 0, 0, 0, '', 'valignmiddle'); |
|
204 | - } |
|
205 | - if ($tab[$i]['source']=='external') |
|
206 | - { |
|
207 | - $contactstatic->fetch($tab[$i]['id']); |
|
208 | - echo $contactstatic->getNomUrl(1, '', 0, 0, 0, 0, '', 'valignmiddle'); |
|
209 | - } |
|
210 | - ?> |
|
198 | + $statusofcontact = $tab[$i]['status']; |
|
199 | + |
|
200 | + if ($tab[$i]['source']=='internal') |
|
201 | + { |
|
202 | + $userstatic->fetch($tab[$i]['id']); |
|
203 | + echo $userstatic->getNomUrl(-1, '', 0, 0, 0, 0, '', 'valignmiddle'); |
|
204 | + } |
|
205 | + if ($tab[$i]['source']=='external') |
|
206 | + { |
|
207 | + $contactstatic->fetch($tab[$i]['id']); |
|
208 | + echo $contactstatic->getNomUrl(1, '', 0, 0, 0, 0, '', 'valignmiddle'); |
|
209 | + } |
|
210 | + ?> |
|
211 | 211 | </div> |
212 | 212 | <div class="tagtd"><?php echo $tab[$i]['libelle']; ?></div> |
213 | 213 | <div class="tagtd center"> |
214 | 214 | <?php //if ($object->statut >= 0) echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">'; ?> |
215 | 215 | <?php |
216 | - if ($tab[$i]['source']=='internal') |
|
217 | - { |
|
218 | - echo $userstatic->LibStatut($tab[$i]['statuscontact'],3); |
|
219 | - } |
|
220 | - if ($tab[$i]['source']=='external') |
|
221 | - { |
|
222 | - echo $contactstatic->LibStatut($tab[$i]['statuscontact'],3); |
|
223 | - } |
|
224 | - ?> |
|
216 | + if ($tab[$i]['source']=='internal') |
|
217 | + { |
|
218 | + echo $userstatic->LibStatut($tab[$i]['statuscontact'],3); |
|
219 | + } |
|
220 | + if ($tab[$i]['source']=='external') |
|
221 | + { |
|
222 | + echo $contactstatic->LibStatut($tab[$i]['statuscontact'],3); |
|
223 | + } |
|
224 | + ?> |
|
225 | 225 | <?php //if ($object->statut >= 0) echo '</a>'; ?> |
226 | 226 | </div> |
227 | 227 | <div class="tagtd nowrap right"> |
@@ -238,11 +238,11 @@ discard block |
||
238 | 238 | </div> |
239 | 239 | <!-- TEMPLATE CONTACTS HOOK BEGIN HERE --> |
240 | 240 | <?php |
241 | - if (is_object($hookmanager)) |
|
242 | - { |
|
243 | - $hookmanager->initHooks(array('contacttpl')); |
|
244 | - $parameters=array(); |
|
245 | - $reshook=$hookmanager->executeHooks('formContactTpl',$parameters,$object,$action); |
|
246 | - } |
|
241 | + if (is_object($hookmanager)) |
|
242 | + { |
|
243 | + $hookmanager->initHooks(array('contacttpl')); |
|
244 | + $parameters=array(); |
|
245 | + $reshook=$hookmanager->executeHooks('formContactTpl',$parameters,$object,$action); |
|
246 | + } |
|
247 | 247 | ?> |
248 | 248 | <!-- END PHP TEMPLATE CONTACTS --> |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | |
24 | 24 | // Protection to avoid direct call of template |
25 | -if (empty($object) || ! is_object($object)) |
|
25 | +if (empty($object) || !is_object($object)) |
|
26 | 26 | { |
27 | 27 | print "Error, template page can't be called as URL"; |
28 | 28 | exit; |
@@ -35,28 +35,28 @@ discard block |
||
35 | 35 | $module = $object->element; |
36 | 36 | |
37 | 37 | // Special cases |
38 | -if ($module == 'propal') { $permission=$user->rights->propale->creer; } |
|
39 | -elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer; } |
|
40 | -elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer; } |
|
41 | -elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer; } |
|
42 | -elseif ($module == 'project') { $permission=$user->rights->projet->creer; } |
|
43 | -elseif ($module == 'action') { $permission=$user->rights->agenda->myactions->create; } |
|
44 | -elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer; } |
|
45 | -elseif ($module == 'reception') { $permission=$user->rights->reception->creer; } |
|
46 | -elseif ($module == 'project_task') { $permission=$user->rights->projet->creer; } |
|
47 | -elseif (! isset($permission) && isset($user->rights->$module->creer)) |
|
38 | +if ($module == 'propal') { $permission = $user->rights->propale->creer; } |
|
39 | +elseif ($module == 'fichinter') { $permission = $user->rights->ficheinter->creer; } |
|
40 | +elseif ($module == 'order_supplier') { $permission = $user->rights->fournisseur->commande->creer; } |
|
41 | +elseif ($module == 'invoice_supplier') { $permission = $user->rights->fournisseur->facture->creer; } |
|
42 | +elseif ($module == 'project') { $permission = $user->rights->projet->creer; } |
|
43 | +elseif ($module == 'action') { $permission = $user->rights->agenda->myactions->create; } |
|
44 | +elseif ($module == 'shipping') { $permission = $user->rights->expedition->creer; } |
|
45 | +elseif ($module == 'reception') { $permission = $user->rights->reception->creer; } |
|
46 | +elseif ($module == 'project_task') { $permission = $user->rights->projet->creer; } |
|
47 | +elseif (!isset($permission) && isset($user->rights->$module->creer)) |
|
48 | 48 | { |
49 | - $permission=$user->rights->$module->creer; |
|
49 | + $permission = $user->rights->$module->creer; |
|
50 | 50 | } |
51 | -elseif (! isset($permission) && isset($user->rights->$module->write)) |
|
51 | +elseif (!isset($permission) && isset($user->rights->$module->write)) |
|
52 | 52 | { |
53 | - $permission=$user->rights->$module->write; |
|
53 | + $permission = $user->rights->$module->write; |
|
54 | 54 | } |
55 | 55 | |
56 | -$formcompany= new FormCompany($db); |
|
57 | -$companystatic=new Societe($db); |
|
58 | -$contactstatic=new Contact($db); |
|
59 | -$userstatic=new User($db); |
|
56 | +$formcompany = new FormCompany($db); |
|
57 | +$companystatic = new Societe($db); |
|
58 | +$contactstatic = new Contact($db); |
|
59 | +$userstatic = new User($db); |
|
60 | 60 | |
61 | 61 | ?> |
62 | 62 | |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | <input type="hidden" name="action" value="addcontact" /> |
90 | 90 | <input type="hidden" name="source" value="internal" /> |
91 | 91 | <?php if ($withproject) print '<input type="hidden" name="withproject" value="'.$withproject.'">'; ?> |
92 | - <div class="nowrap tagtd"><?php echo img_object('','user').' '.$langs->trans("Users"); ?></div> |
|
92 | + <div class="nowrap tagtd"><?php echo img_object('', 'user').' '.$langs->trans("Users"); ?></div> |
|
93 | 93 | <div class="tagtd"><?php echo $conf->global->MAIN_INFO_SOCIETE_NOM; ?></div> |
94 | - <div class="tagtd maxwidthonsmartphone"><?php echo $form->select_dolusers($user->id, 'userid', 0, (! empty($userAlreadySelected)?$userAlreadySelected:null), 0, null, null, 0, 56, '', 0, '', 'minwidth200imp'); ?></div> |
|
94 | + <div class="tagtd maxwidthonsmartphone"><?php echo $form->select_dolusers($user->id, 'userid', 0, (!empty($userAlreadySelected) ? $userAlreadySelected : null), 0, null, null, 0, 56, '', 0, '', 'minwidth200imp'); ?></div> |
|
95 | 95 | <div class="tagtd maxwidthonsmartphone"> |
96 | 96 | <?php |
97 | - $tmpobject=$object; |
|
98 | - if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc; |
|
99 | - echo $formcompany->selectTypeContact($tmpobject, '', 'type','internal'); |
|
97 | + $tmpobject = $object; |
|
98 | + if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) $tmpobject = $objectsrc; |
|
99 | + echo $formcompany->selectTypeContact($tmpobject, '', 'type', 'internal'); |
|
100 | 100 | ?></div> |
101 | 101 | <div class="tagtd"> </div> |
102 | 102 | <div class="tagtd center"><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>"></div> |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | <input type="hidden" name="action" value="addcontact" /> |
117 | 117 | <input type="hidden" name="source" value="external" /> |
118 | 118 | <?php if ($withproject) print '<input type="hidden" name="withproject" value="'.$withproject.'">'; ?> |
119 | - <div class="tagtd nowrap noborderbottom"><?php echo img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); ?></div> |
|
119 | + <div class="tagtd nowrap noborderbottom"><?php echo img_object('', 'contact').' '.$langs->trans("ThirdPartyContacts"); ?></div> |
|
120 | 120 | <div class="tagtd nowrap maxwidthonsmartphone noborderbottom"> |
121 | - <?php $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$object->socid; ?> |
|
121 | + <?php $selectedCompany = isset($_GET["newcompany"]) ? $_GET["newcompany"] : $object->socid; ?> |
|
122 | 122 | <?php |
123 | 123 | // add company icon before select list |
124 | 124 | if ($selectedCompany) |
@@ -129,17 +129,17 @@ discard block |
||
129 | 129 | <?php $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); ?> |
130 | 130 | </div> |
131 | 131 | <div class="tagtd maxwidthonsmartphone noborderbottom"> |
132 | - <?php $nbofcontacts=$form->select_contacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 0, 'minwidth100imp'); ?> |
|
132 | + <?php $nbofcontacts = $form->select_contacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 0, 'minwidth100imp'); ?> |
|
133 | 133 | </div> |
134 | 134 | <div class="tagtd maxwidthonsmartphone noborderbottom"> |
135 | 135 | <?php |
136 | - $tmpobject=$object; |
|
137 | - if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc; |
|
138 | - $formcompany->selectTypeContact($tmpobject, '', 'type','external', 'position', 0, 'minwidth100imp'); ?> |
|
136 | + $tmpobject = $object; |
|
137 | + if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) $tmpobject = $objectsrc; |
|
138 | + $formcompany->selectTypeContact($tmpobject, '', 'type', 'external', 'position', 0, 'minwidth100imp'); ?> |
|
139 | 139 | </div> |
140 | 140 | <div class="tagtd noborderbottom"> </div> |
141 | 141 | <div class="tagtd center noborderbottom"> |
142 | - <input type="submit" id="add-customer-contact" class="button" value="<?php echo $langs->trans("Add"); ?>"<?php if (! $nbofcontacts) echo ' disabled'; ?>> |
|
142 | + <input type="submit" id="add-customer-contact" class="button" value="<?php echo $langs->trans("Add"); ?>"<?php if (!$nbofcontacts) echo ' disabled'; ?>> |
|
143 | 143 | </div> |
144 | 144 | </form> |
145 | 145 | |
@@ -158,14 +158,14 @@ discard block |
||
158 | 158 | </form> |
159 | 159 | |
160 | 160 | <?php |
161 | - $arrayofsource=array('internal','external'); // Show both link to user and thirdparties contacts |
|
162 | - foreach($arrayofsource as $source) { |
|
161 | + $arrayofsource = array('internal', 'external'); // Show both link to user and thirdparties contacts |
|
162 | + foreach ($arrayofsource as $source) { |
|
163 | 163 | |
164 | - $tmpobject=$object; |
|
165 | - if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc; |
|
164 | + $tmpobject = $object; |
|
165 | + if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) $tmpobject = $objectsrc; |
|
166 | 166 | |
167 | - $tab = $tmpobject->liste_contact(-1,$source); |
|
168 | - $num=count($tab); |
|
167 | + $tab = $tmpobject->liste_contact(-1, $source); |
|
168 | + $num = count($tab); |
|
169 | 169 | |
170 | 170 | $i = 0; |
171 | 171 | while ($i < $num) { |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | |
174 | 174 | <form class="tagtr oddeven"> |
175 | 175 | <div class="tagtd" align="left"> |
176 | - <?php if ($tab[$i]['source']=='internal') echo $langs->trans("User"); ?> |
|
177 | - <?php if ($tab[$i]['source']=='external') echo $langs->trans("ThirdPartyContact"); ?> |
|
176 | + <?php if ($tab[$i]['source'] == 'internal') echo $langs->trans("User"); ?> |
|
177 | + <?php if ($tab[$i]['source'] == 'external') echo $langs->trans("ThirdPartyContact"); ?> |
|
178 | 178 | </div> |
179 | 179 | <div class="tagtd" align="left"> |
180 | 180 | <?php |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | { |
188 | 188 | echo $conf->global->MAIN_INFO_SOCIETE_NOM; |
189 | 189 | } |
190 | - if (! $tab[$i]['socid']) |
|
190 | + if (!$tab[$i]['socid']) |
|
191 | 191 | { |
192 | 192 | echo ' '; |
193 | 193 | } |
@@ -197,12 +197,12 @@ discard block |
||
197 | 197 | <?php |
198 | 198 | $statusofcontact = $tab[$i]['status']; |
199 | 199 | |
200 | - if ($tab[$i]['source']=='internal') |
|
200 | + if ($tab[$i]['source'] == 'internal') |
|
201 | 201 | { |
202 | 202 | $userstatic->fetch($tab[$i]['id']); |
203 | 203 | echo $userstatic->getNomUrl(-1, '', 0, 0, 0, 0, '', 'valignmiddle'); |
204 | 204 | } |
205 | - if ($tab[$i]['source']=='external') |
|
205 | + if ($tab[$i]['source'] == 'external') |
|
206 | 206 | { |
207 | 207 | $contactstatic->fetch($tab[$i]['id']); |
208 | 208 | echo $contactstatic->getNomUrl(1, '', 0, 0, 0, 0, '', 'valignmiddle'); |
@@ -213,13 +213,13 @@ discard block |
||
213 | 213 | <div class="tagtd center"> |
214 | 214 | <?php //if ($object->statut >= 0) echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">'; ?> |
215 | 215 | <?php |
216 | - if ($tab[$i]['source']=='internal') |
|
216 | + if ($tab[$i]['source'] == 'internal') |
|
217 | 217 | { |
218 | - echo $userstatic->LibStatut($tab[$i]['statuscontact'],3); |
|
218 | + echo $userstatic->LibStatut($tab[$i]['statuscontact'], 3); |
|
219 | 219 | } |
220 | - if ($tab[$i]['source']=='external') |
|
220 | + if ($tab[$i]['source'] == 'external') |
|
221 | 221 | { |
222 | - echo $contactstatic->LibStatut($tab[$i]['statuscontact'],3); |
|
222 | + echo $contactstatic->LibStatut($tab[$i]['statuscontact'], 3); |
|
223 | 223 | } |
224 | 224 | ?> |
225 | 225 | <?php //if ($object->statut >= 0) echo '</a>'; ?> |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | if (is_object($hookmanager)) |
242 | 242 | { |
243 | 243 | $hookmanager->initHooks(array('contacttpl')); |
244 | - $parameters=array(); |
|
245 | - $reshook=$hookmanager->executeHooks('formContactTpl',$parameters,$object,$action); |
|
244 | + $parameters = array(); |
|
245 | + $reshook = $hookmanager->executeHooks('formContactTpl', $parameters, $object, $action); |
|
246 | 246 | } |
247 | 247 | ?> |
248 | 248 | <!-- END PHP TEMPLATE CONTACTS --> |
@@ -35,20 +35,10 @@ discard block |
||
35 | 35 | $module = $object->element; |
36 | 36 | |
37 | 37 | // Special cases |
38 | -if ($module == 'propal') { $permission=$user->rights->propale->creer; } |
|
39 | -elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer; } |
|
40 | -elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer; } |
|
41 | -elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer; } |
|
42 | -elseif ($module == 'project') { $permission=$user->rights->projet->creer; } |
|
43 | -elseif ($module == 'action') { $permission=$user->rights->agenda->myactions->create; } |
|
44 | -elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer; } |
|
45 | -elseif ($module == 'reception') { $permission=$user->rights->reception->creer; } |
|
46 | -elseif ($module == 'project_task') { $permission=$user->rights->projet->creer; } |
|
47 | -elseif (! isset($permission) && isset($user->rights->$module->creer)) |
|
38 | +if ($module == 'propal') { $permission=$user->rights->propale->creer; } elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer; } elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer; } elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer; } elseif ($module == 'project') { $permission=$user->rights->projet->creer; } elseif ($module == 'action') { $permission=$user->rights->agenda->myactions->create; } elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer; } elseif ($module == 'reception') { $permission=$user->rights->reception->creer; } elseif ($module == 'project_task') { $permission=$user->rights->projet->creer; } elseif (! isset($permission) && isset($user->rights->$module->creer)) |
|
48 | 39 | { |
49 | 40 | $permission=$user->rights->$module->creer; |
50 | -} |
|
51 | -elseif (! isset($permission) && isset($user->rights->$module->write)) |
|
41 | +} elseif (! isset($permission) && isset($user->rights->$module->write)) |
|
52 | 42 | { |
53 | 43 | $permission=$user->rights->$module->write; |
54 | 44 | } |
@@ -88,14 +78,19 @@ discard block |
||
88 | 78 | <input type="hidden" name="id" value="<?php echo $object->id; ?>" /> |
89 | 79 | <input type="hidden" name="action" value="addcontact" /> |
90 | 80 | <input type="hidden" name="source" value="internal" /> |
91 | - <?php if ($withproject) print '<input type="hidden" name="withproject" value="'.$withproject.'">'; ?> |
|
81 | + <?php if ($withproject) { |
|
82 | + print '<input type="hidden" name="withproject" value="'.$withproject.'">'; |
|
83 | +} |
|
84 | +?> |
|
92 | 85 | <div class="nowrap tagtd"><?php echo img_object('','user').' '.$langs->trans("Users"); ?></div> |
93 | 86 | <div class="tagtd"><?php echo $conf->global->MAIN_INFO_SOCIETE_NOM; ?></div> |
94 | 87 | <div class="tagtd maxwidthonsmartphone"><?php echo $form->select_dolusers($user->id, 'userid', 0, (! empty($userAlreadySelected)?$userAlreadySelected:null), 0, null, null, 0, 56, '', 0, '', 'minwidth200imp'); ?></div> |
95 | 88 | <div class="tagtd maxwidthonsmartphone"> |
96 | 89 | <?php |
97 | 90 | $tmpobject=$object; |
98 | - if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc; |
|
91 | + if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) { |
|
92 | + $tmpobject=$objectsrc; |
|
93 | + } |
|
99 | 94 | echo $formcompany->selectTypeContact($tmpobject, '', 'type','internal'); |
100 | 95 | ?></div> |
101 | 96 | <div class="tagtd"> </div> |
@@ -115,7 +110,10 @@ discard block |
||
115 | 110 | <input type="hidden" name="id" value="<?php echo $object->id; ?>" /> |
116 | 111 | <input type="hidden" name="action" value="addcontact" /> |
117 | 112 | <input type="hidden" name="source" value="external" /> |
118 | - <?php if ($withproject) print '<input type="hidden" name="withproject" value="'.$withproject.'">'; ?> |
|
113 | + <?php if ($withproject) { |
|
114 | + print '<input type="hidden" name="withproject" value="'.$withproject.'">'; |
|
115 | +} |
|
116 | +?> |
|
119 | 117 | <div class="tagtd nowrap noborderbottom"><?php echo img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); ?></div> |
120 | 118 | <div class="tagtd nowrap maxwidthonsmartphone noborderbottom"> |
121 | 119 | <?php $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$object->socid; ?> |
@@ -134,12 +132,17 @@ discard block |
||
134 | 132 | <div class="tagtd maxwidthonsmartphone noborderbottom"> |
135 | 133 | <?php |
136 | 134 | $tmpobject=$object; |
137 | - if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc; |
|
135 | + if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) { |
|
136 | + $tmpobject=$objectsrc; |
|
137 | + } |
|
138 | 138 | $formcompany->selectTypeContact($tmpobject, '', 'type','external', 'position', 0, 'minwidth100imp'); ?> |
139 | 139 | </div> |
140 | 140 | <div class="tagtd noborderbottom"> </div> |
141 | 141 | <div class="tagtd center noborderbottom"> |
142 | - <input type="submit" id="add-customer-contact" class="button" value="<?php echo $langs->trans("Add"); ?>"<?php if (! $nbofcontacts) echo ' disabled'; ?>> |
|
142 | + <input type="submit" id="add-customer-contact" class="button" value="<?php echo $langs->trans("Add"); ?>"<?php if (! $nbofcontacts) { |
|
143 | + echo ' disabled'; |
|
144 | +} |
|
145 | +?>> |
|
143 | 146 | </div> |
144 | 147 | </form> |
145 | 148 | |
@@ -162,7 +165,9 @@ discard block |
||
162 | 165 | foreach($arrayofsource as $source) { |
163 | 166 | |
164 | 167 | $tmpobject=$object; |
165 | - if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc; |
|
168 | + if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) { |
|
169 | + $tmpobject=$objectsrc; |
|
170 | + } |
|
166 | 171 | |
167 | 172 | $tab = $tmpobject->liste_contact(-1,$source); |
168 | 173 | $num=count($tab); |
@@ -173,8 +178,14 @@ discard block |
||
173 | 178 | |
174 | 179 | <form class="tagtr oddeven"> |
175 | 180 | <div class="tagtd" align="left"> |
176 | - <?php if ($tab[$i]['source']=='internal') echo $langs->trans("User"); ?> |
|
177 | - <?php if ($tab[$i]['source']=='external') echo $langs->trans("ThirdPartyContact"); ?> |
|
181 | + <?php if ($tab[$i]['source']=='internal') { |
|
182 | + echo $langs->trans("User"); |
|
183 | +} |
|
184 | +?> |
|
185 | + <?php if ($tab[$i]['source']=='external') { |
|
186 | + echo $langs->trans("ThirdPartyContact"); |
|
187 | +} |
|
188 | +?> |
|
178 | 189 | </div> |
179 | 190 | <div class="tagtd" align="left"> |
180 | 191 | <?php |
@@ -29,203 +29,203 @@ |
||
29 | 29 | // Protection to avoid direct call of template |
30 | 30 | if (empty($conf) || ! is_object($conf)) |
31 | 31 | { |
32 | - print "Error, template page can't be called as URL"; |
|
33 | - exit; |
|
32 | + print "Error, template page can't be called as URL"; |
|
33 | + exit; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
37 | 37 | if ($action == 'presend') |
38 | 38 | { |
39 | - $langs->load("mails"); |
|
40 | - |
|
41 | - $titreform='SendMail'; |
|
42 | - |
|
43 | - $object->fetch_projet(); |
|
44 | - |
|
45 | - if (! in_array($object->element, array('societe', 'user', 'member'))) |
|
46 | - { |
|
47 | - // TODO get also the main_lastdoc field of $object. If not found, try to guess with following code |
|
48 | - |
|
49 | - $ref = dol_sanitizeFileName($object->ref); |
|
50 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
51 | - $fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+'); |
|
52 | - // |
|
53 | - if ($object->element == 'invoice_supplier') |
|
54 | - { |
|
55 | - $fileparams = dol_most_recent_file($diroutput . '/' . get_exdir($object->id,2,0,0,$object,$object->element).$ref, preg_quote($ref,'/').'([^\-])+'); |
|
56 | - } |
|
57 | - |
|
58 | - $file = $fileparams['fullname']; |
|
59 | - } |
|
60 | - |
|
61 | - // Define output language |
|
62 | - $outputlangs = $langs; |
|
63 | - $newlang = ''; |
|
64 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) |
|
65 | - { |
|
66 | - $newlang = $_REQUEST['lang_id']; |
|
67 | - } |
|
68 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) |
|
69 | - { |
|
70 | - $newlang = $object->thirdparty->default_lang; |
|
71 | - } |
|
72 | - |
|
73 | - if (!empty($newlang)) |
|
74 | - { |
|
75 | - $outputlangs = new Translate('', $conf); |
|
76 | - $outputlangs->setDefaultLang($newlang); |
|
77 | - // Load traductions files requiredby by page |
|
78 | - $outputlangs->loadLangs(array('commercial','bills','orders','contracts','members','propal','products','supplier_proposal','interventions')); |
|
79 | - } |
|
80 | - |
|
81 | - $topicmail=''; |
|
82 | - if (empty($object->ref_client)) { |
|
83 | - $topicmail = $outputlangs->trans($defaulttopic, '__REF__'); |
|
84 | - } else if (! empty($object->ref_client)) { |
|
85 | - $topicmail = $outputlangs->trans($defaulttopic, '__REF__ (__REFCLIENT__)'); |
|
86 | - } |
|
87 | - |
|
88 | - // Build document if it not exists |
|
89 | - if (! in_array($object->element, array('societe', 'user', 'member'))) |
|
90 | - { |
|
91 | - if ((! $file || ! is_readable($file)) && method_exists($object, 'generateDocument')) |
|
92 | - { |
|
93 | - $result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
94 | - if ($result <= 0) { |
|
95 | - dol_print_error($db, $object->error, $object->errors); |
|
96 | - exit(); |
|
97 | - } |
|
98 | - $fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+'); |
|
99 | - $file = $fileparams['fullname']; |
|
100 | - } |
|
101 | - } |
|
102 | - |
|
103 | - print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>'; |
|
104 | - print '<div class="clearboth"></div>'; |
|
105 | - print '<br>'; |
|
106 | - print load_fiche_titre($langs->trans($titreform)); |
|
107 | - |
|
108 | - dol_fiche_head(''); |
|
109 | - |
|
110 | - // Create form for email |
|
111 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
112 | - $formmail = new FormMail($db); |
|
113 | - |
|
114 | - $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); |
|
115 | - $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); |
|
116 | - |
|
117 | - if ($formmail->fromtype === 'user') |
|
118 | - { |
|
119 | - $formmail->fromid = $user->id; |
|
120 | - } |
|
121 | - $formmail->trackid=$trackid; |
|
122 | - if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set |
|
123 | - { |
|
124 | - include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
125 | - $formmail->frommail=dolAddEmailTrackId($formmail->frommail, $trackid); |
|
126 | - } |
|
127 | - $formmail->withfrom = 1; |
|
128 | - |
|
129 | - // Fill list of recipient with email inside <>. |
|
130 | - $liste = array(); |
|
131 | - if ($object->element == 'expensereport') |
|
132 | - { |
|
133 | - $fuser = new User($db); |
|
134 | - $fuser->fetch($object->fk_user_author); |
|
135 | - $liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">"; |
|
136 | - } |
|
137 | - elseif ($object->element == 'societe') |
|
138 | - { |
|
139 | - foreach ($object->thirdparty_and_contact_email_array(1) as $key => $value) { |
|
140 | - $liste[$key] = $value; |
|
141 | - } |
|
142 | - } |
|
143 | - elseif ($object->element == 'contact') |
|
144 | - { |
|
145 | - $liste['contact'] = $object->getFullName($langs)." <".$object->email.">"; |
|
146 | - } |
|
147 | - elseif ($object->element == 'user' || $object->element == 'member') |
|
148 | - { |
|
149 | - $liste['thirdparty'] = $object->getFullName($langs)." <".$object->email.">"; |
|
150 | - } |
|
151 | - else |
|
152 | - { |
|
153 | - if (is_object($object->thirdparty)) |
|
154 | - { |
|
155 | - foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) { |
|
156 | - $liste[$key] = $value; |
|
157 | - } |
|
158 | - } |
|
159 | - } |
|
160 | - if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) { |
|
161 | - $listeuser=array(); |
|
162 | - $fuserdest = new User($db); |
|
163 | - |
|
164 | - $result= $fuserdest->fetchAll('ASC', 't.lastname', 0, 0, array('customsql'=>'t.statut=1 AND t.employee=1 AND t.email IS NOT NULL AND t.email<>\'\'')); |
|
165 | - if ($result>0 && is_array($fuserdest->users) && count($fuserdest->users)>0) { |
|
166 | - foreach($fuserdest->users as $uuserdest) { |
|
167 | - $listeuser[$uuserdest->id] = $uuserdest->user_get_property($uuserdest->id,'email'); |
|
168 | - } |
|
169 | - } elseif ($result<0) { |
|
170 | - setEventMessages(null, $fuserdest->errors,'errors'); |
|
171 | - } |
|
172 | - if (count($listeuser)>0) { |
|
173 | - $formmail->withtouser = $listeuser; |
|
174 | - $formmail->withtoccuser = $listeuser; |
|
175 | - } |
|
176 | - } |
|
177 | - |
|
178 | - $formmail->withto = GETPOST('sendto') ? GETPOST('sendto') : $liste; |
|
179 | - $formmail->withtocc = $liste; |
|
180 | - $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; |
|
181 | - $formmail->withtopic = $topicmail; |
|
182 | - $formmail->withfile = 2; |
|
183 | - $formmail->withbody = 1; |
|
184 | - $formmail->withdeliveryreceipt = 1; |
|
185 | - $formmail->withcancel = 1; |
|
186 | - |
|
187 | - //$arrayoffamiliestoexclude=array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...); |
|
188 | - if (! isset($arrayoffamiliestoexclude)) $arrayoffamiliestoexclude=null; |
|
189 | - |
|
190 | - // Make substitution in email content |
|
191 | - $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object); |
|
192 | - $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '<img src="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-read.php?tag=' . $object->thirdparty->tag . '&securitykey=' . urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) . '" width="1" height="1" style="width:1px;height:1px" border="0"/>' : ''; |
|
193 | - $substitutionarray['__PERSONALIZED__'] = ''; // deprecated |
|
194 | - $substitutionarray['__CONTACTCIVNAME__'] = ''; |
|
195 | - $parameters = array( |
|
196 | - 'mode' => 'formemail' |
|
197 | - ); |
|
198 | - complete_substitutions_array($substitutionarray, $outputlangs, $object, $parameters); |
|
199 | - |
|
200 | - // Find the good contact adress |
|
201 | - $custcontact = ''; |
|
202 | - $contactarr = array(); |
|
203 | - $contactarr = $object->liste_contact(- 1, 'external'); |
|
204 | - |
|
205 | - if (is_array($contactarr) && count($contactarr) > 0) { |
|
206 | - require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
39 | + $langs->load("mails"); |
|
40 | + |
|
41 | + $titreform='SendMail'; |
|
42 | + |
|
43 | + $object->fetch_projet(); |
|
44 | + |
|
45 | + if (! in_array($object->element, array('societe', 'user', 'member'))) |
|
46 | + { |
|
47 | + // TODO get also the main_lastdoc field of $object. If not found, try to guess with following code |
|
48 | + |
|
49 | + $ref = dol_sanitizeFileName($object->ref); |
|
50 | + include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
51 | + $fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+'); |
|
52 | + // |
|
53 | + if ($object->element == 'invoice_supplier') |
|
54 | + { |
|
55 | + $fileparams = dol_most_recent_file($diroutput . '/' . get_exdir($object->id,2,0,0,$object,$object->element).$ref, preg_quote($ref,'/').'([^\-])+'); |
|
56 | + } |
|
57 | + |
|
58 | + $file = $fileparams['fullname']; |
|
59 | + } |
|
60 | + |
|
61 | + // Define output language |
|
62 | + $outputlangs = $langs; |
|
63 | + $newlang = ''; |
|
64 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) |
|
65 | + { |
|
66 | + $newlang = $_REQUEST['lang_id']; |
|
67 | + } |
|
68 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) |
|
69 | + { |
|
70 | + $newlang = $object->thirdparty->default_lang; |
|
71 | + } |
|
72 | + |
|
73 | + if (!empty($newlang)) |
|
74 | + { |
|
75 | + $outputlangs = new Translate('', $conf); |
|
76 | + $outputlangs->setDefaultLang($newlang); |
|
77 | + // Load traductions files requiredby by page |
|
78 | + $outputlangs->loadLangs(array('commercial','bills','orders','contracts','members','propal','products','supplier_proposal','interventions')); |
|
79 | + } |
|
80 | + |
|
81 | + $topicmail=''; |
|
82 | + if (empty($object->ref_client)) { |
|
83 | + $topicmail = $outputlangs->trans($defaulttopic, '__REF__'); |
|
84 | + } else if (! empty($object->ref_client)) { |
|
85 | + $topicmail = $outputlangs->trans($defaulttopic, '__REF__ (__REFCLIENT__)'); |
|
86 | + } |
|
87 | + |
|
88 | + // Build document if it not exists |
|
89 | + if (! in_array($object->element, array('societe', 'user', 'member'))) |
|
90 | + { |
|
91 | + if ((! $file || ! is_readable($file)) && method_exists($object, 'generateDocument')) |
|
92 | + { |
|
93 | + $result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
94 | + if ($result <= 0) { |
|
95 | + dol_print_error($db, $object->error, $object->errors); |
|
96 | + exit(); |
|
97 | + } |
|
98 | + $fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+'); |
|
99 | + $file = $fileparams['fullname']; |
|
100 | + } |
|
101 | + } |
|
102 | + |
|
103 | + print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>'; |
|
104 | + print '<div class="clearboth"></div>'; |
|
105 | + print '<br>'; |
|
106 | + print load_fiche_titre($langs->trans($titreform)); |
|
107 | + |
|
108 | + dol_fiche_head(''); |
|
109 | + |
|
110 | + // Create form for email |
|
111 | + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
112 | + $formmail = new FormMail($db); |
|
113 | + |
|
114 | + $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); |
|
115 | + $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); |
|
116 | + |
|
117 | + if ($formmail->fromtype === 'user') |
|
118 | + { |
|
119 | + $formmail->fromid = $user->id; |
|
120 | + } |
|
121 | + $formmail->trackid=$trackid; |
|
122 | + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set |
|
123 | + { |
|
124 | + include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
125 | + $formmail->frommail=dolAddEmailTrackId($formmail->frommail, $trackid); |
|
126 | + } |
|
127 | + $formmail->withfrom = 1; |
|
128 | + |
|
129 | + // Fill list of recipient with email inside <>. |
|
130 | + $liste = array(); |
|
131 | + if ($object->element == 'expensereport') |
|
132 | + { |
|
133 | + $fuser = new User($db); |
|
134 | + $fuser->fetch($object->fk_user_author); |
|
135 | + $liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">"; |
|
136 | + } |
|
137 | + elseif ($object->element == 'societe') |
|
138 | + { |
|
139 | + foreach ($object->thirdparty_and_contact_email_array(1) as $key => $value) { |
|
140 | + $liste[$key] = $value; |
|
141 | + } |
|
142 | + } |
|
143 | + elseif ($object->element == 'contact') |
|
144 | + { |
|
145 | + $liste['contact'] = $object->getFullName($langs)." <".$object->email.">"; |
|
146 | + } |
|
147 | + elseif ($object->element == 'user' || $object->element == 'member') |
|
148 | + { |
|
149 | + $liste['thirdparty'] = $object->getFullName($langs)." <".$object->email.">"; |
|
150 | + } |
|
151 | + else |
|
152 | + { |
|
153 | + if (is_object($object->thirdparty)) |
|
154 | + { |
|
155 | + foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) { |
|
156 | + $liste[$key] = $value; |
|
157 | + } |
|
158 | + } |
|
159 | + } |
|
160 | + if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) { |
|
161 | + $listeuser=array(); |
|
162 | + $fuserdest = new User($db); |
|
163 | + |
|
164 | + $result= $fuserdest->fetchAll('ASC', 't.lastname', 0, 0, array('customsql'=>'t.statut=1 AND t.employee=1 AND t.email IS NOT NULL AND t.email<>\'\'')); |
|
165 | + if ($result>0 && is_array($fuserdest->users) && count($fuserdest->users)>0) { |
|
166 | + foreach($fuserdest->users as $uuserdest) { |
|
167 | + $listeuser[$uuserdest->id] = $uuserdest->user_get_property($uuserdest->id,'email'); |
|
168 | + } |
|
169 | + } elseif ($result<0) { |
|
170 | + setEventMessages(null, $fuserdest->errors,'errors'); |
|
171 | + } |
|
172 | + if (count($listeuser)>0) { |
|
173 | + $formmail->withtouser = $listeuser; |
|
174 | + $formmail->withtoccuser = $listeuser; |
|
175 | + } |
|
176 | + } |
|
177 | + |
|
178 | + $formmail->withto = GETPOST('sendto') ? GETPOST('sendto') : $liste; |
|
179 | + $formmail->withtocc = $liste; |
|
180 | + $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; |
|
181 | + $formmail->withtopic = $topicmail; |
|
182 | + $formmail->withfile = 2; |
|
183 | + $formmail->withbody = 1; |
|
184 | + $formmail->withdeliveryreceipt = 1; |
|
185 | + $formmail->withcancel = 1; |
|
186 | + |
|
187 | + //$arrayoffamiliestoexclude=array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...); |
|
188 | + if (! isset($arrayoffamiliestoexclude)) $arrayoffamiliestoexclude=null; |
|
189 | + |
|
190 | + // Make substitution in email content |
|
191 | + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object); |
|
192 | + $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '<img src="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-read.php?tag=' . $object->thirdparty->tag . '&securitykey=' . urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) . '" width="1" height="1" style="width:1px;height:1px" border="0"/>' : ''; |
|
193 | + $substitutionarray['__PERSONALIZED__'] = ''; // deprecated |
|
194 | + $substitutionarray['__CONTACTCIVNAME__'] = ''; |
|
195 | + $parameters = array( |
|
196 | + 'mode' => 'formemail' |
|
197 | + ); |
|
198 | + complete_substitutions_array($substitutionarray, $outputlangs, $object, $parameters); |
|
199 | + |
|
200 | + // Find the good contact adress |
|
201 | + $custcontact = ''; |
|
202 | + $contactarr = array(); |
|
203 | + $contactarr = $object->liste_contact(- 1, 'external'); |
|
204 | + |
|
205 | + if (is_array($contactarr) && count($contactarr) > 0) { |
|
206 | + require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
207 | 207 | $contactstatic = new Contact($db); |
208 | 208 | |
209 | - foreach ($contactarr as $contact) { |
|
209 | + foreach ($contactarr as $contact) { |
|
210 | 210 | $contactstatic->fetch($contact['id']); |
211 | 211 | $substitutionarray['__CONTACT_NAME_'.$contact['code'].'__'] = $contactstatic->getFullName($langs, 1); |
212 | - } |
|
213 | - } |
|
212 | + } |
|
213 | + } |
|
214 | 214 | |
215 | - // Tableau des substitutions |
|
216 | - $formmail->substit = $substitutionarray; |
|
215 | + // Tableau des substitutions |
|
216 | + $formmail->substit = $substitutionarray; |
|
217 | 217 | |
218 | - // Tableau des parametres complementaires |
|
219 | - $formmail->param['action'] = 'send'; |
|
220 | - $formmail->param['models'] = $modelmail; |
|
221 | - $formmail->param['models_id']=GETPOST('modelmailselected','int'); |
|
222 | - $formmail->param['id'] = $object->id; |
|
223 | - $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id; |
|
224 | - $formmail->param['fileinit'] = array($file); |
|
218 | + // Tableau des parametres complementaires |
|
219 | + $formmail->param['action'] = 'send'; |
|
220 | + $formmail->param['models'] = $modelmail; |
|
221 | + $formmail->param['models_id']=GETPOST('modelmailselected','int'); |
|
222 | + $formmail->param['id'] = $object->id; |
|
223 | + $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id; |
|
224 | + $formmail->param['fileinit'] = array($file); |
|
225 | 225 | |
226 | - // Show form |
|
227 | - print $formmail->get_form(); |
|
226 | + // Show form |
|
227 | + print $formmail->get_form(); |
|
228 | 228 | |
229 | - dol_fiche_end(); |
|
229 | + dol_fiche_end(); |
|
230 | 230 | } |
231 | 231 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | |
29 | 29 | // Protection to avoid direct call of template |
30 | -if (empty($conf) || ! is_object($conf)) |
|
30 | +if (empty($conf) || !is_object($conf)) |
|
31 | 31 | { |
32 | 32 | print "Error, template page can't be called as URL"; |
33 | 33 | exit; |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | { |
39 | 39 | $langs->load("mails"); |
40 | 40 | |
41 | - $titreform='SendMail'; |
|
41 | + $titreform = 'SendMail'; |
|
42 | 42 | |
43 | 43 | $object->fetch_projet(); |
44 | 44 | |
45 | - if (! in_array($object->element, array('societe', 'user', 'member'))) |
|
45 | + if (!in_array($object->element, array('societe', 'user', 'member'))) |
|
46 | 46 | { |
47 | 47 | // TODO get also the main_lastdoc field of $object. If not found, try to guess with following code |
48 | 48 | |
49 | 49 | $ref = dol_sanitizeFileName($object->ref); |
50 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
51 | - $fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+'); |
|
50 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
51 | + $fileparams = dol_most_recent_file($diroutput.'/'.$ref, preg_quote($ref, '/').'[^\-]+'); |
|
52 | 52 | // |
53 | 53 | if ($object->element == 'invoice_supplier') |
54 | 54 | { |
55 | - $fileparams = dol_most_recent_file($diroutput . '/' . get_exdir($object->id,2,0,0,$object,$object->element).$ref, preg_quote($ref,'/').'([^\-])+'); |
|
55 | + $fileparams = dol_most_recent_file($diroutput.'/'.get_exdir($object->id, 2, 0, 0, $object, $object->element).$ref, preg_quote($ref, '/').'([^\-])+'); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | $file = $fileparams['fullname']; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | // Define output language |
62 | 62 | $outputlangs = $langs; |
63 | 63 | $newlang = ''; |
64 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) |
|
64 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) |
|
65 | 65 | { |
66 | 66 | $newlang = $_REQUEST['lang_id']; |
67 | 67 | } |
@@ -75,27 +75,27 @@ discard block |
||
75 | 75 | $outputlangs = new Translate('', $conf); |
76 | 76 | $outputlangs->setDefaultLang($newlang); |
77 | 77 | // Load traductions files requiredby by page |
78 | - $outputlangs->loadLangs(array('commercial','bills','orders','contracts','members','propal','products','supplier_proposal','interventions')); |
|
78 | + $outputlangs->loadLangs(array('commercial', 'bills', 'orders', 'contracts', 'members', 'propal', 'products', 'supplier_proposal', 'interventions')); |
|
79 | 79 | } |
80 | 80 | |
81 | - $topicmail=''; |
|
81 | + $topicmail = ''; |
|
82 | 82 | if (empty($object->ref_client)) { |
83 | 83 | $topicmail = $outputlangs->trans($defaulttopic, '__REF__'); |
84 | - } else if (! empty($object->ref_client)) { |
|
84 | + } else if (!empty($object->ref_client)) { |
|
85 | 85 | $topicmail = $outputlangs->trans($defaulttopic, '__REF__ (__REFCLIENT__)'); |
86 | 86 | } |
87 | 87 | |
88 | 88 | // Build document if it not exists |
89 | - if (! in_array($object->element, array('societe', 'user', 'member'))) |
|
89 | + if (!in_array($object->element, array('societe', 'user', 'member'))) |
|
90 | 90 | { |
91 | - if ((! $file || ! is_readable($file)) && method_exists($object, 'generateDocument')) |
|
91 | + if ((!$file || !is_readable($file)) && method_exists($object, 'generateDocument')) |
|
92 | 92 | { |
93 | 93 | $result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
94 | 94 | if ($result <= 0) { |
95 | 95 | dol_print_error($db, $object->error, $object->errors); |
96 | 96 | exit(); |
97 | 97 | } |
98 | - $fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+'); |
|
98 | + $fileparams = dol_most_recent_file($diroutput.'/'.$ref, preg_quote($ref, '/').'[^\-]+'); |
|
99 | 99 | $file = $fileparams['fullname']; |
100 | 100 | } |
101 | 101 | } |
@@ -108,21 +108,21 @@ discard block |
||
108 | 108 | dol_fiche_head(''); |
109 | 109 | |
110 | 110 | // Create form for email |
111 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
111 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
|
112 | 112 | $formmail = new FormMail($db); |
113 | 113 | |
114 | - $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); |
|
115 | - $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); |
|
114 | + $formmail->param['langsmodels'] = (empty($newlang) ? $langs->defaultlang : $newlang); |
|
115 | + $formmail->fromtype = (GETPOST('fromtype') ?GETPOST('fromtype') : (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user')); |
|
116 | 116 | |
117 | 117 | if ($formmail->fromtype === 'user') |
118 | 118 | { |
119 | 119 | $formmail->fromid = $user->id; |
120 | 120 | } |
121 | - $formmail->trackid=$trackid; |
|
122 | - if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set |
|
121 | + $formmail->trackid = $trackid; |
|
122 | + if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set |
|
123 | 123 | { |
124 | 124 | include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
125 | - $formmail->frommail=dolAddEmailTrackId($formmail->frommail, $trackid); |
|
125 | + $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); |
|
126 | 126 | } |
127 | 127 | $formmail->withfrom = 1; |
128 | 128 | |
@@ -158,18 +158,18 @@ discard block |
||
158 | 158 | } |
159 | 159 | } |
160 | 160 | if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) { |
161 | - $listeuser=array(); |
|
161 | + $listeuser = array(); |
|
162 | 162 | $fuserdest = new User($db); |
163 | 163 | |
164 | - $result= $fuserdest->fetchAll('ASC', 't.lastname', 0, 0, array('customsql'=>'t.statut=1 AND t.employee=1 AND t.email IS NOT NULL AND t.email<>\'\'')); |
|
165 | - if ($result>0 && is_array($fuserdest->users) && count($fuserdest->users)>0) { |
|
166 | - foreach($fuserdest->users as $uuserdest) { |
|
167 | - $listeuser[$uuserdest->id] = $uuserdest->user_get_property($uuserdest->id,'email'); |
|
164 | + $result = $fuserdest->fetchAll('ASC', 't.lastname', 0, 0, array('customsql'=>'t.statut=1 AND t.employee=1 AND t.email IS NOT NULL AND t.email<>\'\'')); |
|
165 | + if ($result > 0 && is_array($fuserdest->users) && count($fuserdest->users) > 0) { |
|
166 | + foreach ($fuserdest->users as $uuserdest) { |
|
167 | + $listeuser[$uuserdest->id] = $uuserdest->user_get_property($uuserdest->id, 'email'); |
|
168 | 168 | } |
169 | - } elseif ($result<0) { |
|
170 | - setEventMessages(null, $fuserdest->errors,'errors'); |
|
169 | + } elseif ($result < 0) { |
|
170 | + setEventMessages(null, $fuserdest->errors, 'errors'); |
|
171 | 171 | } |
172 | - if (count($listeuser)>0) { |
|
172 | + if (count($listeuser) > 0) { |
|
173 | 173 | $formmail->withtouser = $listeuser; |
174 | 174 | $formmail->withtoccuser = $listeuser; |
175 | 175 | } |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | $formmail->withcancel = 1; |
186 | 186 | |
187 | 187 | //$arrayoffamiliestoexclude=array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...); |
188 | - if (! isset($arrayoffamiliestoexclude)) $arrayoffamiliestoexclude=null; |
|
188 | + if (!isset($arrayoffamiliestoexclude)) $arrayoffamiliestoexclude = null; |
|
189 | 189 | |
190 | 190 | // Make substitution in email content |
191 | 191 | $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object); |
192 | - $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '<img src="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-read.php?tag=' . $object->thirdparty->tag . '&securitykey=' . urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) . '" width="1" height="1" style="width:1px;height:1px" border="0"/>' : ''; |
|
193 | - $substitutionarray['__PERSONALIZED__'] = ''; // deprecated |
|
192 | + $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>' : ''; |
|
193 | + $substitutionarray['__PERSONALIZED__'] = ''; // deprecated |
|
194 | 194 | $substitutionarray['__CONTACTCIVNAME__'] = ''; |
195 | 195 | $parameters = array( |
196 | 196 | 'mode' => 'formemail' |
@@ -200,10 +200,10 @@ discard block |
||
200 | 200 | // Find the good contact adress |
201 | 201 | $custcontact = ''; |
202 | 202 | $contactarr = array(); |
203 | - $contactarr = $object->liste_contact(- 1, 'external'); |
|
203 | + $contactarr = $object->liste_contact(-1, 'external'); |
|
204 | 204 | |
205 | 205 | if (is_array($contactarr) && count($contactarr) > 0) { |
206 | - require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
206 | + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
|
207 | 207 | $contactstatic = new Contact($db); |
208 | 208 | |
209 | 209 | foreach ($contactarr as $contact) { |
@@ -218,9 +218,9 @@ discard block |
||
218 | 218 | // Tableau des parametres complementaires |
219 | 219 | $formmail->param['action'] = 'send'; |
220 | 220 | $formmail->param['models'] = $modelmail; |
221 | - $formmail->param['models_id']=GETPOST('modelmailselected','int'); |
|
221 | + $formmail->param['models_id'] = GETPOST('modelmailselected', 'int'); |
|
222 | 222 | $formmail->param['id'] = $object->id; |
223 | - $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id; |
|
223 | + $formmail->param['returnurl'] = $_SERVER["PHP_SELF"].'?id='.$object->id; |
|
224 | 224 | $formmail->param['fileinit'] = array($file); |
225 | 225 | |
226 | 226 | // Show form |
@@ -119,9 +119,11 @@ discard block |
||
119 | 119 | $formmail->fromid = $user->id; |
120 | 120 | } |
121 | 121 | $formmail->trackid=$trackid; |
122 | - if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set |
|
122 | + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) { |
|
123 | + // If bit 2 is set |
|
123 | 124 | { |
124 | 125 | include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
126 | + } |
|
125 | 127 | $formmail->frommail=dolAddEmailTrackId($formmail->frommail, $trackid); |
126 | 128 | } |
127 | 129 | $formmail->withfrom = 1; |
@@ -133,22 +135,18 @@ discard block |
||
133 | 135 | $fuser = new User($db); |
134 | 136 | $fuser->fetch($object->fk_user_author); |
135 | 137 | $liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">"; |
136 | - } |
|
137 | - elseif ($object->element == 'societe') |
|
138 | + } elseif ($object->element == 'societe') |
|
138 | 139 | { |
139 | 140 | foreach ($object->thirdparty_and_contact_email_array(1) as $key => $value) { |
140 | 141 | $liste[$key] = $value; |
141 | 142 | } |
142 | - } |
|
143 | - elseif ($object->element == 'contact') |
|
143 | + } elseif ($object->element == 'contact') |
|
144 | 144 | { |
145 | 145 | $liste['contact'] = $object->getFullName($langs)." <".$object->email.">"; |
146 | - } |
|
147 | - elseif ($object->element == 'user' || $object->element == 'member') |
|
146 | + } elseif ($object->element == 'user' || $object->element == 'member') |
|
148 | 147 | { |
149 | 148 | $liste['thirdparty'] = $object->getFullName($langs)." <".$object->email.">"; |
150 | - } |
|
151 | - else |
|
149 | + } else |
|
152 | 150 | { |
153 | 151 | if (is_object($object->thirdparty)) |
154 | 152 | { |
@@ -185,7 +183,9 @@ discard block |
||
185 | 183 | $formmail->withcancel = 1; |
186 | 184 | |
187 | 185 | //$arrayoffamiliestoexclude=array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...); |
188 | - if (! isset($arrayoffamiliestoexclude)) $arrayoffamiliestoexclude=null; |
|
186 | + if (! isset($arrayoffamiliestoexclude)) { |
|
187 | + $arrayoffamiliestoexclude=null; |
|
188 | + } |
|
189 | 189 | |
190 | 190 | // Make substitution in email content |
191 | 191 | $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object); |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | // Protection to avoid direct call of template |
31 | 31 | if (empty($conf) || ! is_object($conf)) |
32 | 32 | { |
33 | - print "Error, template page can't be called as URL"; |
|
34 | - exit; |
|
33 | + print "Error, template page can't be called as URL"; |
|
34 | + exit; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -55,17 +55,17 @@ discard block |
||
55 | 55 | var list = jQuery("#list"); |
56 | 56 | var totalizable = jQuery("#totalizable"); |
57 | 57 | <?php |
58 | - if ((GETPOST('type','alpha') != "select") && (GETPOST('type','alpha') != "sellist")) |
|
59 | - { |
|
60 | - print 'jQuery("#value_choice").hide();'; |
|
61 | - } |
|
62 | - |
|
63 | - if (GETPOST('type','alpha') == "separate") |
|
64 | - { |
|
65 | - print "jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);"; |
|
66 | - print 'jQuery("#value_choice").hide();'; |
|
67 | - } |
|
68 | - ?> |
|
58 | + if ((GETPOST('type','alpha') != "select") && (GETPOST('type','alpha') != "sellist")) |
|
59 | + { |
|
60 | + print 'jQuery("#value_choice").hide();'; |
|
61 | + } |
|
62 | + |
|
63 | + if (GETPOST('type','alpha') == "separate") |
|
64 | + { |
|
65 | + print "jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);"; |
|
66 | + print 'jQuery("#value_choice").hide();'; |
|
67 | + } |
|
68 | + ?> |
|
69 | 69 | |
70 | 70 | // Case of computed field |
71 | 71 | console.log(type); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | |
30 | 30 | // Protection to avoid direct call of template |
31 | -if (empty($conf) || ! is_object($conf)) |
|
31 | +if (empty($conf) || !is_object($conf)) |
|
32 | 32 | { |
33 | 33 | print "Error, template page can't be called as URL"; |
34 | 34 | exit; |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | var list = jQuery("#list"); |
56 | 56 | var totalizable = jQuery("#totalizable"); |
57 | 57 | <?php |
58 | - if ((GETPOST('type','alpha') != "select") && (GETPOST('type','alpha') != "sellist")) |
|
58 | + if ((GETPOST('type', 'alpha') != "select") && (GETPOST('type', 'alpha') != "sellist")) |
|
59 | 59 | { |
60 | 60 | print 'jQuery("#value_choice").hide();'; |
61 | 61 | } |
62 | 62 | |
63 | - if (GETPOST('type','alpha') == "separate") |
|
63 | + if (GETPOST('type', 'alpha') == "separate") |
|
64 | 64 | { |
65 | 65 | print "jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);"; |
66 | 66 | print 'jQuery("#value_choice").hide();'; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | langfile.removeAttr('disabled');required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.removeAttr('disabled'); |
127 | 127 | } |
128 | 128 | } |
129 | - init_typeoffields('<?php echo GETPOST('type','alpha'); ?>'); |
|
129 | + init_typeoffields('<?php echo GETPOST('type', 'alpha'); ?>'); |
|
130 | 130 | jQuery("#type").change(function() { |
131 | 131 | init_typeoffields($(this).val()); |
132 | 132 | }); |
@@ -146,15 +146,15 @@ discard block |
||
146 | 146 | |
147 | 147 | <table summary="listofattributes" class="border centpercent"> |
148 | 148 | <!-- Label --> |
149 | -<tr><td class="titlefield fieldrequired"><?php echo $langs->trans("LabelOrTranslationKey"); ?></td><td class="valeur"><input type="text" name="label" size="40" value="<?php echo GETPOST('label','alpha'); ?>"></td></tr> |
|
149 | +<tr><td class="titlefield fieldrequired"><?php echo $langs->trans("LabelOrTranslationKey"); ?></td><td class="valeur"><input type="text" name="label" size="40" value="<?php echo GETPOST('label', 'alpha'); ?>"></td></tr> |
|
150 | 150 | <!-- Code --> |
151 | -<tr><td class="fieldrequired"><?php echo $langs->trans("AttributeCode"); ?></td><td class="valeur"><input type="text" name="attrname" id="attrname" size="10" value="<?php echo GETPOST('attrname','alpha'); ?>"> (<?php echo $langs->trans("AlphaNumOnlyLowerCharsAndNoSpace"); ?>)</td></tr> |
|
151 | +<tr><td class="fieldrequired"><?php echo $langs->trans("AttributeCode"); ?></td><td class="valeur"><input type="text" name="attrname" id="attrname" size="10" value="<?php echo GETPOST('attrname', 'alpha'); ?>"> (<?php echo $langs->trans("AlphaNumOnlyLowerCharsAndNoSpace"); ?>)</td></tr> |
|
152 | 152 | <!-- Type --> |
153 | 153 | <tr><td class="fieldrequired"><?php echo $langs->trans("Type"); ?></td><td class="valeur"> |
154 | -<?php print $form->selectarray('type',$type2label,GETPOST('type','alpha')); ?> |
|
154 | +<?php print $form->selectarray('type', $type2label, GETPOST('type', 'alpha')); ?> |
|
155 | 155 | </td></tr> |
156 | 156 | <!-- Size --> |
157 | -<tr class="extra_size"><td class="fieldrequired"><?php echo $langs->trans("Size"); ?></td><td class="valeur"><input id="size" type="text" name="size" size="5" value="<?php echo (GETPOST('size','alpha')?GETPOST('size','alpha'):''); ?>"></td></tr> |
|
157 | +<tr class="extra_size"><td class="fieldrequired"><?php echo $langs->trans("Size"); ?></td><td class="valeur"><input id="size" type="text" name="size" size="5" value="<?php echo (GETPOST('size', 'alpha') ?GETPOST('size', 'alpha') : ''); ?>"></td></tr> |
|
158 | 158 | <!-- Default Value (for select list / radio/ checkbox) --> |
159 | 159 | <tr id="value_choice"> |
160 | 160 | <td> |
@@ -163,41 +163,41 @@ discard block |
||
163 | 163 | <td> |
164 | 164 | <table class="nobordernopadding"> |
165 | 165 | <tr><td> |
166 | - <textarea name="param" id="param" cols="80" rows="<?php echo ROWS_4 ?>"><?php echo GETPOST('param','alpha'); ?></textarea> |
|
166 | + <textarea name="param" id="param" cols="80" rows="<?php echo ROWS_4 ?>"><?php echo GETPOST('param', 'alpha'); ?></textarea> |
|
167 | 167 | </td><td> |
168 | - <span id="helpselect"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0,'', 0, 2, 'helpvalue1')?></span> |
|
169 | - <span id="helpsellist"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0,'', 0, 2, 'helpvalue2')?></span> |
|
170 | - <span id="helpchkbxlst"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0,'', 0, 2, 'helpvalue3')?></span> |
|
171 | - <span id="helplink"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelplink"),1,0,'', 0, 2, 'helpvalue4')?></span> |
|
172 | - <span id="helppassword"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpPassword"),1,0,'', 0, 2, 'helpvalue5')?></span> |
|
168 | + <span id="helpselect"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"), 1, 0, '', 0, 2, 'helpvalue1')?></span> |
|
169 | + <span id="helpsellist"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"), 1, 0, '', 0, 2, 'helpvalue2')?></span> |
|
170 | + <span id="helpchkbxlst"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"), 1, 0, '', 0, 2, 'helpvalue3')?></span> |
|
171 | + <span id="helplink"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelplink"), 1, 0, '', 0, 2, 'helpvalue4')?></span> |
|
172 | + <span id="helppassword"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpPassword"), 1, 0, '', 0, 2, 'helpvalue5')?></span> |
|
173 | 173 | </td></tr> |
174 | 174 | </table> |
175 | 175 | </td> |
176 | 176 | </tr> |
177 | 177 | <!-- Position --> |
178 | -<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo GETPOSTISSET('pos')?GETPOST('pos','int'):100; ?>"></td></tr> |
|
178 | +<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo GETPOSTISSET('pos') ?GETPOST('pos', 'int') : 100; ?>"></td></tr> |
|
179 | 179 | <!-- Language file --> |
180 | -<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" id="langfile" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag(GETPOST('langfile','alpha')); ?>"></td></tr> |
|
180 | +<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" id="langfile" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag(GETPOST('langfile', 'alpha')); ?>"></td></tr> |
|
181 | 181 | <!-- Computed Value --> |
182 | -<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" type="text" name="computed_value" class="quatrevingtpercent" value="<?php echo (GETPOST('computed_value','none')?GETPOST('computed_value','none'):''); ?>"></td></tr> |
|
182 | +<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" type="text" name="computed_value" class="quatrevingtpercent" value="<?php echo (GETPOST('computed_value', 'none') ?GETPOST('computed_value', 'none') : ''); ?>"></td></tr> |
|
183 | 183 | <!-- Default Value (at sql setup level) --> |
184 | -<tr class="extra_default_value"><td><?php echo $langs->trans("DefaultValue").' ('.$langs->trans("Database").')'; ?></td><td class="valeur"><input id="default_value" type="text" name="default_value" size="5" value="<?php echo (GETPOST('default_value','alpha')?GETPOST('default_value','alpha'):''); ?>"></td></tr> |
|
184 | +<tr class="extra_default_value"><td><?php echo $langs->trans("DefaultValue").' ('.$langs->trans("Database").')'; ?></td><td class="valeur"><input id="default_value" type="text" name="default_value" size="5" value="<?php echo (GETPOST('default_value', 'alpha') ?GETPOST('default_value', 'alpha') : ''); ?>"></td></tr> |
|
185 | 185 | <!-- Unique --> |
186 | -<tr class="extra_unique"><td><?php echo $langs->trans("Unique"); ?></td><td class="valeur"><input id="unique" type="checkbox" name="unique"<?php echo (GETPOST('unique','alpha')?' checked':''); ?>></td></tr> |
|
186 | +<tr class="extra_unique"><td><?php echo $langs->trans("Unique"); ?></td><td class="valeur"><input id="unique" type="checkbox" name="unique"<?php echo (GETPOST('unique', 'alpha') ? ' checked' : ''); ?>></td></tr> |
|
187 | 187 | <!-- Required --> |
188 | -<tr class="extra_required"><td><?php echo $langs->trans("Required"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required"<?php echo (GETPOST('required','alpha')?' checked':''); ?>></td></tr> |
|
188 | +<tr class="extra_required"><td><?php echo $langs->trans("Required"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required"<?php echo (GETPOST('required', 'alpha') ? ' checked' : ''); ?>></td></tr> |
|
189 | 189 | <!-- Always editable --> |
190 | -<tr class="extra_alwayseditable"><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable"<?php echo ((GETPOST('alwayseditable','alpha') || ! GETPOST('button','alpha'))?' checked':''); ?>></td></tr> |
|
190 | +<tr class="extra_alwayseditable"><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable"<?php echo ((GETPOST('alwayseditable', 'alpha') || !GETPOST('button', 'alpha')) ? ' checked' : ''); ?>></td></tr> |
|
191 | 191 | <!-- Visibility --> |
192 | 192 | <tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc")); ?> |
193 | -</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo GETPOST('list','int')!='' ? GETPOST('list','int') : '1'; ?>"></td></tr> |
|
193 | +</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo GETPOST('list', 'int') != '' ? GETPOST('list', 'int') : '1'; ?>"></td></tr> |
|
194 | 194 | <!-- Totalizable --> |
195 | -<tr class="extra_totalizable"><td><?php echo $langs->trans("Totalizable"); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo ((GETPOST('totalizable','alpha') || GETPOST('button','alpha'))?' checked':''); ?>></td></tr> |
|
195 | +<tr class="extra_totalizable"><td><?php echo $langs->trans("Totalizable"); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo ((GETPOST('totalizable', 'alpha') || GETPOST('button', 'alpha')) ? ' checked' : ''); ?>></td></tr> |
|
196 | 196 | <!-- Help tooltip --> |
197 | 197 | <tr class="help"><td><?php echo $form->textwithpicto($langs->trans("HelpOnTooltip"), $langs->trans("HelpOnTooltipDesc")); ?></td><td class="valeur"><input id="help" class="quatrevingtpercent" type="text" name="help" value="<?php echo dol_escape_htmltag($help); ?>"></td></tr> |
198 | 198 | <?php if ($conf->multicompany->enabled) { ?> |
199 | 199 | <!-- Multicompany entity --> |
200 | - <tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (GETPOST('entitycurrentorall','alpha') ? '':' checked'); ?>></td></tr> |
|
200 | + <tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (GETPOST('entitycurrentorall', 'alpha') ? '' : ' checked'); ?>></td></tr> |
|
201 | 201 | <?php } ?> |
202 | 202 | </table> |
203 | 203 |