@@ -13,19 +13,19 @@ |
||
| 13 | 13 | $sql = 'SELECT rowid'; |
| 14 | 14 | $sql .= ' FROM '.MAIN_DB_PREFIX.'propal'; |
| 15 | 15 | $sql .= ' WHERE total_ht + tva != total'; |
| 16 | -if(! empty($limit)) $sql .= ' LIMIT '.$limit; |
|
| 16 | +if (!empty($limit)) $sql .= ' LIMIT '.$limit; |
|
| 17 | 17 | |
| 18 | 18 | $resql = $db->query($sql); |
| 19 | -if($resql) { |
|
| 19 | +if ($resql) { |
|
| 20 | 20 | $db->begin(); |
| 21 | - while($obj = $db->fetch_object($resql)) { |
|
| 21 | + while ($obj = $db->fetch_object($resql)) { |
|
| 22 | 22 | $propal = new Propal($db); |
| 23 | 23 | var_dump($obj->rowid); |
| 24 | 24 | $propal->fetch($obj->rowid); |
| 25 | 25 | |
| 26 | - foreach($propal->lines as &$l) { |
|
| 27 | - if(empty($l->array_options)) $l->fetch_optionals(); |
|
| 28 | - if(! empty($l->array_options['options_subtotal_nc']) && ! TSubtotal::isModSubtotalLine($l)) { |
|
| 26 | + foreach ($propal->lines as &$l) { |
|
| 27 | + if (empty($l->array_options)) $l->fetch_optionals(); |
|
| 28 | + if (!empty($l->array_options['options_subtotal_nc']) && !TSubtotal::isModSubtotalLine($l)) { |
|
| 29 | 29 | _updateLineNC($propal->element, $propal->id, $l->id, $l->array_options['options_subtotal_nc']); |
| 30 | 30 | } |
| 31 | 31 | } |
@@ -13,7 +13,9 @@ discard block |
||
| 13 | 13 | $sql = 'SELECT rowid'; |
| 14 | 14 | $sql .= ' FROM '.MAIN_DB_PREFIX.'propal'; |
| 15 | 15 | $sql .= ' WHERE total_ht + tva != total'; |
| 16 | -if(! empty($limit)) $sql .= ' LIMIT '.$limit; |
|
| 16 | +if(! empty($limit)) { |
|
| 17 | + $sql .= ' LIMIT '.$limit; |
|
| 18 | +} |
|
| 17 | 19 | |
| 18 | 20 | $resql = $db->query($sql); |
| 19 | 21 | if($resql) { |
@@ -24,7 +26,9 @@ discard block |
||
| 24 | 26 | $propal->fetch($obj->rowid); |
| 25 | 27 | |
| 26 | 28 | foreach($propal->lines as &$l) { |
| 27 | - if(empty($l->array_options)) $l->fetch_optionals(); |
|
| 29 | + if(empty($l->array_options)) { |
|
| 30 | + $l->fetch_optionals(); |
|
| 31 | + } |
|
| 28 | 32 | if(! empty($l->array_options['options_subtotal_nc']) && ! TSubtotal::isModSubtotalLine($l)) { |
| 29 | 33 | _updateLineNC($propal->element, $propal->id, $l->id, $l->array_options['options_subtotal_nc']); |
| 30 | 34 | } |
@@ -25,25 +25,25 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | function subtotalAdminPrepareHead() |
| 27 | 27 | { |
| 28 | - global $langs, $conf; |
|
| 28 | + global $langs, $conf; |
|
| 29 | 29 | |
| 30 | - $langs->load("subtotal@subtotal"); |
|
| 30 | + $langs->load("subtotal@subtotal"); |
|
| 31 | 31 | |
| 32 | - $h = 0; |
|
| 33 | - $head = array(); |
|
| 32 | + $h = 0; |
|
| 33 | + $head = array(); |
|
| 34 | 34 | |
| 35 | - $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_setup.php", 1); |
|
| 36 | - $head[$h][1] = $langs->trans("Parameters"); |
|
| 37 | - $head[$h][2] = 'settings'; |
|
| 38 | - $h++; |
|
| 39 | - $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_about.php", 1); |
|
| 40 | - $head[$h][1] = $langs->trans("About"); |
|
| 41 | - $head[$h][2] = 'about'; |
|
| 42 | - $h++; |
|
| 35 | + $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_setup.php", 1); |
|
| 36 | + $head[$h][1] = $langs->trans("Parameters"); |
|
| 37 | + $head[$h][2] = 'settings'; |
|
| 38 | + $h++; |
|
| 39 | + $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_about.php", 1); |
|
| 40 | + $head[$h][1] = $langs->trans("About"); |
|
| 41 | + $head[$h][2] = 'about'; |
|
| 42 | + $h++; |
|
| 43 | 43 | |
| 44 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'subtotal', $showLabel=false); |
|
| 44 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'subtotal', $showLabel=false); |
|
| 45 | 45 | |
| 46 | - return $head; |
|
| 46 | + return $head; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | function getHtmlSelectTitle(&$object, $showLabel=false) |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | $label = GETPOST('line-title'); |
| 131 | 131 | $description = ($line->qty>90) ? '' : GETPOST('line-description'); |
| 132 | 132 | $pagebreak = (int) GETPOST('line-pagebreak'); |
| 133 | - $showTotalHT = (int) GETPOST('line-showTotalHT'); |
|
| 134 | - $showReduc = (int) GETPOST('line-showReduc'); |
|
| 133 | + $showTotalHT = (int) GETPOST('line-showTotalHT'); |
|
| 134 | + $showReduc = (int) GETPOST('line-showReduc'); |
|
| 135 | 135 | |
| 136 | 136 | $level = GETPOST('subtotal_level', 'int'); |
| 137 | 137 | if (!empty($level)) |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | if ($line->qty > 90) $line->qty = 100 - $level; // Si on edit une ligne sous-total |
| 140 | 140 | else $line->qty = $level; |
| 141 | 141 | } |
| 142 | - $line->array_options['options_show_total_ht'] = $showTotalHT; |
|
| 143 | - $line->array_options['options_show_reduc'] = $showReduc; |
|
| 142 | + $line->array_options['options_show_total_ht'] = $showTotalHT; |
|
| 143 | + $line->array_options['options_show_reduc'] = $showReduc; |
|
| 144 | 144 | |
| 145 | 145 | $res = TSubtotal::doUpdateLine($object, $line->id, $description, 0, $line->qty, 0, '', '', 0, 9, 0, 0, 'HT', $pagebreak, 0, 1, null, 0, $label, TSubtotal::$module_number, $line->array_options); |
| 146 | 146 | |
@@ -246,17 +246,17 @@ discard block |
||
| 246 | 246 | $classname = ucfirst($element); |
| 247 | 247 | |
| 248 | 248 | switch ($element) { |
| 249 | - case 'supplier_proposal': |
|
| 250 | - $classname = 'SupplierProposal'; |
|
| 251 | - break; |
|
| 249 | + case 'supplier_proposal': |
|
| 250 | + $classname = 'SupplierProposal'; |
|
| 251 | + break; |
|
| 252 | 252 | |
| 253 | - case 'order_supplier': |
|
| 254 | - $classname = 'CommandeFournisseur'; |
|
| 255 | - break; |
|
| 253 | + case 'order_supplier': |
|
| 254 | + $classname = 'CommandeFournisseur'; |
|
| 255 | + break; |
|
| 256 | 256 | |
| 257 | - case 'invoice_supplier': |
|
| 258 | - $classname = 'FactureFournisseur'; |
|
| 259 | - break; |
|
| 257 | + case 'invoice_supplier': |
|
| 258 | + $classname = 'FactureFournisseur'; |
|
| 259 | + break; |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | $object = new $classname($db); // Propal | Commande | Facture |
@@ -329,14 +329,14 @@ discard block |
||
| 329 | 329 | else $res = $line->update($user, $notrigger); |
| 330 | 330 | } |
| 331 | 331 | else { |
| 332 | - if(in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) { |
|
| 333 | - if(empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label |
|
| 332 | + if(in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) { |
|
| 333 | + if(empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label |
|
| 334 | 334 | |
| 335 | - require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
| 336 | - $extrafields=new ExtraFields($object->db); |
|
| 337 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
| 338 | - $line->fetch_optionals($line->id,$extralabels); |
|
| 339 | - } |
|
| 335 | + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
| 336 | + $extrafields=new ExtraFields($object->db); |
|
| 337 | + $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
| 338 | + $line->fetch_optionals($line->id,$extralabels); |
|
| 339 | + } |
|
| 340 | 340 | $line->array_options['options_subtotal_nc'] = 0; |
| 341 | 341 | if($object->element == 'order_supplier') $line->update($user); |
| 342 | 342 | $res = TSubtotal::doUpdateLine($object, $line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->product_type, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $notrigger); |
@@ -41,21 +41,21 @@ discard block |
||
| 41 | 41 | $head[$h][2] = 'about'; |
| 42 | 42 | $h++; |
| 43 | 43 | |
| 44 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'subtotal', $showLabel=false); |
|
| 44 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'subtotal', $showLabel = false); |
|
| 45 | 45 | |
| 46 | 46 | return $head; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | -function getHtmlSelectTitle(&$object, $showLabel=false) |
|
| 49 | +function getHtmlSelectTitle(&$object, $showLabel = false) |
|
| 50 | 50 | { |
| 51 | 51 | global $langs; |
| 52 | 52 | |
| 53 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; |
|
| 53 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; |
|
| 54 | 54 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 55 | 55 | $TTitle = TSubtotal::getAllTitleFromDocument($object); |
| 56 | 56 | $html = ''; |
| 57 | - if ($showLabel) $html.= '<label for="under_title">'.$langs->trans('subtotalLabelForUnderTitle').'</label>'; |
|
| 58 | - $html.= '<select onChange="$(\'select[name=under_title]\').val(this.value);" name="under_title" class="under_title minwidth200"><option value="-1"></option>'; |
|
| 57 | + if ($showLabel) $html .= '<label for="under_title">'.$langs->trans('subtotalLabelForUnderTitle').'</label>'; |
|
| 58 | + $html .= '<select onChange="$(\'select[name=under_title]\').val(this.value);" name="under_title" class="under_title minwidth200"><option value="-1"></option>'; |
|
| 59 | 59 | |
| 60 | 60 | $nbsp = ' '; |
| 61 | 61 | foreach ($TTitle as &$line) |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | function getTFreeText() |
| 72 | 72 | { |
| 73 | - global $db,$conf; |
|
| 73 | + global $db, $conf; |
|
| 74 | 74 | |
| 75 | 75 | $TFreeText = array(); |
| 76 | 76 | |
@@ -88,19 +88,19 @@ discard block |
||
| 88 | 88 | return $TFreeText; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | -function getHtmlSelectFreeText($withEmpty=true) |
|
| 91 | +function getHtmlSelectFreeText($withEmpty = true) |
|
| 92 | 92 | { |
| 93 | 93 | global $langs; |
| 94 | 94 | |
| 95 | 95 | $TFreeText = getTFreeText(); |
| 96 | 96 | $html = '<label for="free_text">'.$langs->trans('subtotalLabelForFreeText').'</label>'; |
| 97 | - $html.= '<select onChange="getTFreeText($(this));" name="free_text" class="minwidth200">'; |
|
| 98 | - if ($withEmpty) $html.= '<option value=""></option>'; |
|
| 97 | + $html .= '<select onChange="getTFreeText($(this));" name="free_text" class="minwidth200">'; |
|
| 98 | + if ($withEmpty) $html .= '<option value=""></option>'; |
|
| 99 | 99 | |
| 100 | 100 | $TFreeTextContents = array(); |
| 101 | 101 | foreach ($TFreeText as $id => $tab) |
| 102 | 102 | { |
| 103 | - $html.= '<option value="'.$id.'">'.$tab->label.'</option>'; |
|
| 103 | + $html .= '<option value="'.$id.'">'.$tab->label.'</option>'; |
|
| 104 | 104 | $TFreeTextContents[$id] = $tab->content; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | function _updateSubtotalLine(&$object, &$line) |
| 129 | 129 | { |
| 130 | 130 | $label = GETPOST('line-title'); |
| 131 | - $description = ($line->qty>90) ? '' : GETPOST('line-description'); |
|
| 131 | + $description = ($line->qty > 90) ? '' : GETPOST('line-description'); |
|
| 132 | 132 | $pagebreak = (int) GETPOST('line-pagebreak'); |
| 133 | 133 | $showTotalHT = (int) GETPOST('line-showTotalHT'); |
| 134 | 134 | $showReduc = (int) GETPOST('line-showReduc'); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | function _updateSubtotalBloc($object, $line) |
| 151 | 151 | { |
| 152 | - global $conf,$langs; |
|
| 152 | + global $conf, $langs; |
|
| 153 | 153 | |
| 154 | 154 | $subtotal_tva_tx = $subtotal_tva_tx_init = GETPOST('subtotal_tva_tx', 'int'); |
| 155 | 155 | $subtotal_progress = $subtotal_progress_init = GETPOST('subtotal_progress', 'int'); |
@@ -228,9 +228,9 @@ discard block |
||
| 228 | 228 | * @param $lineid = title lineid |
| 229 | 229 | * @param $subtotal_nc 0 = "Compris" prise en compte des totaux des lignes; 1 = "Non compris" non prise en compte des totaux du bloc; null = update de toutes les lignes |
| 230 | 230 | */ |
| 231 | -function _updateLineNC($element, $elementid, $lineid, $subtotal_nc=null, $notrigger = 0) |
|
| 231 | +function _updateLineNC($element, $elementid, $lineid, $subtotal_nc = null, $notrigger = 0) |
|
| 232 | 232 | { |
| 233 | - global $db,$langs,$tmp_object_nc; |
|
| 233 | + global $db, $langs, $tmp_object_nc; |
|
| 234 | 234 | |
| 235 | 235 | $error = 0; |
| 236 | 236 | if (empty($element)) $error++; |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | { |
| 271 | 271 | foreach ($object->lines as &$l) |
| 272 | 272 | { |
| 273 | - if($l->id == $lineid) { |
|
| 273 | + if ($l->id == $lineid) { |
|
| 274 | 274 | $line = $l; |
| 275 | 275 | break; |
| 276 | 276 | } |
@@ -280,12 +280,12 @@ discard block |
||
| 280 | 280 | { |
| 281 | 281 | $db->begin(); |
| 282 | 282 | |
| 283 | - if(TSubtotal::isModSubtotalLine($line)) |
|
| 283 | + if (TSubtotal::isModSubtotalLine($line)) |
|
| 284 | 284 | { |
| 285 | - if(TSubtotal::isTitle($line)) { |
|
| 285 | + if (TSubtotal::isTitle($line)) { |
|
| 286 | 286 | // Update le contenu du titre (ainsi que le titre lui même) |
| 287 | 287 | $TTitleBlock = TSubtotal::getLinesFromTitleId($object, $lineid, true); |
| 288 | - foreach($TTitleBlock as &$line_block) |
|
| 288 | + foreach ($TTitleBlock as &$line_block) |
|
| 289 | 289 | { |
| 290 | 290 | $res = doUpdate($object, $line_block, $subtotal_nc, $notrigger); |
| 291 | 291 | } |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | if (TSubtotal::isFreeText($line) || TSubtotal::isSubtotal($line)) return 1; |
| 321 | 321 | // Update extrafield et total |
| 322 | - if(! empty($subtotal_nc)) { |
|
| 322 | + if (!empty($subtotal_nc)) { |
|
| 323 | 323 | $line->total_ht = $line->total_tva = $line->total_ttc = $line->total_localtax1 = $line->total_localtax2 = |
| 324 | 324 | $line->multicurrency_total_ht = $line->multicurrency_total_tva = $line->multicurrency_total_ttc = 0; |
| 325 | 325 | |
@@ -329,16 +329,16 @@ discard block |
||
| 329 | 329 | else $res = $line->update($user, $notrigger); |
| 330 | 330 | } |
| 331 | 331 | else { |
| 332 | - if(in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) { |
|
| 333 | - if(empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label |
|
| 332 | + if (in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) { |
|
| 333 | + if (empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label |
|
| 334 | 334 | |
| 335 | 335 | require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
| 336 | - $extrafields=new ExtraFields($object->db); |
|
| 337 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
| 338 | - $line->fetch_optionals($line->id,$extralabels); |
|
| 336 | + $extrafields = new ExtraFields($object->db); |
|
| 337 | + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element_line, true); |
|
| 338 | + $line->fetch_optionals($line->id, $extralabels); |
|
| 339 | 339 | } |
| 340 | 340 | $line->array_options['options_subtotal_nc'] = 0; |
| 341 | - if($object->element == 'order_supplier') $line->update($user); |
|
| 341 | + if ($object->element == 'order_supplier') $line->update($user); |
|
| 342 | 342 | $res = TSubtotal::doUpdateLine($object, $line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->product_type, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $notrigger); |
| 343 | 343 | } |
| 344 | 344 | |
@@ -54,7 +54,9 @@ discard block |
||
| 54 | 54 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 55 | 55 | $TTitle = TSubtotal::getAllTitleFromDocument($object); |
| 56 | 56 | $html = ''; |
| 57 | - if ($showLabel) $html.= '<label for="under_title">'.$langs->trans('subtotalLabelForUnderTitle').'</label>'; |
|
| 57 | + if ($showLabel) { |
|
| 58 | + $html.= '<label for="under_title">'.$langs->trans('subtotalLabelForUnderTitle').'</label>'; |
|
| 59 | + } |
|
| 58 | 60 | $html.= '<select onChange="$(\'select[name=under_title]\').val(this.value);" name="under_title" class="under_title minwidth200"><option value="-1"></option>'; |
| 59 | 61 | |
| 60 | 62 | $nbsp = ' '; |
@@ -95,7 +97,9 @@ discard block |
||
| 95 | 97 | $TFreeText = getTFreeText(); |
| 96 | 98 | $html = '<label for="free_text">'.$langs->trans('subtotalLabelForFreeText').'</label>'; |
| 97 | 99 | $html.= '<select onChange="getTFreeText($(this));" name="free_text" class="minwidth200">'; |
| 98 | - if ($withEmpty) $html.= '<option value=""></option>'; |
|
| 100 | + if ($withEmpty) { |
|
| 101 | + $html.= '<option value=""></option>'; |
|
| 102 | + } |
|
| 99 | 103 | |
| 100 | 104 | $TFreeTextContents = array(); |
| 101 | 105 | foreach ($TFreeText as $id => $tab) |
@@ -136,8 +140,13 @@ discard block |
||
| 136 | 140 | $level = GETPOST('subtotal_level', 'int'); |
| 137 | 141 | if (!empty($level)) |
| 138 | 142 | { |
| 139 | - if ($line->qty > 90) $line->qty = 100 - $level; // Si on edit une ligne sous-total |
|
| 140 | - else $line->qty = $level; |
|
| 143 | + if ($line->qty > 90) { |
|
| 144 | + $line->qty = 100 - $level; |
|
| 145 | + } |
|
| 146 | + // Si on edit une ligne sous-total |
|
| 147 | + else { |
|
| 148 | + $line->qty = $level; |
|
| 149 | + } |
|
| 141 | 150 | } |
| 142 | 151 | $line->array_options['options_show_total_ht'] = $showTotalHT; |
| 143 | 152 | $line->array_options['options_show_reduc'] = $showReduc; |
@@ -166,13 +175,18 @@ discard block |
||
| 166 | 175 | { |
| 167 | 176 | $subtotal_tva_tx = $subtotal_tva_tx_init; // ré-init car la variable peut évoluer |
| 168 | 177 | |
| 169 | - if (!empty($showBlockExtrafields)) $line->array_options = $array_options; |
|
| 170 | - if ($subtotal_tva_tx == '') $subtotal_tva_tx = $line->tva_tx; |
|
| 178 | + if (!empty($showBlockExtrafields)) { |
|
| 179 | + $line->array_options = $array_options; |
|
| 180 | + } |
|
| 181 | + if ($subtotal_tva_tx == '') { |
|
| 182 | + $subtotal_tva_tx = $line->tva_tx; |
|
| 183 | + } |
|
| 171 | 184 | if ($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) |
| 172 | 185 | { |
| 173 | 186 | $subtotal_progress = $subtotal_progress_init; |
| 174 | - if ($subtotal_progress == '') $subtotal_progress = $line->situation_percent; |
|
| 175 | - else |
|
| 187 | + if ($subtotal_progress == '') { |
|
| 188 | + $subtotal_progress = $line->situation_percent; |
|
| 189 | + } else |
|
| 176 | 190 | { |
| 177 | 191 | $prev_percent = $line->get_prev_progress($object->id); |
| 178 | 192 | if ($subtotal_progress < $prev_percent) |
@@ -185,14 +199,21 @@ discard block |
||
| 185 | 199 | |
| 186 | 200 | $res = TSubtotal::doUpdateLine($object, $line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $subtotal_tva_tx, $line->product_type, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $subtotal_progress, $line->fk_unit); |
| 187 | 201 | |
| 188 | - if ($res > 0) $success_updated_line++; |
|
| 189 | - else $error_updated_line++; |
|
| 202 | + if ($res > 0) { |
|
| 203 | + $success_updated_line++; |
|
| 204 | + } else { |
|
| 205 | + $error_updated_line++; |
|
| 206 | + } |
|
| 190 | 207 | } |
| 191 | 208 | } |
| 192 | 209 | |
| 193 | - if ($nb_progress_not_updated > 0) setEventMessage($langs->trans('subtotal_nb_progress_not_updated', $nb_progress_not_updated), 'warnings'); |
|
| 210 | + if ($nb_progress_not_updated > 0) { |
|
| 211 | + setEventMessage($langs->trans('subtotal_nb_progress_not_updated', $nb_progress_not_updated), 'warnings'); |
|
| 212 | + } |
|
| 194 | 213 | |
| 195 | - if ($success_updated_line > 0) setEventMessage($langs->trans('subtotal_success_updated_line', $success_updated_line)); |
|
| 214 | + if ($success_updated_line > 0) { |
|
| 215 | + setEventMessage($langs->trans('subtotal_success_updated_line', $success_updated_line)); |
|
| 216 | + } |
|
| 196 | 217 | if ($error_updated_line > 0) |
| 197 | 218 | { |
| 198 | 219 | setEventMessage($langs->trans('subtotal_error_updated_line', $error_updated_line), 'errors'); |
@@ -233,15 +254,16 @@ discard block |
||
| 233 | 254 | global $db,$langs,$tmp_object_nc; |
| 234 | 255 | |
| 235 | 256 | $error = 0; |
| 236 | - if (empty($element)) $error++; |
|
| 257 | + if (empty($element)) { |
|
| 258 | + $error++; |
|
| 259 | + } |
|
| 237 | 260 | |
| 238 | 261 | if (!$error) |
| 239 | 262 | { |
| 240 | 263 | if (!empty($tmp_object_nc) && $tmp_object_nc->element == $element && $tmp_object_nc->id == $elementid) |
| 241 | 264 | { |
| 242 | 265 | $object = $tmp_object_nc; |
| 243 | - } |
|
| 244 | - else |
|
| 266 | + } else |
|
| 245 | 267 | { |
| 246 | 268 | $classname = ucfirst($element); |
| 247 | 269 | |
@@ -261,8 +283,11 @@ discard block |
||
| 261 | 283 | |
| 262 | 284 | $object = new $classname($db); // Propal | Commande | Facture |
| 263 | 285 | $res = $object->fetch($elementid); |
| 264 | - if ($res < 0) $error++; |
|
| 265 | - else $tmp_object_nc = $object; |
|
| 286 | + if ($res < 0) { |
|
| 287 | + $error++; |
|
| 288 | + } else { |
|
| 289 | + $tmp_object_nc = $object; |
|
| 290 | + } |
|
| 266 | 291 | } |
| 267 | 292 | } |
| 268 | 293 | |
@@ -290,21 +315,21 @@ discard block |
||
| 290 | 315 | $res = doUpdate($object, $line_block, $subtotal_nc, $notrigger); |
| 291 | 316 | } |
| 292 | 317 | } |
| 293 | - } |
|
| 294 | - else |
|
| 318 | + } else |
|
| 295 | 319 | { |
| 296 | 320 | $res = doUpdate($object, $line, $subtotal_nc, $notrigger); |
| 297 | 321 | } |
| 298 | 322 | |
| 299 | 323 | $res = $object->update_price(1); |
| 300 | - if ($res <= 0) $error++; |
|
| 324 | + if ($res <= 0) { |
|
| 325 | + $error++; |
|
| 326 | + } |
|
| 301 | 327 | |
| 302 | 328 | if (!$error) |
| 303 | 329 | { |
| 304 | 330 | setEventMessage($langs->trans('subtotal_update_nc_success')); |
| 305 | 331 | $db->commit(); |
| 306 | - } |
|
| 307 | - else |
|
| 332 | + } else |
|
| 308 | 333 | { |
| 309 | 334 | setEventMessage($langs->trans('subtotal_update_nc_error'), 'errors'); |
| 310 | 335 | $db->rollback(); |
@@ -317,7 +342,9 @@ discard block |
||
| 317 | 342 | { |
| 318 | 343 | global $user; |
| 319 | 344 | |
| 320 | - if (TSubtotal::isFreeText($line) || TSubtotal::isSubtotal($line)) return 1; |
|
| 345 | + if (TSubtotal::isFreeText($line) || TSubtotal::isSubtotal($line)) { |
|
| 346 | + return 1; |
|
| 347 | + } |
|
| 321 | 348 | // Update extrafield et total |
| 322 | 349 | if(! empty($subtotal_nc)) { |
| 323 | 350 | $line->total_ht = $line->total_tva = $line->total_ttc = $line->total_localtax1 = $line->total_localtax2 = |
@@ -325,12 +352,17 @@ discard block |
||
| 325 | 352 | |
| 326 | 353 | $line->array_options['options_subtotal_nc'] = 1; |
| 327 | 354 | |
| 328 | - if ($line->element == 'propaldet') $res = $line->update($notrigger); |
|
| 329 | - else $res = $line->update($user, $notrigger); |
|
| 330 | - } |
|
| 331 | - else { |
|
| 355 | + if ($line->element == 'propaldet') { |
|
| 356 | + $res = $line->update($notrigger); |
|
| 357 | + } else { |
|
| 358 | + $res = $line->update($user, $notrigger); |
|
| 359 | + } |
|
| 360 | + } else { |
|
| 332 | 361 | if(in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) { |
| 333 | - if(empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label |
|
| 362 | + if(empty($line->label)) { |
|
| 363 | + $line->label = $line->description; |
|
| 364 | + } |
|
| 365 | + // supplier lines don't have the field label |
|
| 334 | 366 | |
| 335 | 367 | require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
| 336 | 368 | $extrafields=new ExtraFields($object->db); |
@@ -338,7 +370,9 @@ discard block |
||
| 338 | 370 | $line->fetch_optionals($line->id,$extralabels); |
| 339 | 371 | } |
| 340 | 372 | $line->array_options['options_subtotal_nc'] = 0; |
| 341 | - if($object->element == 'order_supplier') $line->update($user); |
|
| 373 | + if($object->element == 'order_supplier') { |
|
| 374 | + $line->update($user); |
|
| 375 | + } |
|
| 342 | 376 | $res = TSubtotal::doUpdateLine($object, $line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->product_type, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $notrigger); |
| 343 | 377 | } |
| 344 | 378 | |
@@ -36,68 +36,68 @@ discard block |
||
| 36 | 36 | class Interfacesubtotaltrigger |
| 37 | 37 | { |
| 38 | 38 | |
| 39 | - private $db; |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * Constructor |
|
| 43 | - * |
|
| 44 | - * @param DoliDB $db Database handler |
|
| 45 | - */ |
|
| 46 | - public function __construct($db) |
|
| 47 | - { |
|
| 48 | - $this->db = $db; |
|
| 49 | - |
|
| 50 | - $this->name = preg_replace('/^Interface/i', '', get_class($this)); |
|
| 51 | - $this->family = "demo"; |
|
| 52 | - $this->description = "Triggers of this module are empty functions." |
|
| 53 | - . "They have no effect." |
|
| 54 | - . "They are provided for tutorial purpose only."; |
|
| 55 | - // 'development', 'experimental', 'dolibarr' or version |
|
| 56 | - $this->version = 'development'; |
|
| 57 | - $this->picto = 'titre@titre'; |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * Trigger name |
|
| 62 | - * |
|
| 63 | - * @return string Name of trigger file |
|
| 64 | - */ |
|
| 65 | - public function getName() |
|
| 66 | - { |
|
| 67 | - return $this->name; |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * Trigger description |
|
| 72 | - * |
|
| 73 | - * @return string Description of trigger file |
|
| 74 | - */ |
|
| 75 | - public function getDesc() |
|
| 76 | - { |
|
| 77 | - return $this->description; |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * Trigger version |
|
| 82 | - * |
|
| 83 | - * @return string Version of trigger file |
|
| 84 | - */ |
|
| 85 | - public function getVersion() |
|
| 86 | - { |
|
| 87 | - global $langs; |
|
| 88 | - $langs->load("admin"); |
|
| 89 | - |
|
| 90 | - if ($this->version == 'development') { |
|
| 91 | - return $langs->trans("Development"); |
|
| 92 | - } elseif ($this->version == 'experimental') |
|
| 93 | - |
|
| 94 | - return $langs->trans("Experimental"); |
|
| 95 | - elseif ($this->version == 'dolibarr') return DOL_VERSION; |
|
| 96 | - elseif ($this->version) return $this->version; |
|
| 97 | - else { |
|
| 98 | - return $langs->trans("Unknown"); |
|
| 99 | - } |
|
| 100 | - } |
|
| 39 | + private $db; |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * Constructor |
|
| 43 | + * |
|
| 44 | + * @param DoliDB $db Database handler |
|
| 45 | + */ |
|
| 46 | + public function __construct($db) |
|
| 47 | + { |
|
| 48 | + $this->db = $db; |
|
| 49 | + |
|
| 50 | + $this->name = preg_replace('/^Interface/i', '', get_class($this)); |
|
| 51 | + $this->family = "demo"; |
|
| 52 | + $this->description = "Triggers of this module are empty functions." |
|
| 53 | + . "They have no effect." |
|
| 54 | + . "They are provided for tutorial purpose only."; |
|
| 55 | + // 'development', 'experimental', 'dolibarr' or version |
|
| 56 | + $this->version = 'development'; |
|
| 57 | + $this->picto = 'titre@titre'; |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * Trigger name |
|
| 62 | + * |
|
| 63 | + * @return string Name of trigger file |
|
| 64 | + */ |
|
| 65 | + public function getName() |
|
| 66 | + { |
|
| 67 | + return $this->name; |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * Trigger description |
|
| 72 | + * |
|
| 73 | + * @return string Description of trigger file |
|
| 74 | + */ |
|
| 75 | + public function getDesc() |
|
| 76 | + { |
|
| 77 | + return $this->description; |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * Trigger version |
|
| 82 | + * |
|
| 83 | + * @return string Version of trigger file |
|
| 84 | + */ |
|
| 85 | + public function getVersion() |
|
| 86 | + { |
|
| 87 | + global $langs; |
|
| 88 | + $langs->load("admin"); |
|
| 89 | + |
|
| 90 | + if ($this->version == 'development') { |
|
| 91 | + return $langs->trans("Development"); |
|
| 92 | + } elseif ($this->version == 'experimental') |
|
| 93 | + |
|
| 94 | + return $langs->trans("Experimental"); |
|
| 95 | + elseif ($this->version == 'dolibarr') return DOL_VERSION; |
|
| 96 | + elseif ($this->version) return $this->version; |
|
| 97 | + else { |
|
| 98 | + return $langs->trans("Unknown"); |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | 102 | public function addToBegin(&$parent, &$object, $rang) |
| 103 | 103 | { |
@@ -147,27 +147,27 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - /** |
|
| 151 | - * Function called when a Dolibarrr business event is done. |
|
| 152 | - * All functions "run_trigger" are triggered if file |
|
| 153 | - * is inside directory core/triggers |
|
| 154 | - * |
|
| 155 | - * @param string $action Event action code |
|
| 156 | - * @param Object $object Object |
|
| 157 | - * @param User $user Object user |
|
| 158 | - * @param Translate $langs Object langs |
|
| 159 | - * @param conf $conf Object conf |
|
| 160 | - * @return int <0 if KO, 0 if no triggered ran, >0 if OK |
|
| 161 | - */ |
|
| 162 | - public function run_trigger($action, $object, $user, $langs, $conf) |
|
| 163 | - { |
|
| 164 | - // Put here code you want to execute when a Dolibarr business events occurs. |
|
| 165 | - // Data and type of action are stored into $object and $action |
|
| 166 | - // Users |
|
| 167 | - dol_include_once('/subtotal/class/subtotal.class.php'); |
|
| 168 | - $langs->load('subtotal@subtotal'); |
|
| 150 | + /** |
|
| 151 | + * Function called when a Dolibarrr business event is done. |
|
| 152 | + * All functions "run_trigger" are triggered if file |
|
| 153 | + * is inside directory core/triggers |
|
| 154 | + * |
|
| 155 | + * @param string $action Event action code |
|
| 156 | + * @param Object $object Object |
|
| 157 | + * @param User $user Object user |
|
| 158 | + * @param Translate $langs Object langs |
|
| 159 | + * @param conf $conf Object conf |
|
| 160 | + * @return int <0 if KO, 0 if no triggered ran, >0 if OK |
|
| 161 | + */ |
|
| 162 | + public function run_trigger($action, $object, $user, $langs, $conf) |
|
| 163 | + { |
|
| 164 | + // Put here code you want to execute when a Dolibarr business events occurs. |
|
| 165 | + // Data and type of action are stored into $object and $action |
|
| 166 | + // Users |
|
| 167 | + dol_include_once('/subtotal/class/subtotal.class.php'); |
|
| 168 | + $langs->load('subtotal@subtotal'); |
|
| 169 | 169 | |
| 170 | - if (!empty($conf->global->SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE) && in_array($action, array('LINEPROPAL_INSERT', 'LINEORDER_INSERT', 'LINEBILL_INSERT'))) |
|
| 170 | + if (!empty($conf->global->SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE) && in_array($action, array('LINEPROPAL_INSERT', 'LINEORDER_INSERT', 'LINEBILL_INSERT'))) |
|
| 171 | 171 | { |
| 172 | 172 | |
| 173 | 173 | $rang = GETPOST('under_title', 'int'); // Rang du titre |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | |
| 202 | - if ($action == 'LINEBILL_INSERT' && $object->special_code != TSubtotal::$module_number) |
|
| 202 | + if ($action == 'LINEBILL_INSERT' && $object->special_code != TSubtotal::$module_number) |
|
| 203 | 203 | { |
| 204 | 204 | $subtotal_add_title_bloc_from_orderstoinvoice = GETPOST('subtotal_add_title_bloc_from_orderstoinvoice'); |
| 205 | 205 | if (!empty($subtotal_add_title_bloc_from_orderstoinvoice)) |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($action, array('LINEPROPAL_INSERT', 'LINEPROPAL_UPDATE', 'LINEORDER_INSERT', 'LINEORDER_UPDATE', 'LINEBILL_INSERT', 'LINEBILL_UPDATE'))) |
| 257 | 257 | { |
| 258 | - if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php'); |
|
| 258 | + if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php'); |
|
| 259 | 259 | |
| 260 | 260 | $doli_action = GETPOST('action'); |
| 261 | 261 | $set = GETPOST('set'); |
@@ -321,173 +321,173 @@ discard block |
||
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | |
| 324 | - if ($action == 'USER_LOGIN') { |
|
| 325 | - dol_syslog( |
|
| 326 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 327 | - ); |
|
| 328 | - } elseif ($action == 'USER_UPDATE_SESSION') { |
|
| 329 | - // Warning: To increase performances, this action is triggered only if |
|
| 330 | - // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. |
|
| 331 | - dol_syslog( |
|
| 332 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 333 | - ); |
|
| 334 | - } elseif ($action == 'USER_CREATE') { |
|
| 335 | - dol_syslog( |
|
| 336 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 337 | - ); |
|
| 338 | - } elseif ($action == 'USER_CREATE_FROM_CONTACT') { |
|
| 339 | - dol_syslog( |
|
| 340 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 341 | - ); |
|
| 342 | - } elseif ($action == 'USER_MODIFY') { |
|
| 343 | - dol_syslog( |
|
| 344 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 345 | - ); |
|
| 346 | - } elseif ($action == 'USER_NEW_PASSWORD') { |
|
| 347 | - dol_syslog( |
|
| 348 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 349 | - ); |
|
| 350 | - } elseif ($action == 'USER_ENABLEDISABLE') { |
|
| 351 | - dol_syslog( |
|
| 352 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 353 | - ); |
|
| 354 | - } elseif ($action == 'USER_DELETE') { |
|
| 355 | - dol_syslog( |
|
| 356 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 357 | - ); |
|
| 358 | - } elseif ($action == 'USER_LOGOUT') { |
|
| 359 | - dol_syslog( |
|
| 360 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 361 | - ); |
|
| 362 | - } elseif ($action == 'USER_SETINGROUP') { |
|
| 363 | - dol_syslog( |
|
| 364 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 365 | - ); |
|
| 366 | - } elseif ($action == 'USER_REMOVEFROMGROUP') { |
|
| 367 | - dol_syslog( |
|
| 368 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 369 | - ); |
|
| 370 | - } |
|
| 371 | - |
|
| 372 | - // Groups |
|
| 373 | - elseif ($action == 'GROUP_CREATE') { |
|
| 374 | - dol_syslog( |
|
| 375 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 376 | - ); |
|
| 377 | - } elseif ($action == 'GROUP_MODIFY') { |
|
| 378 | - dol_syslog( |
|
| 379 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 380 | - ); |
|
| 381 | - } elseif ($action == 'GROUP_DELETE') { |
|
| 382 | - dol_syslog( |
|
| 383 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 384 | - ); |
|
| 385 | - } |
|
| 386 | - |
|
| 387 | - // Companies |
|
| 388 | - elseif ($action == 'COMPANY_CREATE') { |
|
| 389 | - dol_syslog( |
|
| 390 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 391 | - ); |
|
| 392 | - } elseif ($action == 'COMPANY_MODIFY') { |
|
| 393 | - dol_syslog( |
|
| 394 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 395 | - ); |
|
| 396 | - } elseif ($action == 'COMPANY_DELETE') { |
|
| 397 | - dol_syslog( |
|
| 398 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 399 | - ); |
|
| 400 | - } |
|
| 401 | - |
|
| 402 | - // Contacts |
|
| 403 | - elseif ($action == 'CONTACT_CREATE') { |
|
| 404 | - dol_syslog( |
|
| 405 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 406 | - ); |
|
| 407 | - } elseif ($action == 'CONTACT_MODIFY') { |
|
| 408 | - dol_syslog( |
|
| 409 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 410 | - ); |
|
| 411 | - } elseif ($action == 'CONTACT_DELETE') { |
|
| 412 | - dol_syslog( |
|
| 413 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 414 | - ); |
|
| 415 | - } |
|
| 416 | - |
|
| 417 | - // Products |
|
| 418 | - elseif ($action == 'PRODUCT_CREATE') { |
|
| 419 | - dol_syslog( |
|
| 420 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 421 | - ); |
|
| 422 | - } elseif ($action == 'PRODUCT_MODIFY') { |
|
| 423 | - dol_syslog( |
|
| 424 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 425 | - ); |
|
| 426 | - } elseif ($action == 'PRODUCT_DELETE') { |
|
| 427 | - dol_syslog( |
|
| 428 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 429 | - ); |
|
| 430 | - } |
|
| 431 | - |
|
| 432 | - // Customer orders |
|
| 433 | - elseif ($action == 'ORDER_CREATE') { |
|
| 434 | - dol_syslog( |
|
| 435 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 436 | - ); |
|
| 437 | - } elseif ($action == 'ORDER_VALIDATE') { |
|
| 438 | - dol_syslog( |
|
| 439 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 440 | - ); |
|
| 441 | - } elseif ($action == 'ORDER_DELETE') { |
|
| 442 | - dol_syslog( |
|
| 443 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 444 | - ); |
|
| 445 | - } elseif ($action == 'ORDER_BUILDDOC') { |
|
| 446 | - dol_syslog( |
|
| 447 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 448 | - ); |
|
| 449 | - } elseif ($action == 'ORDER_SENTBYMAIL') { |
|
| 450 | - dol_syslog( |
|
| 451 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 452 | - ); |
|
| 453 | - } elseif ($action == 'LINEORDER_INSERT') { |
|
| 454 | - dol_syslog( |
|
| 455 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 456 | - ); |
|
| 457 | - } elseif ($action == 'LINEORDER_DELETE') { |
|
| 458 | - dol_syslog( |
|
| 459 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 460 | - ); |
|
| 461 | - } |
|
| 462 | - |
|
| 463 | - // Supplier orders |
|
| 464 | - elseif ($action == 'ORDER_SUPPLIER_CREATE') { |
|
| 465 | - dol_syslog( |
|
| 466 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 467 | - ); |
|
| 468 | - } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { |
|
| 469 | - dol_syslog( |
|
| 470 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 471 | - ); |
|
| 472 | - } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { |
|
| 473 | - dol_syslog( |
|
| 474 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 475 | - ); |
|
| 476 | - } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') { |
|
| 477 | - dol_syslog( |
|
| 478 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 479 | - ); |
|
| 480 | - } |
|
| 481 | - |
|
| 482 | - // Proposals |
|
| 483 | - elseif ($action == 'PROPAL_CREATE') { |
|
| 484 | - dol_syslog( |
|
| 485 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 486 | - ); |
|
| 487 | - } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) { |
|
| 488 | - dol_syslog( |
|
| 489 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 490 | - ); |
|
| 324 | + if ($action == 'USER_LOGIN') { |
|
| 325 | + dol_syslog( |
|
| 326 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 327 | + ); |
|
| 328 | + } elseif ($action == 'USER_UPDATE_SESSION') { |
|
| 329 | + // Warning: To increase performances, this action is triggered only if |
|
| 330 | + // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. |
|
| 331 | + dol_syslog( |
|
| 332 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 333 | + ); |
|
| 334 | + } elseif ($action == 'USER_CREATE') { |
|
| 335 | + dol_syslog( |
|
| 336 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 337 | + ); |
|
| 338 | + } elseif ($action == 'USER_CREATE_FROM_CONTACT') { |
|
| 339 | + dol_syslog( |
|
| 340 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 341 | + ); |
|
| 342 | + } elseif ($action == 'USER_MODIFY') { |
|
| 343 | + dol_syslog( |
|
| 344 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 345 | + ); |
|
| 346 | + } elseif ($action == 'USER_NEW_PASSWORD') { |
|
| 347 | + dol_syslog( |
|
| 348 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 349 | + ); |
|
| 350 | + } elseif ($action == 'USER_ENABLEDISABLE') { |
|
| 351 | + dol_syslog( |
|
| 352 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 353 | + ); |
|
| 354 | + } elseif ($action == 'USER_DELETE') { |
|
| 355 | + dol_syslog( |
|
| 356 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 357 | + ); |
|
| 358 | + } elseif ($action == 'USER_LOGOUT') { |
|
| 359 | + dol_syslog( |
|
| 360 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 361 | + ); |
|
| 362 | + } elseif ($action == 'USER_SETINGROUP') { |
|
| 363 | + dol_syslog( |
|
| 364 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 365 | + ); |
|
| 366 | + } elseif ($action == 'USER_REMOVEFROMGROUP') { |
|
| 367 | + dol_syslog( |
|
| 368 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 369 | + ); |
|
| 370 | + } |
|
| 371 | + |
|
| 372 | + // Groups |
|
| 373 | + elseif ($action == 'GROUP_CREATE') { |
|
| 374 | + dol_syslog( |
|
| 375 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 376 | + ); |
|
| 377 | + } elseif ($action == 'GROUP_MODIFY') { |
|
| 378 | + dol_syslog( |
|
| 379 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 380 | + ); |
|
| 381 | + } elseif ($action == 'GROUP_DELETE') { |
|
| 382 | + dol_syslog( |
|
| 383 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 384 | + ); |
|
| 385 | + } |
|
| 386 | + |
|
| 387 | + // Companies |
|
| 388 | + elseif ($action == 'COMPANY_CREATE') { |
|
| 389 | + dol_syslog( |
|
| 390 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 391 | + ); |
|
| 392 | + } elseif ($action == 'COMPANY_MODIFY') { |
|
| 393 | + dol_syslog( |
|
| 394 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 395 | + ); |
|
| 396 | + } elseif ($action == 'COMPANY_DELETE') { |
|
| 397 | + dol_syslog( |
|
| 398 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 399 | + ); |
|
| 400 | + } |
|
| 401 | + |
|
| 402 | + // Contacts |
|
| 403 | + elseif ($action == 'CONTACT_CREATE') { |
|
| 404 | + dol_syslog( |
|
| 405 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 406 | + ); |
|
| 407 | + } elseif ($action == 'CONTACT_MODIFY') { |
|
| 408 | + dol_syslog( |
|
| 409 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 410 | + ); |
|
| 411 | + } elseif ($action == 'CONTACT_DELETE') { |
|
| 412 | + dol_syslog( |
|
| 413 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 414 | + ); |
|
| 415 | + } |
|
| 416 | + |
|
| 417 | + // Products |
|
| 418 | + elseif ($action == 'PRODUCT_CREATE') { |
|
| 419 | + dol_syslog( |
|
| 420 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 421 | + ); |
|
| 422 | + } elseif ($action == 'PRODUCT_MODIFY') { |
|
| 423 | + dol_syslog( |
|
| 424 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 425 | + ); |
|
| 426 | + } elseif ($action == 'PRODUCT_DELETE') { |
|
| 427 | + dol_syslog( |
|
| 428 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 429 | + ); |
|
| 430 | + } |
|
| 431 | + |
|
| 432 | + // Customer orders |
|
| 433 | + elseif ($action == 'ORDER_CREATE') { |
|
| 434 | + dol_syslog( |
|
| 435 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 436 | + ); |
|
| 437 | + } elseif ($action == 'ORDER_VALIDATE') { |
|
| 438 | + dol_syslog( |
|
| 439 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 440 | + ); |
|
| 441 | + } elseif ($action == 'ORDER_DELETE') { |
|
| 442 | + dol_syslog( |
|
| 443 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 444 | + ); |
|
| 445 | + } elseif ($action == 'ORDER_BUILDDOC') { |
|
| 446 | + dol_syslog( |
|
| 447 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 448 | + ); |
|
| 449 | + } elseif ($action == 'ORDER_SENTBYMAIL') { |
|
| 450 | + dol_syslog( |
|
| 451 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 452 | + ); |
|
| 453 | + } elseif ($action == 'LINEORDER_INSERT') { |
|
| 454 | + dol_syslog( |
|
| 455 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 456 | + ); |
|
| 457 | + } elseif ($action == 'LINEORDER_DELETE') { |
|
| 458 | + dol_syslog( |
|
| 459 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 460 | + ); |
|
| 461 | + } |
|
| 462 | + |
|
| 463 | + // Supplier orders |
|
| 464 | + elseif ($action == 'ORDER_SUPPLIER_CREATE') { |
|
| 465 | + dol_syslog( |
|
| 466 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 467 | + ); |
|
| 468 | + } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { |
|
| 469 | + dol_syslog( |
|
| 470 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 471 | + ); |
|
| 472 | + } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { |
|
| 473 | + dol_syslog( |
|
| 474 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 475 | + ); |
|
| 476 | + } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') { |
|
| 477 | + dol_syslog( |
|
| 478 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 479 | + ); |
|
| 480 | + } |
|
| 481 | + |
|
| 482 | + // Proposals |
|
| 483 | + elseif ($action == 'PROPAL_CREATE') { |
|
| 484 | + dol_syslog( |
|
| 485 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 486 | + ); |
|
| 487 | + } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) { |
|
| 488 | + dol_syslog( |
|
| 489 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 490 | + ); |
|
| 491 | 491 | |
| 492 | 492 | $doli_action = GETPOST('action'); |
| 493 | 493 | |
@@ -520,277 +520,277 @@ discard block |
||
| 520 | 520 | if (!empty($line)) $object->update_price(1); |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | - } elseif ($action == 'PROPAL_MODIFY') { |
|
| 524 | - dol_syslog( |
|
| 525 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 526 | - ); |
|
| 527 | - } elseif ($action == 'PROPAL_VALIDATE') { |
|
| 528 | - dol_syslog( |
|
| 529 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 530 | - ); |
|
| 531 | - } elseif ($action == 'PROPAL_BUILDDOC') { |
|
| 532 | - dol_syslog( |
|
| 533 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 534 | - ); |
|
| 535 | - } elseif ($action == 'PROPAL_SENTBYMAIL') { |
|
| 536 | - dol_syslog( |
|
| 537 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 538 | - ); |
|
| 539 | - } elseif ($action == 'PROPAL_CLOSE_SIGNED') { |
|
| 540 | - dol_syslog( |
|
| 541 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 542 | - ); |
|
| 543 | - } elseif ($action == 'PROPAL_CLOSE_REFUSED') { |
|
| 544 | - dol_syslog( |
|
| 545 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 546 | - ); |
|
| 547 | - } elseif ($action == 'PROPAL_DELETE') { |
|
| 548 | - dol_syslog( |
|
| 549 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 550 | - ); |
|
| 551 | - } elseif ($action == 'LINEPROPAL_INSERT') { |
|
| 552 | - dol_syslog( |
|
| 553 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 554 | - ); |
|
| 555 | - } elseif ($action == 'LINEPROPAL_MODIFY') { |
|
| 556 | - dol_syslog( |
|
| 557 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 558 | - ); |
|
| 559 | - } elseif ($action == 'LINEPROPAL_DELETE') { |
|
| 560 | - dol_syslog( |
|
| 561 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 562 | - ); |
|
| 563 | - } |
|
| 564 | - |
|
| 565 | - // Contracts |
|
| 566 | - elseif ($action == 'CONTRACT_CREATE') { |
|
| 567 | - dol_syslog( |
|
| 568 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 569 | - ); |
|
| 570 | - } elseif ($action == 'CONTRACT_MODIFY') { |
|
| 571 | - dol_syslog( |
|
| 572 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 573 | - ); |
|
| 574 | - } elseif ($action == 'CONTRACT_ACTIVATE') { |
|
| 575 | - dol_syslog( |
|
| 576 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 577 | - ); |
|
| 578 | - } elseif ($action == 'CONTRACT_CANCEL') { |
|
| 579 | - dol_syslog( |
|
| 580 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 581 | - ); |
|
| 582 | - } elseif ($action == 'CONTRACT_CLOSE') { |
|
| 583 | - dol_syslog( |
|
| 584 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 585 | - ); |
|
| 586 | - } elseif ($action == 'CONTRACT_DELETE') { |
|
| 587 | - dol_syslog( |
|
| 588 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 589 | - ); |
|
| 590 | - } |
|
| 523 | + } elseif ($action == 'PROPAL_MODIFY') { |
|
| 524 | + dol_syslog( |
|
| 525 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 526 | + ); |
|
| 527 | + } elseif ($action == 'PROPAL_VALIDATE') { |
|
| 528 | + dol_syslog( |
|
| 529 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 530 | + ); |
|
| 531 | + } elseif ($action == 'PROPAL_BUILDDOC') { |
|
| 532 | + dol_syslog( |
|
| 533 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 534 | + ); |
|
| 535 | + } elseif ($action == 'PROPAL_SENTBYMAIL') { |
|
| 536 | + dol_syslog( |
|
| 537 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 538 | + ); |
|
| 539 | + } elseif ($action == 'PROPAL_CLOSE_SIGNED') { |
|
| 540 | + dol_syslog( |
|
| 541 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 542 | + ); |
|
| 543 | + } elseif ($action == 'PROPAL_CLOSE_REFUSED') { |
|
| 544 | + dol_syslog( |
|
| 545 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 546 | + ); |
|
| 547 | + } elseif ($action == 'PROPAL_DELETE') { |
|
| 548 | + dol_syslog( |
|
| 549 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 550 | + ); |
|
| 551 | + } elseif ($action == 'LINEPROPAL_INSERT') { |
|
| 552 | + dol_syslog( |
|
| 553 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 554 | + ); |
|
| 555 | + } elseif ($action == 'LINEPROPAL_MODIFY') { |
|
| 556 | + dol_syslog( |
|
| 557 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 558 | + ); |
|
| 559 | + } elseif ($action == 'LINEPROPAL_DELETE') { |
|
| 560 | + dol_syslog( |
|
| 561 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 562 | + ); |
|
| 563 | + } |
|
| 564 | + |
|
| 565 | + // Contracts |
|
| 566 | + elseif ($action == 'CONTRACT_CREATE') { |
|
| 567 | + dol_syslog( |
|
| 568 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 569 | + ); |
|
| 570 | + } elseif ($action == 'CONTRACT_MODIFY') { |
|
| 571 | + dol_syslog( |
|
| 572 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 573 | + ); |
|
| 574 | + } elseif ($action == 'CONTRACT_ACTIVATE') { |
|
| 575 | + dol_syslog( |
|
| 576 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 577 | + ); |
|
| 578 | + } elseif ($action == 'CONTRACT_CANCEL') { |
|
| 579 | + dol_syslog( |
|
| 580 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 581 | + ); |
|
| 582 | + } elseif ($action == 'CONTRACT_CLOSE') { |
|
| 583 | + dol_syslog( |
|
| 584 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 585 | + ); |
|
| 586 | + } elseif ($action == 'CONTRACT_DELETE') { |
|
| 587 | + dol_syslog( |
|
| 588 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 589 | + ); |
|
| 590 | + } |
|
| 591 | 591 | |
| 592 | 592 | elseif ($action == 'BILL_MODIFY') { |
| 593 | - dol_syslog( |
|
| 594 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 595 | - ); |
|
| 596 | - } elseif ($action == 'BILL_VALIDATE') { |
|
| 597 | - dol_syslog( |
|
| 598 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 599 | - ); |
|
| 600 | - } elseif ($action == 'BILL_BUILDDOC') { |
|
| 601 | - dol_syslog( |
|
| 602 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 603 | - ); |
|
| 604 | - } elseif ($action == 'BILL_SENTBYMAIL') { |
|
| 605 | - dol_syslog( |
|
| 606 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 607 | - ); |
|
| 608 | - } elseif ($action == 'BILL_CANCEL') { |
|
| 609 | - dol_syslog( |
|
| 610 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 611 | - ); |
|
| 612 | - } elseif ($action == 'BILL_DELETE') { |
|
| 613 | - dol_syslog( |
|
| 614 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 615 | - ); |
|
| 616 | - } elseif ($action == 'LINEBILL_INSERT') { |
|
| 593 | + dol_syslog( |
|
| 594 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 595 | + ); |
|
| 596 | + } elseif ($action == 'BILL_VALIDATE') { |
|
| 597 | + dol_syslog( |
|
| 598 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 599 | + ); |
|
| 600 | + } elseif ($action == 'BILL_BUILDDOC') { |
|
| 601 | + dol_syslog( |
|
| 602 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 603 | + ); |
|
| 604 | + } elseif ($action == 'BILL_SENTBYMAIL') { |
|
| 605 | + dol_syslog( |
|
| 606 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 607 | + ); |
|
| 608 | + } elseif ($action == 'BILL_CANCEL') { |
|
| 609 | + dol_syslog( |
|
| 610 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 611 | + ); |
|
| 612 | + } elseif ($action == 'BILL_DELETE') { |
|
| 613 | + dol_syslog( |
|
| 614 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 615 | + ); |
|
| 616 | + } elseif ($action == 'LINEBILL_INSERT') { |
|
| 617 | 617 | |
| 618 | - dol_syslog( |
|
| 619 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 620 | - ); |
|
| 621 | - } elseif ($action == 'LINEBILL_DELETE') { |
|
| 622 | - dol_syslog( |
|
| 623 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 624 | - ); |
|
| 625 | - } |
|
| 626 | - |
|
| 627 | - // Payments |
|
| 628 | - elseif ($action == 'PAYMENT_CUSTOMER_CREATE') { |
|
| 629 | - dol_syslog( |
|
| 630 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 631 | - ); |
|
| 632 | - } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') { |
|
| 633 | - dol_syslog( |
|
| 634 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 635 | - ); |
|
| 636 | - } elseif ($action == 'PAYMENT_ADD_TO_BANK') { |
|
| 637 | - dol_syslog( |
|
| 638 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 639 | - ); |
|
| 640 | - } elseif ($action == 'PAYMENT_DELETE') { |
|
| 641 | - dol_syslog( |
|
| 642 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 643 | - ); |
|
| 644 | - } |
|
| 645 | - |
|
| 646 | - // Interventions |
|
| 647 | - elseif ($action == 'FICHEINTER_CREATE') { |
|
| 648 | - dol_syslog( |
|
| 649 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 650 | - ); |
|
| 651 | - } elseif ($action == 'FICHEINTER_MODIFY') { |
|
| 652 | - dol_syslog( |
|
| 653 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 654 | - ); |
|
| 655 | - } elseif ($action == 'FICHEINTER_VALIDATE') { |
|
| 656 | - dol_syslog( |
|
| 657 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 658 | - ); |
|
| 659 | - } elseif ($action == 'FICHEINTER_DELETE') { |
|
| 660 | - dol_syslog( |
|
| 661 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 662 | - ); |
|
| 663 | - } |
|
| 664 | - |
|
| 665 | - // Members |
|
| 666 | - elseif ($action == 'MEMBER_CREATE') { |
|
| 667 | - dol_syslog( |
|
| 668 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 669 | - ); |
|
| 670 | - } elseif ($action == 'MEMBER_VALIDATE') { |
|
| 671 | - dol_syslog( |
|
| 672 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 673 | - ); |
|
| 674 | - } elseif ($action == 'MEMBER_SUBSCRIPTION') { |
|
| 675 | - dol_syslog( |
|
| 676 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 677 | - ); |
|
| 678 | - } elseif ($action == 'MEMBER_MODIFY') { |
|
| 679 | - dol_syslog( |
|
| 680 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 681 | - ); |
|
| 682 | - } elseif ($action == 'MEMBER_NEW_PASSWORD') { |
|
| 683 | - dol_syslog( |
|
| 684 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 685 | - ); |
|
| 686 | - } elseif ($action == 'MEMBER_RESILIATE') { |
|
| 687 | - dol_syslog( |
|
| 688 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 689 | - ); |
|
| 690 | - } elseif ($action == 'MEMBER_DELETE') { |
|
| 691 | - dol_syslog( |
|
| 692 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 693 | - ); |
|
| 694 | - } |
|
| 695 | - |
|
| 696 | - // Categories |
|
| 697 | - elseif ($action == 'CATEGORY_CREATE') { |
|
| 698 | - dol_syslog( |
|
| 699 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 700 | - ); |
|
| 701 | - } elseif ($action == 'CATEGORY_MODIFY') { |
|
| 702 | - dol_syslog( |
|
| 703 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 704 | - ); |
|
| 705 | - } elseif ($action == 'CATEGORY_DELETE') { |
|
| 706 | - dol_syslog( |
|
| 707 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 708 | - ); |
|
| 709 | - } |
|
| 710 | - |
|
| 711 | - // Projects |
|
| 712 | - elseif ($action == 'PROJECT_CREATE') { |
|
| 713 | - dol_syslog( |
|
| 714 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 715 | - ); |
|
| 716 | - } elseif ($action == 'PROJECT_MODIFY') { |
|
| 717 | - dol_syslog( |
|
| 718 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 719 | - ); |
|
| 720 | - } elseif ($action == 'PROJECT_DELETE') { |
|
| 721 | - dol_syslog( |
|
| 722 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 723 | - ); |
|
| 724 | - } |
|
| 725 | - |
|
| 726 | - // Project tasks |
|
| 727 | - elseif ($action == 'TASK_CREATE') { |
|
| 728 | - dol_syslog( |
|
| 729 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 730 | - ); |
|
| 731 | - } elseif ($action == 'TASK_MODIFY') { |
|
| 732 | - dol_syslog( |
|
| 733 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 734 | - ); |
|
| 735 | - } elseif ($action == 'TASK_DELETE') { |
|
| 736 | - dol_syslog( |
|
| 737 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 738 | - ); |
|
| 739 | - } |
|
| 740 | - |
|
| 741 | - // Task time spent |
|
| 742 | - elseif ($action == 'TASK_TIMESPENT_CREATE') { |
|
| 743 | - dol_syslog( |
|
| 744 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 745 | - ); |
|
| 746 | - } elseif ($action == 'TASK_TIMESPENT_MODIFY') { |
|
| 747 | - dol_syslog( |
|
| 748 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 749 | - ); |
|
| 750 | - } elseif ($action == 'TASK_TIMESPENT_DELETE') { |
|
| 751 | - dol_syslog( |
|
| 752 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 753 | - ); |
|
| 754 | - } |
|
| 755 | - |
|
| 756 | - // Shipping |
|
| 757 | - elseif ($action == 'SHIPPING_CREATE') { |
|
| 758 | - dol_syslog( |
|
| 759 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 760 | - ); |
|
| 761 | - } elseif ($action == 'SHIPPING_MODIFY') { |
|
| 762 | - dol_syslog( |
|
| 763 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 764 | - ); |
|
| 765 | - } elseif ($action == 'SHIPPING_VALIDATE') { |
|
| 766 | - dol_syslog( |
|
| 767 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 768 | - ); |
|
| 769 | - } elseif ($action == 'SHIPPING_SENTBYMAIL') { |
|
| 770 | - dol_syslog( |
|
| 771 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 772 | - ); |
|
| 773 | - } elseif ($action == 'SHIPPING_DELETE') { |
|
| 774 | - dol_syslog( |
|
| 775 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 776 | - ); |
|
| 777 | - } elseif ($action == 'SHIPPING_BUILDDOC') { |
|
| 778 | - dol_syslog( |
|
| 779 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 780 | - ); |
|
| 781 | - } |
|
| 782 | - |
|
| 783 | - // File |
|
| 784 | - elseif ($action == 'FILE_UPLOAD') { |
|
| 785 | - dol_syslog( |
|
| 786 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 787 | - ); |
|
| 788 | - } elseif ($action == 'FILE_DELETE') { |
|
| 789 | - dol_syslog( |
|
| 790 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 791 | - ); |
|
| 792 | - } |
|
| 793 | - |
|
| 794 | - return 0; |
|
| 795 | - } |
|
| 618 | + dol_syslog( |
|
| 619 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 620 | + ); |
|
| 621 | + } elseif ($action == 'LINEBILL_DELETE') { |
|
| 622 | + dol_syslog( |
|
| 623 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 624 | + ); |
|
| 625 | + } |
|
| 626 | + |
|
| 627 | + // Payments |
|
| 628 | + elseif ($action == 'PAYMENT_CUSTOMER_CREATE') { |
|
| 629 | + dol_syslog( |
|
| 630 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 631 | + ); |
|
| 632 | + } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') { |
|
| 633 | + dol_syslog( |
|
| 634 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 635 | + ); |
|
| 636 | + } elseif ($action == 'PAYMENT_ADD_TO_BANK') { |
|
| 637 | + dol_syslog( |
|
| 638 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 639 | + ); |
|
| 640 | + } elseif ($action == 'PAYMENT_DELETE') { |
|
| 641 | + dol_syslog( |
|
| 642 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 643 | + ); |
|
| 644 | + } |
|
| 645 | + |
|
| 646 | + // Interventions |
|
| 647 | + elseif ($action == 'FICHEINTER_CREATE') { |
|
| 648 | + dol_syslog( |
|
| 649 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 650 | + ); |
|
| 651 | + } elseif ($action == 'FICHEINTER_MODIFY') { |
|
| 652 | + dol_syslog( |
|
| 653 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 654 | + ); |
|
| 655 | + } elseif ($action == 'FICHEINTER_VALIDATE') { |
|
| 656 | + dol_syslog( |
|
| 657 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 658 | + ); |
|
| 659 | + } elseif ($action == 'FICHEINTER_DELETE') { |
|
| 660 | + dol_syslog( |
|
| 661 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 662 | + ); |
|
| 663 | + } |
|
| 664 | + |
|
| 665 | + // Members |
|
| 666 | + elseif ($action == 'MEMBER_CREATE') { |
|
| 667 | + dol_syslog( |
|
| 668 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 669 | + ); |
|
| 670 | + } elseif ($action == 'MEMBER_VALIDATE') { |
|
| 671 | + dol_syslog( |
|
| 672 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 673 | + ); |
|
| 674 | + } elseif ($action == 'MEMBER_SUBSCRIPTION') { |
|
| 675 | + dol_syslog( |
|
| 676 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 677 | + ); |
|
| 678 | + } elseif ($action == 'MEMBER_MODIFY') { |
|
| 679 | + dol_syslog( |
|
| 680 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 681 | + ); |
|
| 682 | + } elseif ($action == 'MEMBER_NEW_PASSWORD') { |
|
| 683 | + dol_syslog( |
|
| 684 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 685 | + ); |
|
| 686 | + } elseif ($action == 'MEMBER_RESILIATE') { |
|
| 687 | + dol_syslog( |
|
| 688 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 689 | + ); |
|
| 690 | + } elseif ($action == 'MEMBER_DELETE') { |
|
| 691 | + dol_syslog( |
|
| 692 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 693 | + ); |
|
| 694 | + } |
|
| 695 | + |
|
| 696 | + // Categories |
|
| 697 | + elseif ($action == 'CATEGORY_CREATE') { |
|
| 698 | + dol_syslog( |
|
| 699 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 700 | + ); |
|
| 701 | + } elseif ($action == 'CATEGORY_MODIFY') { |
|
| 702 | + dol_syslog( |
|
| 703 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 704 | + ); |
|
| 705 | + } elseif ($action == 'CATEGORY_DELETE') { |
|
| 706 | + dol_syslog( |
|
| 707 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 708 | + ); |
|
| 709 | + } |
|
| 710 | + |
|
| 711 | + // Projects |
|
| 712 | + elseif ($action == 'PROJECT_CREATE') { |
|
| 713 | + dol_syslog( |
|
| 714 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 715 | + ); |
|
| 716 | + } elseif ($action == 'PROJECT_MODIFY') { |
|
| 717 | + dol_syslog( |
|
| 718 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 719 | + ); |
|
| 720 | + } elseif ($action == 'PROJECT_DELETE') { |
|
| 721 | + dol_syslog( |
|
| 722 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 723 | + ); |
|
| 724 | + } |
|
| 725 | + |
|
| 726 | + // Project tasks |
|
| 727 | + elseif ($action == 'TASK_CREATE') { |
|
| 728 | + dol_syslog( |
|
| 729 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 730 | + ); |
|
| 731 | + } elseif ($action == 'TASK_MODIFY') { |
|
| 732 | + dol_syslog( |
|
| 733 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 734 | + ); |
|
| 735 | + } elseif ($action == 'TASK_DELETE') { |
|
| 736 | + dol_syslog( |
|
| 737 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 738 | + ); |
|
| 739 | + } |
|
| 740 | + |
|
| 741 | + // Task time spent |
|
| 742 | + elseif ($action == 'TASK_TIMESPENT_CREATE') { |
|
| 743 | + dol_syslog( |
|
| 744 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 745 | + ); |
|
| 746 | + } elseif ($action == 'TASK_TIMESPENT_MODIFY') { |
|
| 747 | + dol_syslog( |
|
| 748 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 749 | + ); |
|
| 750 | + } elseif ($action == 'TASK_TIMESPENT_DELETE') { |
|
| 751 | + dol_syslog( |
|
| 752 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 753 | + ); |
|
| 754 | + } |
|
| 755 | + |
|
| 756 | + // Shipping |
|
| 757 | + elseif ($action == 'SHIPPING_CREATE') { |
|
| 758 | + dol_syslog( |
|
| 759 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 760 | + ); |
|
| 761 | + } elseif ($action == 'SHIPPING_MODIFY') { |
|
| 762 | + dol_syslog( |
|
| 763 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 764 | + ); |
|
| 765 | + } elseif ($action == 'SHIPPING_VALIDATE') { |
|
| 766 | + dol_syslog( |
|
| 767 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 768 | + ); |
|
| 769 | + } elseif ($action == 'SHIPPING_SENTBYMAIL') { |
|
| 770 | + dol_syslog( |
|
| 771 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 772 | + ); |
|
| 773 | + } elseif ($action == 'SHIPPING_DELETE') { |
|
| 774 | + dol_syslog( |
|
| 775 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 776 | + ); |
|
| 777 | + } elseif ($action == 'SHIPPING_BUILDDOC') { |
|
| 778 | + dol_syslog( |
|
| 779 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 780 | + ); |
|
| 781 | + } |
|
| 782 | + |
|
| 783 | + // File |
|
| 784 | + elseif ($action == 'FILE_UPLOAD') { |
|
| 785 | + dol_syslog( |
|
| 786 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 787 | + ); |
|
| 788 | + } elseif ($action == 'FILE_DELETE') { |
|
| 789 | + dol_syslog( |
|
| 790 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 791 | + ); |
|
| 792 | + } |
|
| 793 | + |
|
| 794 | + return 0; |
|
| 795 | + } |
|
| 796 | 796 | } |
| 797 | 797 | \ No newline at end of file |
@@ -107,13 +107,13 @@ discard block |
||
| 107 | 107 | if ($object->id != $line->id && $line->rang > $rang) |
| 108 | 108 | { |
| 109 | 109 | // Update du rang de toutes les lignes suivant mon titre |
| 110 | - $parent->updateRangOfLine($line->id, $line->rang+1); |
|
| 110 | + $parent->updateRangOfLine($line->id, $line->rang + 1); |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | // Update du rang de la ligne fraichement ajouté pour la déplacer sous mon titre |
| 115 | - $parent->updateRangOfLine($object->id, $rang+1); |
|
| 116 | - $object->rang = $rang+1; |
|
| 115 | + $parent->updateRangOfLine($object->id, $rang + 1); |
|
| 116 | + $object->rang = $rang + 1; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | public function addToEnd(&$parent, &$object, $rang) |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | if ($subtotal_line_found) |
| 138 | 138 | { |
| 139 | - $parent->updateRangOfLine($line->id, $line->rang+1); |
|
| 139 | + $parent->updateRangOfLine($line->id, $line->rang + 1); |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
@@ -255,14 +255,14 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($action, array('LINEPROPAL_INSERT', 'LINEPROPAL_UPDATE', 'LINEORDER_INSERT', 'LINEORDER_UPDATE', 'LINEBILL_INSERT', 'LINEBILL_UPDATE'))) |
| 257 | 257 | { |
| 258 | - if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php'); |
|
| 258 | + if (!function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php'); |
|
| 259 | 259 | |
| 260 | 260 | $doli_action = GETPOST('action'); |
| 261 | 261 | $set = GETPOST('set'); |
| 262 | - if ( (in_array($doli_action, array('updateligne', 'updateline', 'addline', 'add', 'create')) || $set == 'defaultTVA') && !TSubtotal::isTitle($object) && !TSubtotal::isSubtotal($object) && in_array($object->element, array('propaldet', 'commandedet', 'facturedet'))) |
|
| 262 | + if ((in_array($doli_action, array('updateligne', 'updateline', 'addline', 'add', 'create')) || $set == 'defaultTVA') && !TSubtotal::isTitle($object) && !TSubtotal::isSubtotal($object) && in_array($object->element, array('propaldet', 'commandedet', 'facturedet'))) |
|
| 263 | 263 | { |
| 264 | 264 | dol_syslog( |
| 265 | - "[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". object=".$object->element." id=" . $object->id |
|
| 265 | + "[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". object=".$object->element." id=".$object->id |
|
| 266 | 266 | ); |
| 267 | 267 | |
| 268 | 268 | $TTitle = TSubtotal::getAllTitleFromLine($object); |
@@ -282,9 +282,9 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | // $object correspond à la ligne ajoutée |
| 285 | - if(empty($object->array_options)) $object->fetch_optionals(); |
|
| 285 | + if (empty($object->array_options)) $object->fetch_optionals(); |
|
| 286 | 286 | |
| 287 | - if(! empty($object->array_options['options_subtotal_nc'])) { |
|
| 287 | + if (!empty($object->array_options['options_subtotal_nc'])) { |
|
| 288 | 288 | $object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = |
| 289 | 289 | $object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0; |
| 290 | 290 | |
@@ -296,11 +296,11 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | // Correction d'un bug lors de la création d'une commande depuis une propale qui a, au moins, une ligne NC |
| 298 | 298 | $parent_element = ''; |
| 299 | - if($object->element == 'propaldet') $parent_element = 'propal'; |
|
| 300 | - if($object->element == 'commandedet') $parent_element = 'commande'; |
|
| 301 | - if($object->element == 'facturedet') $parent_element = 'facture'; |
|
| 299 | + if ($object->element == 'propaldet') $parent_element = 'propal'; |
|
| 300 | + if ($object->element == 'commandedet') $parent_element = 'commande'; |
|
| 301 | + if ($object->element == 'facturedet') $parent_element = 'facture'; |
|
| 302 | 302 | |
| 303 | - if(! empty($parent_element) && ! empty($object->array_options['options_subtotal_nc'])) { |
|
| 303 | + if (!empty($parent_element) && !empty($object->array_options['options_subtotal_nc'])) { |
|
| 304 | 304 | _updateLineNC($parent_element, $object->{'fk_'.$parent_element}, $object->id, $object->array_options['options_subtotal_nc'], 1); |
| 305 | 305 | } |
| 306 | 306 | } |
@@ -308,12 +308,12 @@ discard block |
||
| 308 | 308 | |
| 309 | 309 | // Les lignes libres (y compris les sous-totaux) créées à partir d'une facture modèle n'ont pas la TVA de la ligne du modèle mais la TVA par défaut |
| 310 | 310 | if ($action == 'BILL_CREATE' && $object->fac_rec > 0) { |
| 311 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
| 311 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
| 312 | 312 | |
| 313 | 313 | $object->fetch_lines(); // Lignes pas rajoutées à $object->lines par les appels à addline(); |
| 314 | 314 | |
| 315 | - foreach($object->lines as &$line) { |
|
| 316 | - if(TSubtotal::isSubtotal($line) && ! empty($line->tva_tx)) { |
|
| 315 | + foreach ($object->lines as &$line) { |
|
| 316 | + if (TSubtotal::isSubtotal($line) && !empty($line->tva_tx)) { |
|
| 317 | 317 | $line->tva_tx = 0; |
| 318 | 318 | $line->update(); |
| 319 | 319 | } |
@@ -323,170 +323,170 @@ discard block |
||
| 323 | 323 | |
| 324 | 324 | if ($action == 'USER_LOGIN') { |
| 325 | 325 | dol_syslog( |
| 326 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 326 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 327 | 327 | ); |
| 328 | 328 | } elseif ($action == 'USER_UPDATE_SESSION') { |
| 329 | 329 | // Warning: To increase performances, this action is triggered only if |
| 330 | 330 | // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. |
| 331 | 331 | dol_syslog( |
| 332 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 332 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 333 | 333 | ); |
| 334 | 334 | } elseif ($action == 'USER_CREATE') { |
| 335 | 335 | dol_syslog( |
| 336 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 336 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 337 | 337 | ); |
| 338 | 338 | } elseif ($action == 'USER_CREATE_FROM_CONTACT') { |
| 339 | 339 | dol_syslog( |
| 340 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 340 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 341 | 341 | ); |
| 342 | 342 | } elseif ($action == 'USER_MODIFY') { |
| 343 | 343 | dol_syslog( |
| 344 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 344 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 345 | 345 | ); |
| 346 | 346 | } elseif ($action == 'USER_NEW_PASSWORD') { |
| 347 | 347 | dol_syslog( |
| 348 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 348 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 349 | 349 | ); |
| 350 | 350 | } elseif ($action == 'USER_ENABLEDISABLE') { |
| 351 | 351 | dol_syslog( |
| 352 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 352 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 353 | 353 | ); |
| 354 | 354 | } elseif ($action == 'USER_DELETE') { |
| 355 | 355 | dol_syslog( |
| 356 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 356 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 357 | 357 | ); |
| 358 | 358 | } elseif ($action == 'USER_LOGOUT') { |
| 359 | 359 | dol_syslog( |
| 360 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 360 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 361 | 361 | ); |
| 362 | 362 | } elseif ($action == 'USER_SETINGROUP') { |
| 363 | 363 | dol_syslog( |
| 364 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 364 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 365 | 365 | ); |
| 366 | 366 | } elseif ($action == 'USER_REMOVEFROMGROUP') { |
| 367 | 367 | dol_syslog( |
| 368 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 368 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 369 | 369 | ); |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | // Groups |
| 373 | 373 | elseif ($action == 'GROUP_CREATE') { |
| 374 | 374 | dol_syslog( |
| 375 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 375 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 376 | 376 | ); |
| 377 | 377 | } elseif ($action == 'GROUP_MODIFY') { |
| 378 | 378 | dol_syslog( |
| 379 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 379 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 380 | 380 | ); |
| 381 | 381 | } elseif ($action == 'GROUP_DELETE') { |
| 382 | 382 | dol_syslog( |
| 383 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 383 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 384 | 384 | ); |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | // Companies |
| 388 | 388 | elseif ($action == 'COMPANY_CREATE') { |
| 389 | 389 | dol_syslog( |
| 390 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 390 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 391 | 391 | ); |
| 392 | 392 | } elseif ($action == 'COMPANY_MODIFY') { |
| 393 | 393 | dol_syslog( |
| 394 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 394 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 395 | 395 | ); |
| 396 | 396 | } elseif ($action == 'COMPANY_DELETE') { |
| 397 | 397 | dol_syslog( |
| 398 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 398 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 399 | 399 | ); |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | // Contacts |
| 403 | 403 | elseif ($action == 'CONTACT_CREATE') { |
| 404 | 404 | dol_syslog( |
| 405 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 405 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 406 | 406 | ); |
| 407 | 407 | } elseif ($action == 'CONTACT_MODIFY') { |
| 408 | 408 | dol_syslog( |
| 409 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 409 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 410 | 410 | ); |
| 411 | 411 | } elseif ($action == 'CONTACT_DELETE') { |
| 412 | 412 | dol_syslog( |
| 413 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 413 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 414 | 414 | ); |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | // Products |
| 418 | 418 | elseif ($action == 'PRODUCT_CREATE') { |
| 419 | 419 | dol_syslog( |
| 420 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 420 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 421 | 421 | ); |
| 422 | 422 | } elseif ($action == 'PRODUCT_MODIFY') { |
| 423 | 423 | dol_syslog( |
| 424 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 424 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 425 | 425 | ); |
| 426 | 426 | } elseif ($action == 'PRODUCT_DELETE') { |
| 427 | 427 | dol_syslog( |
| 428 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 428 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 429 | 429 | ); |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | // Customer orders |
| 433 | 433 | elseif ($action == 'ORDER_CREATE') { |
| 434 | 434 | dol_syslog( |
| 435 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 435 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 436 | 436 | ); |
| 437 | 437 | } elseif ($action == 'ORDER_VALIDATE') { |
| 438 | 438 | dol_syslog( |
| 439 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 439 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 440 | 440 | ); |
| 441 | 441 | } elseif ($action == 'ORDER_DELETE') { |
| 442 | 442 | dol_syslog( |
| 443 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 443 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 444 | 444 | ); |
| 445 | 445 | } elseif ($action == 'ORDER_BUILDDOC') { |
| 446 | 446 | dol_syslog( |
| 447 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 447 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 448 | 448 | ); |
| 449 | 449 | } elseif ($action == 'ORDER_SENTBYMAIL') { |
| 450 | 450 | dol_syslog( |
| 451 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 451 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 452 | 452 | ); |
| 453 | 453 | } elseif ($action == 'LINEORDER_INSERT') { |
| 454 | 454 | dol_syslog( |
| 455 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 455 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 456 | 456 | ); |
| 457 | 457 | } elseif ($action == 'LINEORDER_DELETE') { |
| 458 | 458 | dol_syslog( |
| 459 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 459 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 460 | 460 | ); |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | // Supplier orders |
| 464 | 464 | elseif ($action == 'ORDER_SUPPLIER_CREATE') { |
| 465 | 465 | dol_syslog( |
| 466 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 466 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 467 | 467 | ); |
| 468 | 468 | } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { |
| 469 | 469 | dol_syslog( |
| 470 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 470 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 471 | 471 | ); |
| 472 | 472 | } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { |
| 473 | 473 | dol_syslog( |
| 474 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 474 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 475 | 475 | ); |
| 476 | 476 | } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') { |
| 477 | 477 | dol_syslog( |
| 478 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 478 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 479 | 479 | ); |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | // Proposals |
| 483 | 483 | elseif ($action == 'PROPAL_CREATE') { |
| 484 | 484 | dol_syslog( |
| 485 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 485 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 486 | 486 | ); |
| 487 | 487 | } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) { |
| 488 | 488 | dol_syslog( |
| 489 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 489 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 490 | 490 | ); |
| 491 | 491 | |
| 492 | 492 | $doli_action = GETPOST('action'); |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($doli_action, array('confirm_clone'))) |
| 495 | 495 | { |
| 496 | 496 | dol_syslog( |
| 497 | - "[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". object=".$object->element." id=" . $object->id |
|
| 497 | + "[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". object=".$object->element." id=".$object->id |
|
| 498 | 498 | ); |
| 499 | 499 | |
| 500 | 500 | // En fonction de l'objet et de la version, les lignes conservent l'id de l'objet d'origine |
@@ -522,272 +522,272 @@ discard block |
||
| 522 | 522 | |
| 523 | 523 | } elseif ($action == 'PROPAL_MODIFY') { |
| 524 | 524 | dol_syslog( |
| 525 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 525 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 526 | 526 | ); |
| 527 | 527 | } elseif ($action == 'PROPAL_VALIDATE') { |
| 528 | 528 | dol_syslog( |
| 529 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 529 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 530 | 530 | ); |
| 531 | 531 | } elseif ($action == 'PROPAL_BUILDDOC') { |
| 532 | 532 | dol_syslog( |
| 533 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 533 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 534 | 534 | ); |
| 535 | 535 | } elseif ($action == 'PROPAL_SENTBYMAIL') { |
| 536 | 536 | dol_syslog( |
| 537 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 537 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 538 | 538 | ); |
| 539 | 539 | } elseif ($action == 'PROPAL_CLOSE_SIGNED') { |
| 540 | 540 | dol_syslog( |
| 541 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 541 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 542 | 542 | ); |
| 543 | 543 | } elseif ($action == 'PROPAL_CLOSE_REFUSED') { |
| 544 | 544 | dol_syslog( |
| 545 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 545 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 546 | 546 | ); |
| 547 | 547 | } elseif ($action == 'PROPAL_DELETE') { |
| 548 | 548 | dol_syslog( |
| 549 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 549 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 550 | 550 | ); |
| 551 | 551 | } elseif ($action == 'LINEPROPAL_INSERT') { |
| 552 | 552 | dol_syslog( |
| 553 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 553 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 554 | 554 | ); |
| 555 | 555 | } elseif ($action == 'LINEPROPAL_MODIFY') { |
| 556 | 556 | dol_syslog( |
| 557 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 557 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 558 | 558 | ); |
| 559 | 559 | } elseif ($action == 'LINEPROPAL_DELETE') { |
| 560 | 560 | dol_syslog( |
| 561 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 561 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 562 | 562 | ); |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | // Contracts |
| 566 | 566 | elseif ($action == 'CONTRACT_CREATE') { |
| 567 | 567 | dol_syslog( |
| 568 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 568 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 569 | 569 | ); |
| 570 | 570 | } elseif ($action == 'CONTRACT_MODIFY') { |
| 571 | 571 | dol_syslog( |
| 572 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 572 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 573 | 573 | ); |
| 574 | 574 | } elseif ($action == 'CONTRACT_ACTIVATE') { |
| 575 | 575 | dol_syslog( |
| 576 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 576 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 577 | 577 | ); |
| 578 | 578 | } elseif ($action == 'CONTRACT_CANCEL') { |
| 579 | 579 | dol_syslog( |
| 580 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 580 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 581 | 581 | ); |
| 582 | 582 | } elseif ($action == 'CONTRACT_CLOSE') { |
| 583 | 583 | dol_syslog( |
| 584 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 584 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 585 | 585 | ); |
| 586 | 586 | } elseif ($action == 'CONTRACT_DELETE') { |
| 587 | 587 | dol_syslog( |
| 588 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 588 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 589 | 589 | ); |
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | elseif ($action == 'BILL_MODIFY') { |
| 593 | 593 | dol_syslog( |
| 594 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 594 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 595 | 595 | ); |
| 596 | 596 | } elseif ($action == 'BILL_VALIDATE') { |
| 597 | 597 | dol_syslog( |
| 598 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 598 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 599 | 599 | ); |
| 600 | 600 | } elseif ($action == 'BILL_BUILDDOC') { |
| 601 | 601 | dol_syslog( |
| 602 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 602 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 603 | 603 | ); |
| 604 | 604 | } elseif ($action == 'BILL_SENTBYMAIL') { |
| 605 | 605 | dol_syslog( |
| 606 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 606 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 607 | 607 | ); |
| 608 | 608 | } elseif ($action == 'BILL_CANCEL') { |
| 609 | 609 | dol_syslog( |
| 610 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 610 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 611 | 611 | ); |
| 612 | 612 | } elseif ($action == 'BILL_DELETE') { |
| 613 | 613 | dol_syslog( |
| 614 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 614 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 615 | 615 | ); |
| 616 | 616 | } elseif ($action == 'LINEBILL_INSERT') { |
| 617 | 617 | |
| 618 | 618 | dol_syslog( |
| 619 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 619 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 620 | 620 | ); |
| 621 | 621 | } elseif ($action == 'LINEBILL_DELETE') { |
| 622 | 622 | dol_syslog( |
| 623 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 623 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 624 | 624 | ); |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | // Payments |
| 628 | 628 | elseif ($action == 'PAYMENT_CUSTOMER_CREATE') { |
| 629 | 629 | dol_syslog( |
| 630 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 630 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 631 | 631 | ); |
| 632 | 632 | } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') { |
| 633 | 633 | dol_syslog( |
| 634 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 634 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 635 | 635 | ); |
| 636 | 636 | } elseif ($action == 'PAYMENT_ADD_TO_BANK') { |
| 637 | 637 | dol_syslog( |
| 638 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 638 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 639 | 639 | ); |
| 640 | 640 | } elseif ($action == 'PAYMENT_DELETE') { |
| 641 | 641 | dol_syslog( |
| 642 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 642 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 643 | 643 | ); |
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | // Interventions |
| 647 | 647 | elseif ($action == 'FICHEINTER_CREATE') { |
| 648 | 648 | dol_syslog( |
| 649 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 649 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 650 | 650 | ); |
| 651 | 651 | } elseif ($action == 'FICHEINTER_MODIFY') { |
| 652 | 652 | dol_syslog( |
| 653 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 653 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 654 | 654 | ); |
| 655 | 655 | } elseif ($action == 'FICHEINTER_VALIDATE') { |
| 656 | 656 | dol_syslog( |
| 657 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 657 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 658 | 658 | ); |
| 659 | 659 | } elseif ($action == 'FICHEINTER_DELETE') { |
| 660 | 660 | dol_syslog( |
| 661 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 661 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 662 | 662 | ); |
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | // Members |
| 666 | 666 | elseif ($action == 'MEMBER_CREATE') { |
| 667 | 667 | dol_syslog( |
| 668 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 668 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 669 | 669 | ); |
| 670 | 670 | } elseif ($action == 'MEMBER_VALIDATE') { |
| 671 | 671 | dol_syslog( |
| 672 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 672 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 673 | 673 | ); |
| 674 | 674 | } elseif ($action == 'MEMBER_SUBSCRIPTION') { |
| 675 | 675 | dol_syslog( |
| 676 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 676 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 677 | 677 | ); |
| 678 | 678 | } elseif ($action == 'MEMBER_MODIFY') { |
| 679 | 679 | dol_syslog( |
| 680 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 680 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 681 | 681 | ); |
| 682 | 682 | } elseif ($action == 'MEMBER_NEW_PASSWORD') { |
| 683 | 683 | dol_syslog( |
| 684 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 684 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 685 | 685 | ); |
| 686 | 686 | } elseif ($action == 'MEMBER_RESILIATE') { |
| 687 | 687 | dol_syslog( |
| 688 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 688 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 689 | 689 | ); |
| 690 | 690 | } elseif ($action == 'MEMBER_DELETE') { |
| 691 | 691 | dol_syslog( |
| 692 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 692 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 693 | 693 | ); |
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | // Categories |
| 697 | 697 | elseif ($action == 'CATEGORY_CREATE') { |
| 698 | 698 | dol_syslog( |
| 699 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 699 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 700 | 700 | ); |
| 701 | 701 | } elseif ($action == 'CATEGORY_MODIFY') { |
| 702 | 702 | dol_syslog( |
| 703 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 703 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 704 | 704 | ); |
| 705 | 705 | } elseif ($action == 'CATEGORY_DELETE') { |
| 706 | 706 | dol_syslog( |
| 707 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 707 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 708 | 708 | ); |
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | // Projects |
| 712 | 712 | elseif ($action == 'PROJECT_CREATE') { |
| 713 | 713 | dol_syslog( |
| 714 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 714 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 715 | 715 | ); |
| 716 | 716 | } elseif ($action == 'PROJECT_MODIFY') { |
| 717 | 717 | dol_syslog( |
| 718 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 718 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 719 | 719 | ); |
| 720 | 720 | } elseif ($action == 'PROJECT_DELETE') { |
| 721 | 721 | dol_syslog( |
| 722 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 722 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 723 | 723 | ); |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | // Project tasks |
| 727 | 727 | elseif ($action == 'TASK_CREATE') { |
| 728 | 728 | dol_syslog( |
| 729 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 729 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 730 | 730 | ); |
| 731 | 731 | } elseif ($action == 'TASK_MODIFY') { |
| 732 | 732 | dol_syslog( |
| 733 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 733 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 734 | 734 | ); |
| 735 | 735 | } elseif ($action == 'TASK_DELETE') { |
| 736 | 736 | dol_syslog( |
| 737 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 737 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 738 | 738 | ); |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | // Task time spent |
| 742 | 742 | elseif ($action == 'TASK_TIMESPENT_CREATE') { |
| 743 | 743 | dol_syslog( |
| 744 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 744 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 745 | 745 | ); |
| 746 | 746 | } elseif ($action == 'TASK_TIMESPENT_MODIFY') { |
| 747 | 747 | dol_syslog( |
| 748 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 748 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 749 | 749 | ); |
| 750 | 750 | } elseif ($action == 'TASK_TIMESPENT_DELETE') { |
| 751 | 751 | dol_syslog( |
| 752 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 752 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 753 | 753 | ); |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | // Shipping |
| 757 | 757 | elseif ($action == 'SHIPPING_CREATE') { |
| 758 | 758 | dol_syslog( |
| 759 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 759 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 760 | 760 | ); |
| 761 | 761 | } elseif ($action == 'SHIPPING_MODIFY') { |
| 762 | 762 | dol_syslog( |
| 763 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 763 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 764 | 764 | ); |
| 765 | 765 | } elseif ($action == 'SHIPPING_VALIDATE') { |
| 766 | 766 | dol_syslog( |
| 767 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 767 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 768 | 768 | ); |
| 769 | 769 | } elseif ($action == 'SHIPPING_SENTBYMAIL') { |
| 770 | 770 | dol_syslog( |
| 771 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 771 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 772 | 772 | ); |
| 773 | 773 | } elseif ($action == 'SHIPPING_DELETE') { |
| 774 | 774 | dol_syslog( |
| 775 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 775 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 776 | 776 | ); |
| 777 | 777 | } elseif ($action == 'SHIPPING_BUILDDOC') { |
| 778 | 778 | dol_syslog( |
| 779 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 779 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 780 | 780 | ); |
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | // File |
| 784 | 784 | elseif ($action == 'FILE_UPLOAD') { |
| 785 | 785 | dol_syslog( |
| 786 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 786 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 787 | 787 | ); |
| 788 | 788 | } elseif ($action == 'FILE_DELETE') { |
| 789 | 789 | dol_syslog( |
| 790 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
| 790 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
| 791 | 791 | ); |
| 792 | 792 | } |
| 793 | 793 | |
@@ -89,12 +89,14 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | if ($this->version == 'development') { |
| 91 | 91 | return $langs->trans("Development"); |
| 92 | - } elseif ($this->version == 'experimental') |
|
| 93 | - |
|
| 92 | + } elseif ($this->version == 'experimental') { |
|
| 93 | + |
|
| 94 | 94 | return $langs->trans("Experimental"); |
| 95 | - elseif ($this->version == 'dolibarr') return DOL_VERSION; |
|
| 96 | - elseif ($this->version) return $this->version; |
|
| 97 | - else { |
|
| 95 | + } elseif ($this->version == 'dolibarr') { |
|
| 96 | + return DOL_VERSION; |
|
| 97 | + } elseif ($this->version) { |
|
| 98 | + return $this->version; |
|
| 99 | + } else { |
|
| 98 | 100 | return $langs->trans("Unknown"); |
| 99 | 101 | } |
| 100 | 102 | } |
@@ -122,14 +124,18 @@ discard block |
||
| 122 | 124 | $subtotal_line_found = false; |
| 123 | 125 | foreach ($parent->lines as $k => &$line) |
| 124 | 126 | { |
| 125 | - if ($line->rang < $rang) continue; |
|
| 126 | - elseif ($line->rang == $rang) // Je suis sur la ligne de titre où je souhaite ajouter ma nouvelle ligne en fin de bloc |
|
| 127 | + if ($line->rang < $rang) { |
|
| 128 | + continue; |
|
| 129 | + } elseif ($line->rang == $rang) { |
|
| 130 | + // Je suis sur la ligne de titre où je souhaite ajouter ma nouvelle ligne en fin de bloc |
|
| 127 | 131 | { |
| 128 | 132 | $title_level = $line->qty; |
| 129 | 133 | } |
| 130 | - elseif (!$subtotal_line_found && $title_level > -1 && ($line->qty == 100 - $title_level)) // Le level de mon titre a été trouvé avant, donc maintenant je vais m'arrêter jusqu'à trouver un sous-total |
|
| 134 | + } elseif (!$subtotal_line_found && $title_level > -1 && ($line->qty == 100 - $title_level)) { |
|
| 135 | + // Le level de mon titre a été trouvé avant, donc maintenant je vais m'arrêter jusqu'à trouver un sous-total |
|
| 131 | 136 | { |
| 132 | 137 | $subtotal_line_found = true; |
| 138 | + } |
|
| 133 | 139 | $rang = $line->rang; |
| 134 | 140 | } |
| 135 | 141 | |
@@ -191,8 +197,11 @@ discard block |
||
| 191 | 197 | break; |
| 192 | 198 | } |
| 193 | 199 | |
| 194 | - if (!empty($conf->global->SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK)) $this->addToEnd($parent, $object, $rang); |
|
| 195 | - else $this->addToBegin($parent, $object, $rang); |
|
| 200 | + if (!empty($conf->global->SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK)) { |
|
| 201 | + $this->addToEnd($parent, $object, $rang); |
|
| 202 | + } else { |
|
| 203 | + $this->addToBegin($parent, $object, $rang); |
|
| 204 | + } |
|
| 196 | 205 | |
| 197 | 206 | } |
| 198 | 207 | |
@@ -220,7 +229,9 @@ discard block |
||
| 220 | 229 | $commande->fetch($current_fk_commande); |
| 221 | 230 | |
| 222 | 231 | $label = $conf->global->SUBTOTAL_TEXT_FOR_TITLE_ORDETSTOINVOICE; |
| 223 | - if (empty($label)) $label = 'Commande [__REFORDER__] - Référence client : [__REFCUSTOMER__]'; |
|
| 232 | + if (empty($label)) { |
|
| 233 | + $label = 'Commande [__REFORDER__] - Référence client : [__REFCUSTOMER__]'; |
|
| 234 | + } |
|
| 224 | 235 | $label = str_replace(array('__REFORDER__', '__REFCUSTOMER__'), array($commande->ref, $commande->ref_client), $label); |
| 225 | 236 | |
| 226 | 237 | TSubtotal::addTitle($facture, $label, 1, $rang); |
@@ -255,7 +266,9 @@ discard block |
||
| 255 | 266 | |
| 256 | 267 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($action, array('LINEPROPAL_INSERT', 'LINEPROPAL_UPDATE', 'LINEORDER_INSERT', 'LINEORDER_UPDATE', 'LINEBILL_INSERT', 'LINEBILL_UPDATE'))) |
| 257 | 268 | { |
| 258 | - if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php'); |
|
| 269 | + if(! function_exists('_updateLineNC')) { |
|
| 270 | + dol_include_once('/subtotal/lib/subtotal.lib.php'); |
|
| 271 | + } |
|
| 259 | 272 | |
| 260 | 273 | $doli_action = GETPOST('action'); |
| 261 | 274 | $set = GETPOST('set'); |
@@ -273,32 +286,50 @@ discard block |
||
| 273 | 286 | $object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = |
| 274 | 287 | $object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0; |
| 275 | 288 | |
| 276 | - if ($object->element == 'propal') $res = $object->update(1); |
|
| 277 | - else $res = $object->update($user, 1); |
|
| 289 | + if ($object->element == 'propal') { |
|
| 290 | + $res = $object->update(1); |
|
| 291 | + } else { |
|
| 292 | + $res = $object->update($user, 1); |
|
| 293 | + } |
|
| 278 | 294 | |
| 279 | - if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
| 295 | + if ($res > 0) { |
|
| 296 | + setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
| 297 | + } |
|
| 280 | 298 | break; |
| 281 | 299 | } |
| 282 | 300 | } |
| 283 | 301 | |
| 284 | 302 | // $object correspond à la ligne ajoutée |
| 285 | - if(empty($object->array_options)) $object->fetch_optionals(); |
|
| 303 | + if(empty($object->array_options)) { |
|
| 304 | + $object->fetch_optionals(); |
|
| 305 | + } |
|
| 286 | 306 | |
| 287 | 307 | if(! empty($object->array_options['options_subtotal_nc'])) { |
| 288 | 308 | $object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = |
| 289 | 309 | $object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0; |
| 290 | 310 | |
| 291 | - if ($object->element == 'propaldet') $res = $object->update(1); |
|
| 292 | - else $res = $object->update($user, 1); |
|
| 311 | + if ($object->element == 'propaldet') { |
|
| 312 | + $res = $object->update(1); |
|
| 313 | + } else { |
|
| 314 | + $res = $object->update($user, 1); |
|
| 315 | + } |
|
| 293 | 316 | |
| 294 | - if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
| 317 | + if ($res > 0) { |
|
| 318 | + setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
| 319 | + } |
|
| 295 | 320 | } |
| 296 | 321 | |
| 297 | 322 | // Correction d'un bug lors de la création d'une commande depuis une propale qui a, au moins, une ligne NC |
| 298 | 323 | $parent_element = ''; |
| 299 | - if($object->element == 'propaldet') $parent_element = 'propal'; |
|
| 300 | - if($object->element == 'commandedet') $parent_element = 'commande'; |
|
| 301 | - if($object->element == 'facturedet') $parent_element = 'facture'; |
|
| 324 | + if($object->element == 'propaldet') { |
|
| 325 | + $parent_element = 'propal'; |
|
| 326 | + } |
|
| 327 | + if($object->element == 'commandedet') { |
|
| 328 | + $parent_element = 'commande'; |
|
| 329 | + } |
|
| 330 | + if($object->element == 'facturedet') { |
|
| 331 | + $parent_element = 'facture'; |
|
| 332 | + } |
|
| 302 | 333 | |
| 303 | 334 | if(! empty($parent_element) && ! empty($object->array_options['options_subtotal_nc'])) { |
| 304 | 335 | _updateLineNC($parent_element, $object->{'fk_'.$parent_element}, $object->id, $object->array_options['options_subtotal_nc'], 1); |
@@ -498,26 +529,38 @@ discard block |
||
| 498 | 529 | ); |
| 499 | 530 | |
| 500 | 531 | // En fonction de l'objet et de la version, les lignes conservent l'id de l'objet d'origine |
| 501 | - if (method_exists($object, 'fetch_lines')) $object->fetch_lines(); |
|
| 502 | - else $object->fetch($object->id); |
|
| 532 | + if (method_exists($object, 'fetch_lines')) { |
|
| 533 | + $object->fetch_lines(); |
|
| 534 | + } else { |
|
| 535 | + $object->fetch($object->id); |
|
| 536 | + } |
|
| 503 | 537 | |
| 504 | 538 | foreach ($object->lines as &$line) |
| 505 | 539 | { |
| 506 | - if (empty($line->array_options)) $line->fetch_optionals(); |
|
| 540 | + if (empty($line->array_options)) { |
|
| 541 | + $line->fetch_optionals(); |
|
| 542 | + } |
|
| 507 | 543 | |
| 508 | 544 | if (!TSubtotal::isModSubtotalLine($line) && !empty($line->array_options['options_subtotal_nc'])) |
| 509 | 545 | { |
| 510 | 546 | $line->total_ht = $line->total_tva = $line->total_ttc = $line->total_localtax1 = $line->total_localtax2 = |
| 511 | 547 | $line->multicurrency_total_ht = $line->multicurrency_total_tva = $line->multicurrency_total_ttc = 0; |
| 512 | 548 | |
| 513 | - if ($line->element == 'propaldet') $res = $line->update(1); |
|
| 514 | - else $res = $line->update($user, 1); |
|
| 549 | + if ($line->element == 'propaldet') { |
|
| 550 | + $res = $line->update(1); |
|
| 551 | + } else { |
|
| 552 | + $res = $line->update($user, 1); |
|
| 553 | + } |
|
| 515 | 554 | |
| 516 | - if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
| 555 | + if ($res > 0) { |
|
| 556 | + setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
| 557 | + } |
|
| 517 | 558 | } |
| 518 | 559 | } |
| 519 | 560 | |
| 520 | - if (!empty($line)) $object->update_price(1); |
|
| 561 | + if (!empty($line)) { |
|
| 562 | + $object->update_price(1); |
|
| 563 | + } |
|
| 521 | 564 | } |
| 522 | 565 | |
| 523 | 566 | } elseif ($action == 'PROPAL_MODIFY') { |
@@ -587,9 +630,7 @@ discard block |
||
| 587 | 630 | dol_syslog( |
| 588 | 631 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
| 589 | 632 | ); |
| 590 | - } |
|
| 591 | - |
|
| 592 | - elseif ($action == 'BILL_MODIFY') { |
|
| 633 | + } elseif ($action == 'BILL_MODIFY') { |
|
| 593 | 634 | dol_syslog( |
| 594 | 635 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
| 595 | 636 | ); |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | * @var $object Facture fournisseur |
| 42 | 42 | */ |
| 43 | 43 | else if($object->element=='invoice_supplier') { |
| 44 | - $object->special_code = TSubtotal::$module_number; |
|
| 45 | - $rang = $object->line_max() + 1; |
|
| 46 | - $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
| 44 | + $object->special_code = TSubtotal::$module_number; |
|
| 45 | + $rang = $object->line_max() + 1; |
|
| 46 | + $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
| 47 | 47 | } |
| 48 | 48 | /** |
| 49 | 49 | * @var $object Propal |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | * @var $object Commande fournisseur |
| 63 | 63 | */ |
| 64 | 64 | else if($object->element=='order_supplier') { |
| 65 | - $object->special_code = TSubtotal::$module_number; |
|
| 66 | - $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9); |
|
| 65 | + $object->special_code = TSubtotal::$module_number; |
|
| 66 | + $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9); |
|
| 67 | 67 | } |
| 68 | 68 | /** |
| 69 | 69 | * @var $object Facturerec |
@@ -369,10 +369,10 @@ discard block |
||
| 369 | 369 | |
| 370 | 370 | public static function isSubtotal(&$line, $level=-1) |
| 371 | 371 | { |
| 372 | - $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90; |
|
| 373 | - if($res && $level > -1) { |
|
| 374 | - return self::getNiveau($line) == $level; |
|
| 375 | - } else return $res; |
|
| 372 | + $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90; |
|
| 373 | + if($res && $level > -1) { |
|
| 374 | + return self::getNiveau($line) == $level; |
|
| 375 | + } else return $res; |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | public static function isFreeText(&$line) |
@@ -409,16 +409,16 @@ discard block |
||
| 409 | 409 | $createRight = $user->rights->{$object->element}->creer; |
| 410 | 410 | if($object->element == 'facturerec' ) |
| 411 | 411 | { |
| 412 | - $object->statut = 0; // hack for facture rec |
|
| 413 | - $createRight = $user->rights->facture->creer; |
|
| 412 | + $object->statut = 0; // hack for facture rec |
|
| 413 | + $createRight = $user->rights->facture->creer; |
|
| 414 | 414 | } |
| 415 | 415 | elseif($object->element == 'order_supplier' ) |
| 416 | 416 | { |
| 417 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
| 417 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
| 418 | 418 | } |
| 419 | 419 | elseif($object->element == 'invoice_supplier' ) |
| 420 | 420 | { |
| 421 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
| 421 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK)) |
@@ -443,8 +443,8 @@ discard block |
||
| 443 | 443 | break; |
| 444 | 444 | |
| 445 | 445 | case 'supplier_proposal': |
| 446 | - $res = $object->addline($line->desc, $line->subprice, $line->qty, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, $line->remise_percent, 'HT', 0, $line->info_bits, $line->product_type, -1, $line->special_code, 0, 0, $line->pa_ht, $line->label, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->origin, $line->origin_id); |
|
| 447 | - break; |
|
| 446 | + $res = $object->addline($line->desc, $line->subprice, $line->qty, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, $line->remise_percent, 'HT', 0, $line->info_bits, $line->product_type, -1, $line->special_code, 0, 0, $line->pa_ht, $line->label, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->origin, $line->origin_id); |
|
| 447 | + break; |
|
| 448 | 448 | |
| 449 | 449 | case 'commande': |
| 450 | 450 | //$desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0) |
@@ -452,10 +452,10 @@ discard block |
||
| 452 | 452 | break; |
| 453 | 453 | |
| 454 | 454 | case 'order_supplier': |
| 455 | - $object->line = $line; |
|
| 456 | - $object->line->fk_commande = $object->id; |
|
| 457 | - $object->line->rang = $object->line_max() +1; |
|
| 458 | - $res = $object->line->insert(1); |
|
| 455 | + $object->line = $line; |
|
| 456 | + $object->line->fk_commande = $object->id; |
|
| 457 | + $object->line->rang = $object->line_max() +1; |
|
| 458 | + $res = $object->line->insert(1); |
|
| 459 | 459 | break; |
| 460 | 460 | |
| 461 | 461 | case 'facture': |
@@ -508,8 +508,8 @@ discard block |
||
| 508 | 508 | $object->db->commit(); |
| 509 | 509 | foreach ($TLineAdded as &$line) |
| 510 | 510 | { |
| 511 | - // ça peut paraitre non optimisé de déclancher la fonction sur toutes les lignes mais ceci est nécessaire pour réappliquer l'état exact de chaque ligne |
|
| 512 | - _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']); |
|
| 511 | + // ça peut paraitre non optimisé de déclancher la fonction sur toutes les lignes mais ceci est nécessaire pour réappliquer l'état exact de chaque ligne |
|
| 512 | + _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']); |
|
| 513 | 513 | } |
| 514 | 514 | return count($TLineAdded); |
| 515 | 515 | } |
@@ -583,33 +583,33 @@ discard block |
||
| 583 | 583 | |
| 584 | 584 | switch ($object->element) |
| 585 | 585 | { |
| 586 | - case 'propal': |
|
| 587 | - $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $date_start, $date_end, $array_options, $fk_unit, 0, $notrigger); |
|
| 588 | - break; |
|
| 586 | + case 'propal': |
|
| 587 | + $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $date_start, $date_end, $array_options, $fk_unit, 0, $notrigger); |
|
| 588 | + break; |
|
| 589 | 589 | |
| 590 | - case 'supplier_proposal': |
|
| 591 | - $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $array_options,'', $fk_unit); |
|
| 592 | - break; |
|
| 590 | + case 'supplier_proposal': |
|
| 591 | + $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $array_options,'', $fk_unit); |
|
| 592 | + break; |
|
| 593 | 593 | |
| 594 | 594 | case 'commande': |
| 595 | 595 | $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $date_start, $date_end, $type, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $special_code, $array_options, $fk_unit, 0, $notrigger); |
| 596 | 596 | break; |
| 597 | 597 | |
| 598 | 598 | case 'order_supplier': |
| 599 | - $object->special_code = SELF::$module_number; |
|
| 600 | - if (empty($desc)) $desc = $label; |
|
| 601 | - $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, 0, $date_start, $date_end, $array_options, $fk_unit); |
|
| 602 | - break; |
|
| 599 | + $object->special_code = SELF::$module_number; |
|
| 600 | + if (empty($desc)) $desc = $label; |
|
| 601 | + $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, 0, $date_start, $date_end, $array_options, $fk_unit); |
|
| 602 | + break; |
|
| 603 | 603 | |
| 604 | 604 | case 'facture': |
| 605 | 605 | $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $special_code, $array_options, $situation_percent, $fk_unit, 0, $notrigger); |
| 606 | 606 | break; |
| 607 | 607 | |
| 608 | 608 | case 'invoice_supplier': |
| 609 | - $object->special_code = SELF::$module_number; |
|
| 610 | - if (empty($desc)) $desc = $label; |
|
| 611 | - $res = $object->updateline($rowid, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, 0, $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $fk_unit); |
|
| 612 | - break; |
|
| 609 | + $object->special_code = SELF::$module_number; |
|
| 610 | + if (empty($desc)) $desc = $label; |
|
| 611 | + $res = $object->updateline($rowid, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, 0, $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $fk_unit); |
|
| 612 | + break; |
|
| 613 | 613 | |
| 614 | 614 | case 'facturerec': |
| 615 | 615 | // Add extrafields and get rang |
@@ -1000,8 +1000,8 @@ discard block |
||
| 1000 | 1000 | { |
| 1001 | 1001 | if (is_readable($logo)) |
| 1002 | 1002 | { |
| 1003 | - $height=pdf_getHeightForLogo($logo); |
|
| 1004 | - $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 1003 | + $height=pdf_getHeightForLogo($logo); |
|
| 1004 | + $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 1005 | 1005 | } |
| 1006 | 1006 | else |
| 1007 | 1007 | { |
@@ -1192,13 +1192,13 @@ discard block |
||
| 1192 | 1192 | * @param int $hidebottom Hide bottom |
| 1193 | 1193 | * @return void |
| 1194 | 1194 | */ |
| 1195 | - private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
| 1196 | - { |
|
| 1197 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
| 1198 | - $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
| 1199 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1200 | - $pdf->line($x, $y+$h, $x, $y); |
|
| 1201 | - } |
|
| 1195 | + private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
| 1196 | + { |
|
| 1197 | + if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
| 1198 | + $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
| 1199 | + if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1200 | + $pdf->line($x, $y+$h, $x, $y); |
|
| 1201 | + } |
|
| 1202 | 1202 | |
| 1203 | 1203 | |
| 1204 | 1204 | public static function concat(&$outputlangs, $files, $fileoutput='') |
@@ -1208,14 +1208,14 @@ discard block |
||
| 1208 | 1208 | if (empty($fileoutput)) $fileoutput = $file[0]; |
| 1209 | 1209 | |
| 1210 | 1210 | $pdf=pdf_getInstance(); |
| 1211 | - if (class_exists('TCPDF')) |
|
| 1212 | - { |
|
| 1213 | - $pdf->setPrintHeader(false); |
|
| 1214 | - $pdf->setPrintFooter(false); |
|
| 1215 | - } |
|
| 1216 | - $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
| 1211 | + if (class_exists('TCPDF')) |
|
| 1212 | + { |
|
| 1213 | + $pdf->setPrintHeader(false); |
|
| 1214 | + $pdf->setPrintFooter(false); |
|
| 1215 | + } |
|
| 1216 | + $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
| 1217 | 1217 | |
| 1218 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1218 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1219 | 1219 | |
| 1220 | 1220 | |
| 1221 | 1221 | foreach($files as $file) |
@@ -5,30 +5,30 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | static $module_number = 104777; |
| 7 | 7 | |
| 8 | - static function addSubTotalLine(&$object, $label, $qty, $rang=-1) { |
|
| 8 | + static function addSubTotalLine(&$object, $label, $qty, $rang = -1) { |
|
| 9 | 9 | |
| 10 | 10 | $res = 0; |
| 11 | 11 | |
| 12 | - if( (float)DOL_VERSION <= 3.4 ) { |
|
| 12 | + if ((float) DOL_VERSION <= 3.4) { |
|
| 13 | 13 | /** |
| 14 | 14 | * @var $object Facture |
| 15 | 15 | */ |
| 16 | - if($object->element=='facture') $res = $object->addline($object->id, $label, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,-1, TSubtotal::$module_number); |
|
| 16 | + if ($object->element == 'facture') $res = $object->addline($object->id, $label, 0, $qty, 0, 0, 0, 0, 0, '', '', 0, 0, '', 'HT', 0, 9, -1, TSubtotal::$module_number); |
|
| 17 | 17 | /** |
| 18 | 18 | * @var $object Propal |
| 19 | 19 | */ |
| 20 | - else if($object->element=='propal') $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,'HT',0,0,9,-1, TSubtotal::$module_number); |
|
| 20 | + else if ($object->element == 'propal') $res = $object->addline($object->id, $label, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, 0, 9, -1, TSubtotal::$module_number); |
|
| 21 | 21 | /** |
| 22 | 22 | * @var $object Commande |
| 23 | 23 | */ |
| 24 | - else if($object->element=='commande') $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,-1, TSubtotal::$module_number); |
|
| 24 | + else if ($object->element == 'commande') $res = $object->addline($object->id, $label, 0, $qty, 0, 0, 0, 0, 0, 0, 0, 'HT', 0, '', '', 9, -1, TSubtotal::$module_number); |
|
| 25 | 25 | |
| 26 | 26 | } |
| 27 | 27 | else { |
| 28 | 28 | $desc = ''; |
| 29 | 29 | |
| 30 | - $TNotElements = array ('invoice_supplier', 'order_supplier'); |
|
| 31 | - if ((float) DOL_VERSION < 6 || $qty==50 && !in_array($object->element, $TNotElements) ) { |
|
| 30 | + $TNotElements = array('invoice_supplier', 'order_supplier'); |
|
| 31 | + if ((float) DOL_VERSION < 6 || $qty == 50 && !in_array($object->element, $TNotElements)) { |
|
| 32 | 32 | $desc = $label; |
| 33 | 33 | $label = ''; |
| 34 | 34 | } |
@@ -36,39 +36,39 @@ discard block |
||
| 36 | 36 | /** |
| 37 | 37 | * @var $object Facture |
| 38 | 38 | */ |
| 39 | - if($object->element=='facture') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label); |
|
| 39 | + if ($object->element == 'facture') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, '', '', 0, 0, '', 'HT', 0, 9, $rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label); |
|
| 40 | 40 | /** |
| 41 | 41 | * @var $object Facture fournisseur |
| 42 | 42 | */ |
| 43 | - else if($object->element=='invoice_supplier') { |
|
| 43 | + else if ($object->element == 'invoice_supplier') { |
|
| 44 | 44 | $object->special_code = TSubtotal::$module_number; |
| 45 | 45 | $rang = $object->line_max() + 1; |
| 46 | - $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
| 46 | + $res = $object->addline($label, 0, 0, 0, 0, $qty, 0, 0, '', '', 0, 0, 'HT', 9, $rang); |
|
| 47 | 47 | } |
| 48 | 48 | /** |
| 49 | 49 | * @var $object Propal |
| 50 | 50 | */ |
| 51 | - else if($object->element=='propal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 51 | + else if ($object->element == 'propal') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, 0, 9, $rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 52 | 52 | /** |
| 53 | 53 | * @var $object Propal Fournisseur |
| 54 | 54 | */ |
| 55 | - else if($object->element=='supplier_proposal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 55 | + else if ($object->element == 'supplier_proposal') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, 0, 9, $rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * @var $object Commande |
| 59 | 59 | */ |
| 60 | - else if($object->element=='commande') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,$rang, TSubtotal::$module_number, 0, null, 0, $label); |
|
| 60 | + else if ($object->element == 'commande') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 0, 0, 'HT', 0, '', '', 9, $rang, TSubtotal::$module_number, 0, null, 0, $label); |
|
| 61 | 61 | /** |
| 62 | 62 | * @var $object Commande fournisseur |
| 63 | 63 | */ |
| 64 | - else if($object->element=='order_supplier') { |
|
| 64 | + else if ($object->element == 'order_supplier') { |
|
| 65 | 65 | $object->special_code = TSubtotal::$module_number; |
| 66 | - $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9); |
|
| 66 | + $res = $object->addline($label, 0, $qty, 0, 0, 0, 0, 0, '', 0, 'HT', 0, 9); |
|
| 67 | 67 | } |
| 68 | 68 | /** |
| 69 | 69 | * @var $object Facturerec |
| 70 | 70 | */ |
| 71 | - else if($object->element=='facturerec') $res = $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label); |
|
| 71 | + else if ($object->element == 'facturerec') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number, $label); |
|
| 72 | 72 | |
| 73 | 73 | } |
| 74 | 74 | |
@@ -79,20 +79,20 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | public static function generateDoc(&$object) |
| 81 | 81 | { |
| 82 | - global $conf,$langs,$db; |
|
| 82 | + global $conf, $langs, $db; |
|
| 83 | 83 | |
| 84 | 84 | if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) |
| 85 | 85 | { |
| 86 | - $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); |
|
| 87 | - $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); |
|
| 88 | - $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); |
|
| 86 | + $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); |
|
| 87 | + $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); |
|
| 88 | + $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); |
|
| 89 | 89 | |
| 90 | 90 | // Define output language |
| 91 | 91 | $outputlangs = $langs; |
| 92 | 92 | $newlang = GETPOST('lang_id', 'alpha'); |
| 93 | - if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) |
|
| 93 | + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) |
|
| 94 | 94 | $newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
| 95 | - if (! empty($newlang)) { |
|
| 95 | + if (!empty($newlang)) { |
|
| 96 | 96 | $outputlangs = new Translate("", $conf); |
| 97 | 97 | $outputlangs->setDefaultLang($newlang); |
| 98 | 98 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | else |
| 108 | 108 | { |
| 109 | - if ($object->element!= 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 109 | + if ($object->element != 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -118,11 +118,11 @@ discard block |
||
| 118 | 118 | * @param type $rang_start |
| 119 | 119 | * @param type $move_to |
| 120 | 120 | */ |
| 121 | - public static function updateRang(&$object, $rang_start, $move_to=1) |
|
| 121 | + public static function updateRang(&$object, $rang_start, $move_to = 1) |
|
| 122 | 122 | { |
| 123 | 123 | if (!class_exists('GenericObject')) require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
| 124 | 124 | |
| 125 | - $row=new GenericObject($object->db); |
|
| 125 | + $row = new GenericObject($object->db); |
|
| 126 | 126 | $row->table_element_line = $object->table_element_line; |
| 127 | 127 | $row->fk_element = $object->fk_element; |
| 128 | 128 | $row->id = $object->id; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | { |
| 132 | 132 | if ($line->rang < $rang_start) continue; |
| 133 | 133 | |
| 134 | - $row->updateRangOfLine($line->id, $line->rang+$move_to); |
|
| 134 | + $row->updateRangOfLine($line->id, $line->rang + $move_to); |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | { |
| 161 | 161 | if ($rang_to_add != -1) self::updateRang($object, $rang_to_add); |
| 162 | 162 | |
| 163 | - self::addSubTotalLine($object, $langs->trans('SubTotal'), 100-$title_niveau, $rang_to_add); |
|
| 163 | + self::addSubTotalLine($object, $langs->trans('SubTotal'), 100 - $title_niveau, $rang_to_add); |
|
| 164 | 164 | |
| 165 | 165 | $object->lines[] = $object->line; // ajout de la ligne dans le tableau de ligne (Dolibarr ne le fait pas) |
| 166 | 166 | if ($rang_to_add != -1) |
@@ -172,14 +172,14 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - public static function addTitle(&$object, $label, $level, $rang=-1) |
|
| 175 | + public static function addTitle(&$object, $label, $level, $rang = -1) |
|
| 176 | 176 | { |
| 177 | 177 | self::addSubTotalLine($object, $label, $level, $rang); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - public static function addTotal(&$object, $label, $level, $rang=-1) |
|
| 180 | + public static function addTotal(&$object, $label, $level, $rang = -1) |
|
| 181 | 181 | { |
| 182 | - self::addSubTotalLine($object, $label, (100-$level), $rang); |
|
| 182 | + self::addSubTotalLine($object, $label, (100 - $level), $rang); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * |
| 191 | 191 | * @return array |
| 192 | 192 | */ |
| 193 | - public static function getAllTitleWithoutTotalFromDocument(&$object, $get_block_total=false) |
|
| 193 | + public static function getAllTitleWithoutTotalFromDocument(&$object, $get_block_total = false) |
|
| 194 | 194 | { |
| 195 | 195 | $TTitle = self::getAllTitleFromDocument($object, $get_block_total); |
| 196 | 196 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @param boolean $return_rang_on_false si true alors renvoi le rang où devrait ce trouver le sous-total |
| 212 | 212 | * @return boolean |
| 213 | 213 | */ |
| 214 | - public static function titleHasTotalLine(&$object, &$title_line, $strict_mode=false, $return_rang_on_false=false) |
|
| 214 | + public static function titleHasTotalLine(&$object, &$title_line, $strict_mode = false, $return_rang_on_false = false) |
|
| 215 | 215 | { |
| 216 | 216 | if (empty($object->lines) || !is_array($object->lines)) return false; |
| 217 | 217 | |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | return ($return_rang_on_false) ? -1 : false; |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - public static function getAllTitleFromDocument(&$object, $get_block_total=false) |
|
| 240 | + public static function getAllTitleFromDocument(&$object, $get_block_total = false) |
|
| 241 | 241 | { |
| 242 | 242 | $TRes = array(); |
| 243 | 243 | if (!empty($object->lines)) |
@@ -358,19 +358,19 @@ discard block |
||
| 358 | 358 | return false; |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - public static function isTitle(&$line, $level=-1) |
|
| 361 | + public static function isTitle(&$line, $level = -1) |
|
| 362 | 362 | { |
| 363 | 363 | $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty <= 9; |
| 364 | - if($res && $level > -1) { |
|
| 364 | + if ($res && $level > -1) { |
|
| 365 | 365 | return $line->qty == $level; |
| 366 | 366 | } else return $res; |
| 367 | 367 | |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - public static function isSubtotal(&$line, $level=-1) |
|
| 370 | + public static function isSubtotal(&$line, $level = -1) |
|
| 371 | 371 | { |
| 372 | 372 | $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90; |
| 373 | - if($res && $level > -1) { |
|
| 373 | + if ($res && $level > -1) { |
|
| 374 | 374 | return self::getNiveau($line) == $level; |
| 375 | 375 | } else return $res; |
| 376 | 376 | } |
@@ -385,43 +385,43 @@ discard block |
||
| 385 | 385 | return self::isTitle($line) || self::isSubtotal($line) || self::isFreeText($line); |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | - public static function getFreeTextHtml(&$line, $readonly=0) |
|
| 388 | + public static function getFreeTextHtml(&$line, $readonly = 0) |
|
| 389 | 389 | { |
| 390 | 390 | global $conf; |
| 391 | 391 | |
| 392 | 392 | // Copie du fichier "objectline_edit.tpl.php" |
| 393 | 393 | // editeur wysiwyg |
| 394 | 394 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
| 395 | - $nbrows=ROWS_2; |
|
| 396 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
| 397 | - $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
|
| 398 | - $toolbarname='dolibarr_details'; |
|
| 399 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
| 400 | - $text = !empty($line->description)?$line->description:$line->label; |
|
| 401 | - $doleditor=new DolEditor('line-description',$text,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%', $readonly); |
|
| 395 | + $nbrows = ROWS_2; |
|
| 396 | + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
| 397 | + $enable = (isset($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
|
| 398 | + $toolbarname = 'dolibarr_details'; |
|
| 399 | + if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname = 'dolibarr_notes'; |
|
| 400 | + $text = !empty($line->description) ? $line->description : $line->label; |
|
| 401 | + $doleditor = new DolEditor('line-description', $text, '', 164, $toolbarname, '', false, true, $enable, $nbrows, '98%', $readonly); |
|
| 402 | 402 | return $doleditor->Create(1); |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | - public static function duplicateLines(&$object, $lineid, $withBlockLine=false) |
|
| 405 | + public static function duplicateLines(&$object, $lineid, $withBlockLine = false) |
|
| 406 | 406 | { |
| 407 | - global $db,$user,$conf; |
|
| 407 | + global $db, $user, $conf; |
|
| 408 | 408 | |
| 409 | 409 | $createRight = $user->rights->{$object->element}->creer; |
| 410 | - if($object->element == 'facturerec' ) |
|
| 410 | + if ($object->element == 'facturerec') |
|
| 411 | 411 | { |
| 412 | 412 | $object->statut = 0; // hack for facture rec |
| 413 | 413 | $createRight = $user->rights->facture->creer; |
| 414 | 414 | } |
| 415 | - elseif($object->element == 'order_supplier' ) |
|
| 415 | + elseif ($object->element == 'order_supplier') |
|
| 416 | 416 | { |
| 417 | 417 | $createRight = $user->rights->fournisseur->commande->creer; |
| 418 | 418 | } |
| 419 | - elseif($object->element == 'invoice_supplier' ) |
|
| 419 | + elseif ($object->element == 'invoice_supplier') |
|
| 420 | 420 | { |
| 421 | 421 | $createRight = $user->rights->fournisseur->facture->creer; |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK)) |
|
| 424 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK)) |
|
| 425 | 425 | { |
| 426 | 426 | dol_include_once('/subtotal/lib/subtotal.lib.php'); |
| 427 | 427 | |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | case 'order_supplier': |
| 455 | 455 | $object->line = $line; |
| 456 | 456 | $object->line->fk_commande = $object->id; |
| 457 | - $object->line->rang = $object->line_max() +1; |
|
| 457 | + $object->line->rang = $object->line_max() + 1; |
|
| 458 | 458 | $res = $object->line->insert(1); |
| 459 | 459 | break; |
| 460 | 460 | |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | { |
| 495 | 495 | $object->line_from = $line; |
| 496 | 496 | // Call trigger |
| 497 | - $result=$object->call_trigger('LINE_DUPLICATE',$user); // $object->line |
|
| 497 | + $result = $object->call_trigger('LINE_DUPLICATE', $user); // $object->line |
|
| 498 | 498 | if ($result < 0) |
| 499 | 499 | { |
| 500 | 500 | $object->db->rollback(); |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | } |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | - public static function getLinesFromTitle(&$object, $key_trad, $level=1, $under_title='', $withBlockLine=false, $key_is_id=false) |
|
| 527 | + public static function getLinesFromTitle(&$object, $key_trad, $level = 1, $under_title = '', $withBlockLine = false, $key_is_id = false) |
|
| 528 | 528 | { |
| 529 | 529 | global $langs; |
| 530 | 530 | |
@@ -536,17 +536,17 @@ discard block |
||
| 536 | 536 | |
| 537 | 537 | $TLine = array(); |
| 538 | 538 | $add_line = false; |
| 539 | - $under_title_found=false; |
|
| 539 | + $under_title_found = false; |
|
| 540 | 540 | |
| 541 | 541 | foreach ($object->lines as $key => &$line) |
| 542 | 542 | { |
| 543 | 543 | if (!$under_title_found && !empty($TTitle_under_search)) |
| 544 | 544 | { |
| 545 | - if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) $under_title_found = true; |
|
| 545 | + if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search))) $under_title_found = true; |
|
| 546 | 546 | } |
| 547 | 547 | else |
| 548 | 548 | { |
| 549 | - if ( ($key_is_id && $line->id == $key_trad) || (!$key_is_id && $line->product_type == 9 && $line->qty == $level && (in_array($line->desc, $TTitle_search) || in_array($line->label, $TTitle_search) ))) |
|
| 549 | + if (($key_is_id && $line->id == $key_trad) || (!$key_is_id && $line->product_type == 9 && $line->qty == $level && (in_array($line->desc, $TTitle_search) || in_array($line->label, $TTitle_search)))) |
|
| 550 | 550 | { |
| 551 | 551 | if ($key_is_id) $level = $line->qty; |
| 552 | 552 | |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | |
| 563 | 563 | if ($add_line) |
| 564 | 564 | { |
| 565 | - if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) continue; |
|
| 565 | + if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line))) continue; |
|
| 566 | 566 | else $TLine[] = $line; |
| 567 | 567 | } |
| 568 | 568 | } |
@@ -571,12 +571,12 @@ discard block |
||
| 571 | 571 | return $TLine; |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | - public static function getLinesFromTitleId(&$object, $lineid, $withBlockLine=false) |
|
| 574 | + public static function getLinesFromTitleId(&$object, $lineid, $withBlockLine = false) |
|
| 575 | 575 | { |
| 576 | 576 | return self::getLinesFromTitle($object, $lineid, '', '', $withBlockLine, true); |
| 577 | 577 | } |
| 578 | 578 | |
| 579 | - public static function doUpdateLine(&$object, $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $type, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null, $notrigger = 0) |
|
| 579 | + public static function doUpdateLine(&$object, $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $type, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $situation_percent = 0, $fk_unit = null, $notrigger = 0) |
|
| 580 | 580 | { |
| 581 | 581 | $res = 0; |
| 582 | 582 | $object->db->begin(); |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | break; |
| 589 | 589 | |
| 590 | 590 | case 'supplier_proposal': |
| 591 | - $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $array_options,'', $fk_unit); |
|
| 591 | + $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $array_options, '', $fk_unit); |
|
| 592 | 592 | break; |
| 593 | 593 | |
| 594 | 594 | case 'commande': |
@@ -617,9 +617,9 @@ discard block |
||
| 617 | 617 | $factureRecLine->fetch($rowid); |
| 618 | 618 | $factureRecLine->array_options = $array_options; |
| 619 | 619 | $factureRecLine->insertExtraFields(); |
| 620 | - $rang=$factureRecLine->rang; |
|
| 620 | + $rang = $factureRecLine->rang; |
|
| 621 | 621 | |
| 622 | - $fk_product=0; $fk_remise_except=''; $pu_ttc=0; |
|
| 622 | + $fk_product = 0; $fk_remise_except = ''; $pu_ttc = 0; |
|
| 623 | 623 | $res = $object->updateline($rowid, $desc, $pu, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $price_base_type, $info_bits, $fk_remise_except, $pu_ttc, $type, $rang, $special_code, $label, $fk_unit); |
| 624 | 624 | break; |
| 625 | 625 | } |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | global $db, $object; |
| 636 | 636 | |
| 637 | 637 | $TTitle = array(); |
| 638 | - if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
| 638 | + if (!empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
| 639 | 639 | else { |
| 640 | 640 | if ($origin_line->element == 'propaldet') |
| 641 | 641 | { |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | */ |
| 716 | 716 | public static function addRecapPage(&$parameters, &$origin_pdf) |
| 717 | 717 | { |
| 718 | - global $user,$conf,$langs; |
|
| 718 | + global $user, $conf, $langs; |
|
| 719 | 719 | |
| 720 | 720 | $origin_file = $parameters['file']; |
| 721 | 721 | $outputlangs = $parameters['outputlangs']; |
@@ -731,21 +731,21 @@ discard block |
||
| 731 | 731 | $objmarge->marge_droite = 10; |
| 732 | 732 | |
| 733 | 733 | $objectref = dol_sanitizeFileName($object->ref); |
| 734 | - if ($object->element == 'propal') $dir = $conf->propal->dir_output . '/' . $objectref; |
|
| 735 | - elseif ($object->element == 'commande') $dir = $conf->commande->dir_output . '/' . $objectref; |
|
| 736 | - elseif ($object->element == 'facture') $dir = $conf->facture->dir_output . '/' . $objectref; |
|
| 734 | + if ($object->element == 'propal') $dir = $conf->propal->dir_output.'/'.$objectref; |
|
| 735 | + elseif ($object->element == 'commande') $dir = $conf->commande->dir_output.'/'.$objectref; |
|
| 736 | + elseif ($object->element == 'facture') $dir = $conf->facture->dir_output.'/'.$objectref; |
|
| 737 | 737 | elseif ($object->element == 'facturerec') return; // no PDF for facturerec |
| 738 | 738 | else |
| 739 | 739 | { |
| 740 | 740 | setEventMessage($langs->trans('warning_subtotal_recap_object_element_unknown', $object->element), 'warnings'); |
| 741 | 741 | return -1; |
| 742 | 742 | } |
| 743 | - $file = $dir . '/' . $objectref . '_recap.pdf'; |
|
| 743 | + $file = $dir.'/'.$objectref.'_recap.pdf'; |
|
| 744 | 744 | |
| 745 | 745 | // $pdf=pdf_getInstance($origin_pdf->format); |
| 746 | - $pdf=pdf_getInstance(array(210, 297)); // Format A4 Portrait |
|
| 747 | - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
| 748 | - $pdf->SetAutoPageBreak(1,0); |
|
| 746 | + $pdf = pdf_getInstance(array(210, 297)); // Format A4 Portrait |
|
| 747 | + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
| 748 | + $pdf->SetAutoPageBreak(1, 0); |
|
| 749 | 749 | |
| 750 | 750 | if (class_exists('TCPDF')) |
| 751 | 751 | { |
@@ -754,49 +754,49 @@ discard block |
||
| 754 | 754 | } |
| 755 | 755 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
| 756 | 756 | // Set path to the background PDF File |
| 757 | - if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
| 757 | + if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
| 758 | 758 | { |
| 759 | 759 | $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
| 760 | 760 | $tplidx = $pdf->importPage(1); |
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | $pdf->Open(); |
| 764 | - $pagenb=0; |
|
| 765 | - $pdf->SetDrawColor(128,128,128); |
|
| 764 | + $pagenb = 0; |
|
| 765 | + $pdf->SetDrawColor(128, 128, 128); |
|
| 766 | 766 | |
| 767 | 767 | $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
| 768 | 768 | $pdf->SetSubject($outputlangs->transnoentities("subtotalRecap")); |
| 769 | 769 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
| 770 | 770 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
| 771 | 771 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("subtotalRecap")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); |
| 772 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 772 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 773 | 773 | |
| 774 | - $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
|
| 774 | + $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
|
| 775 | 775 | |
| 776 | - $pagenb=0; |
|
| 777 | - $pdf->SetDrawColor(128,128,128); |
|
| 776 | + $pagenb = 0; |
|
| 777 | + $pdf->SetDrawColor(128, 128, 128); |
|
| 778 | 778 | |
| 779 | 779 | |
| 780 | 780 | // New page |
| 781 | 781 | $pdf->AddPage(); |
| 782 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 782 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 783 | 783 | $pagenb++; |
| 784 | 784 | |
| 785 | 785 | |
| 786 | 786 | self::pagehead($objmarge, $pdf, $object, 1, $outputlangs); |
| 787 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 788 | - $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
| 789 | - $pdf->SetTextColor(0,0,0); |
|
| 787 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 788 | + $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
| 789 | + $pdf->SetTextColor(0, 0, 0); |
|
| 790 | 790 | |
| 791 | - $heightforinfotot = 25; // Height reserved to output the info and total part |
|
| 792 | - $heightforfooter = $objmarge->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
| 791 | + $heightforinfotot = 25; // Height reserved to output the info and total part |
|
| 792 | + $heightforfooter = $objmarge->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
| 793 | 793 | |
| 794 | 794 | $posx_designation = 25; |
| 795 | 795 | $posx_options = 150; |
| 796 | 796 | $posx_montant = 170; |
| 797 | 797 | |
| 798 | 798 | $tab_top = 72; |
| 799 | - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?72:20); // TODO à vérifier |
|
| 799 | + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 72 : 20); // TODO à vérifier |
|
| 800 | 800 | |
| 801 | 801 | $TTot = array('total_ht' => 0, 'total_ttc' => 0, 'TTotal_tva' => array()); |
| 802 | 802 | |
@@ -810,14 +810,14 @@ discard block |
||
| 810 | 810 | $nexY = $tab_top + 10; |
| 811 | 811 | |
| 812 | 812 | $nblignes = count($TLine); |
| 813 | - foreach($TLine as $i => &$line) |
|
| 813 | + foreach ($TLine as $i => &$line) |
|
| 814 | 814 | { |
| 815 | 815 | $curY = $nexY; |
| 816 | 816 | |
| 817 | 817 | if (self::getNiveau($line) == 1) |
| 818 | 818 | { |
| 819 | - $pdf->SetFont('','B', $default_font_size - 1); // Into loop to work with multipage |
|
| 820 | - $curY+=2; |
|
| 819 | + $pdf->SetFont('', 'B', $default_font_size - 1); // Into loop to work with multipage |
|
| 820 | + $curY += 2; |
|
| 821 | 821 | |
| 822 | 822 | $TTot['total_ht'] += $line->total_ht; |
| 823 | 823 | $TTot['total_tva'] += $line->total_tva; |
@@ -836,67 +836,67 @@ discard block |
||
| 836 | 836 | $TTot['TTotal_tva_multicurrency'][$tx] += $amount; |
| 837 | 837 | } |
| 838 | 838 | } |
| 839 | - else $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
| 839 | + else $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage |
|
| 840 | 840 | |
| 841 | - $pdf->SetTextColor(0,0,0); |
|
| 841 | + $pdf->SetTextColor(0, 0, 0); |
|
| 842 | 842 | |
| 843 | 843 | $pdf->setTopMargin($tab_top_newpage + 10); |
| 844 | - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
| 845 | - $pageposbefore=$pdf->getPage(); |
|
| 844 | + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
| 845 | + $pageposbefore = $pdf->getPage(); |
|
| 846 | 846 | |
| 847 | - $showpricebeforepagebreak=1; |
|
| 847 | + $showpricebeforepagebreak = 1; |
|
| 848 | 848 | |
| 849 | 849 | $decalage = (self::getNiveau($line) - 1) * 2; |
| 850 | 850 | |
| 851 | 851 | // Print: Designation |
| 852 | 852 | $label = $line->label; |
| 853 | - if( (float)DOL_VERSION < 6 ) { |
|
| 853 | + if ((float) DOL_VERSION < 6) { |
|
| 854 | 854 | $label = !empty($line->label) ? $line->label : $line->desc; |
| 855 | 855 | } |
| 856 | 856 | |
| 857 | 857 | |
| 858 | 858 | $pdf->startTransaction(); |
| 859 | - $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
|
| 860 | - $pageposafter=$pdf->getPage(); |
|
| 859 | + $pdf->writeHTMLCell($posx_options - $posx_designation - $decalage, 3, $posx_designation + $decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J', true); |
|
| 860 | + $pageposafter = $pdf->getPage(); |
|
| 861 | 861 | if ($pageposafter > $pageposbefore) // There is a pagebreak |
| 862 | 862 | { |
| 863 | 863 | $pdf->rollbackTransaction(true); |
| 864 | - $pageposafter=$pageposbefore; |
|
| 864 | + $pageposafter = $pageposbefore; |
|
| 865 | 865 | //print $pageposafter.'-'.$pageposbefore;exit; |
| 866 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
| 867 | - $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
|
| 866 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
| 867 | + $pdf->writeHTMLCell($posx_options - $posx_designation - $decalage, 3, $posx_designation + $decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J', true); |
|
| 868 | 868 | |
| 869 | - $pageposafter=$pdf->getPage(); |
|
| 870 | - $posyafter=$pdf->GetY(); |
|
| 869 | + $pageposafter = $pdf->getPage(); |
|
| 870 | + $posyafter = $pdf->GetY(); |
|
| 871 | 871 | //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
| 872 | - if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) // There is no space left for total+free text |
|
| 872 | + if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter + $heightforinfotot))) // There is no space left for total+free text |
|
| 873 | 873 | { |
| 874 | - if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
|
| 874 | + if ($i == ($nblignes - 1)) // No more lines, and no space left to show total, so we create a new page |
|
| 875 | 875 | { |
| 876 | - $pdf->AddPage('','',true); |
|
| 877 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 876 | + $pdf->AddPage('', '', true); |
|
| 877 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 878 | 878 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
| 879 | - $pdf->setPage($pageposafter+1); |
|
| 879 | + $pdf->setPage($pageposafter + 1); |
|
| 880 | 880 | } |
| 881 | 881 | } |
| 882 | 882 | else |
| 883 | 883 | { |
| 884 | 884 | // We found a page break |
| 885 | - $showpricebeforepagebreak=0; |
|
| 885 | + $showpricebeforepagebreak = 0; |
|
| 886 | 886 | } |
| 887 | 887 | } |
| 888 | 888 | else // No pagebreak |
| 889 | 889 | { |
| 890 | 890 | $pdf->commitTransaction(); |
| 891 | 891 | } |
| 892 | - $posYAfterDescription=$pdf->GetY(); |
|
| 892 | + $posYAfterDescription = $pdf->GetY(); |
|
| 893 | 893 | |
| 894 | 894 | $nexY = $pdf->GetY(); |
| 895 | - $pageposafter=$pdf->getPage(); |
|
| 895 | + $pageposafter = $pdf->getPage(); |
|
| 896 | 896 | |
| 897 | 897 | $pdf->setPage($pageposbefore); |
| 898 | 898 | $pdf->setTopMargin($objmarge->marge_haute); |
| 899 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 899 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 900 | 900 | |
| 901 | 901 | // We suppose that a too long description or photo were moved completely on next page |
| 902 | 902 | if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { |
@@ -909,14 +909,14 @@ discard block |
||
| 909 | 909 | if (!empty($line->total_options)) |
| 910 | 910 | { |
| 911 | 911 | $pdf->SetXY($posx_options, $curY); |
| 912 | - $pdf->MultiCell($posx_montant-$posx_options-0.8, 3, price($line->total_options, 0, $outputlangs), 0, 'R', 0); |
|
| 912 | + $pdf->MultiCell($posx_montant - $posx_options - 0.8, 3, price($line->total_options, 0, $outputlangs), 0, 'R', 0); |
|
| 913 | 913 | } |
| 914 | 914 | |
| 915 | 915 | // Print: Montant |
| 916 | 916 | $pdf->SetXY($posx_montant, $curY); |
| 917 | - $pdf->MultiCell($objmarge->page_largeur-$objmarge->marge_droite-$posx_montant-0.8, 3, price($line->total_ht, 0, $outputlangs), 0, 'R', 0); |
|
| 917 | + $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant - 0.8, 3, price($line->total_ht, 0, $outputlangs), 0, 'R', 0); |
|
| 918 | 918 | |
| 919 | - $nexY+=2; // Passe espace entre les lignes |
|
| 919 | + $nexY += 2; // Passe espace entre les lignes |
|
| 920 | 920 | |
| 921 | 921 | // Detect if some page were added automatically and output _tableau for past pages |
| 922 | 922 | while ($pagenb < $pageposafter) |
@@ -933,7 +933,7 @@ discard block |
||
| 933 | 933 | |
| 934 | 934 | $pagenb++; |
| 935 | 935 | $pdf->setPage($pagenb); |
| 936 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 936 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 937 | 937 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
| 938 | 938 | } |
| 939 | 939 | } |
@@ -943,19 +943,19 @@ discard block |
||
| 943 | 943 | if ($pagenb == 1) |
| 944 | 944 | { |
| 945 | 945 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $objmarge->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); |
| 946 | - $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
| 946 | + $bottomlasttab = $objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
| 947 | 947 | } |
| 948 | 948 | else |
| 949 | 949 | { |
| 950 | 950 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top_newpage, $objmarge->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code); |
| 951 | - $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
| 951 | + $bottomlasttab = $objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
| 952 | 952 | } |
| 953 | 953 | |
| 954 | 954 | // Affiche zone totaux |
| 955 | - $posy=self::tableau_tot($objmarge, $pdf, $object, $bottomlasttab, $outputlangs, $TTot); |
|
| 955 | + $posy = self::tableau_tot($objmarge, $pdf, $object, $bottomlasttab, $outputlangs, $TTot); |
|
| 956 | 956 | |
| 957 | 957 | $pdf->Close(); |
| 958 | - $pdf->Output($file,'F'); |
|
| 958 | + $pdf->Output($file, 'F'); |
|
| 959 | 959 | |
| 960 | 960 | $pagecount = self::concat($outputlangs, array($origin_file, $file), $origin_file); |
| 961 | 961 | |
@@ -967,7 +967,7 @@ discard block |
||
| 967 | 967 | $level = $line->qty; // TODO à améliorer |
| 968 | 968 | |
| 969 | 969 | $pdf->SetXY($objmarge->marge_gauche, $curY); |
| 970 | - $pdf->MultiCell($posx_designation-$objmarge->marge_gauche-0.8, 5, $level, 0, 'L', 0); |
|
| 970 | + $pdf->MultiCell($posx_designation - $objmarge->marge_gauche - 0.8, 5, $level, 0, 'L', 0); |
|
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | /** |
@@ -981,50 +981,50 @@ discard block |
||
| 981 | 981 | */ |
| 982 | 982 | private static function pagehead(&$objmarge, &$pdf, &$object, $showdetail, $outputlangs) |
| 983 | 983 | { |
| 984 | - global $conf,$mysoc; |
|
| 984 | + global $conf, $mysoc; |
|
| 985 | 985 | |
| 986 | 986 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 987 | 987 | |
| 988 | - pdf_pagehead($pdf,$outputlangs,$objmarge->page_hauteur); |
|
| 988 | + pdf_pagehead($pdf, $outputlangs, $objmarge->page_hauteur); |
|
| 989 | 989 | |
| 990 | - $pdf->SetTextColor(0,0,60); |
|
| 991 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
| 990 | + $pdf->SetTextColor(0, 0, 60); |
|
| 991 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
| 992 | 992 | |
| 993 | - $posy=$objmarge->marge_haute; |
|
| 994 | - $posx=$objmarge->page_largeur-$objmarge->marge_droite-100; |
|
| 993 | + $posy = $objmarge->marge_haute; |
|
| 994 | + $posx = $objmarge->page_largeur - $objmarge->marge_droite - 100; |
|
| 995 | 995 | |
| 996 | - $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
| 996 | + $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
| 997 | 997 | |
| 998 | - $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
| 998 | + $logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
| 999 | 999 | if ($mysoc->logo) |
| 1000 | 1000 | { |
| 1001 | 1001 | if (is_readable($logo)) |
| 1002 | 1002 | { |
| 1003 | - $height=pdf_getHeightForLogo($logo); |
|
| 1004 | - $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 1003 | + $height = pdf_getHeightForLogo($logo); |
|
| 1004 | + $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 1005 | 1005 | } |
| 1006 | 1006 | else |
| 1007 | 1007 | { |
| 1008 | - $pdf->SetTextColor(200,0,0); |
|
| 1009 | - $pdf->SetFont('','B',$default_font_size - 2); |
|
| 1010 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
|
| 1008 | + $pdf->SetTextColor(200, 0, 0); |
|
| 1009 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 1010 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); |
|
| 1011 | 1011 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); |
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | - $posy+=35; |
|
| 1014 | + $posy += 35; |
|
| 1015 | 1015 | } |
| 1016 | 1016 | else |
| 1017 | 1017 | { |
| 1018 | - $text=$mysoc->name; |
|
| 1018 | + $text = $mysoc->name; |
|
| 1019 | 1019 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
| 1020 | 1020 | |
| 1021 | - $posy+=15; |
|
| 1021 | + $posy += 15; |
|
| 1022 | 1022 | } |
| 1023 | 1023 | |
| 1024 | 1024 | |
| 1025 | - $pdf->SetTextColor(0,0,0); |
|
| 1026 | - $pdf->SetFont('','B', $default_font_size + 2); |
|
| 1027 | - $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
| 1025 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1026 | + $pdf->SetFont('', 'B', $default_font_size + 2); |
|
| 1027 | + $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
| 1028 | 1028 | |
| 1029 | 1029 | $key = 'subtotalPropalTitle'; |
| 1030 | 1030 | if ($object->element == 'commande') $key = 'subtotalCommandeTitle'; |
@@ -1033,14 +1033,14 @@ discard block |
||
| 1033 | 1033 | |
| 1034 | 1034 | $pdf->MultiCell(150, 4, $outputlangs->transnoentities($key, $object->ref, $object->thirdparty->name), '', 'L'); |
| 1035 | 1035 | |
| 1036 | - $pdf->SetFont('','', $default_font_size); |
|
| 1037 | - $pdf->SetXY($objmarge->page_largeur-$objmarge->marge_droite-40,$posy); |
|
| 1036 | + $pdf->SetFont('', '', $default_font_size); |
|
| 1037 | + $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - 40, $posy); |
|
| 1038 | 1038 | $pdf->MultiCell(40, 4, dol_print_date($object->date, 'daytext'), '', 'R'); |
| 1039 | 1039 | |
| 1040 | 1040 | $posy += 8; |
| 1041 | 1041 | |
| 1042 | - $pdf->SetFont('','B', $default_font_size + 2); |
|
| 1043 | - $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
| 1042 | + $pdf->SetFont('', 'B', $default_font_size + 2); |
|
| 1043 | + $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
| 1044 | 1044 | $pdf->MultiCell(70, 4, $outputlangs->transnoentities('subtotalRecapLot'), '', 'L'); |
| 1045 | 1045 | |
| 1046 | 1046 | } |
@@ -1058,44 +1058,44 @@ discard block |
||
| 1058 | 1058 | * @param string $currency Currency code |
| 1059 | 1059 | * @return void |
| 1060 | 1060 | */ |
| 1061 | - private static function tableau(&$objmarge, &$pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') |
|
| 1061 | + private static function tableau(&$objmarge, &$pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '') |
|
| 1062 | 1062 | { |
| 1063 | 1063 | global $conf; |
| 1064 | 1064 | |
| 1065 | 1065 | // Force to disable hidetop and hidebottom |
| 1066 | - $hidebottom=0; |
|
| 1067 | - if ($hidetop) $hidetop=-1; |
|
| 1066 | + $hidebottom = 0; |
|
| 1067 | + if ($hidetop) $hidetop = -1; |
|
| 1068 | 1068 | |
| 1069 | 1069 | $currency = !empty($currency) ? $currency : $conf->currency; |
| 1070 | 1070 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 1071 | 1071 | |
| 1072 | 1072 | // Amount in (at tab_top - 1) |
| 1073 | - $pdf->SetTextColor(0,0,0); |
|
| 1074 | - $pdf->SetFont('','',$default_font_size); |
|
| 1073 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1074 | + $pdf->SetFont('', '', $default_font_size); |
|
| 1075 | 1075 | |
| 1076 | 1076 | if (empty($hidetop)) |
| 1077 | 1077 | { |
| 1078 | - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); |
|
| 1079 | - $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4.5); |
|
| 1078 | + $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); |
|
| 1079 | + $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4.5); |
|
| 1080 | 1080 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
| 1081 | 1081 | |
| 1082 | - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite-$objmarge->marge_gauche, 8, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
| 1082 | + if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur - $objmarge->marge_droite - $objmarge->marge_gauche, 8, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
| 1083 | 1083 | |
| 1084 | 1084 | |
| 1085 | - $pdf->line($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top); // line prend une position y en 2eme param et 4eme param |
|
| 1085 | + $pdf->line($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur - $objmarge->marge_droite, $tab_top); // line prend une position y en 2eme param et 4eme param |
|
| 1086 | 1086 | |
| 1087 | - $pdf->SetXY($posx_designation, $tab_top+2); |
|
| 1088 | - $pdf->MultiCell($posx_options - $posx_designation,2, $outputlangs->transnoentities("Designation"),'','L'); |
|
| 1089 | - $pdf->SetXY($posx_options, $tab_top+2); |
|
| 1090 | - $pdf->MultiCell($posx_montant - $posx_options,2, $outputlangs->transnoentities("Options"),'','R'); |
|
| 1091 | - $pdf->SetXY($posx_montant, $tab_top+2); |
|
| 1092 | - $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant,2, $outputlangs->transnoentities("Amount"),'','R'); |
|
| 1087 | + $pdf->SetXY($posx_designation, $tab_top + 2); |
|
| 1088 | + $pdf->MultiCell($posx_options - $posx_designation, 2, $outputlangs->transnoentities("Designation"), '', 'L'); |
|
| 1089 | + $pdf->SetXY($posx_options, $tab_top + 2); |
|
| 1090 | + $pdf->MultiCell($posx_montant - $posx_options, 2, $outputlangs->transnoentities("Options"), '', 'R'); |
|
| 1091 | + $pdf->SetXY($posx_montant, $tab_top + 2); |
|
| 1092 | + $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant, 2, $outputlangs->transnoentities("Amount"), '', 'R'); |
|
| 1093 | 1093 | |
| 1094 | - $pdf->line($objmarge->marge_gauche, $tab_top+8, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top+8); // line prend une position y en 2eme param et 4eme param |
|
| 1094 | + $pdf->line($objmarge->marge_gauche, $tab_top + 8, $objmarge->page_largeur - $objmarge->marge_droite, $tab_top + 8); // line prend une position y en 2eme param et 4eme param |
|
| 1095 | 1095 | } |
| 1096 | 1096 | else |
| 1097 | 1097 | { |
| 1098 | - $pdf->line($objmarge->marge_gauche, $tab_top-2, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top-2); // line prend une position y en 2eme param et 4eme param |
|
| 1098 | + $pdf->line($objmarge->marge_gauche, $tab_top - 2, $objmarge->page_largeur - $objmarge->marge_droite, $tab_top - 2); // line prend une position y en 2eme param et 4eme param |
|
| 1099 | 1099 | } |
| 1100 | 1100 | |
| 1101 | 1101 | } |
@@ -1104,29 +1104,29 @@ discard block |
||
| 1104 | 1104 | { |
| 1105 | 1105 | global $conf; |
| 1106 | 1106 | |
| 1107 | - $pdf->line($objmarge->marge_gauche, $posy, $objmarge->page_largeur-$objmarge->marge_droite, $posy); // line prend une position y en 2eme param et 4eme param |
|
| 1107 | + $pdf->line($objmarge->marge_gauche, $posy, $objmarge->page_largeur - $objmarge->marge_droite, $posy); // line prend une position y en 2eme param et 4eme param |
|
| 1108 | 1108 | |
| 1109 | 1109 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 1110 | 1110 | |
| 1111 | - $tab2_top = $posy+2; |
|
| 1111 | + $tab2_top = $posy + 2; |
|
| 1112 | 1112 | $tab2_hl = 4; |
| 1113 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 1113 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 1114 | 1114 | |
| 1115 | 1115 | // Tableau total |
| 1116 | 1116 | $col1x = 120; $col2x = 170; |
| 1117 | 1117 | if ($objmarge->page_largeur < 210) // To work with US executive format |
| 1118 | 1118 | { |
| 1119 | - $col2x-=20; |
|
| 1119 | + $col2x -= 20; |
|
| 1120 | 1120 | } |
| 1121 | 1121 | $largcol2 = ($objmarge->page_largeur - $objmarge->marge_droite - $col2x); |
| 1122 | 1122 | |
| 1123 | - $useborder=0; |
|
| 1123 | + $useborder = 0; |
|
| 1124 | 1124 | $index = 0; |
| 1125 | 1125 | |
| 1126 | 1126 | // Total HT |
| 1127 | - $pdf->SetFillColor(255,255,255); |
|
| 1127 | + $pdf->SetFillColor(255, 255, 255); |
|
| 1128 | 1128 | $pdf->SetXY($col1x, $tab2_top + 0); |
| 1129 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
| 1129 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
| 1130 | 1130 | |
| 1131 | 1131 | // $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1) ? $TTot['multicurrency_total_ht'] : $TTot['total_ht']; |
| 1132 | 1132 | $total_ht = $TTot['total_ht']; |
@@ -1134,10 +1134,10 @@ discard block |
||
| 1134 | 1134 | $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht, 0, $outputlangs), 0, 'R', 1); |
| 1135 | 1135 | |
| 1136 | 1136 | // Show VAT by rates and total |
| 1137 | - $pdf->SetFillColor(248,248,248); |
|
| 1137 | + $pdf->SetFillColor(248, 248, 248); |
|
| 1138 | 1138 | |
| 1139 | - $atleastoneratenotnull=0; |
|
| 1140 | - foreach($TTot['TTotal_tva'] as $tvakey => $tvaval) |
|
| 1139 | + $atleastoneratenotnull = 0; |
|
| 1140 | + foreach ($TTot['TTotal_tva'] as $tvakey => $tvaval) |
|
| 1141 | 1141 | { |
| 1142 | 1142 | if ($tvakey != 0) // On affiche pas taux 0 |
| 1143 | 1143 | { |
@@ -1146,15 +1146,15 @@ discard block |
||
| 1146 | 1146 | $index++; |
| 1147 | 1147 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1148 | 1148 | |
| 1149 | - $tvacompl=''; |
|
| 1150 | - if (preg_match('/\*/',$tvakey)) |
|
| 1149 | + $tvacompl = ''; |
|
| 1150 | + if (preg_match('/\*/', $tvakey)) |
|
| 1151 | 1151 | { |
| 1152 | - $tvakey=str_replace('*','',$tvakey); |
|
| 1152 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 1153 | 1153 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 1154 | 1154 | } |
| 1155 | - $totalvat =$outputlangs->transnoentities("TotalVAT").' '; |
|
| 1156 | - $totalvat.=vatrate($tvakey,1).$tvacompl; |
|
| 1157 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1155 | + $totalvat = $outputlangs->transnoentities("TotalVAT").' '; |
|
| 1156 | + $totalvat .= vatrate($tvakey, 1).$tvacompl; |
|
| 1157 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1158 | 1158 | |
| 1159 | 1159 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1160 | 1160 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -1164,16 +1164,16 @@ discard block |
||
| 1164 | 1164 | // Total TTC |
| 1165 | 1165 | $index++; |
| 1166 | 1166 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1167 | - $pdf->SetTextColor(0,0,60); |
|
| 1168 | - $pdf->SetFillColor(224,224,224); |
|
| 1169 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
| 1167 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1168 | + $pdf->SetFillColor(224, 224, 224); |
|
| 1169 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
| 1170 | 1170 | |
| 1171 | 1171 | // $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $TTot['multicurrency_total_ttc'] : $TTot['total_ttc']; |
| 1172 | 1172 | $total_ttc = $TTot['total_ttc']; |
| 1173 | 1173 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1174 | 1174 | $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1); |
| 1175 | 1175 | |
| 1176 | - $pdf->SetTextColor(0,0,0); |
|
| 1176 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1177 | 1177 | |
| 1178 | 1178 | $index++; |
| 1179 | 1179 | return ($tab2_top + ($tab2_hl * $index)); |
@@ -1192,22 +1192,22 @@ discard block |
||
| 1192 | 1192 | * @param int $hidebottom Hide bottom |
| 1193 | 1193 | * @return void |
| 1194 | 1194 | */ |
| 1195 | - private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
| 1195 | + private static function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0) |
|
| 1196 | 1196 | { |
| 1197 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
| 1198 | - $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
| 1199 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1200 | - $pdf->line($x, $y+$h, $x, $y); |
|
| 1197 | + if (empty($hidetop) || $hidetop == -1) $pdf->line($x, $y, $x + $l, $y); |
|
| 1198 | + $pdf->line($x + $l, $y, $x + $l, $y + $h); |
|
| 1199 | + if (empty($hidebottom)) $pdf->line($x + $l, $y + $h, $x, $y + $h); |
|
| 1200 | + $pdf->line($x, $y + $h, $x, $y); |
|
| 1201 | 1201 | } |
| 1202 | 1202 | |
| 1203 | 1203 | |
| 1204 | - public static function concat(&$outputlangs, $files, $fileoutput='') |
|
| 1204 | + public static function concat(&$outputlangs, $files, $fileoutput = '') |
|
| 1205 | 1205 | { |
| 1206 | 1206 | global $conf; |
| 1207 | 1207 | |
| 1208 | 1208 | if (empty($fileoutput)) $fileoutput = $file[0]; |
| 1209 | 1209 | |
| 1210 | - $pdf=pdf_getInstance(); |
|
| 1210 | + $pdf = pdf_getInstance(); |
|
| 1211 | 1211 | if (class_exists('TCPDF')) |
| 1212 | 1212 | { |
| 1213 | 1213 | $pdf->setPrintHeader(false); |
@@ -1215,10 +1215,10 @@ discard block |
||
| 1215 | 1215 | } |
| 1216 | 1216 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
| 1217 | 1217 | |
| 1218 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1218 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1219 | 1219 | |
| 1220 | 1220 | |
| 1221 | - foreach($files as $file) |
|
| 1221 | + foreach ($files as $file) |
|
| 1222 | 1222 | { |
| 1223 | 1223 | $pagecount = $pdf->setSourceFile($file); |
| 1224 | 1224 | for ($i = 1; $i <= $pagecount; $i++) |
@@ -1230,8 +1230,8 @@ discard block |
||
| 1230 | 1230 | } |
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | - $pdf->Output($fileoutput,'F'); |
|
| 1234 | - if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1233 | + $pdf->Output($fileoutput, 'F'); |
|
| 1234 | + if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1235 | 1235 | |
| 1236 | 1236 | return $pagecount; |
| 1237 | 1237 | } |
@@ -1244,7 +1244,7 @@ discard block |
||
| 1244 | 1244 | */ |
| 1245 | 1245 | public static function hasNcTitle(&$line) |
| 1246 | 1246 | { |
| 1247 | - if(isset($line->has_nc_title)) return $line->has_nc_title; |
|
| 1247 | + if (isset($line->has_nc_title)) return $line->has_nc_title; |
|
| 1248 | 1248 | |
| 1249 | 1249 | $TTitle = self::getAllTitleFromLine($line); |
| 1250 | 1250 | foreach ($TTitle as &$line_title) |
@@ -13,18 +13,23 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * @var $object Facture |
| 15 | 15 | */ |
| 16 | - if($object->element=='facture') $res = $object->addline($object->id, $label, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,-1, TSubtotal::$module_number); |
|
| 16 | + if($object->element=='facture') { |
|
| 17 | + $res = $object->addline($object->id, $label, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,-1, TSubtotal::$module_number); |
|
| 18 | + } |
|
| 17 | 19 | /** |
| 18 | 20 | * @var $object Propal |
| 19 | 21 | */ |
| 20 | - else if($object->element=='propal') $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,'HT',0,0,9,-1, TSubtotal::$module_number); |
|
| 22 | + else if($object->element=='propal') { |
|
| 23 | + $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,'HT',0,0,9,-1, TSubtotal::$module_number); |
|
| 24 | + } |
|
| 21 | 25 | /** |
| 22 | 26 | * @var $object Commande |
| 23 | 27 | */ |
| 24 | - else if($object->element=='commande') $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,-1, TSubtotal::$module_number); |
|
| 28 | + else if($object->element=='commande') { |
|
| 29 | + $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,-1, TSubtotal::$module_number); |
|
| 30 | + } |
|
| 25 | 31 | |
| 26 | - } |
|
| 27 | - else { |
|
| 32 | + } else { |
|
| 28 | 33 | $desc = ''; |
| 29 | 34 | |
| 30 | 35 | $TNotElements = array ('invoice_supplier', 'order_supplier'); |
@@ -36,7 +41,9 @@ discard block |
||
| 36 | 41 | /** |
| 37 | 42 | * @var $object Facture |
| 38 | 43 | */ |
| 39 | - if($object->element=='facture') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label); |
|
| 44 | + if($object->element=='facture') { |
|
| 45 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label); |
|
| 46 | + } |
|
| 40 | 47 | /** |
| 41 | 48 | * @var $object Facture fournisseur |
| 42 | 49 | */ |
@@ -48,16 +55,22 @@ discard block |
||
| 48 | 55 | /** |
| 49 | 56 | * @var $object Propal |
| 50 | 57 | */ |
| 51 | - else if($object->element=='propal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 58 | + else if($object->element=='propal') { |
|
| 59 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 60 | + } |
|
| 52 | 61 | /** |
| 53 | 62 | * @var $object Propal Fournisseur |
| 54 | 63 | */ |
| 55 | - else if($object->element=='supplier_proposal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 64 | + else if($object->element=='supplier_proposal') { |
|
| 65 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 66 | + } |
|
| 56 | 67 | |
| 57 | 68 | /** |
| 58 | 69 | * @var $object Commande |
| 59 | 70 | */ |
| 60 | - else if($object->element=='commande') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,$rang, TSubtotal::$module_number, 0, null, 0, $label); |
|
| 71 | + else if($object->element=='commande') { |
|
| 72 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,$rang, TSubtotal::$module_number, 0, null, 0, $label); |
|
| 73 | + } |
|
| 61 | 74 | /** |
| 62 | 75 | * @var $object Commande fournisseur |
| 63 | 76 | */ |
@@ -68,7 +81,9 @@ discard block |
||
| 68 | 81 | /** |
| 69 | 82 | * @var $object Facturerec |
| 70 | 83 | */ |
| 71 | - else if($object->element=='facturerec') $res = $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label); |
|
| 84 | + else if($object->element=='facturerec') { |
|
| 85 | + $res = $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label); |
|
| 86 | + } |
|
| 72 | 87 | |
| 73 | 88 | } |
| 74 | 89 | |
@@ -90,8 +105,9 @@ discard block |
||
| 90 | 105 | // Define output language |
| 91 | 106 | $outputlangs = $langs; |
| 92 | 107 | $newlang = GETPOST('lang_id', 'alpha'); |
| 93 | - if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) |
|
| 94 | - $newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
|
| 108 | + if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) { |
|
| 109 | + $newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
|
| 110 | + } |
|
| 95 | 111 | if (! empty($newlang)) { |
| 96 | 112 | $outputlangs = new Translate("", $conf); |
| 97 | 113 | $outputlangs->setDefaultLang($newlang); |
@@ -100,13 +116,18 @@ discard block |
||
| 100 | 116 | $ret = $object->fetch($object->id); // Reload to get new records |
| 101 | 117 | if ((float) DOL_VERSION <= 3.6) |
| 102 | 118 | { |
| 103 | - if ($object->element == 'propal') propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 104 | - elseif ($object->element == 'commande') commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 105 | - elseif ($object->element == 'facture') facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 106 | - } |
|
| 107 | - else |
|
| 119 | + if ($object->element == 'propal') { |
|
| 120 | + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 121 | + } elseif ($object->element == 'commande') { |
|
| 122 | + commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 123 | + } elseif ($object->element == 'facture') { |
|
| 124 | + facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 125 | + } |
|
| 126 | + } else |
|
| 108 | 127 | { |
| 109 | - if ($object->element!= 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 128 | + if ($object->element!= 'facturerec') { |
|
| 129 | + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 130 | + } |
|
| 110 | 131 | } |
| 111 | 132 | } |
| 112 | 133 | } |
@@ -120,7 +141,9 @@ discard block |
||
| 120 | 141 | */ |
| 121 | 142 | public static function updateRang(&$object, $rang_start, $move_to=1) |
| 122 | 143 | { |
| 123 | - if (!class_exists('GenericObject')) require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
|
| 144 | + if (!class_exists('GenericObject')) { |
|
| 145 | + require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
|
| 146 | + } |
|
| 124 | 147 | |
| 125 | 148 | $row=new GenericObject($object->db); |
| 126 | 149 | $row->table_element_line = $object->table_element_line; |
@@ -129,7 +152,9 @@ discard block |
||
| 129 | 152 | |
| 130 | 153 | foreach ($object->lines as &$line) |
| 131 | 154 | { |
| 132 | - if ($line->rang < $rang_start) continue; |
|
| 155 | + if ($line->rang < $rang_start) { |
|
| 156 | + continue; |
|
| 157 | + } |
|
| 133 | 158 | |
| 134 | 159 | $row->updateRangOfLine($line->id, $line->rang+$move_to); |
| 135 | 160 | } |
@@ -152,21 +177,28 @@ discard block |
||
| 152 | 177 | foreach ($TTitle_reverse as $k => $title_line) |
| 153 | 178 | { |
| 154 | 179 | $title_niveau = self::getNiveau($title_line); |
| 155 | - if ($title_niveau < $level_new_title) break; |
|
| 180 | + if ($title_niveau < $level_new_title) { |
|
| 181 | + break; |
|
| 182 | + } |
|
| 156 | 183 | |
| 157 | 184 | $rang_to_add = self::titleHasTotalLine($object, $title_line, true, true); |
| 158 | 185 | |
| 159 | 186 | if (is_numeric($rang_to_add)) |
| 160 | 187 | { |
| 161 | - if ($rang_to_add != -1) self::updateRang($object, $rang_to_add); |
|
| 188 | + if ($rang_to_add != -1) { |
|
| 189 | + self::updateRang($object, $rang_to_add); |
|
| 190 | + } |
|
| 162 | 191 | |
| 163 | 192 | self::addSubTotalLine($object, $langs->trans('SubTotal'), 100-$title_niveau, $rang_to_add); |
| 164 | 193 | |
| 165 | 194 | $object->lines[] = $object->line; // ajout de la ligne dans le tableau de ligne (Dolibarr ne le fait pas) |
| 166 | 195 | if ($rang_to_add != -1) |
| 167 | 196 | { |
| 168 | - if (method_exists($object, 'fetch_lines')) $object->fetch_lines(); |
|
| 169 | - else $object->fetch($object->id); |
|
| 197 | + if (method_exists($object, 'fetch_lines')) { |
|
| 198 | + $object->fetch_lines(); |
|
| 199 | + } else { |
|
| 200 | + $object->fetch($object->id); |
|
| 201 | + } |
|
| 170 | 202 | } |
| 171 | 203 | } |
| 172 | 204 | } |
@@ -196,7 +228,9 @@ discard block |
||
| 196 | 228 | |
| 197 | 229 | foreach ($TTitle as $k => $title_line) |
| 198 | 230 | { |
| 199 | - if (self::titleHasTotalLine($object, $title_line)) unset($TTitle[$k]); |
|
| 231 | + if (self::titleHasTotalLine($object, $title_line)) { |
|
| 232 | + unset($TTitle[$k]); |
|
| 233 | + } |
|
| 200 | 234 | } |
| 201 | 235 | |
| 202 | 236 | return $TTitle; |
@@ -213,23 +247,41 @@ discard block |
||
| 213 | 247 | */ |
| 214 | 248 | public static function titleHasTotalLine(&$object, &$title_line, $strict_mode=false, $return_rang_on_false=false) |
| 215 | 249 | { |
| 216 | - if (empty($object->lines) || !is_array($object->lines)) return false; |
|
| 250 | + if (empty($object->lines) || !is_array($object->lines)) { |
|
| 251 | + return false; |
|
| 252 | + } |
|
| 217 | 253 | |
| 218 | 254 | $title_niveau = self::getNiveau($title_line); |
| 219 | 255 | foreach ($object->lines as &$line) |
| 220 | 256 | { |
| 221 | - if ($line->rang <= $title_line->rang) continue; |
|
| 222 | - if (self::isTitle($line) && self::getNiveau($line) <= $title_niveau) return false; // Oups on croise un titre d'un niveau inférieur ou égale (exemple : je croise un titre niveau 2 alors que je suis sur un titre de niveau 3) pas lieu de continuer car un nouveau bloc commence |
|
| 223 | - if (!self::isSubtotal($line)) continue; |
|
| 257 | + if ($line->rang <= $title_line->rang) { |
|
| 258 | + continue; |
|
| 259 | + } |
|
| 260 | + if (self::isTitle($line) && self::getNiveau($line) <= $title_niveau) { |
|
| 261 | + return false; |
|
| 262 | + } |
|
| 263 | + // Oups on croise un titre d'un niveau inférieur ou égale (exemple : je croise un titre niveau 2 alors que je suis sur un titre de niveau 3) pas lieu de continuer car un nouveau bloc commence |
|
| 264 | + if (!self::isSubtotal($line)) { |
|
| 265 | + continue; |
|
| 266 | + } |
|
| 224 | 267 | |
| 225 | 268 | $subtotal_niveau = self::getNiveau($line); |
| 226 | 269 | |
| 227 | 270 | // Comparaison du niveau de la ligne de sous-total avec celui du titre |
| 228 | - if ($subtotal_niveau == $title_niveau) return true; // niveau égale => Ok mon titre a un sous-total |
|
| 229 | - elseif ($subtotal_niveau < $title_niveau) // niveau inférieur trouvé (exemple : sous-total de niveau 1 contre mon titre de niveau 3) |
|
| 271 | + if ($subtotal_niveau == $title_niveau) { |
|
| 272 | + return true; |
|
| 273 | + } |
|
| 274 | + // niveau égale => Ok mon titre a un sous-total |
|
| 275 | + elseif ($subtotal_niveau < $title_niveau) { |
|
| 276 | + // niveau inférieur trouvé (exemple : sous-total de niveau 1 contre mon titre de niveau 3) |
|
| 230 | 277 | { |
| 231 | - if ($strict_mode) return ($return_rang_on_false) ? $line->rang : false; // mode strict niveau pas égale donc faux |
|
| 232 | - else return true; // mode libre => OK je considère que mon titre à un sous-total |
|
| 278 | + if ($strict_mode) return ($return_rang_on_false) ? $line->rang : false; |
|
| 279 | + } |
|
| 280 | + // mode strict niveau pas égale donc faux |
|
| 281 | + else { |
|
| 282 | + return true; |
|
| 283 | + } |
|
| 284 | + // mode libre => OK je considère que mon titre à un sous-total |
|
| 233 | 285 | } |
| 234 | 286 | } |
| 235 | 287 | |
@@ -277,16 +329,19 @@ discard block |
||
| 277 | 329 | |
| 278 | 330 | foreach ($object->lines as &$l) |
| 279 | 331 | { |
| 280 | - if ($l->rang <= $line->rang) continue; |
|
| 281 | - elseif (self::isSubtotal($l) && self::getNiveau($l) <= self::getNiveau($line)) break; |
|
| 282 | - elseif ($breakOnTitle && self::isTitle($l) && self::getNiveau($l) <= self::getNiveau($line)) break; |
|
| 332 | + if ($l->rang <= $line->rang) { |
|
| 333 | + continue; |
|
| 334 | + } elseif (self::isSubtotal($l) && self::getNiveau($l) <= self::getNiveau($line)) { |
|
| 335 | + break; |
|
| 336 | + } elseif ($breakOnTitle && self::isTitle($l) && self::getNiveau($l) <= self::getNiveau($line)) { |
|
| 337 | + break; |
|
| 338 | + } |
|
| 283 | 339 | |
| 284 | 340 | if (!empty($l->array_options['options_subtotal_nc'])) |
| 285 | 341 | { |
| 286 | 342 | $tabprice = calcul_price_total($l->qty, $l->subprice, $l->remise_percent, $l->tva_tx, $l->localtax1_tx, $l->localtax2_tx, 0, 'HT', $l->info_bits, $l->product_type); |
| 287 | 343 | $TTot['total_options'] += $tabprice[0]; // total ht |
| 288 | - } |
|
| 289 | - else |
|
| 344 | + } else |
|
| 290 | 345 | { |
| 291 | 346 | $TTot['total_pa_ht'] += $l->pa_ht * $l->qty; |
| 292 | 347 | $TTot['total_subprice'] += $l->subprice * $l->qty; |
@@ -306,29 +361,41 @@ discard block |
||
| 306 | 361 | |
| 307 | 362 | public static function getOrderIdFromLineId(&$db, $fk_commandedet) |
| 308 | 363 | { |
| 309 | - if (empty($fk_commandedet)) return false; |
|
| 364 | + if (empty($fk_commandedet)) { |
|
| 365 | + return false; |
|
| 366 | + } |
|
| 310 | 367 | |
| 311 | 368 | $sql = 'SELECT fk_commande FROM '.MAIN_DB_PREFIX.'commandedet WHERE rowid = '.$fk_commandedet; |
| 312 | 369 | $resql = $db->query($sql); |
| 313 | 370 | |
| 314 | - if ($resql && ($row = $db->fetch_object($resql))) return $row->fk_commande; |
|
| 315 | - else return false; |
|
| 371 | + if ($resql && ($row = $db->fetch_object($resql))) { |
|
| 372 | + return $row->fk_commande; |
|
| 373 | + } else { |
|
| 374 | + return false; |
|
| 375 | + } |
|
| 316 | 376 | } |
| 317 | 377 | |
| 318 | 378 | public static function getLastLineOrderId(&$db, $fk_commande) |
| 319 | 379 | { |
| 320 | - if (empty($fk_commande)) return false; |
|
| 380 | + if (empty($fk_commande)) { |
|
| 381 | + return false; |
|
| 382 | + } |
|
| 321 | 383 | |
| 322 | 384 | $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'commandedet WHERE fk_commande = '.$fk_commande.' ORDER BY rang DESC LIMIT 1'; |
| 323 | 385 | $resql = $db->query($sql); |
| 324 | 386 | |
| 325 | - if ($resql && ($row = $db->fetch_object($resql))) return $row->rowid; |
|
| 326 | - else return false; |
|
| 387 | + if ($resql && ($row = $db->fetch_object($resql))) { |
|
| 388 | + return $row->rowid; |
|
| 389 | + } else { |
|
| 390 | + return false; |
|
| 391 | + } |
|
| 327 | 392 | } |
| 328 | 393 | |
| 329 | 394 | public static function getParentTitleOfLine(&$object, $i) |
| 330 | 395 | { |
| 331 | - if ($i <= 0) return false; |
|
| 396 | + if ($i <= 0) { |
|
| 397 | + return false; |
|
| 398 | + } |
|
| 332 | 399 | |
| 333 | 400 | $skip_title = 0; |
| 334 | 401 | // Je parcours les lignes précédentes |
@@ -347,8 +414,7 @@ discard block |
||
| 347 | 414 | //@INFO J'ai ma ligne titre qui contient ma ligne, par contre je check pas s'il y a un sous-total |
| 348 | 415 | return $line; |
| 349 | 416 | break; |
| 350 | - } |
|
| 351 | - elseif ($line->product_type == 9 && $line->qty >= 90 && $line->qty <= 99) |
|
| 417 | + } elseif ($line->product_type == 9 && $line->qty >= 90 && $line->qty <= 99) |
|
| 352 | 418 | { |
| 353 | 419 | // Il s'agit d'un sous-total, ça veut dire que le prochain titre théoriquement doit être ignorer (je travail avec un incrément au cas ou je croise plusieurs sous-totaux) |
| 354 | 420 | $skip_title++; |
@@ -363,7 +429,9 @@ discard block |
||
| 363 | 429 | $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty <= 9; |
| 364 | 430 | if($res && $level > -1) { |
| 365 | 431 | return $line->qty == $level; |
| 366 | - } else return $res; |
|
| 432 | + } else { |
|
| 433 | + return $res; |
|
| 434 | + } |
|
| 367 | 435 | |
| 368 | 436 | } |
| 369 | 437 | |
@@ -372,7 +440,9 @@ discard block |
||
| 372 | 440 | $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90; |
| 373 | 441 | if($res && $level > -1) { |
| 374 | 442 | return self::getNiveau($line) == $level; |
| 375 | - } else return $res; |
|
| 443 | + } else { |
|
| 444 | + return $res; |
|
| 445 | + } |
|
| 376 | 446 | } |
| 377 | 447 | |
| 378 | 448 | public static function isFreeText(&$line) |
@@ -393,10 +463,14 @@ discard block |
||
| 393 | 463 | // editeur wysiwyg |
| 394 | 464 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
| 395 | 465 | $nbrows=ROWS_2; |
| 396 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
| 466 | + if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
|
| 467 | + $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
| 468 | + } |
|
| 397 | 469 | $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
| 398 | 470 | $toolbarname='dolibarr_details'; |
| 399 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
| 471 | + if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) { |
|
| 472 | + $toolbarname='dolibarr_notes'; |
|
| 473 | + } |
|
| 400 | 474 | $text = !empty($line->description)?$line->description:$line->label; |
| 401 | 475 | $doleditor=new DolEditor('line-description',$text,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%', $readonly); |
| 402 | 476 | return $doleditor->Create(1); |
@@ -411,12 +485,10 @@ discard block |
||
| 411 | 485 | { |
| 412 | 486 | $object->statut = 0; // hack for facture rec |
| 413 | 487 | $createRight = $user->rights->facture->creer; |
| 414 | - } |
|
| 415 | - elseif($object->element == 'order_supplier' ) |
|
| 488 | + } elseif($object->element == 'order_supplier' ) |
|
| 416 | 489 | { |
| 417 | 490 | $createRight = $user->rights->fournisseur->commande->creer; |
| 418 | - } |
|
| 419 | - elseif($object->element == 'invoice_supplier' ) |
|
| 491 | + } elseif($object->element == 'invoice_supplier' ) |
|
| 420 | 492 | { |
| 421 | 493 | $createRight = $user->rights->fournisseur->facture->creer; |
| 422 | 494 | } |
@@ -489,8 +561,9 @@ discard block |
||
| 489 | 561 | |
| 490 | 562 | $TLineAdded[] = $object->line; |
| 491 | 563 | // Error from addline |
| 492 | - if ($res <= 0) break; |
|
| 493 | - else |
|
| 564 | + if ($res <= 0) { |
|
| 565 | + break; |
|
| 566 | + } else |
|
| 494 | 567 | { |
| 495 | 568 | $object->line_from = $line; |
| 496 | 569 | // Call trigger |
@@ -512,8 +585,7 @@ discard block |
||
| 512 | 585 | _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']); |
| 513 | 586 | } |
| 514 | 587 | return count($TLineAdded); |
| 515 | - } |
|
| 516 | - else |
|
| 588 | + } else |
|
| 517 | 589 | { |
| 518 | 590 | $object->db->rollback(); |
| 519 | 591 | return -1; |
@@ -529,10 +601,14 @@ discard block |
||
| 529 | 601 | global $langs; |
| 530 | 602 | |
| 531 | 603 | // Besoin de comparer sur les 2 formes d'écriture |
| 532 | - if (!$key_is_id) $TTitle_search = array($langs->trans($key_trad), $langs->transnoentitiesnoconv($key_trad)); |
|
| 604 | + if (!$key_is_id) { |
|
| 605 | + $TTitle_search = array($langs->trans($key_trad), $langs->transnoentitiesnoconv($key_trad)); |
|
| 606 | + } |
|
| 533 | 607 | |
| 534 | 608 | $TTitle_under_search = array(); |
| 535 | - if (!empty($under_title)) $TTitle_under_search = array($langs->trans($under_title), $langs->transnoentitiesnoconv($under_title)); |
|
| 609 | + if (!empty($under_title)) { |
|
| 610 | + $TTitle_under_search = array($langs->trans($under_title), $langs->transnoentitiesnoconv($under_title)); |
|
| 611 | + } |
|
| 536 | 612 | |
| 537 | 613 | $TLine = array(); |
| 538 | 614 | $add_line = false; |
@@ -542,28 +618,37 @@ discard block |
||
| 542 | 618 | { |
| 543 | 619 | if (!$under_title_found && !empty($TTitle_under_search)) |
| 544 | 620 | { |
| 545 | - if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) $under_title_found = true; |
|
| 546 | - } |
|
| 547 | - else |
|
| 621 | + if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) { |
|
| 622 | + $under_title_found = true; |
|
| 623 | + } |
|
| 624 | + } else |
|
| 548 | 625 | { |
| 549 | 626 | if ( ($key_is_id && $line->id == $key_trad) || (!$key_is_id && $line->product_type == 9 && $line->qty == $level && (in_array($line->desc, $TTitle_search) || in_array($line->label, $TTitle_search) ))) |
| 550 | 627 | { |
| 551 | - if ($key_is_id) $level = $line->qty; |
|
| 628 | + if ($key_is_id) { |
|
| 629 | + $level = $line->qty; |
|
| 630 | + } |
|
| 552 | 631 | |
| 553 | 632 | $add_line = true; |
| 554 | - if ($withBlockLine) $TLine[] = $line; |
|
| 633 | + if ($withBlockLine) { |
|
| 634 | + $TLine[] = $line; |
|
| 635 | + } |
|
| 555 | 636 | continue; |
| 556 | - } |
|
| 557 | - elseif ($add_line && TSubtotal::isModSubtotalLine($line) && TSubtotal::getNiveau($line) == $level) // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre |
|
| 637 | + } elseif ($add_line && TSubtotal::isModSubtotalLine($line) && TSubtotal::getNiveau($line) == $level) { |
|
| 638 | + // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre |
|
| 558 | 639 | { |
| 559 | 640 | if ($withBlockLine) $TLine[] = $line; |
| 641 | + } |
|
| 560 | 642 | break; |
| 561 | 643 | } |
| 562 | 644 | |
| 563 | 645 | if ($add_line) |
| 564 | 646 | { |
| 565 | - if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) continue; |
|
| 566 | - else $TLine[] = $line; |
|
| 647 | + if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) { |
|
| 648 | + continue; |
|
| 649 | + } else { |
|
| 650 | + $TLine[] = $line; |
|
| 651 | + } |
|
| 567 | 652 | } |
| 568 | 653 | } |
| 569 | 654 | } |
@@ -597,7 +682,9 @@ discard block |
||
| 597 | 682 | |
| 598 | 683 | case 'order_supplier': |
| 599 | 684 | $object->special_code = SELF::$module_number; |
| 600 | - if (empty($desc)) $desc = $label; |
|
| 685 | + if (empty($desc)) { |
|
| 686 | + $desc = $label; |
|
| 687 | + } |
|
| 601 | 688 | $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, 0, $date_start, $date_end, $array_options, $fk_unit); |
| 602 | 689 | break; |
| 603 | 690 | |
@@ -607,7 +694,9 @@ discard block |
||
| 607 | 694 | |
| 608 | 695 | case 'invoice_supplier': |
| 609 | 696 | $object->special_code = SELF::$module_number; |
| 610 | - if (empty($desc)) $desc = $label; |
|
| 697 | + if (empty($desc)) { |
|
| 698 | + $desc = $label; |
|
| 699 | + } |
|
| 611 | 700 | $res = $object->updateline($rowid, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, 0, $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $fk_unit); |
| 612 | 701 | break; |
| 613 | 702 | |
@@ -624,8 +713,11 @@ discard block |
||
| 624 | 713 | break; |
| 625 | 714 | } |
| 626 | 715 | |
| 627 | - if ($res <= 0) $object->db->rollback(); |
|
| 628 | - else $object->db->commit(); |
|
| 716 | + if ($res <= 0) { |
|
| 717 | + $object->db->rollback(); |
|
| 718 | + } else { |
|
| 719 | + $object->db->commit(); |
|
| 720 | + } |
|
| 629 | 721 | |
| 630 | 722 | return $res; |
| 631 | 723 | } |
@@ -635,24 +727,20 @@ discard block |
||
| 635 | 727 | global $db, $object; |
| 636 | 728 | |
| 637 | 729 | $TTitle = array(); |
| 638 | - if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
| 639 | - else { |
|
| 730 | + if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} else { |
|
| 640 | 731 | if ($origin_line->element == 'propaldet') |
| 641 | 732 | { |
| 642 | 733 | $object = new Propal($db); |
| 643 | 734 | $object->fetch($origin_line->fk_propal); |
| 644 | - } |
|
| 645 | - else if ($origin_line->element == 'commandedet') |
|
| 735 | + } else if ($origin_line->element == 'commandedet') |
|
| 646 | 736 | { |
| 647 | 737 | $object = new Commande($db); |
| 648 | 738 | $object->fetch($origin_line->fk_commande); |
| 649 | - } |
|
| 650 | - else if ($origin_line->element == 'facturedet') |
|
| 739 | + } else if ($origin_line->element == 'facturedet') |
|
| 651 | 740 | { |
| 652 | 741 | $object = new Facture($db); |
| 653 | 742 | $object->fetch($origin_line->fk_facture); |
| 654 | - } |
|
| 655 | - else |
|
| 743 | + } else |
|
| 656 | 744 | { |
| 657 | 745 | return $TTitle; |
| 658 | 746 | } |
@@ -662,8 +750,11 @@ discard block |
||
| 662 | 750 | $i = 0; |
| 663 | 751 | foreach ($object->lines as &$line) |
| 664 | 752 | { |
| 665 | - if ($origin_line->id == $line->id) break; |
|
| 666 | - else $i++; |
|
| 753 | + if ($origin_line->id == $line->id) { |
|
| 754 | + break; |
|
| 755 | + } else { |
|
| 756 | + $i++; |
|
| 757 | + } |
|
| 667 | 758 | } |
| 668 | 759 | |
| 669 | 760 | $i--; // Skip la ligne d'origine |
@@ -678,35 +769,43 @@ discard block |
||
| 678 | 769 | if (self::isSubtotal($object->lines[$y])) |
| 679 | 770 | { |
| 680 | 771 | $next_title_lvl_to_skip = self::getNiveau($object->lines[$y]); |
| 681 | - } |
|
| 682 | - elseif (self::isTitle($object->lines[$y])) |
|
| 772 | + } elseif (self::isTitle($object->lines[$y])) |
|
| 683 | 773 | { |
| 684 | 774 | if ($object->lines[$y]->qty == $next_title_lvl_to_skip) |
| 685 | 775 | { |
| 686 | 776 | $next_title_lvl_to_skip = 0; |
| 687 | 777 | continue; |
| 688 | - } |
|
| 689 | - else |
|
| 778 | + } else |
|
| 690 | 779 | { |
| 691 | - if (empty($object->lines[$y]->array_options)) $object->lines[$y]->fetch_optionals(); |
|
| 780 | + if (empty($object->lines[$y]->array_options)) { |
|
| 781 | + $object->lines[$y]->fetch_optionals(); |
|
| 782 | + } |
|
| 692 | 783 | $TTitle[$object->lines[$y]->id] = $object->lines[$y]; |
| 693 | 784 | |
| 694 | - if ($object->lines[$y]->qty == 1) break; |
|
| 785 | + if ($object->lines[$y]->qty == 1) { |
|
| 786 | + break; |
|
| 787 | + } |
|
| 695 | 788 | } |
| 696 | 789 | } |
| 697 | 790 | } |
| 698 | 791 | } |
| 699 | 792 | |
| 700 | - if ($reverse) $TTitle = array_reverse($TTitle, true); |
|
| 793 | + if ($reverse) { |
|
| 794 | + $TTitle = array_reverse($TTitle, true); |
|
| 795 | + } |
|
| 701 | 796 | |
| 702 | 797 | return $TTitle; |
| 703 | 798 | } |
| 704 | 799 | |
| 705 | 800 | public static function getNiveau(&$line) |
| 706 | 801 | { |
| 707 | - if (self::isTitle($line)) return $line->qty; |
|
| 708 | - elseif (self::isSubtotal($line)) return 100 - $line->qty; |
|
| 709 | - else return 0; |
|
| 802 | + if (self::isTitle($line)) { |
|
| 803 | + return $line->qty; |
|
| 804 | + } elseif (self::isSubtotal($line)) { |
|
| 805 | + return 100 - $line->qty; |
|
| 806 | + } else { |
|
| 807 | + return 0; |
|
| 808 | + } |
|
| 710 | 809 | } |
| 711 | 810 | |
| 712 | 811 | /** |
@@ -731,10 +830,16 @@ discard block |
||
| 731 | 830 | $objmarge->marge_droite = 10; |
| 732 | 831 | |
| 733 | 832 | $objectref = dol_sanitizeFileName($object->ref); |
| 734 | - if ($object->element == 'propal') $dir = $conf->propal->dir_output . '/' . $objectref; |
|
| 735 | - elseif ($object->element == 'commande') $dir = $conf->commande->dir_output . '/' . $objectref; |
|
| 736 | - elseif ($object->element == 'facture') $dir = $conf->facture->dir_output . '/' . $objectref; |
|
| 737 | - elseif ($object->element == 'facturerec') return; // no PDF for facturerec |
|
| 833 | + if ($object->element == 'propal') { |
|
| 834 | + $dir = $conf->propal->dir_output . '/' . $objectref; |
|
| 835 | + } elseif ($object->element == 'commande') { |
|
| 836 | + $dir = $conf->commande->dir_output . '/' . $objectref; |
|
| 837 | + } elseif ($object->element == 'facture') { |
|
| 838 | + $dir = $conf->facture->dir_output . '/' . $objectref; |
|
| 839 | + } elseif ($object->element == 'facturerec') { |
|
| 840 | + return; |
|
| 841 | + } |
|
| 842 | + // no PDF for facturerec |
|
| 738 | 843 | else |
| 739 | 844 | { |
| 740 | 845 | setEventMessage($langs->trans('warning_subtotal_recap_object_element_unknown', $object->element), 'warnings'); |
@@ -769,7 +874,9 @@ discard block |
||
| 769 | 874 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
| 770 | 875 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
| 771 | 876 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("subtotalRecap")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); |
| 772 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 877 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
| 878 | + $pdf->SetCompression(false); |
|
| 879 | + } |
|
| 773 | 880 | |
| 774 | 881 | $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
| 775 | 882 | |
@@ -779,7 +886,9 @@ discard block |
||
| 779 | 886 | |
| 780 | 887 | // New page |
| 781 | 888 | $pdf->AddPage(); |
| 782 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 889 | + if (! empty($tplidx)) { |
|
| 890 | + $pdf->useTemplate($tplidx); |
|
| 891 | + } |
|
| 783 | 892 | $pagenb++; |
| 784 | 893 | |
| 785 | 894 | |
@@ -835,8 +944,10 @@ discard block |
||
| 835 | 944 | { |
| 836 | 945 | $TTot['TTotal_tva_multicurrency'][$tx] += $amount; |
| 837 | 946 | } |
| 947 | + } else { |
|
| 948 | + $pdf->SetFont('','', $default_font_size - 1); |
|
| 838 | 949 | } |
| 839 | - else $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
| 950 | + // Into loop to work with multipage |
|
| 840 | 951 | |
| 841 | 952 | $pdf->SetTextColor(0,0,0); |
| 842 | 953 | |
@@ -858,9 +969,11 @@ discard block |
||
| 858 | 969 | $pdf->startTransaction(); |
| 859 | 970 | $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
| 860 | 971 | $pageposafter=$pdf->getPage(); |
| 861 | - if ($pageposafter > $pageposbefore) // There is a pagebreak |
|
| 972 | + if ($pageposafter > $pageposbefore) { |
|
| 973 | + // There is a pagebreak |
|
| 862 | 974 | { |
| 863 | 975 | $pdf->rollbackTransaction(true); |
| 976 | + } |
|
| 864 | 977 | $pageposafter=$pageposbefore; |
| 865 | 978 | //print $pageposafter.'-'.$pageposbefore;exit; |
| 866 | 979 | $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
@@ -869,23 +982,27 @@ discard block |
||
| 869 | 982 | $pageposafter=$pdf->getPage(); |
| 870 | 983 | $posyafter=$pdf->GetY(); |
| 871 | 984 | //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
| 872 | - if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) // There is no space left for total+free text |
|
| 985 | + if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) { |
|
| 986 | + // There is no space left for total+free text |
|
| 873 | 987 | { |
| 874 | 988 | if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
| 875 | 989 | { |
| 876 | 990 | $pdf->AddPage('','',true); |
| 877 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 878 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 991 | + } |
|
| 992 | + if (! empty($tplidx)) { |
|
| 993 | + $pdf->useTemplate($tplidx); |
|
| 994 | + } |
|
| 995 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
| 996 | + self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 997 | + } |
|
| 879 | 998 | $pdf->setPage($pageposafter+1); |
| 880 | 999 | } |
| 881 | - } |
|
| 882 | - else |
|
| 1000 | + } else |
|
| 883 | 1001 | { |
| 884 | 1002 | // We found a page break |
| 885 | 1003 | $showpricebeforepagebreak=0; |
| 886 | 1004 | } |
| 887 | - } |
|
| 888 | - else // No pagebreak |
|
| 1005 | + } else // No pagebreak |
|
| 889 | 1006 | { |
| 890 | 1007 | $pdf->commitTransaction(); |
| 891 | 1008 | } |
@@ -925,8 +1042,7 @@ discard block |
||
| 925 | 1042 | if ($pagenb == 1) |
| 926 | 1043 | { |
| 927 | 1044 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $objmarge->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); |
| 928 | - } |
|
| 929 | - else |
|
| 1045 | + } else |
|
| 930 | 1046 | { |
| 931 | 1047 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top_newpage, $objmarge->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code); |
| 932 | 1048 | } |
@@ -934,7 +1050,9 @@ discard block |
||
| 934 | 1050 | $pagenb++; |
| 935 | 1051 | $pdf->setPage($pagenb); |
| 936 | 1052 | $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
| 937 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 1053 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
| 1054 | + self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 1055 | + } |
|
| 938 | 1056 | } |
| 939 | 1057 | } |
| 940 | 1058 | } |
@@ -944,8 +1062,7 @@ discard block |
||
| 944 | 1062 | { |
| 945 | 1063 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $objmarge->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); |
| 946 | 1064 | $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
| 947 | - } |
|
| 948 | - else |
|
| 1065 | + } else |
|
| 949 | 1066 | { |
| 950 | 1067 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top_newpage, $objmarge->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code); |
| 951 | 1068 | $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
@@ -959,7 +1076,9 @@ discard block |
||
| 959 | 1076 | |
| 960 | 1077 | $pagecount = self::concat($outputlangs, array($origin_file, $file), $origin_file); |
| 961 | 1078 | |
| 962 | - if (empty($conf->global->SUBTOTAL_KEEP_RECAP_FILE)) unlink($file); |
|
| 1079 | + if (empty($conf->global->SUBTOTAL_KEEP_RECAP_FILE)) { |
|
| 1080 | + unlink($file); |
|
| 1081 | + } |
|
| 963 | 1082 | } |
| 964 | 1083 | |
| 965 | 1084 | private static function printLevel($objmarge, $pdf, $line, $curY, $posx_designation) |
@@ -1002,8 +1121,7 @@ discard block |
||
| 1002 | 1121 | { |
| 1003 | 1122 | $height=pdf_getHeightForLogo($logo); |
| 1004 | 1123 | $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
| 1005 | - } |
|
| 1006 | - else |
|
| 1124 | + } else |
|
| 1007 | 1125 | { |
| 1008 | 1126 | $pdf->SetTextColor(200,0,0); |
| 1009 | 1127 | $pdf->SetFont('','B',$default_font_size - 2); |
@@ -1012,8 +1130,7 @@ discard block |
||
| 1012 | 1130 | } |
| 1013 | 1131 | |
| 1014 | 1132 | $posy+=35; |
| 1015 | - } |
|
| 1016 | - else |
|
| 1133 | + } else |
|
| 1017 | 1134 | { |
| 1018 | 1135 | $text=$mysoc->name; |
| 1019 | 1136 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
@@ -1027,9 +1144,13 @@ discard block |
||
| 1027 | 1144 | $pdf->SetXY($objmarge->marge_gauche,$posy); |
| 1028 | 1145 | |
| 1029 | 1146 | $key = 'subtotalPropalTitle'; |
| 1030 | - if ($object->element == 'commande') $key = 'subtotalCommandeTitle'; |
|
| 1031 | - elseif ($object->element == 'facture') $key = 'subtotalInvoiceTitle'; |
|
| 1032 | - elseif ($object->element == 'facturerec') $key = 'subtotalInvoiceTitle'; |
|
| 1147 | + if ($object->element == 'commande') { |
|
| 1148 | + $key = 'subtotalCommandeTitle'; |
|
| 1149 | + } elseif ($object->element == 'facture') { |
|
| 1150 | + $key = 'subtotalInvoiceTitle'; |
|
| 1151 | + } elseif ($object->element == 'facturerec') { |
|
| 1152 | + $key = 'subtotalInvoiceTitle'; |
|
| 1153 | + } |
|
| 1033 | 1154 | |
| 1034 | 1155 | $pdf->MultiCell(150, 4, $outputlangs->transnoentities($key, $object->ref, $object->thirdparty->name), '', 'L'); |
| 1035 | 1156 | |
@@ -1064,7 +1185,9 @@ discard block |
||
| 1064 | 1185 | |
| 1065 | 1186 | // Force to disable hidetop and hidebottom |
| 1066 | 1187 | $hidebottom=0; |
| 1067 | - if ($hidetop) $hidetop=-1; |
|
| 1188 | + if ($hidetop) { |
|
| 1189 | + $hidetop=-1; |
|
| 1190 | + } |
|
| 1068 | 1191 | |
| 1069 | 1192 | $currency = !empty($currency) ? $currency : $conf->currency; |
| 1070 | 1193 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
@@ -1079,7 +1202,9 @@ discard block |
||
| 1079 | 1202 | $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4.5); |
| 1080 | 1203 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
| 1081 | 1204 | |
| 1082 | - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite-$objmarge->marge_gauche, 8, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
| 1205 | + if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { |
|
| 1206 | + $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite-$objmarge->marge_gauche, 8, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
| 1207 | + } |
|
| 1083 | 1208 | |
| 1084 | 1209 | |
| 1085 | 1210 | $pdf->line($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top); // line prend une position y en 2eme param et 4eme param |
@@ -1092,8 +1217,7 @@ discard block |
||
| 1092 | 1217 | $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant,2, $outputlangs->transnoentities("Amount"),'','R'); |
| 1093 | 1218 | |
| 1094 | 1219 | $pdf->line($objmarge->marge_gauche, $tab_top+8, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top+8); // line prend une position y en 2eme param et 4eme param |
| 1095 | - } |
|
| 1096 | - else |
|
| 1220 | + } else |
|
| 1097 | 1221 | { |
| 1098 | 1222 | $pdf->line($objmarge->marge_gauche, $tab_top-2, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top-2); // line prend une position y en 2eme param et 4eme param |
| 1099 | 1223 | } |
@@ -1114,10 +1238,12 @@ discard block |
||
| 1114 | 1238 | |
| 1115 | 1239 | // Tableau total |
| 1116 | 1240 | $col1x = 120; $col2x = 170; |
| 1117 | - if ($objmarge->page_largeur < 210) // To work with US executive format |
|
| 1241 | + if ($objmarge->page_largeur < 210) { |
|
| 1242 | + // To work with US executive format |
|
| 1118 | 1243 | { |
| 1119 | 1244 | $col2x-=20; |
| 1120 | 1245 | } |
| 1246 | + } |
|
| 1121 | 1247 | $largcol2 = ($objmarge->page_largeur - $objmarge->marge_droite - $col2x); |
| 1122 | 1248 | |
| 1123 | 1249 | $useborder=0; |
@@ -1139,9 +1265,11 @@ discard block |
||
| 1139 | 1265 | $atleastoneratenotnull=0; |
| 1140 | 1266 | foreach($TTot['TTotal_tva'] as $tvakey => $tvaval) |
| 1141 | 1267 | { |
| 1142 | - if ($tvakey != 0) // On affiche pas taux 0 |
|
| 1268 | + if ($tvakey != 0) { |
|
| 1269 | + // On affiche pas taux 0 |
|
| 1143 | 1270 | { |
| 1144 | 1271 | $atleastoneratenotnull++; |
| 1272 | + } |
|
| 1145 | 1273 | |
| 1146 | 1274 | $index++; |
| 1147 | 1275 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
@@ -1194,9 +1322,13 @@ discard block |
||
| 1194 | 1322 | */ |
| 1195 | 1323 | private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
| 1196 | 1324 | { |
| 1197 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
| 1325 | + if (empty($hidetop) || $hidetop==-1) { |
|
| 1326 | + $pdf->line($x, $y, $x+$l, $y); |
|
| 1327 | + } |
|
| 1198 | 1328 | $pdf->line($x+$l, $y, $x+$l, $y+$h); |
| 1199 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1329 | + if (empty($hidebottom)) { |
|
| 1330 | + $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1331 | + } |
|
| 1200 | 1332 | $pdf->line($x, $y+$h, $x, $y); |
| 1201 | 1333 | } |
| 1202 | 1334 | |
@@ -1205,7 +1337,9 @@ discard block |
||
| 1205 | 1337 | { |
| 1206 | 1338 | global $conf; |
| 1207 | 1339 | |
| 1208 | - if (empty($fileoutput)) $fileoutput = $file[0]; |
|
| 1340 | + if (empty($fileoutput)) { |
|
| 1341 | + $fileoutput = $file[0]; |
|
| 1342 | + } |
|
| 1209 | 1343 | |
| 1210 | 1344 | $pdf=pdf_getInstance(); |
| 1211 | 1345 | if (class_exists('TCPDF')) |
@@ -1215,7 +1349,9 @@ discard block |
||
| 1215 | 1349 | } |
| 1216 | 1350 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
| 1217 | 1351 | |
| 1218 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1352 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
| 1353 | + $pdf->SetCompression(false); |
|
| 1354 | + } |
|
| 1219 | 1355 | |
| 1220 | 1356 | |
| 1221 | 1357 | foreach($files as $file) |
@@ -1231,7 +1367,9 @@ discard block |
||
| 1231 | 1367 | } |
| 1232 | 1368 | |
| 1233 | 1369 | $pdf->Output($fileoutput,'F'); |
| 1234 | - if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1370 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
| 1371 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1372 | + } |
|
| 1235 | 1373 | |
| 1236 | 1374 | return $pagecount; |
| 1237 | 1375 | } |
@@ -1244,7 +1382,9 @@ discard block |
||
| 1244 | 1382 | */ |
| 1245 | 1383 | public static function hasNcTitle(&$line) |
| 1246 | 1384 | { |
| 1247 | - if(isset($line->has_nc_title)) return $line->has_nc_title; |
|
| 1385 | + if(isset($line->has_nc_title)) { |
|
| 1386 | + return $line->has_nc_title; |
|
| 1387 | + } |
|
| 1248 | 1388 | |
| 1249 | 1389 | $TTitle = self::getAllTitleFromLine($line); |
| 1250 | 1390 | foreach ($TTitle as &$line_title) |
@@ -1269,7 +1409,9 @@ discard block |
||
| 1269 | 1409 | public static function getTitleLabel($line) |
| 1270 | 1410 | { |
| 1271 | 1411 | $title = $line->label; |
| 1272 | - if (empty($title)) $title = !empty($line->description) ? $line->description : $line->desc; |
|
| 1412 | + if (empty($title)) { |
|
| 1413 | + $title = !empty($line->description) ? $line->description : $line->desc; |
|
| 1414 | + } |
|
| 1273 | 1415 | return $title; |
| 1274 | 1416 | } |
| 1275 | 1417 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * \ingroup titre |
| 24 | 24 | * \brief Description and activation file for module titre |
| 25 | 25 | */ |
| 26 | -include_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php"; |
|
| 26 | +include_once DOL_DOCUMENT_ROOT."/core/modules/DolibarrModules.class.php"; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Description and activation class for module titre |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $this->version = '3.1.10'; |
| 67 | 67 | // Key used in llx_const table to save module status enabled/disabled |
| 68 | 68 | // (where MYMODULE is value of property name of module in uppercase) |
| 69 | - $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
| 69 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
| 70 | 70 | // Where to store the module in setup page |
| 71 | 71 | // (0=common,1=interface,2=others,3=very specific) |
| 72 | 72 | $this->special = 2; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | // List of modules id that must be enabled if this module is enabled |
| 126 | 126 | $this->depends = array(); |
| 127 | 127 | |
| 128 | - $this->conflictwith=array('modMilestone'); |
|
| 128 | + $this->conflictwith = array('modMilestone'); |
|
| 129 | 129 | // List of modules id to disable if this one is disabled |
| 130 | 130 | $this->requiredby = array(); |
| 131 | 131 | // Minimum version of PHP required by module |
@@ -190,20 +190,20 @@ discard block |
||
| 190 | 190 | // 'categories_x' to add a tab in category view |
| 191 | 191 | // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
| 192 | 192 | // Dictionnaries |
| 193 | - if (! isset($conf->subtotal->enabled)) { |
|
| 194 | - $conf->subtotal=new stdClass(); |
|
| 193 | + if (!isset($conf->subtotal->enabled)) { |
|
| 194 | + $conf->subtotal = new stdClass(); |
|
| 195 | 195 | $conf->subtotal->enabled = 0; |
| 196 | 196 | } |
| 197 | 197 | $this->dictionaries = array( |
| 198 | 198 | 'langs'=>'subtotal@subtotal', |
| 199 | - 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
| 200 | - 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
| 201 | - 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
| 202 | - 'tabsqlsort'=>array('label ASC'), // Sort order |
|
| 203 | - 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
| 204 | - 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
| 205 | - 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
| 206 | - 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
| 199 | + 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
| 200 | + 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
| 201 | + 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
| 202 | + 'tabsqlsort'=>array('label ASC'), // Sort order |
|
| 203 | + 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
| 204 | + 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
| 205 | + 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
| 206 | + 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
| 207 | 207 | 'tabcond'=>array($conf->subtotal->enabled) |
| 208 | 208 | ); |
| 209 | 209 | /* Example: |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | |
| 479 | 479 | $extra = new ExtraFields($db); // propaldet, commandedet, facturedet |
| 480 | 480 | $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det'); |
| 481 | - foreach($TElementType as $element_type) { |
|
| 481 | + foreach ($TElementType as $element_type) { |
|
| 482 | 482 | $extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
| 483 | 483 | $extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
| 484 | 484 | } |
@@ -31,185 +31,185 @@ discard block |
||
| 31 | 31 | class modSubtotal extends DolibarrModules |
| 32 | 32 | { |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
| 36 | - * |
|
| 37 | - * @param DoliDB $db Database handler |
|
| 38 | - */ |
|
| 34 | + /** |
|
| 35 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
| 36 | + * |
|
| 37 | + * @param DoliDB $db Database handler |
|
| 38 | + */ |
|
| 39 | 39 | |
| 40 | - public function __construct($db) |
|
| 41 | - { |
|
| 42 | - global $langs, $conf; |
|
| 40 | + public function __construct($db) |
|
| 41 | + { |
|
| 42 | + global $langs, $conf; |
|
| 43 | 43 | |
| 44 | - $this->db = $db; |
|
| 44 | + $this->db = $db; |
|
| 45 | 45 | |
| 46 | 46 | $this->editor_name = 'ATM-Consulting'; |
| 47 | - // Id for module (must be unique). |
|
| 48 | - // Use a free id here |
|
| 49 | - // (See in Home -> System information -> Dolibarr for list of used modules id). |
|
| 50 | - $this->numero = 104777; // 104000 to 104999 for ATM CONSULTING |
|
| 51 | - // Key text used to identify module (for permissions, menus, etc...) |
|
| 52 | - $this->rights_class = 'subtotal'; |
|
| 47 | + // Id for module (must be unique). |
|
| 48 | + // Use a free id here |
|
| 49 | + // (See in Home -> System information -> Dolibarr for list of used modules id). |
|
| 50 | + $this->numero = 104777; // 104000 to 104999 for ATM CONSULTING |
|
| 51 | + // Key text used to identify module (for permissions, menus, etc...) |
|
| 52 | + $this->rights_class = 'subtotal'; |
|
| 53 | 53 | |
| 54 | - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
| 55 | - // It is used to group modules in module setup page |
|
| 56 | - $this->family = "technic"; |
|
| 57 | - // Module label (no space allowed) |
|
| 58 | - // used if translation string 'ModuleXXXName' not found |
|
| 59 | - // (where XXX is value of numeric property 'numero' of module) |
|
| 60 | - $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
| 61 | - // Module description |
|
| 62 | - // used if translation string 'ModuleXXXDesc' not found |
|
| 63 | - // (where XXX is value of numeric property 'numero' of module) |
|
| 64 | - $this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre"; |
|
| 65 | - // Possible values for version are: 'development', 'experimental' or version |
|
| 66 | - $this->version = '3.1.10'; |
|
| 67 | - // Key used in llx_const table to save module status enabled/disabled |
|
| 68 | - // (where MYMODULE is value of property name of module in uppercase) |
|
| 69 | - $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
| 70 | - // Where to store the module in setup page |
|
| 71 | - // (0=common,1=interface,2=others,3=very specific) |
|
| 72 | - $this->special = 2; |
|
| 73 | - // Name of image file used for this module. |
|
| 74 | - // If file is in theme/yourtheme/img directory under name object_pictovalue.png |
|
| 75 | - // use this->picto='pictovalue' |
|
| 76 | - // If file is in module/img directory under name object_pictovalue.png |
|
| 77 | - // use this->picto='pictovalue@module' |
|
| 78 | - $this->picto = 'subtotal@subtotal'; // mypicto@titre |
|
| 79 | - // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
|
| 80 | - // for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable) |
|
| 81 | - // for specific path of parts (eg: /titre/core/modules/barcode) |
|
| 82 | - // for specific css file (eg: /titre/css/titre.css.php) |
|
| 83 | - $this->module_parts = array( |
|
| 84 | - // Set this to 1 if module has its own trigger directory |
|
| 85 | - 'triggers' => 1, |
|
| 86 | - // Set this to 1 if module has its own login method directory |
|
| 87 | - //'login' => 0, |
|
| 88 | - // Set this to 1 if module has its own substitution function file |
|
| 89 | - //'substitutions' => 0, |
|
| 90 | - // Set this to 1 if module has its own menus handler directory |
|
| 91 | - //'menus' => 0, |
|
| 92 | - // Set this to 1 if module has its own barcode directory |
|
| 93 | - //'barcode' => 0, |
|
| 94 | - // Set this to 1 if module has its own models directory |
|
| 95 | - 'models' => 1, |
|
| 96 | - // Set this to relative path of css if module has its own css file |
|
| 97 | - //'css' => '/titre/css/mycss.css.php', |
|
| 98 | - // Set here all hooks context managed by module |
|
| 99 | - 'hooks' => array( |
|
| 100 | - 'invoicecard' |
|
| 101 | - ,'invoicesuppliercard' |
|
| 102 | - ,'propalcard' |
|
| 103 | - ,'supplier_proposalcard' |
|
| 104 | - ,'ordercard' |
|
| 105 | - ,'ordersuppliercard' |
|
| 106 | - ,'odtgeneration' |
|
| 107 | - ,'orderstoinvoice' |
|
| 108 | - ,'admin' |
|
| 109 | - ,'invoicereccard' |
|
| 110 | - ,'consumptionthirdparty' |
|
| 111 | - ,'ordershipmentcard' |
|
| 112 | - ,'expeditioncard' |
|
| 54 | + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
| 55 | + // It is used to group modules in module setup page |
|
| 56 | + $this->family = "technic"; |
|
| 57 | + // Module label (no space allowed) |
|
| 58 | + // used if translation string 'ModuleXXXName' not found |
|
| 59 | + // (where XXX is value of numeric property 'numero' of module) |
|
| 60 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
| 61 | + // Module description |
|
| 62 | + // used if translation string 'ModuleXXXDesc' not found |
|
| 63 | + // (where XXX is value of numeric property 'numero' of module) |
|
| 64 | + $this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre"; |
|
| 65 | + // Possible values for version are: 'development', 'experimental' or version |
|
| 66 | + $this->version = '3.1.10'; |
|
| 67 | + // Key used in llx_const table to save module status enabled/disabled |
|
| 68 | + // (where MYMODULE is value of property name of module in uppercase) |
|
| 69 | + $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
| 70 | + // Where to store the module in setup page |
|
| 71 | + // (0=common,1=interface,2=others,3=very specific) |
|
| 72 | + $this->special = 2; |
|
| 73 | + // Name of image file used for this module. |
|
| 74 | + // If file is in theme/yourtheme/img directory under name object_pictovalue.png |
|
| 75 | + // use this->picto='pictovalue' |
|
| 76 | + // If file is in module/img directory under name object_pictovalue.png |
|
| 77 | + // use this->picto='pictovalue@module' |
|
| 78 | + $this->picto = 'subtotal@subtotal'; // mypicto@titre |
|
| 79 | + // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
|
| 80 | + // for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable) |
|
| 81 | + // for specific path of parts (eg: /titre/core/modules/barcode) |
|
| 82 | + // for specific css file (eg: /titre/css/titre.css.php) |
|
| 83 | + $this->module_parts = array( |
|
| 84 | + // Set this to 1 if module has its own trigger directory |
|
| 85 | + 'triggers' => 1, |
|
| 86 | + // Set this to 1 if module has its own login method directory |
|
| 87 | + //'login' => 0, |
|
| 88 | + // Set this to 1 if module has its own substitution function file |
|
| 89 | + //'substitutions' => 0, |
|
| 90 | + // Set this to 1 if module has its own menus handler directory |
|
| 91 | + //'menus' => 0, |
|
| 92 | + // Set this to 1 if module has its own barcode directory |
|
| 93 | + //'barcode' => 0, |
|
| 94 | + // Set this to 1 if module has its own models directory |
|
| 95 | + 'models' => 1, |
|
| 96 | + // Set this to relative path of css if module has its own css file |
|
| 97 | + //'css' => '/titre/css/mycss.css.php', |
|
| 98 | + // Set here all hooks context managed by module |
|
| 99 | + 'hooks' => array( |
|
| 100 | + 'invoicecard' |
|
| 101 | + ,'invoicesuppliercard' |
|
| 102 | + ,'propalcard' |
|
| 103 | + ,'supplier_proposalcard' |
|
| 104 | + ,'ordercard' |
|
| 105 | + ,'ordersuppliercard' |
|
| 106 | + ,'odtgeneration' |
|
| 107 | + ,'orderstoinvoice' |
|
| 108 | + ,'admin' |
|
| 109 | + ,'invoicereccard' |
|
| 110 | + ,'consumptionthirdparty' |
|
| 111 | + ,'ordershipmentcard' |
|
| 112 | + ,'expeditioncard' |
|
| 113 | 113 | ,'deliverycard' |
| 114 | - ) |
|
| 115 | - // Set here all workflow context managed by module |
|
| 116 | - //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
|
| 117 | - ); |
|
| 114 | + ) |
|
| 115 | + // Set here all workflow context managed by module |
|
| 116 | + //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
|
| 117 | + ); |
|
| 118 | 118 | |
| 119 | - // Data directories to create when module is enabled. |
|
| 120 | - // Example: this->dirs = array("/titre/temp"); |
|
| 121 | - $this->dirs = array(); |
|
| 119 | + // Data directories to create when module is enabled. |
|
| 120 | + // Example: this->dirs = array("/titre/temp"); |
|
| 121 | + $this->dirs = array(); |
|
| 122 | 122 | |
| 123 | - // Config pages. Put here list of php pages |
|
| 124 | - // stored into titre/admin directory, used to setup module. |
|
| 125 | - $this->config_page_url = array("subtotal_setup.php@subtotal"); |
|
| 123 | + // Config pages. Put here list of php pages |
|
| 124 | + // stored into titre/admin directory, used to setup module. |
|
| 125 | + $this->config_page_url = array("subtotal_setup.php@subtotal"); |
|
| 126 | 126 | |
| 127 | - // Dependencies |
|
| 128 | - // List of modules id that must be enabled if this module is enabled |
|
| 129 | - $this->depends = array(); |
|
| 127 | + // Dependencies |
|
| 128 | + // List of modules id that must be enabled if this module is enabled |
|
| 129 | + $this->depends = array(); |
|
| 130 | 130 | |
| 131 | 131 | $this->conflictwith=array('modMilestone'); |
| 132 | - // List of modules id to disable if this one is disabled |
|
| 133 | - $this->requiredby = array(); |
|
| 134 | - // Minimum version of PHP required by module |
|
| 135 | - $this->phpmin = array(5, 3); |
|
| 136 | - // Minimum version of Dolibarr required by module |
|
| 137 | - $this->need_dolibarr_version = array(3, 2); |
|
| 138 | - $this->langfiles = array("subtotal@subtotal"); // langfiles@titre |
|
| 139 | - // Constants |
|
| 140 | - // List of particular constants to add when module is enabled |
|
| 141 | - // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
| 142 | - // Example: |
|
| 143 | - $this->const = array( |
|
| 144 | - 0=>array( |
|
| 145 | - 'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES', |
|
| 146 | - 'chaine', |
|
| 147 | - 'I', |
|
| 148 | - 'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché', |
|
| 149 | - 1 |
|
| 150 | - ) |
|
| 132 | + // List of modules id to disable if this one is disabled |
|
| 133 | + $this->requiredby = array(); |
|
| 134 | + // Minimum version of PHP required by module |
|
| 135 | + $this->phpmin = array(5, 3); |
|
| 136 | + // Minimum version of Dolibarr required by module |
|
| 137 | + $this->need_dolibarr_version = array(3, 2); |
|
| 138 | + $this->langfiles = array("subtotal@subtotal"); // langfiles@titre |
|
| 139 | + // Constants |
|
| 140 | + // List of particular constants to add when module is enabled |
|
| 141 | + // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
| 142 | + // Example: |
|
| 143 | + $this->const = array( |
|
| 144 | + 0=>array( |
|
| 145 | + 'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES', |
|
| 146 | + 'chaine', |
|
| 147 | + 'I', |
|
| 148 | + 'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché', |
|
| 149 | + 1 |
|
| 150 | + ) |
|
| 151 | 151 | ,1=>array('SUBTOTAL_ALLOW_ADD_BLOCK', 'chaine', '1', 'Permet l\'ajout de titres et sous-totaux') |
| 152 | 152 | ,2=>array('SUBTOTAL_ALLOW_EDIT_BLOCK', 'chaine', '1', 'Permet de modifier titres et sous-totaux') |
| 153 | 153 | ,3=>array('SUBTOTAL_ALLOW_REMOVE_BLOCK', 'chaine', '1', 'Permet de supprimer les titres et sous-totaux') |
| 154 | 154 | ,4=>array('SUBTOTAL_TITLE_STYLE', 'chaine', 'BU') |
| 155 | 155 | ,5=>array('SUBTOTAL_SUBTOTAL_STYLE', 'chaine', 'B') |
| 156 | - // 1=>array( |
|
| 157 | - // 'MYMODULE_MYNEWCONST2', |
|
| 158 | - // 'chaine', |
|
| 159 | - // 'myvalue', |
|
| 160 | - // 'This is another constant to add', |
|
| 161 | - // 0 |
|
| 162 | - // ) |
|
| 163 | - ); |
|
| 156 | + // 1=>array( |
|
| 157 | + // 'MYMODULE_MYNEWCONST2', |
|
| 158 | + // 'chaine', |
|
| 159 | + // 'myvalue', |
|
| 160 | + // 'This is another constant to add', |
|
| 161 | + // 0 |
|
| 162 | + // ) |
|
| 163 | + ); |
|
| 164 | 164 | |
| 165 | 165 | |
| 166 | 166 | |
| 167 | 167 | |
| 168 | - // Array to add new pages in new tabs |
|
| 169 | - // Example: |
|
| 170 | - $this->tabs = array( |
|
| 171 | - // // To add a new tab identified by code tabname1 |
|
| 172 | - // 'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__', |
|
| 173 | - // // To add another new tab identified by code tabname2 |
|
| 174 | - // 'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__', |
|
| 175 | - // // To remove an existing tab identified by code tabname |
|
| 176 | - // 'objecttype:-tabname' |
|
| 177 | - ); |
|
| 178 | - // where objecttype can be |
|
| 179 | - // 'thirdparty' to add a tab in third party view |
|
| 180 | - // 'intervention' to add a tab in intervention view |
|
| 181 | - // 'order_supplier' to add a tab in supplier order view |
|
| 182 | - // 'invoice_supplier' to add a tab in supplier invoice view |
|
| 183 | - // 'invoice' to add a tab in customer invoice view |
|
| 184 | - // 'order' to add a tab in customer order view |
|
| 185 | - // 'product' to add a tab in product view |
|
| 186 | - // 'stock' to add a tab in stock view |
|
| 187 | - // 'propal' to add a tab in propal view |
|
| 188 | - // 'member' to add a tab in fundation member view |
|
| 189 | - // 'contract' to add a tab in contract view |
|
| 190 | - // 'user' to add a tab in user view |
|
| 191 | - // 'group' to add a tab in group view |
|
| 192 | - // 'contact' to add a tab in contact view |
|
| 193 | - // 'categories_x' to add a tab in category view |
|
| 194 | - // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
| 195 | - // Dictionnaries |
|
| 196 | - if (! isset($conf->subtotal->enabled)) { |
|
| 197 | - $conf->subtotal=new stdClass(); |
|
| 198 | - $conf->subtotal->enabled = 0; |
|
| 199 | - } |
|
| 200 | - $this->dictionaries = array( |
|
| 168 | + // Array to add new pages in new tabs |
|
| 169 | + // Example: |
|
| 170 | + $this->tabs = array( |
|
| 171 | + // // To add a new tab identified by code tabname1 |
|
| 172 | + // 'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__', |
|
| 173 | + // // To add another new tab identified by code tabname2 |
|
| 174 | + // 'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__', |
|
| 175 | + // // To remove an existing tab identified by code tabname |
|
| 176 | + // 'objecttype:-tabname' |
|
| 177 | + ); |
|
| 178 | + // where objecttype can be |
|
| 179 | + // 'thirdparty' to add a tab in third party view |
|
| 180 | + // 'intervention' to add a tab in intervention view |
|
| 181 | + // 'order_supplier' to add a tab in supplier order view |
|
| 182 | + // 'invoice_supplier' to add a tab in supplier invoice view |
|
| 183 | + // 'invoice' to add a tab in customer invoice view |
|
| 184 | + // 'order' to add a tab in customer order view |
|
| 185 | + // 'product' to add a tab in product view |
|
| 186 | + // 'stock' to add a tab in stock view |
|
| 187 | + // 'propal' to add a tab in propal view |
|
| 188 | + // 'member' to add a tab in fundation member view |
|
| 189 | + // 'contract' to add a tab in contract view |
|
| 190 | + // 'user' to add a tab in user view |
|
| 191 | + // 'group' to add a tab in group view |
|
| 192 | + // 'contact' to add a tab in contact view |
|
| 193 | + // 'categories_x' to add a tab in category view |
|
| 194 | + // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
| 195 | + // Dictionnaries |
|
| 196 | + if (! isset($conf->subtotal->enabled)) { |
|
| 197 | + $conf->subtotal=new stdClass(); |
|
| 198 | + $conf->subtotal->enabled = 0; |
|
| 199 | + } |
|
| 200 | + $this->dictionaries = array( |
|
| 201 | 201 | 'langs'=>'subtotal@subtotal', |
| 202 | - 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
| 203 | - 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
| 204 | - 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
| 205 | - 'tabsqlsort'=>array('label ASC'), // Sort order |
|
| 206 | - 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
| 207 | - 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
| 208 | - 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
| 209 | - 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
| 210 | - 'tabcond'=>array($conf->subtotal->enabled) |
|
| 202 | + 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
| 203 | + 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
| 204 | + 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
| 205 | + 'tabsqlsort'=>array('label ASC'), // Sort order |
|
| 206 | + 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
| 207 | + 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
| 208 | + 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
| 209 | + 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
| 210 | + 'tabcond'=>array($conf->subtotal->enabled) |
|
| 211 | 211 | ); |
| 212 | - /* Example: |
|
| 212 | + /* Example: |
|
| 213 | 213 | // This is to avoid warnings |
| 214 | 214 | if (! isset($conf->titre->enabled)) $conf->titre->enabled=0; |
| 215 | 215 | $this->dictionnaries=array( |
@@ -250,223 +250,223 @@ discard block |
||
| 250 | 250 | ); |
| 251 | 251 | */ |
| 252 | 252 | |
| 253 | - // Boxes |
|
| 254 | - // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
| 255 | - $this->boxes = array(); // Boxes list |
|
| 253 | + // Boxes |
|
| 254 | + // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
| 255 | + $this->boxes = array(); // Boxes list |
|
| 256 | 256 | |
| 257 | - /* |
|
| 257 | + /* |
|
| 258 | 258 | $this->boxes[$r][1] = "myboxb.php"; |
| 259 | 259 | $r++; |
| 260 | 260 | */ |
| 261 | 261 | |
| 262 | - // Permissions |
|
| 263 | - $this->rights = array(); // Permission array used by this module |
|
| 264 | - $r = 0; |
|
| 262 | + // Permissions |
|
| 263 | + $this->rights = array(); // Permission array used by this module |
|
| 264 | + $r = 0; |
|
| 265 | 265 | |
| 266 | - // Add here list of permission defined by |
|
| 267 | - // an id, a label, a boolean and two constant strings. |
|
| 268 | - // Example: |
|
| 269 | - //// Permission id (must not be already used) |
|
| 270 | - //$this->rights[$r][0] = 2000; |
|
| 271 | - //// Permission label |
|
| 272 | - //$this->rights[$r][1] = 'Permision label'; |
|
| 273 | - //// Permission by default for new user (0/1) |
|
| 274 | - //$this->rights[$r][3] = 1; |
|
| 275 | - //// In php code, permission will be checked by test |
|
| 276 | - //// if ($user->rights->permkey->level1->level2) |
|
| 277 | - //$this->rights[$r][4] = 'level1'; |
|
| 278 | - //// In php code, permission will be checked by test |
|
| 279 | - //// if ($user->rights->permkey->level1->level2) |
|
| 280 | - //$this->rights[$r][5] = 'level2'; |
|
| 281 | - //$r++; |
|
| 282 | - // Main menu entries |
|
| 283 | - $this->menus = array(); // List of menus to add |
|
| 284 | - $r = 0; |
|
| 266 | + // Add here list of permission defined by |
|
| 267 | + // an id, a label, a boolean and two constant strings. |
|
| 268 | + // Example: |
|
| 269 | + //// Permission id (must not be already used) |
|
| 270 | + //$this->rights[$r][0] = 2000; |
|
| 271 | + //// Permission label |
|
| 272 | + //$this->rights[$r][1] = 'Permision label'; |
|
| 273 | + //// Permission by default for new user (0/1) |
|
| 274 | + //$this->rights[$r][3] = 1; |
|
| 275 | + //// In php code, permission will be checked by test |
|
| 276 | + //// if ($user->rights->permkey->level1->level2) |
|
| 277 | + //$this->rights[$r][4] = 'level1'; |
|
| 278 | + //// In php code, permission will be checked by test |
|
| 279 | + //// if ($user->rights->permkey->level1->level2) |
|
| 280 | + //$this->rights[$r][5] = 'level2'; |
|
| 281 | + //$r++; |
|
| 282 | + // Main menu entries |
|
| 283 | + $this->menus = array(); // List of menus to add |
|
| 284 | + $r = 0; |
|
| 285 | 285 | |
| 286 | - // Add here entries to declare new menus |
|
| 287 | - // |
|
| 288 | - // Example to declare a new Top Menu entry and its Left menu entry: |
|
| 289 | - //$this->menu[$r]=array( |
|
| 290 | - // // Put 0 if this is a top menu |
|
| 291 | - // 'fk_menu'=>0, |
|
| 292 | - // // This is a Top menu entry |
|
| 293 | - // 'type'=>'top', |
|
| 294 | - // 'titre'=>'titre top menu', |
|
| 295 | - // 'mainmenu'=>'titre', |
|
| 296 | - // 'leftmenu'=>'titre', |
|
| 297 | - // 'url'=>'/titre/pagetop.php', |
|
| 298 | - // // Lang file to use (without .lang) by module. |
|
| 299 | - // // File must be in langs/code_CODE/ directory. |
|
| 300 | - // 'langs'=>'mylangfile', |
|
| 301 | - // 'position'=>100, |
|
| 302 | - // // Define condition to show or hide menu entry. |
|
| 303 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 304 | - // 'enabled'=>'$conf->titre->enabled', |
|
| 305 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 306 | - // // if you want your menu with a permission rules |
|
| 307 | - // 'perms'=>'1', |
|
| 308 | - // 'target'=>'', |
|
| 309 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
| 310 | - // 'user'=>2 |
|
| 311 | - //); |
|
| 312 | - //$r++; |
|
| 313 | - //$this->menu[$r]=array( |
|
| 314 | - // // Use r=value where r is index key used for the parent menu entry |
|
| 315 | - // // (higher parent must be a top menu entry) |
|
| 316 | - // 'fk_menu'=>'r=0', |
|
| 317 | - // // This is a Left menu entry |
|
| 318 | - // 'type'=>'left', |
|
| 319 | - // 'titre'=>'titre left menu', |
|
| 320 | - // 'mainmenu'=>'titre', |
|
| 321 | - // 'leftmenu'=>'titre', |
|
| 322 | - // 'url'=>'/titre/pagelevel1.php', |
|
| 323 | - // // Lang file to use (without .lang) by module. |
|
| 324 | - // // File must be in langs/code_CODE/ directory. |
|
| 325 | - // 'langs'=>'mylangfile', |
|
| 326 | - // 'position'=>100, |
|
| 327 | - // // Define condition to show or hide menu entry. |
|
| 328 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 329 | - // 'enabled'=>'$conf->titre->enabled', |
|
| 330 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 331 | - // // if you want your menu with a permission rules |
|
| 332 | - // 'perms'=>'1', |
|
| 333 | - // 'target'=>'', |
|
| 334 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
| 335 | - // 'user'=>2 |
|
| 336 | - //); |
|
| 337 | - //$r++; |
|
| 338 | - // |
|
| 339 | - // Example to declare a Left Menu entry into an existing Top menu entry: |
|
| 340 | - //$this->menu[$r]=array( |
|
| 341 | - // // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' |
|
| 342 | - // 'fk_menu'=>'fk_mainmenu=mainmenucode', |
|
| 343 | - // // This is a Left menu entry |
|
| 344 | - // 'type'=>'left', |
|
| 345 | - // 'titre'=>'titre left menu', |
|
| 346 | - // 'mainmenu'=>'mainmenucode', |
|
| 347 | - // 'leftmenu'=>'titre', |
|
| 348 | - // 'url'=>'/titre/pagelevel2.php', |
|
| 349 | - // // Lang file to use (without .lang) by module. |
|
| 350 | - // // File must be in langs/code_CODE/ directory. |
|
| 351 | - // 'langs'=>'mylangfile', |
|
| 352 | - // 'position'=>100, |
|
| 353 | - // // Define condition to show or hide menu entry. |
|
| 354 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 355 | - // // Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 356 | - // 'enabled'=>'$conf->titre->enabled', |
|
| 357 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 358 | - // // if you want your menu with a permission rules |
|
| 359 | - // 'perms'=>'1', |
|
| 360 | - // 'target'=>'', |
|
| 361 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
| 362 | - // 'user'=>2 |
|
| 363 | - //); |
|
| 364 | - //$r++; |
|
| 365 | - // Exports |
|
| 366 | - $r = 1; |
|
| 286 | + // Add here entries to declare new menus |
|
| 287 | + // |
|
| 288 | + // Example to declare a new Top Menu entry and its Left menu entry: |
|
| 289 | + //$this->menu[$r]=array( |
|
| 290 | + // // Put 0 if this is a top menu |
|
| 291 | + // 'fk_menu'=>0, |
|
| 292 | + // // This is a Top menu entry |
|
| 293 | + // 'type'=>'top', |
|
| 294 | + // 'titre'=>'titre top menu', |
|
| 295 | + // 'mainmenu'=>'titre', |
|
| 296 | + // 'leftmenu'=>'titre', |
|
| 297 | + // 'url'=>'/titre/pagetop.php', |
|
| 298 | + // // Lang file to use (without .lang) by module. |
|
| 299 | + // // File must be in langs/code_CODE/ directory. |
|
| 300 | + // 'langs'=>'mylangfile', |
|
| 301 | + // 'position'=>100, |
|
| 302 | + // // Define condition to show or hide menu entry. |
|
| 303 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 304 | + // 'enabled'=>'$conf->titre->enabled', |
|
| 305 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 306 | + // // if you want your menu with a permission rules |
|
| 307 | + // 'perms'=>'1', |
|
| 308 | + // 'target'=>'', |
|
| 309 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
| 310 | + // 'user'=>2 |
|
| 311 | + //); |
|
| 312 | + //$r++; |
|
| 313 | + //$this->menu[$r]=array( |
|
| 314 | + // // Use r=value where r is index key used for the parent menu entry |
|
| 315 | + // // (higher parent must be a top menu entry) |
|
| 316 | + // 'fk_menu'=>'r=0', |
|
| 317 | + // // This is a Left menu entry |
|
| 318 | + // 'type'=>'left', |
|
| 319 | + // 'titre'=>'titre left menu', |
|
| 320 | + // 'mainmenu'=>'titre', |
|
| 321 | + // 'leftmenu'=>'titre', |
|
| 322 | + // 'url'=>'/titre/pagelevel1.php', |
|
| 323 | + // // Lang file to use (without .lang) by module. |
|
| 324 | + // // File must be in langs/code_CODE/ directory. |
|
| 325 | + // 'langs'=>'mylangfile', |
|
| 326 | + // 'position'=>100, |
|
| 327 | + // // Define condition to show or hide menu entry. |
|
| 328 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 329 | + // 'enabled'=>'$conf->titre->enabled', |
|
| 330 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 331 | + // // if you want your menu with a permission rules |
|
| 332 | + // 'perms'=>'1', |
|
| 333 | + // 'target'=>'', |
|
| 334 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
| 335 | + // 'user'=>2 |
|
| 336 | + //); |
|
| 337 | + //$r++; |
|
| 338 | + // |
|
| 339 | + // Example to declare a Left Menu entry into an existing Top menu entry: |
|
| 340 | + //$this->menu[$r]=array( |
|
| 341 | + // // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' |
|
| 342 | + // 'fk_menu'=>'fk_mainmenu=mainmenucode', |
|
| 343 | + // // This is a Left menu entry |
|
| 344 | + // 'type'=>'left', |
|
| 345 | + // 'titre'=>'titre left menu', |
|
| 346 | + // 'mainmenu'=>'mainmenucode', |
|
| 347 | + // 'leftmenu'=>'titre', |
|
| 348 | + // 'url'=>'/titre/pagelevel2.php', |
|
| 349 | + // // Lang file to use (without .lang) by module. |
|
| 350 | + // // File must be in langs/code_CODE/ directory. |
|
| 351 | + // 'langs'=>'mylangfile', |
|
| 352 | + // 'position'=>100, |
|
| 353 | + // // Define condition to show or hide menu entry. |
|
| 354 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 355 | + // // Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 356 | + // 'enabled'=>'$conf->titre->enabled', |
|
| 357 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 358 | + // // if you want your menu with a permission rules |
|
| 359 | + // 'perms'=>'1', |
|
| 360 | + // 'target'=>'', |
|
| 361 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
| 362 | + // 'user'=>2 |
|
| 363 | + //); |
|
| 364 | + //$r++; |
|
| 365 | + // Exports |
|
| 366 | + $r = 1; |
|
| 367 | 367 | |
| 368 | - // Example: |
|
| 369 | - //$this->export_code[$r]=$this->rights_class.'_'.$r; |
|
| 370 | - //// Translation key (used only if key ExportDataset_xxx_z not found) |
|
| 371 | - //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; |
|
| 372 | - //// Condition to show export in list (ie: '$user->id==3'). |
|
| 373 | - //// Set to 1 to always show when module is enabled. |
|
| 374 | - //$this->export_enabled[$r]='1'; |
|
| 375 | - //$this->export_permission[$r]=array(array("facture","facture","export")); |
|
| 376 | - //$this->export_fields_array[$r]=array( |
|
| 377 | - // 's.rowid'=>"IdCompany", |
|
| 378 | - // 's.nom'=>'CompanyName', |
|
| 379 | - // 's.address'=>'Address', |
|
| 380 | - // 's.cp'=>'Zip', |
|
| 381 | - // 's.ville'=>'Town', |
|
| 382 | - // 's.fk_pays'=>'Country', |
|
| 383 | - // 's.tel'=>'Phone', |
|
| 384 | - // 's.siren'=>'ProfId1', |
|
| 385 | - // 's.siret'=>'ProfId2', |
|
| 386 | - // 's.ape'=>'ProfId3', |
|
| 387 | - // 's.idprof4'=>'ProfId4', |
|
| 388 | - // 's.code_compta'=>'CustomerAccountancyCode', |
|
| 389 | - // 's.code_compta_fournisseur'=>'SupplierAccountancyCode', |
|
| 390 | - // 'f.rowid'=>"InvoiceId", |
|
| 391 | - // 'f.facnumber'=>"InvoiceRef", |
|
| 392 | - // 'f.datec'=>"InvoiceDateCreation", |
|
| 393 | - // 'f.datef'=>"DateInvoice", |
|
| 394 | - // 'f.total'=>"TotalHT", |
|
| 395 | - // 'f.total_ttc'=>"TotalTTC", |
|
| 396 | - // 'f.tva'=>"TotalVAT", |
|
| 397 | - // 'f.paye'=>"InvoicePaid", |
|
| 398 | - // 'f.fk_statut'=>'InvoiceStatus', |
|
| 399 | - // 'f.note'=>"InvoiceNote", |
|
| 400 | - // 'fd.rowid'=>'LineId', |
|
| 401 | - // 'fd.description'=>"LineDescription", |
|
| 402 | - // 'fd.price'=>"LineUnitPrice", |
|
| 403 | - // 'fd.tva_tx'=>"LineVATRate", |
|
| 404 | - // 'fd.qty'=>"LineQty", |
|
| 405 | - // 'fd.total_ht'=>"LineTotalHT", |
|
| 406 | - // 'fd.total_tva'=>"LineTotalTVA", |
|
| 407 | - // 'fd.total_ttc'=>"LineTotalTTC", |
|
| 408 | - // 'fd.date_start'=>"DateStart", |
|
| 409 | - // 'fd.date_end'=>"DateEnd", |
|
| 410 | - // 'fd.fk_product'=>'ProductId', |
|
| 411 | - // 'p.ref'=>'ProductRef' |
|
| 412 | - //); |
|
| 413 | - //$this->export_entities_array[$r]=array('s.rowid'=>"company", |
|
| 414 | - // 's.nom'=>'company', |
|
| 415 | - // 's.address'=>'company', |
|
| 416 | - // 's.cp'=>'company', |
|
| 417 | - // 's.ville'=>'company', |
|
| 418 | - // 's.fk_pays'=>'company', |
|
| 419 | - // 's.tel'=>'company', |
|
| 420 | - // 's.siren'=>'company', |
|
| 421 | - // 's.siret'=>'company', |
|
| 422 | - // 's.ape'=>'company', |
|
| 423 | - // 's.idprof4'=>'company', |
|
| 424 | - // 's.code_compta'=>'company', |
|
| 425 | - // 's.code_compta_fournisseur'=>'company', |
|
| 426 | - // 'f.rowid'=>"invoice", |
|
| 427 | - // 'f.facnumber'=>"invoice", |
|
| 428 | - // 'f.datec'=>"invoice", |
|
| 429 | - // 'f.datef'=>"invoice", |
|
| 430 | - // 'f.total'=>"invoice", |
|
| 431 | - // 'f.total_ttc'=>"invoice", |
|
| 432 | - // 'f.tva'=>"invoice", |
|
| 433 | - // 'f.paye'=>"invoice", |
|
| 434 | - // 'f.fk_statut'=>'invoice', |
|
| 435 | - // 'f.note'=>"invoice", |
|
| 436 | - // 'fd.rowid'=>'invoice_line', |
|
| 437 | - // 'fd.description'=>"invoice_line", |
|
| 438 | - // 'fd.price'=>"invoice_line", |
|
| 439 | - // 'fd.total_ht'=>"invoice_line", |
|
| 440 | - // 'fd.total_tva'=>"invoice_line", |
|
| 441 | - // 'fd.total_ttc'=>"invoice_line", |
|
| 442 | - // 'fd.tva_tx'=>"invoice_line", |
|
| 443 | - // 'fd.qty'=>"invoice_line", |
|
| 444 | - // 'fd.date_start'=>"invoice_line", |
|
| 445 | - // 'fd.date_end'=>"invoice_line", |
|
| 446 | - // 'fd.fk_product'=>'product', |
|
| 447 | - // 'p.ref'=>'product' |
|
| 448 | - //); |
|
| 449 | - //$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
| 450 | - //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, ' |
|
| 451 | - // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)'; |
|
| 452 | - //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX |
|
| 453 | - // . 'product as p on (fd.fk_product = p.rowid)'; |
|
| 454 | - //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid ' |
|
| 455 | - // . 'AND f.rowid = fd.fk_facture'; |
|
| 456 | - //$r++; |
|
| 457 | - } |
|
| 368 | + // Example: |
|
| 369 | + //$this->export_code[$r]=$this->rights_class.'_'.$r; |
|
| 370 | + //// Translation key (used only if key ExportDataset_xxx_z not found) |
|
| 371 | + //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; |
|
| 372 | + //// Condition to show export in list (ie: '$user->id==3'). |
|
| 373 | + //// Set to 1 to always show when module is enabled. |
|
| 374 | + //$this->export_enabled[$r]='1'; |
|
| 375 | + //$this->export_permission[$r]=array(array("facture","facture","export")); |
|
| 376 | + //$this->export_fields_array[$r]=array( |
|
| 377 | + // 's.rowid'=>"IdCompany", |
|
| 378 | + // 's.nom'=>'CompanyName', |
|
| 379 | + // 's.address'=>'Address', |
|
| 380 | + // 's.cp'=>'Zip', |
|
| 381 | + // 's.ville'=>'Town', |
|
| 382 | + // 's.fk_pays'=>'Country', |
|
| 383 | + // 's.tel'=>'Phone', |
|
| 384 | + // 's.siren'=>'ProfId1', |
|
| 385 | + // 's.siret'=>'ProfId2', |
|
| 386 | + // 's.ape'=>'ProfId3', |
|
| 387 | + // 's.idprof4'=>'ProfId4', |
|
| 388 | + // 's.code_compta'=>'CustomerAccountancyCode', |
|
| 389 | + // 's.code_compta_fournisseur'=>'SupplierAccountancyCode', |
|
| 390 | + // 'f.rowid'=>"InvoiceId", |
|
| 391 | + // 'f.facnumber'=>"InvoiceRef", |
|
| 392 | + // 'f.datec'=>"InvoiceDateCreation", |
|
| 393 | + // 'f.datef'=>"DateInvoice", |
|
| 394 | + // 'f.total'=>"TotalHT", |
|
| 395 | + // 'f.total_ttc'=>"TotalTTC", |
|
| 396 | + // 'f.tva'=>"TotalVAT", |
|
| 397 | + // 'f.paye'=>"InvoicePaid", |
|
| 398 | + // 'f.fk_statut'=>'InvoiceStatus', |
|
| 399 | + // 'f.note'=>"InvoiceNote", |
|
| 400 | + // 'fd.rowid'=>'LineId', |
|
| 401 | + // 'fd.description'=>"LineDescription", |
|
| 402 | + // 'fd.price'=>"LineUnitPrice", |
|
| 403 | + // 'fd.tva_tx'=>"LineVATRate", |
|
| 404 | + // 'fd.qty'=>"LineQty", |
|
| 405 | + // 'fd.total_ht'=>"LineTotalHT", |
|
| 406 | + // 'fd.total_tva'=>"LineTotalTVA", |
|
| 407 | + // 'fd.total_ttc'=>"LineTotalTTC", |
|
| 408 | + // 'fd.date_start'=>"DateStart", |
|
| 409 | + // 'fd.date_end'=>"DateEnd", |
|
| 410 | + // 'fd.fk_product'=>'ProductId', |
|
| 411 | + // 'p.ref'=>'ProductRef' |
|
| 412 | + //); |
|
| 413 | + //$this->export_entities_array[$r]=array('s.rowid'=>"company", |
|
| 414 | + // 's.nom'=>'company', |
|
| 415 | + // 's.address'=>'company', |
|
| 416 | + // 's.cp'=>'company', |
|
| 417 | + // 's.ville'=>'company', |
|
| 418 | + // 's.fk_pays'=>'company', |
|
| 419 | + // 's.tel'=>'company', |
|
| 420 | + // 's.siren'=>'company', |
|
| 421 | + // 's.siret'=>'company', |
|
| 422 | + // 's.ape'=>'company', |
|
| 423 | + // 's.idprof4'=>'company', |
|
| 424 | + // 's.code_compta'=>'company', |
|
| 425 | + // 's.code_compta_fournisseur'=>'company', |
|
| 426 | + // 'f.rowid'=>"invoice", |
|
| 427 | + // 'f.facnumber'=>"invoice", |
|
| 428 | + // 'f.datec'=>"invoice", |
|
| 429 | + // 'f.datef'=>"invoice", |
|
| 430 | + // 'f.total'=>"invoice", |
|
| 431 | + // 'f.total_ttc'=>"invoice", |
|
| 432 | + // 'f.tva'=>"invoice", |
|
| 433 | + // 'f.paye'=>"invoice", |
|
| 434 | + // 'f.fk_statut'=>'invoice', |
|
| 435 | + // 'f.note'=>"invoice", |
|
| 436 | + // 'fd.rowid'=>'invoice_line', |
|
| 437 | + // 'fd.description'=>"invoice_line", |
|
| 438 | + // 'fd.price'=>"invoice_line", |
|
| 439 | + // 'fd.total_ht'=>"invoice_line", |
|
| 440 | + // 'fd.total_tva'=>"invoice_line", |
|
| 441 | + // 'fd.total_ttc'=>"invoice_line", |
|
| 442 | + // 'fd.tva_tx'=>"invoice_line", |
|
| 443 | + // 'fd.qty'=>"invoice_line", |
|
| 444 | + // 'fd.date_start'=>"invoice_line", |
|
| 445 | + // 'fd.date_end'=>"invoice_line", |
|
| 446 | + // 'fd.fk_product'=>'product', |
|
| 447 | + // 'p.ref'=>'product' |
|
| 448 | + //); |
|
| 449 | + //$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
| 450 | + //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, ' |
|
| 451 | + // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)'; |
|
| 452 | + //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX |
|
| 453 | + // . 'product as p on (fd.fk_product = p.rowid)'; |
|
| 454 | + //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid ' |
|
| 455 | + // . 'AND f.rowid = fd.fk_facture'; |
|
| 456 | + //$r++; |
|
| 457 | + } |
|
| 458 | 458 | |
| 459 | - /** |
|
| 460 | - * Function called when module is enabled. |
|
| 461 | - * The init function add constants, boxes, permissions and menus |
|
| 462 | - * (defined in constructor) into Dolibarr database. |
|
| 463 | - * It also creates data directories |
|
| 464 | - * |
|
| 465 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
| 466 | - * @return int 1 if OK, 0 if KO |
|
| 467 | - */ |
|
| 468 | - public function init($options = '') |
|
| 469 | - { |
|
| 459 | + /** |
|
| 460 | + * Function called when module is enabled. |
|
| 461 | + * The init function add constants, boxes, permissions and menus |
|
| 462 | + * (defined in constructor) into Dolibarr database. |
|
| 463 | + * It also creates data directories |
|
| 464 | + * |
|
| 465 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
| 466 | + * @return int 1 if OK, 0 if KO |
|
| 467 | + */ |
|
| 468 | + public function init($options = '') |
|
| 469 | + { |
|
| 470 | 470 | global $conf, $db; |
| 471 | 471 | |
| 472 | 472 | |
@@ -474,46 +474,46 @@ discard block |
||
| 474 | 474 | exit("Attention, ce module rentre ne conflit avec le module Jalon/Milestones. Merci de le désactiver auparavant."); |
| 475 | 475 | } |
| 476 | 476 | */ |
| 477 | - $sql = array(); |
|
| 477 | + $sql = array(); |
|
| 478 | 478 | |
| 479 | - $result = $this->loadTables(); |
|
| 480 | - dol_include_once('/core/class/extrafields.class.php'); |
|
| 479 | + $result = $this->loadTables(); |
|
| 480 | + dol_include_once('/core/class/extrafields.class.php'); |
|
| 481 | 481 | |
| 482 | - $extra = new ExtraFields($db); // propaldet, commandedet, facturedet |
|
| 483 | - $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det'); |
|
| 484 | - foreach($TElementType as $element_type) { |
|
| 485 | - $extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
| 486 | - $extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
| 487 | - } |
|
| 482 | + $extra = new ExtraFields($db); // propaldet, commandedet, facturedet |
|
| 483 | + $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det'); |
|
| 484 | + foreach($TElementType as $element_type) { |
|
| 485 | + $extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
| 486 | + $extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
| 487 | + } |
|
| 488 | 488 | |
| 489 | - return $this->_init($sql, $options); |
|
| 490 | - } |
|
| 489 | + return $this->_init($sql, $options); |
|
| 490 | + } |
|
| 491 | 491 | |
| 492 | - /** |
|
| 493 | - * Function called when module is disabled. |
|
| 494 | - * Remove from database constants, boxes and permissions from Dolibarr database. |
|
| 495 | - * Data directories are not deleted |
|
| 496 | - * |
|
| 497 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
| 498 | - * @return int 1 if OK, 0 if KO |
|
| 499 | - */ |
|
| 500 | - public function remove($options = '') |
|
| 501 | - { |
|
| 502 | - $sql = array(); |
|
| 492 | + /** |
|
| 493 | + * Function called when module is disabled. |
|
| 494 | + * Remove from database constants, boxes and permissions from Dolibarr database. |
|
| 495 | + * Data directories are not deleted |
|
| 496 | + * |
|
| 497 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
| 498 | + * @return int 1 if OK, 0 if KO |
|
| 499 | + */ |
|
| 500 | + public function remove($options = '') |
|
| 501 | + { |
|
| 502 | + $sql = array(); |
|
| 503 | 503 | |
| 504 | - return $this->_remove($sql, $options); |
|
| 505 | - } |
|
| 504 | + return $this->_remove($sql, $options); |
|
| 505 | + } |
|
| 506 | 506 | |
| 507 | - /** |
|
| 508 | - * Create tables, keys and data required by module |
|
| 509 | - * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys |
|
| 510 | - * and create data commands must be stored in directory /titre/sql/ |
|
| 511 | - * This function is called by this->init |
|
| 512 | - * |
|
| 513 | - * @return int <=0 if KO, >0 if OK |
|
| 514 | - */ |
|
| 515 | - private function loadTables() |
|
| 516 | - { |
|
| 517 | - return $this->_load_tables('/subtotal/sql/'); |
|
| 518 | - } |
|
| 507 | + /** |
|
| 508 | + * Create tables, keys and data required by module |
|
| 509 | + * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys |
|
| 510 | + * and create data commands must be stored in directory /titre/sql/ |
|
| 511 | + * This function is called by this->init |
|
| 512 | + * |
|
| 513 | + * @return int <=0 if KO, >0 if OK |
|
| 514 | + */ |
|
| 515 | + private function loadTables() |
|
| 516 | + { |
|
| 517 | + return $this->_load_tables('/subtotal/sql/'); |
|
| 518 | + } |
|
| 519 | 519 | } |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | * @return void |
| 102 | 102 | */ |
| 103 | 103 | |
| 104 | - var $module_number = 104777; |
|
| 104 | + var $module_number = 104777; |
|
| 105 | 105 | |
| 106 | - function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
| 107 | - { |
|
| 108 | - global $langs,$db,$user, $conf; |
|
| 106 | + function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
| 107 | + { |
|
| 108 | + global $langs,$db,$user, $conf; |
|
| 109 | 109 | |
| 110 | 110 | $langs->load('subtotal@subtotal'); |
| 111 | 111 | |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | $createRight = $user->rights->facture->creer; |
| 121 | 121 | } elseif($object->element == 'order_supplier' ) |
| 122 | 122 | { |
| 123 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
| 123 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
| 124 | 124 | } elseif($object->element == 'invoice_supplier' ) |
| 125 | 125 | { |
| 126 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
| 126 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
| 127 | 127 | } |
| 128 | 128 | elseif($object->element == 'shipping') |
| 129 | 129 | { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
| 179 | 179 | |
| 180 | - TSubtotal::addSubTotalLine($object, $title, $qty); |
|
| 180 | + TSubtotal::addSubTotalLine($object, $title, $qty); |
|
| 181 | 181 | } |
| 182 | 182 | else if($action==='ask_deleteallline') { |
| 183 | 183 | $form=new Form($db); |
@@ -399,36 +399,36 @@ discard block |
||
| 399 | 399 | $TContext = explode(':',$parameters['context']); |
| 400 | 400 | if ( |
| 401 | 401 | in_array('invoicecard',$TContext) |
| 402 | - || in_array('invoicesuppliercard',$TContext) |
|
| 402 | + || in_array('invoicesuppliercard',$TContext) |
|
| 403 | 403 | || in_array('propalcard',$TContext) |
| 404 | 404 | || in_array('ordercard',$TContext) |
| 405 | - || in_array('ordersuppliercard',$TContext) |
|
| 405 | + || in_array('ordersuppliercard',$TContext) |
|
| 406 | 406 | || in_array('invoicereccard',$TContext) |
| 407 | 407 | ) |
| 408 | - { |
|
| 409 | - $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
| 410 | - $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
| 408 | + { |
|
| 409 | + $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
| 410 | + $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
| 411 | 411 | $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0; |
| 412 | 412 | $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf; |
| 413 | 413 | |
| 414 | 414 | $var=false; |
| 415 | - $out.= '<tr '.$bc[$var].'> |
|
| 415 | + $out.= '<tr '.$bc[$var].'> |
|
| 416 | 416 | <td colspan="4" align="right"> |
| 417 | 417 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
| 418 | 418 | <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
| 419 | 419 | </td> |
| 420 | 420 | </tr>'; |
| 421 | 421 | |
| 422 | - $var=!$var; |
|
| 423 | - $out.= '<tr '.$bc[$var].'> |
|
| 422 | + $var=!$var; |
|
| 423 | + $out.= '<tr '.$bc[$var].'> |
|
| 424 | 424 | <td colspan="4" align="right"> |
| 425 | 425 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
| 426 | 426 | <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
| 427 | 427 | </td> |
| 428 | 428 | </tr>'; |
| 429 | 429 | |
| 430 | - $var=!$var; |
|
| 431 | - $out.= '<tr '.$bc[$var].'> |
|
| 430 | + $var=!$var; |
|
| 431 | + $out.= '<tr '.$bc[$var].'> |
|
| 432 | 432 | <td colspan="4" align="right"> |
| 433 | 433 | <label for="hideprices">'.$langs->trans('SubTotalhidePrice').'</label> |
| 434 | 434 | <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
@@ -440,9 +440,9 @@ discard block |
||
| 440 | 440 | if ( |
| 441 | 441 | (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
| 442 | 442 | || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
| 443 | - || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 443 | + || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 444 | 444 | || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
| 445 | - || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 445 | + || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 446 | 446 | || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
| 447 | 447 | ) |
| 448 | 448 | { |
@@ -461,19 +461,19 @@ discard block |
||
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | |
| 464 | - return 1; |
|
| 464 | + return 1; |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | - function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
| 468 | - { |
|
| 467 | + function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
| 468 | + { |
|
| 469 | 469 | |
| 470 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
| 471 | - { |
|
| 470 | + if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
| 471 | + { |
|
| 472 | 472 | |
| 473 | - } |
|
| 473 | + } |
|
| 474 | 474 | |
| 475 | - return 0; |
|
| 476 | - } |
|
| 475 | + return 0; |
|
| 476 | + } |
|
| 477 | 477 | |
| 478 | 478 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
| 479 | 479 | global $conf; |
@@ -522,11 +522,11 @@ discard block |
||
| 522 | 522 | |
| 523 | 523 | if ( |
| 524 | 524 | in_array('invoicecard',explode(':',$parameters['context'])) |
| 525 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 525 | + || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 526 | 526 | || in_array('propalcard',explode(':',$parameters['context'])) |
| 527 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 527 | + || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 528 | 528 | || in_array('ordercard',explode(':',$parameters['context'])) |
| 529 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 529 | + || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 530 | 530 | || in_array('invoicereccard',explode(':',$parameters['context'])) |
| 531 | 531 | ) { |
| 532 | 532 | |
@@ -605,20 +605,20 @@ discard block |
||
| 605 | 605 | in_array('invoicecard',explode(':',$parameters['context'])) |
| 606 | 606 | || in_array('propalcard',explode(':',$parameters['context'])) |
| 607 | 607 | || in_array('ordercard',explode(':',$parameters['context'])) |
| 608 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 609 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 610 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 608 | + || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 609 | + || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 610 | + || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 611 | 611 | ) |
| 612 | - { |
|
| 612 | + { |
|
| 613 | 613 | if(in_array('invoicecard',explode(':',$parameters['context']))) { |
| 614 | 614 | $sessname = 'subtotal_hideInnerLines_facture'; |
| 615 | 615 | $sessname2 = 'subtotal_hidedetails_facture'; |
| 616 | 616 | $sessname3 = 'subtotal_hideprices_facture'; |
| 617 | 617 | } |
| 618 | 618 | elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
| 619 | - $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
|
| 620 | - $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
|
| 621 | - $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
|
| 619 | + $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
|
| 620 | + $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
|
| 621 | + $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
|
| 622 | 622 | } |
| 623 | 623 | elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
| 624 | 624 | $sessname = 'subtotal_hideInnerLines_propal'; |
@@ -626,9 +626,9 @@ discard block |
||
| 626 | 626 | $sessname3 = 'subtotal_hideprices_propal'; |
| 627 | 627 | } |
| 628 | 628 | elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
| 629 | - $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
|
| 630 | - $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
|
| 631 | - $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
|
| 629 | + $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
|
| 630 | + $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
|
| 631 | + $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
|
| 632 | 632 | } |
| 633 | 633 | elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
| 634 | 634 | $sessname = 'subtotal_hideInnerLines_commande'; |
@@ -636,9 +636,9 @@ discard block |
||
| 636 | 636 | $sessname3 = 'subtotal_hideprices_commande'; |
| 637 | 637 | } |
| 638 | 638 | elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
| 639 | - $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
|
| 640 | - $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
|
| 641 | - $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
|
| 639 | + $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
|
| 640 | + $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
|
| 641 | + $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
|
| 642 | 642 | } |
| 643 | 643 | else { |
| 644 | 644 | $sessname = 'subtotal_hideInnerLines_unknown'; |
@@ -663,17 +663,17 @@ discard block |
||
| 663 | 663 | foreach($object->lines as &$line) { |
| 664 | 664 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
| 665 | 665 | |
| 666 | - if($line->qty>=90) { |
|
| 667 | - $line->modsubtotal_total = 1; |
|
| 668 | - } |
|
| 669 | - else{ |
|
| 670 | - $line->modsubtotal_title = 1; |
|
| 671 | - } |
|
| 666 | + if($line->qty>=90) { |
|
| 667 | + $line->modsubtotal_total = 1; |
|
| 668 | + } |
|
| 669 | + else{ |
|
| 670 | + $line->modsubtotal_title = 1; |
|
| 671 | + } |
|
| 672 | 672 | |
| 673 | 673 | $line->total_ht = $this->getTotalLineFromObject($object, $line, ''); |
| 674 | 674 | } |
| 675 | - } |
|
| 676 | - } |
|
| 675 | + } |
|
| 676 | + } |
|
| 677 | 677 | |
| 678 | 678 | } |
| 679 | 679 | else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
@@ -690,7 +690,7 @@ discard block |
||
| 690 | 690 | */ |
| 691 | 691 | else if($object->element=='invoice_supplier') |
| 692 | 692 | { |
| 693 | - $object->deleteline($idLine); |
|
| 693 | + $object->deleteline($idLine); |
|
| 694 | 694 | } |
| 695 | 695 | /** |
| 696 | 696 | * @var $object Propal |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | */ |
| 714 | 714 | else if($object->element=='order_supplier') |
| 715 | 715 | { |
| 716 | - $object->deleteline($idLine); |
|
| 716 | + $object->deleteline($idLine); |
|
| 717 | 717 | } |
| 718 | 718 | /** |
| 719 | 719 | * @var $object Facturerec |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | |
| 789 | 789 | foreach($object->lines as $l) { |
| 790 | 790 | |
| 791 | - $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 791 | + $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 792 | 792 | if($lid == $lineid) { |
| 793 | 793 | |
| 794 | 794 | $found = true; |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | |
| 798 | 798 | if($found) { |
| 799 | 799 | |
| 800 | - $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 800 | + $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 801 | 801 | |
| 802 | 802 | if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
| 803 | 803 | break; // end of story |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | if(method_exists('Closure','bind')) { |
| 930 | 930 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
| 931 | 931 | $sweetsThief = function ($pdf) { |
| 932 | - return $pdf->bMargin ; |
|
| 932 | + return $pdf->bMargin ; |
|
| 933 | 933 | }; |
| 934 | 934 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
| 935 | 935 | |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 998 | 998 | $total_to_print = price($total); |
| 999 | 999 | |
| 1000 | - $line->total_ht = $total; |
|
| 1000 | + $line->total_ht = $total; |
|
| 1001 | 1001 | $line->total = $total; |
| 1002 | 1002 | $line->total_tva = $total_tva; |
| 1003 | 1003 | $line->total_ttc = $total_ttc; |
@@ -1154,7 +1154,7 @@ discard block |
||
| 1154 | 1154 | } |
| 1155 | 1155 | |
| 1156 | 1156 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
| 1157 | - global $conf, $hideprices, $hookmanager; |
|
| 1157 | + global $conf, $hideprices, $hookmanager; |
|
| 1158 | 1158 | |
| 1159 | 1159 | if(is_array($parameters)) $i = & $parameters['i']; |
| 1160 | 1160 | else $i = (int)$parameters; |
@@ -1193,7 +1193,7 @@ discard block |
||
| 1193 | 1193 | } |
| 1194 | 1194 | } |
| 1195 | 1195 | if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
| 1196 | - $this->resprints = price($object->lines[$i]->total_ht); |
|
| 1196 | + $this->resprints = price($object->lines[$i]->total_ht); |
|
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | 1199 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1322,7 +1322,7 @@ discard block |
||
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | 1324 | function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
| 1325 | - global $conf,$hideprices,$hookmanager; |
|
| 1325 | + global $conf,$hideprices,$hookmanager; |
|
| 1326 | 1326 | |
| 1327 | 1327 | if(is_array($parameters)) $i = & $parameters['i']; |
| 1328 | 1328 | else $i = (int)$parameters; |
@@ -1330,18 +1330,18 @@ discard block |
||
| 1330 | 1330 | if($this->isModSubtotalLine($parameters,$object) ) { |
| 1331 | 1331 | $this->resprints = ' '; |
| 1332 | 1332 | |
| 1333 | - $line = $object->lines[$i]; |
|
| 1333 | + $line = $object->lines[$i]; |
|
| 1334 | 1334 | |
| 1335 | - // On récupère les montants du bloc pour les afficher dans la ligne de sous-total |
|
| 1336 | - if(TSubtotal::isSubtotal($line)) { |
|
| 1337 | - $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1335 | + // On récupère les montants du bloc pour les afficher dans la ligne de sous-total |
|
| 1336 | + if(TSubtotal::isSubtotal($line)) { |
|
| 1337 | + $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1338 | 1338 | |
| 1339 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1340 | - if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1341 | - $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
| 1342 | - $this->resprints = price($TTotal['total_subprice']); |
|
| 1343 | - } |
|
| 1344 | - } |
|
| 1339 | + if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1340 | + if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1341 | + $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
| 1342 | + $this->resprints = price($TTotal['total_subprice']); |
|
| 1343 | + } |
|
| 1344 | + } |
|
| 1345 | 1345 | |
| 1346 | 1346 | if((float)DOL_VERSION<=3.6) { |
| 1347 | 1347 | return ''; |
@@ -1357,58 +1357,58 @@ discard block |
||
| 1357 | 1357 | (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) |
| 1358 | 1358 | ) |
| 1359 | 1359 | { |
| 1360 | - // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1361 | - if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1362 | - { |
|
| 1363 | - $this->resprints = ' '; |
|
| 1360 | + // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1361 | + if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1362 | + { |
|
| 1363 | + $this->resprints = ' '; |
|
| 1364 | 1364 | |
| 1365 | - // currentcontext à modifier celon l'appel |
|
| 1366 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1367 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1365 | + // currentcontext à modifier celon l'appel |
|
| 1366 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1367 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1368 | 1368 | |
| 1369 | - } |
|
| 1369 | + } |
|
| 1370 | 1370 | } |
| 1371 | 1371 | // Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble |
| 1372 | 1372 | else if (!empty($hideprices)) |
| 1373 | 1373 | { |
| 1374 | 1374 | |
| 1375 | - // Check if a title exist for this line && if the title have subtotal |
|
| 1376 | - $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1377 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1378 | - { |
|
| 1375 | + // Check if a title exist for this line && if the title have subtotal |
|
| 1376 | + $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1377 | + if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1378 | + { |
|
| 1379 | 1379 | |
| 1380 | - $this->resprints = ' '; |
|
| 1380 | + $this->resprints = ' '; |
|
| 1381 | 1381 | |
| 1382 | - // currentcontext à modifier celon l'appel |
|
| 1383 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1384 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1385 | - } |
|
| 1382 | + // currentcontext à modifier celon l'appel |
|
| 1383 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1384 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1385 | + } |
|
| 1386 | 1386 | } |
| 1387 | 1387 | |
| 1388 | 1388 | return 0; |
| 1389 | 1389 | } |
| 1390 | 1390 | |
| 1391 | 1391 | function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') { |
| 1392 | - global $conf,$hideprices,$hookmanager; |
|
| 1392 | + global $conf,$hideprices,$hookmanager; |
|
| 1393 | 1393 | |
| 1394 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1395 | - else $i = (int) $parameters; |
|
| 1394 | + if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1395 | + else $i = (int) $parameters; |
|
| 1396 | 1396 | |
| 1397 | 1397 | if($this->isModSubtotalLine($parameters,$object) ) { |
| 1398 | 1398 | $this->resprints = ' '; |
| 1399 | 1399 | |
| 1400 | - $line = $object->lines[$i]; |
|
| 1400 | + $line = $object->lines[$i]; |
|
| 1401 | 1401 | |
| 1402 | - // Affichage de la remise |
|
| 1403 | - if(TSubtotal::isSubtotal($line)) { |
|
| 1404 | - $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1402 | + // Affichage de la remise |
|
| 1403 | + if(TSubtotal::isSubtotal($line)) { |
|
| 1404 | + $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1405 | 1405 | |
| 1406 | - if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1407 | - if(! empty($parentTitle->array_options['options_show_reduc'])) { |
|
| 1408 | - $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
| 1409 | - $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%'; |
|
| 1410 | - } |
|
| 1411 | - } |
|
| 1406 | + if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1407 | + if(! empty($parentTitle->array_options['options_show_reduc'])) { |
|
| 1408 | + $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
| 1409 | + $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%'; |
|
| 1410 | + } |
|
| 1411 | + } |
|
| 1412 | 1412 | |
| 1413 | 1413 | if((float)DOL_VERSION<=3.6) { |
| 1414 | 1414 | return ''; |
@@ -1418,15 +1418,15 @@ discard block |
||
| 1418 | 1418 | } |
| 1419 | 1419 | } |
| 1420 | 1420 | elseif (!empty($hideprices) |
| 1421 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1422 | - ) |
|
| 1423 | - { |
|
| 1424 | - if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1425 | - { |
|
| 1426 | - $this->resprints = ' '; |
|
| 1427 | - return 1; |
|
| 1428 | - } |
|
| 1429 | - } |
|
| 1421 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1422 | + ) |
|
| 1423 | + { |
|
| 1424 | + if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1425 | + { |
|
| 1426 | + $this->resprints = ' '; |
|
| 1427 | + return 1; |
|
| 1428 | + } |
|
| 1429 | + } |
|
| 1430 | 1430 | |
| 1431 | 1431 | return 0; |
| 1432 | 1432 | } |
@@ -1462,7 +1462,7 @@ discard block |
||
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | 1464 | function pdf_getlinevatrate($parameters=array(), &$object, &$action='') { |
| 1465 | - global $conf,$hideprices,$hookmanager; |
|
| 1465 | + global $conf,$hideprices,$hookmanager; |
|
| 1466 | 1466 | |
| 1467 | 1467 | if($this->isModSubtotalLine($parameters,$object) ){ |
| 1468 | 1468 | $this->resprints = ' '; |
@@ -1487,31 +1487,31 @@ discard block |
||
| 1487 | 1487 | (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) |
| 1488 | 1488 | ) |
| 1489 | 1489 | { |
| 1490 | - // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1491 | - if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1492 | - { |
|
| 1493 | - $this->resprints = ' '; |
|
| 1490 | + // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1491 | + if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1492 | + { |
|
| 1493 | + $this->resprints = ' '; |
|
| 1494 | 1494 | |
| 1495 | - // currentcontext à modifier celon l'appel |
|
| 1496 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1497 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1498 | - } |
|
| 1495 | + // currentcontext à modifier celon l'appel |
|
| 1496 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1497 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1498 | + } |
|
| 1499 | 1499 | } |
| 1500 | 1500 | // Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble |
| 1501 | 1501 | else if (!empty($hideprices)) |
| 1502 | 1502 | { |
| 1503 | 1503 | |
| 1504 | - // Check if a title exist for this line && if the title have subtotal |
|
| 1505 | - $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1506 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1507 | - { |
|
| 1504 | + // Check if a title exist for this line && if the title have subtotal |
|
| 1505 | + $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1506 | + if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1507 | + { |
|
| 1508 | 1508 | |
| 1509 | - $this->resprints = ' '; |
|
| 1509 | + $this->resprints = ' '; |
|
| 1510 | 1510 | |
| 1511 | - // currentcontext à modifier celon l'appel |
|
| 1512 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1513 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1514 | - } |
|
| 1511 | + // currentcontext à modifier celon l'appel |
|
| 1512 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1513 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1514 | + } |
|
| 1515 | 1515 | } |
| 1516 | 1516 | |
| 1517 | 1517 | return 0; |
@@ -1635,33 +1635,33 @@ discard block |
||
| 1635 | 1635 | |
| 1636 | 1636 | $this->add_numerotation($object); |
| 1637 | 1637 | |
| 1638 | - foreach($object->lines as $k => &$l) { |
|
| 1639 | - if(TSubtotal::isSubtotal($l)) { |
|
| 1640 | - $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); |
|
| 1641 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1642 | - if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1643 | - $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
|
| 1644 | - } |
|
| 1645 | - } |
|
| 1638 | + foreach($object->lines as $k => &$l) { |
|
| 1639 | + if(TSubtotal::isSubtotal($l)) { |
|
| 1640 | + $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); |
|
| 1641 | + if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1642 | + if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1643 | + $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
|
| 1644 | + } |
|
| 1645 | + } |
|
| 1646 | 1646 | |
| 1647 | 1647 | |
| 1648 | - // Pas de hook sur les colonnes du PDF expédition, on unset les bonnes variables |
|
| 1649 | - if(($object->element == 'shipping' || $object->element == 'delivery') && $this->isModSubtotalLine($k, $object)) |
|
| 1648 | + // Pas de hook sur les colonnes du PDF expédition, on unset les bonnes variables |
|
| 1649 | + if(($object->element == 'shipping' || $object->element == 'delivery') && $this->isModSubtotalLine($k, $object)) |
|
| 1650 | 1650 | { |
| 1651 | 1651 | $l->qty = $l->qty_asked; |
| 1652 | 1652 | unset($l->qty_asked, $l->qty_shipped, $l->volume, $l->weight); |
| 1653 | 1653 | } |
| 1654 | - } |
|
| 1654 | + } |
|
| 1655 | 1655 | |
| 1656 | 1656 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
| 1657 | 1657 | $hidedetails = (int)GETPOST('hidedetails'); |
| 1658 | 1658 | |
| 1659 | 1659 | if ($hideInnerLines) { // si c une ligne de titre |
| 1660 | - $fk_parent_line=0; |
|
| 1660 | + $fk_parent_line=0; |
|
| 1661 | 1661 | $TLines =array(); |
| 1662 | 1662 | |
| 1663 | 1663 | $original_count=count($object->lines); |
| 1664 | - $TTvas = array(); // tableau de tva |
|
| 1664 | + $TTvas = array(); // tableau de tva |
|
| 1665 | 1665 | |
| 1666 | 1666 | foreach($object->lines as $k=>&$line) |
| 1667 | 1667 | { |
@@ -1700,48 +1700,48 @@ discard block |
||
| 1700 | 1700 | |
| 1701 | 1701 | if ($hideInnerLines) |
| 1702 | 1702 | { |
| 1703 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1704 | - { |
|
| 1705 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
| 1703 | + if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1704 | + { |
|
| 1705 | + if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
| 1706 | 1706 | |
| 1707 | - // on remplit le tableau de tva pour substituer les lignes cachées |
|
| 1708 | - $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
| 1709 | - $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
| 1710 | - $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
| 1711 | - } |
|
| 1712 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1713 | - { |
|
| 1714 | - //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
| 1715 | - // génère des lignes d'affichage des montants HT soumis à tva |
|
| 1716 | - $nbtva = count($TTvas); |
|
| 1717 | - if(!empty($nbtva)){ |
|
| 1718 | - foreach ($TTvas as $tx =>$val){ |
|
| 1719 | - $l = clone $line; |
|
| 1720 | - $l->product_type = 1; |
|
| 1721 | - $l->special_code = ''; |
|
| 1722 | - $l->qty = 1; |
|
| 1723 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1724 | - $l->tva_tx = $tx; |
|
| 1725 | - $l->total_ht = $val['total_ht']; |
|
| 1726 | - $l->total_tva = $val['total_tva']; |
|
| 1727 | - $l->total = $line->total_ht; |
|
| 1728 | - $l->total_ttc = $val['total_ttc']; |
|
| 1729 | - $TLines[] = $l; |
|
| 1730 | - array_shift($TTvas); |
|
| 1731 | - } |
|
| 1732 | - } |
|
| 1707 | + // on remplit le tableau de tva pour substituer les lignes cachées |
|
| 1708 | + $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
| 1709 | + $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
| 1710 | + $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
| 1711 | + } |
|
| 1712 | + if($line->product_type==9 && $line->rowid>0) |
|
| 1713 | + { |
|
| 1714 | + //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
| 1715 | + // génère des lignes d'affichage des montants HT soumis à tva |
|
| 1716 | + $nbtva = count($TTvas); |
|
| 1717 | + if(!empty($nbtva)){ |
|
| 1718 | + foreach ($TTvas as $tx =>$val){ |
|
| 1719 | + $l = clone $line; |
|
| 1720 | + $l->product_type = 1; |
|
| 1721 | + $l->special_code = ''; |
|
| 1722 | + $l->qty = 1; |
|
| 1723 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1724 | + $l->tva_tx = $tx; |
|
| 1725 | + $l->total_ht = $val['total_ht']; |
|
| 1726 | + $l->total_tva = $val['total_tva']; |
|
| 1727 | + $l->total = $line->total_ht; |
|
| 1728 | + $l->total_ttc = $val['total_ttc']; |
|
| 1729 | + $TLines[] = $l; |
|
| 1730 | + array_shift($TTvas); |
|
| 1731 | + } |
|
| 1732 | + } |
|
| 1733 | 1733 | |
| 1734 | - // ajoute la ligne de sous-total |
|
| 1735 | - $TLines[] = $line; |
|
| 1736 | - } |
|
| 1737 | - } else { |
|
| 1734 | + // ajoute la ligne de sous-total |
|
| 1735 | + $TLines[] = $line; |
|
| 1736 | + } |
|
| 1737 | + } else { |
|
| 1738 | 1738 | |
| 1739 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1740 | - { |
|
| 1741 | - // ajoute la ligne de sous-total |
|
| 1742 | - $TLines[] = $line; |
|
| 1743 | - } |
|
| 1744 | - } |
|
| 1739 | + if($line->product_type==9 && $line->rowid>0) |
|
| 1740 | + { |
|
| 1741 | + // ajoute la ligne de sous-total |
|
| 1742 | + $TLines[] = $line; |
|
| 1743 | + } |
|
| 1744 | + } |
|
| 1745 | 1745 | |
| 1746 | 1746 | |
| 1747 | 1747 | } |
@@ -1766,20 +1766,20 @@ discard block |
||
| 1766 | 1766 | $nbtva = count($TTvas); |
| 1767 | 1767 | if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
| 1768 | 1768 | { |
| 1769 | - foreach ($TTvas as $tx =>$val){ |
|
| 1770 | - $l = clone $line; |
|
| 1771 | - $l->product_type = 1; |
|
| 1772 | - $l->special_code = ''; |
|
| 1773 | - $l->qty = 1; |
|
| 1774 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1775 | - $l->tva_tx = $tx; |
|
| 1776 | - $l->total_ht = $val['total_ht']; |
|
| 1777 | - $l->total_tva = $val['total_tva']; |
|
| 1778 | - $l->total = $line->total_ht; |
|
| 1779 | - $l->total_ttc = $val['total_ttc']; |
|
| 1780 | - $TLines[] = $l; |
|
| 1781 | - array_shift($TTvas); |
|
| 1782 | - } |
|
| 1769 | + foreach ($TTvas as $tx =>$val){ |
|
| 1770 | + $l = clone $line; |
|
| 1771 | + $l->product_type = 1; |
|
| 1772 | + $l->special_code = ''; |
|
| 1773 | + $l->qty = 1; |
|
| 1774 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1775 | + $l->tva_tx = $tx; |
|
| 1776 | + $l->total_ht = $val['total_ht']; |
|
| 1777 | + $l->total_tva = $val['total_tva']; |
|
| 1778 | + $l->total = $line->total_ht; |
|
| 1779 | + $l->total_ttc = $val['total_ttc']; |
|
| 1780 | + $TLines[] = $l; |
|
| 1781 | + array_shift($TTvas); |
|
| 1782 | + } |
|
| 1783 | 1783 | } |
| 1784 | 1784 | |
| 1785 | 1785 | global $nblignes; |
@@ -1791,7 +1791,7 @@ discard block |
||
| 1791 | 1791 | $this->resprints = ''; |
| 1792 | 1792 | return 0; |
| 1793 | 1793 | } |
| 1794 | - } |
|
| 1794 | + } |
|
| 1795 | 1795 | |
| 1796 | 1796 | return 0; |
| 1797 | 1797 | } |
@@ -1983,11 +1983,11 @@ discard block |
||
| 1983 | 1983 | } |
| 1984 | 1984 | elseif($object->element == 'order_supplier' ) |
| 1985 | 1985 | { |
| 1986 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
| 1986 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
| 1987 | 1987 | } |
| 1988 | 1988 | elseif($object->element == 'invoice_supplier' ) |
| 1989 | 1989 | { |
| 1990 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
| 1990 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
| 1991 | 1991 | } |
| 1992 | 1992 | elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) |
| 1993 | 1993 | { |
@@ -2020,7 +2020,7 @@ discard block |
||
| 2020 | 2020 | null; |
| 2021 | 2021 | } |
| 2022 | 2022 | else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) |
| 2023 | - { |
|
| 2023 | + { |
|
| 2024 | 2024 | if($object->element=='facture')$idvar = 'facid'; |
| 2025 | 2025 | else $idvar='id'; |
| 2026 | 2026 | |
@@ -2069,7 +2069,7 @@ discard block |
||
| 2069 | 2069 | //var_dump($line); |
| 2070 | 2070 | |
| 2071 | 2071 | // HTML 5 data for js |
| 2072 | - $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
| 2072 | + $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
| 2073 | 2073 | |
| 2074 | 2074 | |
| 2075 | 2075 | ?> |
@@ -2131,8 +2131,8 @@ discard block |
||
| 2131 | 2131 | } |
| 2132 | 2132 | |
| 2133 | 2133 | if ($object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
| 2134 | - $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
| 2135 | - $line->description = ''; |
|
| 2134 | + $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
| 2135 | + $line->description = ''; |
|
| 2136 | 2136 | } |
| 2137 | 2137 | $newlabel = $line->label; |
| 2138 | 2138 | if($line->label=='' && !$isFreeText) { |
@@ -2166,38 +2166,38 @@ discard block |
||
| 2166 | 2166 | |
| 2167 | 2167 | |
| 2168 | 2168 | echo '<div class="subtotal_underline" style="margin-left:24px; line-height: 25px;">'; |
| 2169 | - echo '<div>'; |
|
| 2170 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2171 | - echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>'; |
|
| 2172 | - echo '</div>'; |
|
| 2173 | - |
|
| 2174 | - if (TSubtotal::isTitle($line)) |
|
| 2175 | - { |
|
| 2176 | - $form = new Form($db); |
|
| 2177 | - echo '<div>'; |
|
| 2178 | - echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
|
| 2179 | - echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
|
| 2180 | - if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2181 | - echo '</select>'; |
|
| 2182 | - echo '</div>'; |
|
| 2183 | - |
|
| 2184 | - if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
|
| 2185 | - { |
|
| 2186 | - echo '<div>'; |
|
| 2187 | - echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%'; |
|
| 2188 | - echo '</div>'; |
|
| 2189 | - } |
|
| 2190 | - echo '<div>'; |
|
| 2191 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2192 | - echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>'; |
|
| 2193 | - echo '</div>'; |
|
| 2194 | - |
|
| 2195 | - echo '<div>'; |
|
| 2196 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2197 | - echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
|
| 2198 | - echo '</div>'; |
|
| 2199 | - } |
|
| 2200 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 2169 | + echo '<div>'; |
|
| 2170 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2171 | + echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>'; |
|
| 2172 | + echo '</div>'; |
|
| 2173 | + |
|
| 2174 | + if (TSubtotal::isTitle($line)) |
|
| 2175 | + { |
|
| 2176 | + $form = new Form($db); |
|
| 2177 | + echo '<div>'; |
|
| 2178 | + echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
|
| 2179 | + echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
|
| 2180 | + if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2181 | + echo '</select>'; |
|
| 2182 | + echo '</div>'; |
|
| 2183 | + |
|
| 2184 | + if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
|
| 2185 | + { |
|
| 2186 | + echo '<div>'; |
|
| 2187 | + echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%'; |
|
| 2188 | + echo '</div>'; |
|
| 2189 | + } |
|
| 2190 | + echo '<div>'; |
|
| 2191 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2192 | + echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>'; |
|
| 2193 | + echo '</div>'; |
|
| 2194 | + |
|
| 2195 | + echo '<div>'; |
|
| 2196 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2197 | + echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
|
| 2198 | + echo '</div>'; |
|
| 2199 | + } |
|
| 2200 | + else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 2201 | 2201 | echo '</div>'; |
| 2202 | 2202 | |
| 2203 | 2203 | if($line->qty<10) { |
@@ -2714,17 +2714,17 @@ discard block |
||
| 2714 | 2714 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
| 2715 | 2715 | { |
| 2716 | 2716 | |
| 2717 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
| 2718 | - { |
|
| 2719 | - foreach ($object->lines as $line) |
|
| 2720 | - { |
|
| 2721 | - // fetch optionals attributes and labels |
|
| 2722 | - require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
| 2723 | - $extrafields=new ExtraFields($this->db); |
|
| 2724 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
| 2725 | - $line->fetch_optionals($line->id,$extralabels); |
|
| 2726 | - } |
|
| 2727 | - } |
|
| 2717 | + if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
| 2718 | + { |
|
| 2719 | + foreach ($object->lines as $line) |
|
| 2720 | + { |
|
| 2721 | + // fetch optionals attributes and labels |
|
| 2722 | + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
| 2723 | + $extrafields=new ExtraFields($this->db); |
|
| 2724 | + $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
| 2725 | + $line->fetch_optionals($line->id,$extralabels); |
|
| 2726 | + } |
|
| 2727 | + } |
|
| 2728 | 2728 | |
| 2729 | 2729 | $TSubNc = array(); |
| 2730 | 2730 | foreach ($object->lines as &$l) |
@@ -2815,80 +2815,80 @@ discard block |
||
| 2815 | 2815 | { |
| 2816 | 2816 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 2817 | 2817 | |
| 2818 | - $line = &$parameters['line']; |
|
| 2818 | + $line = &$parameters['line']; |
|
| 2819 | 2819 | |
| 2820 | - $ThtmlData['data-id'] = $line->id; |
|
| 2821 | - $ThtmlData['data-product_type'] = $line->product_type; |
|
| 2822 | - $ThtmlData['data-qty'] = 0; //$line->qty; |
|
| 2823 | - $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
| 2820 | + $ThtmlData['data-id'] = $line->id; |
|
| 2821 | + $ThtmlData['data-product_type'] = $line->product_type; |
|
| 2822 | + $ThtmlData['data-qty'] = 0; //$line->qty; |
|
| 2823 | + $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
| 2824 | 2824 | |
| 2825 | - if(TSubtotal::isTitle($line)){ |
|
| 2826 | - $ThtmlData['data-issubtotal'] = 'title'; |
|
| 2827 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2828 | - $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
| 2829 | - } |
|
| 2830 | - else{ |
|
| 2831 | - $ThtmlData['data-issubtotal'] = 'freetext'; |
|
| 2832 | - } |
|
| 2825 | + if(TSubtotal::isTitle($line)){ |
|
| 2826 | + $ThtmlData['data-issubtotal'] = 'title'; |
|
| 2827 | + }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2828 | + $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
| 2829 | + } |
|
| 2830 | + else{ |
|
| 2831 | + $ThtmlData['data-issubtotal'] = 'freetext'; |
|
| 2832 | + } |
|
| 2833 | 2833 | |
| 2834 | 2834 | |
| 2835 | - // Change or add data from hooks |
|
| 2836 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
| 2835 | + // Change or add data from hooks |
|
| 2836 | + $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
| 2837 | 2837 | |
| 2838 | - // hook |
|
| 2839 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
| 2840 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 2841 | - if ($reshook>0) |
|
| 2842 | - { |
|
| 2843 | - $ThtmlData = $hookmanager->resArray; |
|
| 2844 | - } |
|
| 2845 | - |
|
| 2846 | - return $this->implodeHtmlData($ThtmlData); |
|
| 2838 | + // hook |
|
| 2839 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
| 2840 | + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 2841 | + if ($reshook>0) |
|
| 2842 | + { |
|
| 2843 | + $ThtmlData = $hookmanager->resArray; |
|
| 2844 | + } |
|
| 2845 | + |
|
| 2846 | + return $this->implodeHtmlData($ThtmlData); |
|
| 2847 | 2847 | |
| 2848 | 2848 | } |
| 2849 | 2849 | |
| 2850 | 2850 | |
| 2851 | 2851 | function implodeHtmlData($ThtmlData = array()) |
| 2852 | 2852 | { |
| 2853 | - $data = ''; |
|
| 2854 | - foreach($ThtmlData as $k => $h ) |
|
| 2855 | - { |
|
| 2856 | - if(is_array($h)) |
|
| 2857 | - { |
|
| 2858 | - $h = json_encode($h); |
|
| 2859 | - } |
|
| 2853 | + $data = ''; |
|
| 2854 | + foreach($ThtmlData as $k => $h ) |
|
| 2855 | + { |
|
| 2856 | + if(is_array($h)) |
|
| 2857 | + { |
|
| 2858 | + $h = json_encode($h); |
|
| 2859 | + } |
|
| 2860 | 2860 | |
| 2861 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2862 | - } |
|
| 2861 | + $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2862 | + } |
|
| 2863 | 2863 | |
| 2864 | - return $data; |
|
| 2864 | + return $data; |
|
| 2865 | 2865 | } |
| 2866 | 2866 | |
| 2867 | 2867 | function _ajax_block_order_js($object) |
| 2868 | 2868 | { |
| 2869 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
| 2869 | + global $conf,$tagidfortablednd,$filepath,$langs; |
|
| 2870 | 2870 | |
| 2871 | - /* |
|
| 2871 | + /* |
|
| 2872 | 2872 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
| 2873 | 2873 | * for compatibility reasons we don't use tableDnD but jquery sortable |
| 2874 | 2874 | */ |
| 2875 | 2875 | |
| 2876 | - $id=$object->id; |
|
| 2877 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
| 2878 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
| 2876 | + $id=$object->id; |
|
| 2877 | + $nboflines=(isset($object->lines)?count($object->lines):0); |
|
| 2878 | + $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
| 2879 | 2879 | |
| 2880 | - $id=$object->id; |
|
| 2881 | - $fk_element=$object->fk_element; |
|
| 2882 | - $table_element_line=$object->table_element_line; |
|
| 2883 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
| 2884 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
| 2885 | - $filepath=(empty($filepath)?'':$filepath); |
|
| 2880 | + $id=$object->id; |
|
| 2881 | + $fk_element=$object->fk_element; |
|
| 2882 | + $table_element_line=$object->table_element_line; |
|
| 2883 | + $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
| 2884 | + $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
| 2885 | + $filepath=(empty($filepath)?'':$filepath); |
|
| 2886 | 2886 | |
| 2887 | 2887 | |
| 2888 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
| 2889 | - { |
|
| 2888 | + if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
| 2889 | + { |
|
| 2890 | 2890 | |
| 2891 | - ?> |
|
| 2891 | + ?> |
|
| 2892 | 2892 | |
| 2893 | 2893 | |
| 2894 | 2894 | <script type="text/javascript"> |
@@ -16,17 +16,17 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | global $type_element, $where; |
| 18 | 18 | |
| 19 | - $contexts = explode(':',$parameters['context']); |
|
| 19 | + $contexts = explode(':', $parameters['context']); |
|
| 20 | 20 | |
| 21 | - if(in_array('consumptionthirdparty',$contexts) && in_array($type_element, array('propal', 'order', 'invoice', 'supplier_order', 'supplier_invoice', 'supplier_proposal'))) { |
|
| 21 | + if (in_array('consumptionthirdparty', $contexts) && in_array($type_element, array('propal', 'order', 'invoice', 'supplier_order', 'supplier_invoice', 'supplier_proposal'))) { |
|
| 22 | 22 | $mod_num = TSubtotal::$module_number; |
| 23 | 23 | |
| 24 | 24 | // Not a title (can't use TSubtotal class methods in sql) |
| 25 | - $where.= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty > 9)'; |
|
| 25 | + $where .= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty > 9)'; |
|
| 26 | 26 | // Not a subtotal (can't use TSubtotal class methods in sql) |
| 27 | - $where.= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty < 90)'; |
|
| 27 | + $where .= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty < 90)'; |
|
| 28 | 28 | // Not a free line text (can't use TSubtotal class methods in sql) |
| 29 | - $where.= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty != 50)'; |
|
| 29 | + $where .= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty != 50)'; |
|
| 30 | 30 | |
| 31 | 31 | } |
| 32 | 32 | |
@@ -105,47 +105,47 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
| 107 | 107 | { |
| 108 | - global $langs,$db,$user, $conf; |
|
| 108 | + global $langs, $db, $user, $conf; |
|
| 109 | 109 | |
| 110 | 110 | $langs->load('subtotal@subtotal'); |
| 111 | 111 | |
| 112 | - $contexts = explode(':',$parameters['context']); |
|
| 112 | + $contexts = explode(':', $parameters['context']); |
|
| 113 | 113 | |
| 114 | - if(in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('invoicereccard',$contexts) || in_array('expeditioncard',$contexts)) { |
|
| 114 | + if (in_array('ordercard', $contexts) || in_array('ordersuppliercard', $contexts) || in_array('propalcard', $contexts) || in_array('supplier_proposalcard', $contexts) || in_array('invoicecard', $contexts) || in_array('invoicesuppliercard', $contexts) || in_array('invoicereccard', $contexts) || in_array('expeditioncard', $contexts)) { |
|
| 115 | 115 | |
| 116 | 116 | $createRight = $user->rights->{$object->element}->creer; |
| 117 | - if($object->element == 'facturerec' ) |
|
| 117 | + if ($object->element == 'facturerec') |
|
| 118 | 118 | { |
| 119 | 119 | $object->statut = 0; // hack for facture rec |
| 120 | 120 | $createRight = $user->rights->facture->creer; |
| 121 | - } elseif($object->element == 'order_supplier' ) |
|
| 121 | + } elseif ($object->element == 'order_supplier') |
|
| 122 | 122 | { |
| 123 | 123 | $createRight = $user->rights->fournisseur->commande->creer; |
| 124 | - } elseif($object->element == 'invoice_supplier' ) |
|
| 124 | + } elseif ($object->element == 'invoice_supplier') |
|
| 125 | 125 | { |
| 126 | 126 | $createRight = $user->rights->fournisseur->facture->creer; |
| 127 | 127 | } |
| 128 | - elseif($object->element == 'shipping') |
|
| 128 | + elseif ($object->element == 'shipping') |
|
| 129 | 129 | { |
| 130 | 130 | $createRight = true; // No rights management for shipments |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - if ($object->statut == 0 && $createRight) { |
|
| 133 | + if ($object->statut == 0 && $createRight) { |
|
| 134 | 134 | |
| 135 | 135 | |
| 136 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 137 | - else $idvar='id'; |
|
| 136 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
| 137 | + else $idvar = 'id'; |
|
| 138 | 138 | |
| 139 | - if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
|
| 139 | + if (in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text'))) |
|
| 140 | 140 | { |
| 141 | 141 | $level = GETPOST('level', 'int'); //New avec SUBTOTAL_USE_NEW_FORMAT |
| 142 | 142 | |
| 143 | - if($action=='add_title_line') { |
|
| 143 | + if ($action == 'add_title_line') { |
|
| 144 | 144 | $title = GETPOST('title'); |
| 145 | - if(empty($title)) $title = $langs->trans('title'); |
|
| 146 | - $qty = $level<1 ? 1 : $level ; |
|
| 145 | + if (empty($title)) $title = $langs->trans('title'); |
|
| 146 | + $qty = $level < 1 ? 1 : $level; |
|
| 147 | 147 | } |
| 148 | - else if($action=='add_free_text') { |
|
| 148 | + else if ($action == 'add_free_text') { |
|
| 149 | 149 | $title = GETPOST('title'); |
| 150 | 150 | |
| 151 | 151 | if (empty($title)) { |
@@ -157,21 +157,21 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
| 160 | + if (empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
| 161 | 161 | $qty = 50; |
| 162 | 162 | } |
| 163 | - else if($action=='add_subtitle_line') { |
|
| 163 | + else if ($action == 'add_subtitle_line') { |
|
| 164 | 164 | $title = GETPOST('title'); |
| 165 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
| 165 | + if (empty($title)) $title = $langs->trans('subtitle'); |
|
| 166 | 166 | $qty = 2; |
| 167 | 167 | } |
| 168 | - else if($action=='add_subtotal_line') { |
|
| 168 | + else if ($action == 'add_subtotal_line') { |
|
| 169 | 169 | $title = $langs->trans('SubSubTotal'); |
| 170 | 170 | $qty = 98; |
| 171 | 171 | } |
| 172 | 172 | else { |
| 173 | 173 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
| 174 | - $qty = $level ? 100-$level : 99; |
|
| 174 | + $qty = $level ? 100 - $level : 99; |
|
| 175 | 175 | } |
| 176 | 176 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 177 | 177 | |
@@ -179,15 +179,15 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | TSubtotal::addSubTotalLine($object, $title, $qty); |
| 181 | 181 | } |
| 182 | - else if($action==='ask_deleteallline') { |
|
| 183 | - $form=new Form($db); |
|
| 182 | + else if ($action === 'ask_deleteallline') { |
|
| 183 | + $form = new Form($db); |
|
| 184 | 184 | |
| 185 | - $lineid = GETPOST('lineid','integer'); |
|
| 185 | + $lineid = GETPOST('lineid', 'integer'); |
|
| 186 | 186 | $TIdForGroup = $this->getArrayOfLineForAGroup($object, $lineid); |
| 187 | 187 | |
| 188 | 188 | $nbLines = count($TIdForGroup); |
| 189 | 189 | |
| 190 | - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines',$nbLines), 'confirm_delete_all_lines','',0,1); |
|
| 190 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines', $nbLines), 'confirm_delete_all_lines', '', 0, 1); |
|
| 191 | 191 | print $formconfirm; |
| 192 | 192 | } |
| 193 | 193 | |
@@ -197,13 +197,13 @@ discard block |
||
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | |
| 200 | - if($object->element != 'shipping' && $action!='editline') { |
|
| 200 | + if ($object->element != 'shipping' && $action != 'editline') { |
|
| 201 | 201 | // New format is for 3.8 |
| 202 | 202 | $this->printNewFormat($object, $conf, $langs, $idvar); |
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
| 206 | + elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice', $contexts)) |
|
| 207 | 207 | { |
| 208 | 208 | ?> |
| 209 | 209 | <script type="text/javascript"> |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | $(document).ready(function() { |
| 229 | 229 | $('div.fiche div.tabsAction').append('<br />'); |
| 230 | 230 | |
| 231 | - $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_title_line" rel="add_title_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddTitle' )?></a></div>'); |
|
| 231 | + $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_title_line" rel="add_title_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddTitle')?></a></div>'); |
|
| 232 | 232 | $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_total_line" rel="add_total_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddSubTotal')?></a></div>'); |
| 233 | 233 | $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_free_text" rel="add_free_text" href="javascript:;" class="butAction"><?php echo $langs->trans('AddFreeText')?></a></div>'); |
| 234 | 234 | |
@@ -279,9 +279,9 @@ discard block |
||
| 279 | 279 | $('body').append(dialog_html); |
| 280 | 280 | |
| 281 | 281 | <?php |
| 282 | - $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME)?'ckeditor':$conf->global->FCKEDITOR_EDITORNAME; |
|
| 283 | - $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
| 284 | - if($editorConf && in_array($editorTool,array('textarea','ckeditor'))){ |
|
| 282 | + $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME) ? 'ckeditor' : $conf->global->FCKEDITOR_EDITORNAME; |
|
| 283 | + $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
| 284 | + if ($editorConf && in_array($editorTool, array('textarea', 'ckeditor'))) { |
|
| 285 | 285 | ?> |
| 286 | 286 | if (action == 'addTitle' || action == 'addFreeTxt') |
| 287 | 287 | { |
@@ -396,62 +396,62 @@ discard block |
||
| 396 | 396 | global $conf, $langs, $bc; |
| 397 | 397 | |
| 398 | 398 | $action = GETPOST('action'); |
| 399 | - $TContext = explode(':',$parameters['context']); |
|
| 399 | + $TContext = explode(':', $parameters['context']); |
|
| 400 | 400 | if ( |
| 401 | - in_array('invoicecard',$TContext) |
|
| 402 | - || in_array('invoicesuppliercard',$TContext) |
|
| 403 | - || in_array('propalcard',$TContext) |
|
| 404 | - || in_array('ordercard',$TContext) |
|
| 405 | - || in_array('ordersuppliercard',$TContext) |
|
| 406 | - || in_array('invoicereccard',$TContext) |
|
| 401 | + in_array('invoicecard', $TContext) |
|
| 402 | + || in_array('invoicesuppliercard', $TContext) |
|
| 403 | + || in_array('propalcard', $TContext) |
|
| 404 | + || in_array('ordercard', $TContext) |
|
| 405 | + || in_array('ordersuppliercard', $TContext) |
|
| 406 | + || in_array('invoicereccard', $TContext) |
|
| 407 | 407 | ) |
| 408 | 408 | { |
| 409 | - $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
| 410 | - $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
| 411 | - $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0; |
|
| 412 | - $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf; |
|
| 409 | + $hideInnerLines = isset($_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
| 410 | + $hidedetails = isset($_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
| 411 | + $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED) ? $conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED : 0; |
|
| 412 | + $hideprices = isset($_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf; |
|
| 413 | 413 | |
| 414 | - $var=false; |
|
| 415 | - $out.= '<tr '.$bc[$var].'> |
|
| 414 | + $var = false; |
|
| 415 | + $out .= '<tr '.$bc[$var].'> |
|
| 416 | 416 | <td colspan="4" align="right"> |
| 417 | 417 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
| 418 | - <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
|
| 418 | + <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(($hideInnerLines) ? 'checked="checked"' : '').' /> |
|
| 419 | 419 | </td> |
| 420 | 420 | </tr>'; |
| 421 | 421 | |
| 422 | - $var=!$var; |
|
| 423 | - $out.= '<tr '.$bc[$var].'> |
|
| 422 | + $var = !$var; |
|
| 423 | + $out .= '<tr '.$bc[$var].'> |
|
| 424 | 424 | <td colspan="4" align="right"> |
| 425 | 425 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
| 426 | - <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
|
| 426 | + <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(($hidedetails) ? 'checked="checked"' : '').' /> |
|
| 427 | 427 | </td> |
| 428 | 428 | </tr>'; |
| 429 | 429 | |
| 430 | - $var=!$var; |
|
| 431 | - $out.= '<tr '.$bc[$var].'> |
|
| 430 | + $var = !$var; |
|
| 431 | + $out .= '<tr '.$bc[$var].'> |
|
| 432 | 432 | <td colspan="4" align="right"> |
| 433 | 433 | <label for="hideprices">'.$langs->trans('SubTotalhidePrice').'</label> |
| 434 | - <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
|
| 434 | + <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(($hideprices) ? 'checked="checked"' : '').' /> |
|
| 435 | 435 | </td> |
| 436 | 436 | </tr>'; |
| 437 | 437 | |
| 438 | 438 | |
| 439 | 439 | |
| 440 | 440 | if ( |
| 441 | - (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
| 442 | - || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 443 | - || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 444 | - || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 445 | - || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 446 | - || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
|
| 441 | + (in_array('propalcard', $TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
| 442 | + || (in_array('ordercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 443 | + || (in_array('ordersuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 444 | + || (in_array('invoicecard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 445 | + || (in_array('invoicesuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 446 | + || (in_array('invoicereccard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 447 | 447 | ) |
| 448 | 448 | { |
| 449 | - $var=!$var; |
|
| 450 | - $out.= ' |
|
| 449 | + $var = !$var; |
|
| 450 | + $out .= ' |
|
| 451 | 451 | <tr '.$bc[$var].'> |
| 452 | 452 | <td colspan="4" align="right"> |
| 453 | 453 | <label for="subtotal_add_recap">'.$langs->trans('subtotal_add_recap').'</label> |
| 454 | - <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.( GETPOST('subtotal_add_recap') ? 'checked="checked"' : '' ).' /> |
|
| 454 | + <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.(GETPOST('subtotal_add_recap') ? 'checked="checked"' : '').' /> |
|
| 455 | 455 | </td> |
| 456 | 456 | </tr>'; |
| 457 | 457 | } |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
| 468 | 468 | { |
| 469 | 469 | |
| 470 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
| 470 | + if (in_array('invoicecard', explode(':', $parameters['context']))) |
|
| 471 | 471 | { |
| 472 | 472 | |
| 473 | 473 | } |
@@ -478,13 +478,13 @@ discard block |
||
| 478 | 478 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
| 479 | 479 | global $conf; |
| 480 | 480 | |
| 481 | - if($action === 'builddoc') { |
|
| 481 | + if ($action === 'builddoc') { |
|
| 482 | 482 | |
| 483 | 483 | $line = &$parameters['line']; |
| 484 | 484 | $object = &$parameters['object']; |
| 485 | 485 | $substitutionarray = &$parameters['substitutionarray']; |
| 486 | 486 | |
| 487 | - if($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
| 487 | + if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
| 488 | 488 | $substitutionarray['line_modsubtotal'] = 1; |
| 489 | 489 | |
| 490 | 490 | $substitutionarray['line_price_ht'] |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | = $substitutionarray['line_up'] |
| 496 | 496 | = ''; |
| 497 | 497 | |
| 498 | - if($line->qty>90) { |
|
| 498 | + if ($line->qty > 90) { |
|
| 499 | 499 | $substitutionarray['line_modsubtotal_total'] = true; |
| 500 | 500 | |
| 501 | 501 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | |
| 510 | 510 | |
| 511 | 511 | } |
| 512 | - else{ |
|
| 512 | + else { |
|
| 513 | 513 | $substitutionarray['line_not_modsubtotal'] = true; |
| 514 | 514 | $substitutionarray['line_modsubtotal'] = 0; |
| 515 | 515 | } |
@@ -521,29 +521,29 @@ discard block |
||
| 521 | 521 | function createFrom($parameters, &$object, $action, $hookmanager) { |
| 522 | 522 | |
| 523 | 523 | if ( |
| 524 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
| 525 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 526 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
| 527 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 528 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
| 529 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 530 | - || in_array('invoicereccard',explode(':',$parameters['context'])) |
|
| 524 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
| 525 | + || in_array('invoicesuppliercard', explode(':', $parameters['context'])) |
|
| 526 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
| 527 | + || in_array('supplier_proposalcard', explode(':', $parameters['context'])) |
|
| 528 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
| 529 | + || in_array('ordersuppliercard', explode(':', $parameters['context'])) |
|
| 530 | + || in_array('invoicereccard', explode(':', $parameters['context'])) |
|
| 531 | 531 | ) { |
| 532 | 532 | |
| 533 | 533 | global $db; |
| 534 | 534 | |
| 535 | 535 | $objFrom = $parameters['objFrom']; |
| 536 | 536 | |
| 537 | - foreach($objFrom->lines as $k=> &$lineOld) { |
|
| 537 | + foreach ($objFrom->lines as $k=> &$lineOld) { |
|
| 538 | 538 | |
| 539 | - if($lineOld->product_type == 9 && $lineOld->info_bits > 0 ) { |
|
| 539 | + if ($lineOld->product_type == 9 && $lineOld->info_bits > 0) { |
|
| 540 | 540 | |
| 541 | 541 | $line = & $object->lines[$k]; |
| 542 | 542 | |
| 543 | 543 | $idLine = (int) ($line->id ? $line->id : $line->rowid); |
| 544 | 544 | |
| 545 | 545 | $db->query("UPDATE ".MAIN_DB_PREFIX.$line->table_element." |
| 546 | - SET info_bits=".(int)$lineOld->info_bits." |
|
| 546 | + SET info_bits=".(int) $lineOld->info_bits." |
|
| 547 | 547 | WHERE rowid = ".$idLine." |
| 548 | 548 | "); |
| 549 | 549 | |
@@ -559,15 +559,15 @@ discard block |
||
| 559 | 559 | |
| 560 | 560 | function doActions($parameters, &$object, $action, $hookmanager) |
| 561 | 561 | { |
| 562 | - global $db, $conf, $langs,$user; |
|
| 562 | + global $db, $conf, $langs, $user; |
|
| 563 | 563 | |
| 564 | 564 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 565 | 565 | dol_include_once('/subtotal/lib/subtotal.lib.php'); |
| 566 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
| 566 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
| 567 | 567 | |
| 568 | 568 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
| 569 | 569 | |
| 570 | - if($object->element=='facture') $idvar = 'facid'; |
|
| 570 | + if ($object->element == 'facture') $idvar = 'facid'; |
|
| 571 | 571 | else $idvar = 'id'; |
| 572 | 572 | |
| 573 | 573 | if ($action == 'updateligne' || $action == 'updateline') |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | if ($line->id == $lineid && TSubtotal::isModSubtotalLine($line)) |
| 581 | 581 | { |
| 582 | 582 | $found = true; |
| 583 | - if(TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
| 583 | + if (TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
| 584 | 584 | $extrafieldsline = new ExtraFields($db); |
| 585 | 585 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
| 586 | 586 | $extrafieldsline->setOptionalsFromPost($extralabelsline, $line); |
@@ -599,43 +599,43 @@ discard block |
||
| 599 | 599 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
| 600 | 600 | } |
| 601 | 601 | } |
| 602 | - else if($action === 'builddoc') { |
|
| 602 | + else if ($action === 'builddoc') { |
|
| 603 | 603 | |
| 604 | 604 | if ( |
| 605 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
| 606 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
| 607 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
| 608 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 609 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 610 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 605 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
| 606 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
| 607 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
| 608 | + || in_array('ordersuppliercard', explode(':', $parameters['context'])) |
|
| 609 | + || in_array('invoicesuppliercard', explode(':', $parameters['context'])) |
|
| 610 | + || in_array('supplier_proposalcard', explode(':', $parameters['context'])) |
|
| 611 | 611 | ) |
| 612 | 612 | { |
| 613 | - if(in_array('invoicecard',explode(':',$parameters['context']))) { |
|
| 613 | + if (in_array('invoicecard', explode(':', $parameters['context']))) { |
|
| 614 | 614 | $sessname = 'subtotal_hideInnerLines_facture'; |
| 615 | 615 | $sessname2 = 'subtotal_hidedetails_facture'; |
| 616 | 616 | $sessname3 = 'subtotal_hideprices_facture'; |
| 617 | 617 | } |
| 618 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
| 618 | + elseif (in_array('invoicesuppliercard', explode(':', $parameters['context']))) { |
|
| 619 | 619 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
| 620 | 620 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
| 621 | 621 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
| 622 | 622 | } |
| 623 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
| 623 | + elseif (in_array('propalcard', explode(':', $parameters['context']))) { |
|
| 624 | 624 | $sessname = 'subtotal_hideInnerLines_propal'; |
| 625 | 625 | $sessname2 = 'subtotal_hidedetails_propal'; |
| 626 | 626 | $sessname3 = 'subtotal_hideprices_propal'; |
| 627 | 627 | } |
| 628 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
| 628 | + elseif (in_array('supplier_proposalcard', explode(':', $parameters['context']))) { |
|
| 629 | 629 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
| 630 | 630 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
| 631 | 631 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
| 632 | 632 | } |
| 633 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
| 633 | + elseif (in_array('ordercard', explode(':', $parameters['context']))) { |
|
| 634 | 634 | $sessname = 'subtotal_hideInnerLines_commande'; |
| 635 | 635 | $sessname2 = 'subtotal_hidedetails_commande'; |
| 636 | 636 | $sessname3 = 'subtotal_hideprices_commande'; |
| 637 | 637 | } |
| 638 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
| 638 | + elseif (in_array('ordersuppliercard', explode(':', $parameters['context']))) { |
|
| 639 | 639 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
| 640 | 640 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
| 641 | 641 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
@@ -648,25 +648,25 @@ discard block |
||
| 648 | 648 | |
| 649 | 649 | global $hideprices; |
| 650 | 650 | |
| 651 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
| 652 | - if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) $_SESSION[$sessname] = array(); // prevent old system |
|
| 651 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
| 652 | + if (!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id])) $_SESSION[$sessname] = array(); // prevent old system |
|
| 653 | 653 | $_SESSION[$sessname][$object->id] = $hideInnerLines; |
| 654 | 654 | |
| 655 | - $hidedetails= (int)GETPOST('hidedetails'); |
|
| 656 | - if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) $_SESSION[$sessname2] = array(); // prevent old system |
|
| 655 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
| 656 | + if (!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id])) $_SESSION[$sessname2] = array(); // prevent old system |
|
| 657 | 657 | $_SESSION[$sessname2][$object->id] = $hidedetails; |
| 658 | 658 | |
| 659 | - $hideprices= (int)GETPOST('hideprices'); |
|
| 660 | - if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) $_SESSION[$sessname3] = array(); // prevent old system |
|
| 659 | + $hideprices = (int) GETPOST('hideprices'); |
|
| 660 | + if (!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id])) $_SESSION[$sessname3] = array(); // prevent old system |
|
| 661 | 661 | $_SESSION[$sessname3][$object->id] = $hideprices; |
| 662 | 662 | |
| 663 | - foreach($object->lines as &$line) { |
|
| 663 | + foreach ($object->lines as &$line) { |
|
| 664 | 664 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
| 665 | 665 | |
| 666 | - if($line->qty>=90) { |
|
| 666 | + if ($line->qty >= 90) { |
|
| 667 | 667 | $line->modsubtotal_total = 1; |
| 668 | 668 | } |
| 669 | - else{ |
|
| 669 | + else { |
|
| 670 | 670 | $line->modsubtotal_title = 1; |
| 671 | 671 | } |
| 672 | 672 | |
@@ -676,34 +676,34 @@ discard block |
||
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | } |
| 679 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
| 679 | + else if ($action === 'confirm_delete_all_lines' && GETPOST('confirm') == 'yes') { |
|
| 680 | 680 | |
| 681 | 681 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
| 682 | 682 | |
| 683 | - foreach($Tab as $idLine) { |
|
| 683 | + foreach ($Tab as $idLine) { |
|
| 684 | 684 | /** |
| 685 | 685 | * @var $object Facture |
| 686 | 686 | */ |
| 687 | - if($object->element=='facture') $object->deleteline($idLine); |
|
| 687 | + if ($object->element == 'facture') $object->deleteline($idLine); |
|
| 688 | 688 | /** |
| 689 | 689 | * @var $object Facture fournisseur |
| 690 | 690 | */ |
| 691 | - else if($object->element=='invoice_supplier') |
|
| 691 | + else if ($object->element == 'invoice_supplier') |
|
| 692 | 692 | { |
| 693 | 693 | $object->deleteline($idLine); |
| 694 | 694 | } |
| 695 | 695 | /** |
| 696 | 696 | * @var $object Propal |
| 697 | 697 | */ |
| 698 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
| 698 | + else if ($object->element == 'propal') $object->deleteline($idLine); |
|
| 699 | 699 | /** |
| 700 | 700 | * @var $object Propal Fournisseur |
| 701 | 701 | */ |
| 702 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
| 702 | + else if ($object->element == 'supplier_proposal') $object->deleteline($idLine); |
|
| 703 | 703 | /** |
| 704 | 704 | * @var $object Commande |
| 705 | 705 | */ |
| 706 | - else if($object->element=='commande') |
|
| 706 | + else if ($object->element == 'commande') |
|
| 707 | 707 | { |
| 708 | 708 | if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
| 709 | 709 | else $object->deleteline($idLine); |
@@ -711,18 +711,18 @@ discard block |
||
| 711 | 711 | /** |
| 712 | 712 | * @var $object Commande fournisseur |
| 713 | 713 | */ |
| 714 | - else if($object->element=='order_supplier') |
|
| 714 | + else if ($object->element == 'order_supplier') |
|
| 715 | 715 | { |
| 716 | 716 | $object->deleteline($idLine); |
| 717 | 717 | } |
| 718 | 718 | /** |
| 719 | 719 | * @var $object Facturerec |
| 720 | 720 | */ |
| 721 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
| 721 | + else if ($object->element == 'facturerec') $object->deleteline($idLine); |
|
| 722 | 722 | /** |
| 723 | 723 | * @var $object Expedition |
| 724 | 724 | */ |
| 725 | - else if($object->element=='shipping') $object->deleteline($user, $idLine); |
|
| 725 | + else if ($object->element == 'shipping') $object->deleteline($user, $idLine); |
|
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | header('location:?id='.$object->id); |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | return 0; |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | - function formAddObjectLine ($parameters, &$object, &$action, $hookmanager) { |
|
| 748 | + function formAddObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
| 749 | 749 | return 0; |
| 750 | 750 | } |
| 751 | 751 | |
@@ -763,8 +763,8 @@ discard block |
||
| 763 | 763 | if (!empty($parameters['fk_element'])) |
| 764 | 764 | { |
| 765 | 765 | |
| 766 | - if($obj->fetch($parameters['fk_element'])){ |
|
| 767 | - $obj->id= $obj->rowid; |
|
| 766 | + if ($obj->fetch($parameters['fk_element'])) { |
|
| 767 | + $obj->id = $obj->rowid; |
|
| 768 | 768 | if (empty($obj->array_options)) |
| 769 | 769 | $obj->fetch_optionals(); |
| 770 | 770 | if (!empty($obj->array_options['options_subtotal_nc'])) |
@@ -784,22 +784,22 @@ discard block |
||
| 784 | 784 | |
| 785 | 785 | $found = false; |
| 786 | 786 | |
| 787 | - $Tab= array(); |
|
| 787 | + $Tab = array(); |
|
| 788 | 788 | |
| 789 | - foreach($object->lines as $l) { |
|
| 789 | + foreach ($object->lines as $l) { |
|
| 790 | 790 | |
| 791 | 791 | $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
| 792 | - if($lid == $lineid) { |
|
| 792 | + if ($lid == $lineid) { |
|
| 793 | 793 | |
| 794 | 794 | $found = true; |
| 795 | 795 | $qty_line = $l->qty; |
| 796 | 796 | } |
| 797 | 797 | |
| 798 | - if($found) { |
|
| 798 | + if ($found) { |
|
| 799 | 799 | |
| 800 | 800 | $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
| 801 | 801 | |
| 802 | - if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
|
| 802 | + if ($l->special_code == $this->module_number && (($l->qty == 99 && $qty_line == 1) || ($l->qty == 98 && $qty_line == 2))) { |
|
| 803 | 803 | break; // end of story |
| 804 | 804 | } |
| 805 | 805 | } |
@@ -828,7 +828,7 @@ discard block |
||
| 828 | 828 | * |
| 829 | 829 | * @param $use_level isn't used anymore |
| 830 | 830 | */ |
| 831 | - function getTotalLineFromObject(&$object, &$line, $use_level=false, $return_all=0) { |
|
| 831 | + function getTotalLineFromObject(&$object, &$line, $use_level = false, $return_all = 0) { |
|
| 832 | 832 | global $conf; |
| 833 | 833 | |
| 834 | 834 | $rang = $line->rang; |
@@ -839,31 +839,31 @@ discard block |
||
| 839 | 839 | $total_ttc = 0; |
| 840 | 840 | $TTotal_tva = array(); |
| 841 | 841 | |
| 842 | - $sign=1; |
|
| 843 | - if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; |
|
| 842 | + $sign = 1; |
|
| 843 | + if (isset($object->type) && $object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1; |
|
| 844 | 844 | |
| 845 | 845 | if (GETPOST('action') == 'builddoc') $builddoc = true; |
| 846 | 846 | else $builddoc = false; |
| 847 | 847 | |
| 848 | 848 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 849 | - foreach($object->lines as $l) { |
|
| 849 | + foreach ($object->lines as $l) { |
|
| 850 | 850 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
| 851 | - if($l->rang>=$rang) { |
|
| 851 | + if ($l->rang >= $rang) { |
|
| 852 | 852 | //echo 'return!<br>'; |
| 853 | 853 | if (!$return_all) return $total; |
| 854 | 854 | else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
| 855 | 855 | } |
| 856 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
| 856 | + else if (TSubtotal::isTitle($l, 100 - $qty_line)) |
|
| 857 | 857 | { |
| 858 | 858 | $total = 0; |
| 859 | 859 | $total_tva = 0; |
| 860 | 860 | $total_ttc = 0; |
| 861 | 861 | $TTotal_tva = array(); |
| 862 | 862 | } |
| 863 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
| 863 | + elseif (!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
| 864 | 864 | |
| 865 | 865 | // TODO retirer le test avec $builddoc quand Dolibarr affichera le total progression sur la card et pas seulement dans le PDF |
| 866 | - if ($builddoc && $object->element == 'facture' && $object->type==Facture::TYPE_SITUATION) |
|
| 866 | + if ($builddoc && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
|
| 867 | 867 | { |
| 868 | 868 | if ($l->situation_percent > 0) |
| 869 | 869 | { |
@@ -876,7 +876,7 @@ discard block |
||
| 876 | 876 | } |
| 877 | 877 | |
| 878 | 878 | $result = $sign * ($l->total_ht / ($l->situation_percent / 100)) * $progress; |
| 879 | - $total+= $result; |
|
| 879 | + $total += $result; |
|
| 880 | 880 | // TODO check si les 3 lignes du dessous sont corrects |
| 881 | 881 | $total_tva += $sign * ($l->total_tva / ($l->situation_percent / 100)) * $progress; |
| 882 | 882 | $TTotal_tva[$l->tva_tx] += $sign * ($l->total_tva / ($l->situation_percent / 100)) * $progress; |
@@ -908,10 +908,10 @@ discard block |
||
| 908 | 908 | * @param $w float width |
| 909 | 909 | * @param $h float height |
| 910 | 910 | */ |
| 911 | - function pdf_add_total(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
| 912 | - global $conf,$subtotal_last_title_posy; |
|
| 911 | + function pdf_add_total(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
| 912 | + global $conf, $subtotal_last_title_posy; |
|
| 913 | 913 | |
| 914 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
| 914 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
| 915 | 915 | if (!empty($conf->global->SUBTOTAL_ONE_LINE_IF_HIDE_INNERLINES) && $hideInnerLines && !empty($subtotal_last_title_posy)) |
| 916 | 916 | { |
| 917 | 917 | $posy = $subtotal_last_title_posy; |
@@ -920,40 +920,40 @@ discard block |
||
| 920 | 920 | |
| 921 | 921 | $hidePriceOnSubtotalLines = (int) GETPOST('hide_price_on_subtotal_lines'); |
| 922 | 922 | |
| 923 | - if($object->element == 'shipping' || $object->element == 'delivery') |
|
| 923 | + if ($object->element == 'shipping' || $object->element == 'delivery') |
|
| 924 | 924 | { |
| 925 | 925 | $hidePriceOnSubtotalLines = 1; |
| 926 | 926 | } |
| 927 | 927 | |
| 928 | 928 | $set_pagebreak_margin = false; |
| 929 | - if(method_exists('Closure','bind')) { |
|
| 929 | + if (method_exists('Closure', 'bind')) { |
|
| 930 | 930 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
| 931 | - $sweetsThief = function ($pdf) { |
|
| 932 | - return $pdf->bMargin ; |
|
| 931 | + $sweetsThief = function($pdf) { |
|
| 932 | + return $pdf->bMargin; |
|
| 933 | 933 | }; |
| 934 | 934 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
| 935 | 935 | |
| 936 | - $bMargin = $sweetsThief($pdf); |
|
| 936 | + $bMargin = $sweetsThief($pdf); |
|
| 937 | 937 | |
| 938 | - $pdf->SetAutoPageBreak( false ); |
|
| 938 | + $pdf->SetAutoPageBreak(false); |
|
| 939 | 939 | |
| 940 | 940 | $set_pagebreak_margin = true; |
| 941 | 941 | } |
| 942 | 942 | |
| 943 | 943 | |
| 944 | - if($line->qty==99) |
|
| 945 | - $pdf->SetFillColor(220,220,220); |
|
| 946 | - elseif ($line->qty==98) |
|
| 947 | - $pdf->SetFillColor(230,230,230); |
|
| 944 | + if ($line->qty == 99) |
|
| 945 | + $pdf->SetFillColor(220, 220, 220); |
|
| 946 | + elseif ($line->qty == 98) |
|
| 947 | + $pdf->SetFillColor(230, 230, 230); |
|
| 948 | 948 | else |
| 949 | - $pdf->SetFillColor(240,240,240); |
|
| 949 | + $pdf->SetFillColor(240, 240, 240); |
|
| 950 | 950 | |
| 951 | 951 | $style = 'B'; |
| 952 | 952 | if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
| 953 | 953 | |
| 954 | 954 | $pdf->SetFont('', $style, 9); |
| 955 | 955 | |
| 956 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R',true); |
|
| 956 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R', true); |
|
| 957 | 957 | // var_dump($bMargin); |
| 958 | 958 | $pageAfter = $pdf->getPage(); |
| 959 | 959 | |
@@ -981,7 +981,7 @@ discard block |
||
| 981 | 981 | |
| 982 | 982 | |
| 983 | 983 | |
| 984 | - if($total_to_print !== '') { |
|
| 984 | + if ($total_to_print !== '') { |
|
| 985 | 985 | |
| 986 | 986 | if (GETPOST('hideInnerLines')) |
| 987 | 987 | { |
@@ -1005,11 +1005,11 @@ discard block |
||
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | 1007 | $pdf->SetXY($pdf->postotalht, $posy); |
| 1008 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 1009 | - $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
| 1008 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
| 1009 | + $pdf->MultiCell($pdf->page_largeur - $pdf->marge_droite - $pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
| 1010 | 1010 | } |
| 1011 | - else{ |
|
| 1012 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 1011 | + else { |
|
| 1012 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | 1015 | $posy = $posy + $cell_height; |
@@ -1029,22 +1029,22 @@ discard block |
||
| 1029 | 1029 | * @param $w float width |
| 1030 | 1030 | * @param $h float height |
| 1031 | 1031 | */ |
| 1032 | - function pdf_add_title(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
| 1032 | + function pdf_add_title(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
| 1033 | 1033 | |
| 1034 | - global $db,$conf,$subtotal_last_title_posy; |
|
| 1034 | + global $db, $conf, $subtotal_last_title_posy; |
|
| 1035 | 1035 | |
| 1036 | 1036 | $subtotal_last_title_posy = $posy; |
| 1037 | - $pdf->SetXY ($posx, $posy); |
|
| 1037 | + $pdf->SetXY($posx, $posy); |
|
| 1038 | 1038 | |
| 1039 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
| 1039 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
| 1040 | 1040 | |
| 1041 | 1041 | |
| 1042 | 1042 | |
| 1043 | - $style = ($line->qty==1) ? 'BU' : 'BUI'; |
|
| 1043 | + $style = ($line->qty == 1) ? 'BU' : 'BUI'; |
|
| 1044 | 1044 | if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
| 1045 | 1045 | |
| 1046 | - if($hideInnerLines) { |
|
| 1047 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
| 1046 | + if ($hideInnerLines) { |
|
| 1047 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); |
|
| 1048 | 1048 | else |
| 1049 | 1049 | { |
| 1050 | 1050 | if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
@@ -1053,44 +1053,44 @@ discard block |
||
| 1053 | 1053 | } |
| 1054 | 1054 | else { |
| 1055 | 1055 | |
| 1056 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
| 1056 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
| 1057 | 1057 | else $pdf->SetFont('', $style, 9); |
| 1058 | 1058 | |
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | 1061 | if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) $pdf->MultiCell($w, $h, $label, 0, 'L'); // Pas de HTML dans la chaine |
| 1062 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
| 1062 | + else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J', true); // et maintenant avec du HTML |
|
| 1063 | 1063 | |
| 1064 | - if($description && !$hidedesc) { |
|
| 1064 | + if ($description && !$hidedesc) { |
|
| 1065 | 1065 | $posy = $pdf->GetY(); |
| 1066 | 1066 | |
| 1067 | 1067 | $pdf->SetFont('', '', 8); |
| 1068 | 1068 | |
| 1069 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J',true); |
|
| 1069 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J', true); |
|
| 1070 | 1070 | |
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | - function pdf_writelinedesc_ref($parameters=array(), &$object, &$action='') { |
|
| 1075 | + function pdf_writelinedesc_ref($parameters = array(), &$object, &$action = '') { |
|
| 1076 | 1076 | // ultimate PDF hook O_o |
| 1077 | 1077 | |
| 1078 | - return $this->pdf_writelinedesc($parameters,$object,$action); |
|
| 1078 | + return $this->pdf_writelinedesc($parameters, $object, $action); |
|
| 1079 | 1079 | |
| 1080 | 1080 | } |
| 1081 | 1081 | |
| 1082 | 1082 | function isModSubtotalLine(&$parameters, &$object) { |
| 1083 | 1083 | |
| 1084 | - if(is_array($parameters)) { |
|
| 1084 | + if (is_array($parameters)) { |
|
| 1085 | 1085 | $i = & $parameters['i']; |
| 1086 | 1086 | } |
| 1087 | 1087 | else { |
| 1088 | - $i = (int)$parameters; |
|
| 1088 | + $i = (int) $parameters; |
|
| 1089 | 1089 | } |
| 1090 | 1090 | |
| 1091 | 1091 | $line = $object->lines[$i]; |
| 1092 | 1092 | |
| 1093 | - if($object->element == 'shipping' || $object->element == 'delivery') |
|
| 1093 | + if ($object->element == 'shipping' || $object->element == 'delivery') |
|
| 1094 | 1094 | { |
| 1095 | 1095 | dol_include_once('/commande/class/commande.class.php'); |
| 1096 | 1096 | $line = new OrderLine($object->db); |
@@ -1098,7 +1098,7 @@ discard block |
||
| 1098 | 1098 | } |
| 1099 | 1099 | |
| 1100 | 1100 | |
| 1101 | - if($line->special_code == $this->module_number && $line->product_type == 9) { |
|
| 1101 | + if ($line->special_code == $this->module_number && $line->product_type == 9) { |
|
| 1102 | 1102 | return true; |
| 1103 | 1103 | } |
| 1104 | 1104 | |
@@ -1106,42 +1106,42 @@ discard block |
||
| 1106 | 1106 | |
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | - function pdf_getlineqty($parameters=array(), &$object, &$action='') { |
|
| 1110 | - global $conf,$hideprices; |
|
| 1109 | + function pdf_getlineqty($parameters = array(), &$object, &$action = '') { |
|
| 1110 | + global $conf, $hideprices; |
|
| 1111 | 1111 | |
| 1112 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1112 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1113 | 1113 | $this->resprints = ' '; |
| 1114 | 1114 | |
| 1115 | - if((float)DOL_VERSION<=3.6) { |
|
| 1115 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1116 | 1116 | return ''; |
| 1117 | 1117 | } |
| 1118 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1118 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1119 | 1119 | return 1; |
| 1120 | 1120 | } |
| 1121 | 1121 | |
| 1122 | 1122 | } |
| 1123 | - elseif(!empty($hideprices)) { |
|
| 1123 | + elseif (!empty($hideprices)) { |
|
| 1124 | 1124 | $this->resprints = $object->lines[$parameters['i']]->qty; |
| 1125 | 1125 | return 1; |
| 1126 | 1126 | } |
| 1127 | 1127 | elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
| 1128 | 1128 | { |
| 1129 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
| 1130 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
| 1129 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
| 1130 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
| 1131 | 1131 | if (empty($hideInnerLines) && !empty($hidedetails)) |
| 1132 | 1132 | { |
| 1133 | 1133 | $this->resprints = $object->lines[$parameters['i']]->qty; |
| 1134 | 1134 | } |
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1138 | - else $i = (int)$parameters; |
|
| 1137 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1138 | + else $i = (int) $parameters; |
|
| 1139 | 1139 | |
| 1140 | 1140 | if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
| 1141 | 1141 | |
| 1142 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
| 1142 | + if (empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
| 1143 | 1143 | |
| 1144 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1144 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1145 | 1145 | { |
| 1146 | 1146 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1147 | 1147 | { |
@@ -1153,20 +1153,20 @@ discard block |
||
| 1153 | 1153 | return 0; |
| 1154 | 1154 | } |
| 1155 | 1155 | |
| 1156 | - function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
|
| 1156 | + function pdf_getlinetotalexcltax($parameters = array(), &$object, &$action = '') { |
|
| 1157 | 1157 | global $conf, $hideprices, $hookmanager; |
| 1158 | 1158 | |
| 1159 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1160 | - else $i = (int)$parameters; |
|
| 1159 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1160 | + else $i = (int) $parameters; |
|
| 1161 | 1161 | |
| 1162 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1162 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1163 | 1163 | |
| 1164 | 1164 | $this->resprints = ' '; |
| 1165 | 1165 | |
| 1166 | - if((float)DOL_VERSION<=3.6) { |
|
| 1166 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1167 | 1167 | return ''; |
| 1168 | 1168 | } |
| 1169 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1169 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1170 | 1170 | return 1; |
| 1171 | 1171 | } |
| 1172 | 1172 | |
@@ -1192,7 +1192,7 @@ discard block |
||
| 1192 | 1192 | } |
| 1193 | 1193 | } |
| 1194 | 1194 | } |
| 1195 | - if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
|
| 1195 | + if ((int) GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) { |
|
| 1196 | 1196 | $this->resprints = price($object->lines[$i]->total_ht); |
| 1197 | 1197 | } |
| 1198 | 1198 | |
@@ -1217,7 +1217,7 @@ discard block |
||
| 1217 | 1217 | { |
| 1218 | 1218 | // Check if a title exist for this line && if the title have subtotal |
| 1219 | 1219 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
| 1220 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1220 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1221 | 1221 | { |
| 1222 | 1222 | |
| 1223 | 1223 | $this->resprints = ' '; |
@@ -1237,7 +1237,7 @@ discard block |
||
| 1237 | 1237 | */ |
| 1238 | 1238 | private function callHook(&$object, &$hookmanager, $action, $params, $defaultReturn = 1) |
| 1239 | 1239 | { |
| 1240 | - $reshook=$hookmanager->executeHooks('subtotalHidePrices',$params, $object, $action); |
|
| 1240 | + $reshook = $hookmanager->executeHooks('subtotalHidePrices', $params, $object, $action); |
|
| 1241 | 1241 | if ($reshook < 0) |
| 1242 | 1242 | { |
| 1243 | 1243 | $this->error = $hookmanager->error; |
@@ -1253,7 +1253,7 @@ discard block |
||
| 1253 | 1253 | $this->resprints = $hookmanager->resprints; |
| 1254 | 1254 | |
| 1255 | 1255 | // override return (use $this->results['overrideReturn'] or $this->resArray['overrideReturn'] in other module action_xxxx.class.php ) |
| 1256 | - if(isset($hookmanager->resArray['overrideReturn'])) |
|
| 1256 | + if (isset($hookmanager->resArray['overrideReturn'])) |
|
| 1257 | 1257 | { |
| 1258 | 1258 | return $hookmanager->resArray['overrideReturn']; |
| 1259 | 1259 | } |
@@ -1262,25 +1262,25 @@ discard block |
||
| 1262 | 1262 | return $defaultReturn; |
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | - function pdf_getlinetotalwithtax($parameters=array(), &$object, &$action='') { |
|
| 1265 | + function pdf_getlinetotalwithtax($parameters = array(), &$object, &$action = '') { |
|
| 1266 | 1266 | global $conf; |
| 1267 | 1267 | |
| 1268 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1268 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1269 | 1269 | |
| 1270 | 1270 | $this->resprints = ' '; |
| 1271 | 1271 | |
| 1272 | - if((float)DOL_VERSION<=3.6) { |
|
| 1272 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1273 | 1273 | return ''; |
| 1274 | 1274 | } |
| 1275 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1275 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1276 | 1276 | return 1; |
| 1277 | 1277 | } |
| 1278 | 1278 | } |
| 1279 | 1279 | |
| 1280 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1281 | - else $i = (int)$parameters; |
|
| 1280 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1281 | + else $i = (int) $parameters; |
|
| 1282 | 1282 | |
| 1283 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1283 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1284 | 1284 | { |
| 1285 | 1285 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1286 | 1286 | { |
@@ -1292,24 +1292,24 @@ discard block |
||
| 1292 | 1292 | return 0; |
| 1293 | 1293 | } |
| 1294 | 1294 | |
| 1295 | - function pdf_getlineunit($parameters=array(), &$object, &$action='') { |
|
| 1295 | + function pdf_getlineunit($parameters = array(), &$object, &$action = '') { |
|
| 1296 | 1296 | global $conf; |
| 1297 | 1297 | |
| 1298 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1298 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1299 | 1299 | $this->resprints = ' '; |
| 1300 | 1300 | |
| 1301 | - if((float)DOL_VERSION<=3.6) { |
|
| 1301 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1302 | 1302 | return ''; |
| 1303 | 1303 | } |
| 1304 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1304 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1305 | 1305 | return 1; |
| 1306 | 1306 | } |
| 1307 | 1307 | } |
| 1308 | 1308 | |
| 1309 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1310 | - else $i = (int)$parameters; |
|
| 1309 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1310 | + else $i = (int) $parameters; |
|
| 1311 | 1311 | |
| 1312 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1312 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1313 | 1313 | { |
| 1314 | 1314 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1315 | 1315 | { |
@@ -1321,32 +1321,32 @@ discard block |
||
| 1321 | 1321 | return 0; |
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | - function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
|
| 1325 | - global $conf,$hideprices,$hookmanager; |
|
| 1324 | + function pdf_getlineupexcltax($parameters = array(), &$object, &$action = '') { |
|
| 1325 | + global $conf, $hideprices, $hookmanager; |
|
| 1326 | 1326 | |
| 1327 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1328 | - else $i = (int)$parameters; |
|
| 1327 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1328 | + else $i = (int) $parameters; |
|
| 1329 | 1329 | |
| 1330 | - if($this->isModSubtotalLine($parameters,$object) ) { |
|
| 1330 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1331 | 1331 | $this->resprints = ' '; |
| 1332 | 1332 | |
| 1333 | 1333 | $line = $object->lines[$i]; |
| 1334 | 1334 | |
| 1335 | 1335 | // On récupère les montants du bloc pour les afficher dans la ligne de sous-total |
| 1336 | - if(TSubtotal::isSubtotal($line)) { |
|
| 1336 | + if (TSubtotal::isSubtotal($line)) { |
|
| 1337 | 1337 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
| 1338 | 1338 | |
| 1339 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1340 | - if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1339 | + if (is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1340 | + if (!empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1341 | 1341 | $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
| 1342 | 1342 | $this->resprints = price($TTotal['total_subprice']); |
| 1343 | 1343 | } |
| 1344 | 1344 | } |
| 1345 | 1345 | |
| 1346 | - if((float)DOL_VERSION<=3.6) { |
|
| 1346 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1347 | 1347 | return ''; |
| 1348 | 1348 | } |
| 1349 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1349 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1350 | 1350 | return 1; |
| 1351 | 1351 | } |
| 1352 | 1352 | } |
@@ -1374,7 +1374,7 @@ discard block |
||
| 1374 | 1374 | |
| 1375 | 1375 | // Check if a title exist for this line && if the title have subtotal |
| 1376 | 1376 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
| 1377 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1377 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1378 | 1378 | { |
| 1379 | 1379 | |
| 1380 | 1380 | $this->resprints = ' '; |
@@ -1388,37 +1388,37 @@ discard block |
||
| 1388 | 1388 | return 0; |
| 1389 | 1389 | } |
| 1390 | 1390 | |
| 1391 | - function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') { |
|
| 1392 | - global $conf,$hideprices,$hookmanager; |
|
| 1391 | + function pdf_getlineremisepercent($parameters = array(), &$object, &$action = '') { |
|
| 1392 | + global $conf, $hideprices, $hookmanager; |
|
| 1393 | 1393 | |
| 1394 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1394 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1395 | 1395 | else $i = (int) $parameters; |
| 1396 | 1396 | |
| 1397 | - if($this->isModSubtotalLine($parameters,$object) ) { |
|
| 1397 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1398 | 1398 | $this->resprints = ' '; |
| 1399 | 1399 | |
| 1400 | 1400 | $line = $object->lines[$i]; |
| 1401 | 1401 | |
| 1402 | 1402 | // Affichage de la remise |
| 1403 | - if(TSubtotal::isSubtotal($line)) { |
|
| 1403 | + if (TSubtotal::isSubtotal($line)) { |
|
| 1404 | 1404 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
| 1405 | 1405 | |
| 1406 | - if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1407 | - if(! empty($parentTitle->array_options['options_show_reduc'])) { |
|
| 1406 | + if (empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1407 | + if (!empty($parentTitle->array_options['options_show_reduc'])) { |
|
| 1408 | 1408 | $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
| 1409 | - $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%'; |
|
| 1409 | + $this->resprints = price((1 - $TTotal['total_ht'] / $TTotal['total_subprice']) * 100, 0, '', 1, 2, 2).'%'; |
|
| 1410 | 1410 | } |
| 1411 | 1411 | } |
| 1412 | 1412 | |
| 1413 | - if((float)DOL_VERSION<=3.6) { |
|
| 1413 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1414 | 1414 | return ''; |
| 1415 | 1415 | } |
| 1416 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1416 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1417 | 1417 | return 1; |
| 1418 | 1418 | } |
| 1419 | 1419 | } |
| 1420 | 1420 | elseif (!empty($hideprices) |
| 1421 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1421 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1422 | 1422 | ) |
| 1423 | 1423 | { |
| 1424 | 1424 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1431,24 +1431,24 @@ discard block |
||
| 1431 | 1431 | return 0; |
| 1432 | 1432 | } |
| 1433 | 1433 | |
| 1434 | - function pdf_getlineupwithtax($parameters=array(), &$object, &$action='') { |
|
| 1435 | - global $conf,$hideprices; |
|
| 1434 | + function pdf_getlineupwithtax($parameters = array(), &$object, &$action = '') { |
|
| 1435 | + global $conf, $hideprices; |
|
| 1436 | 1436 | |
| 1437 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1437 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1438 | 1438 | $this->resprints = ' '; |
| 1439 | - if((float)DOL_VERSION<=3.6) { |
|
| 1439 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1440 | 1440 | return ''; |
| 1441 | 1441 | } |
| 1442 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1442 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1443 | 1443 | return 1; |
| 1444 | 1444 | } |
| 1445 | 1445 | } |
| 1446 | 1446 | |
| 1447 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1448 | - else $i = (int)$parameters; |
|
| 1447 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1448 | + else $i = (int) $parameters; |
|
| 1449 | 1449 | |
| 1450 | 1450 | if (!empty($hideprices) |
| 1451 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1451 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1452 | 1452 | ) |
| 1453 | 1453 | { |
| 1454 | 1454 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1461,22 +1461,22 @@ discard block |
||
| 1461 | 1461 | return 0; |
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | - function pdf_getlinevatrate($parameters=array(), &$object, &$action='') { |
|
| 1465 | - global $conf,$hideprices,$hookmanager; |
|
| 1464 | + function pdf_getlinevatrate($parameters = array(), &$object, &$action = '') { |
|
| 1465 | + global $conf, $hideprices, $hookmanager; |
|
| 1466 | 1466 | |
| 1467 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1467 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1468 | 1468 | $this->resprints = ' '; |
| 1469 | 1469 | |
| 1470 | - if((float)DOL_VERSION<=3.6) { |
|
| 1470 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1471 | 1471 | return ''; |
| 1472 | 1472 | } |
| 1473 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1473 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1474 | 1474 | return 1; |
| 1475 | 1475 | } |
| 1476 | 1476 | } |
| 1477 | 1477 | |
| 1478 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1479 | - else $i = (int)$parameters; |
|
| 1478 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1479 | + else $i = (int) $parameters; |
|
| 1480 | 1480 | |
| 1481 | 1481 | if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
| 1482 | 1482 | |
@@ -1503,7 +1503,7 @@ discard block |
||
| 1503 | 1503 | |
| 1504 | 1504 | // Check if a title exist for this line && if the title have subtotal |
| 1505 | 1505 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
| 1506 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1506 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1507 | 1507 | { |
| 1508 | 1508 | |
| 1509 | 1509 | $this->resprints = ' '; |
@@ -1517,23 +1517,23 @@ discard block |
||
| 1517 | 1517 | return 0; |
| 1518 | 1518 | } |
| 1519 | 1519 | |
| 1520 | - function pdf_getlineprogress($parameters=array(), &$object, &$action) { |
|
| 1520 | + function pdf_getlineprogress($parameters = array(), &$object, &$action) { |
|
| 1521 | 1521 | global $conf; |
| 1522 | 1522 | |
| 1523 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1523 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1524 | 1524 | $this->resprints = ' '; |
| 1525 | - if((float)DOL_VERSION<=3.6) { |
|
| 1525 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1526 | 1526 | return ''; |
| 1527 | 1527 | } |
| 1528 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1528 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1529 | 1529 | return 1; |
| 1530 | 1530 | } |
| 1531 | 1531 | } |
| 1532 | 1532 | |
| 1533 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1534 | - else $i = (int)$parameters; |
|
| 1533 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1534 | + else $i = (int) $parameters; |
|
| 1535 | 1535 | |
| 1536 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1536 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1537 | 1537 | { |
| 1538 | 1538 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1539 | 1539 | { |
@@ -1548,12 +1548,12 @@ discard block |
||
| 1548 | 1548 | function add_numerotation(&$object) { |
| 1549 | 1549 | global $conf; |
| 1550 | 1550 | |
| 1551 | - if(!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
| 1551 | + if (!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
| 1552 | 1552 | |
| 1553 | 1553 | $TLevelTitre = array(); |
| 1554 | 1554 | $prevlevel = 0; |
| 1555 | 1555 | |
| 1556 | - foreach($object->lines as $k=>&$line) |
|
| 1556 | + foreach ($object->lines as $k=>&$line) |
|
| 1557 | 1557 | { |
| 1558 | 1558 | if ($line->id > 0 && $this->isModSubtotalLine($k, $object) && $line->qty <= 10) |
| 1559 | 1559 | { |
@@ -1567,12 +1567,12 @@ discard block |
||
| 1567 | 1567 | } |
| 1568 | 1568 | |
| 1569 | 1569 | // TODO ne gère pas encore la numération des lignes "Totaux" |
| 1570 | - private function formatNumerotation(&$TLineTitle, $line_reference='', $level=1, $prefix_num=0) |
|
| 1570 | + private function formatNumerotation(&$TLineTitle, $line_reference = '', $level = 1, $prefix_num = 0) |
|
| 1571 | 1571 | { |
| 1572 | 1572 | $TTitle = array(); |
| 1573 | 1573 | |
| 1574 | - $i=1; |
|
| 1575 | - $j=0; |
|
| 1574 | + $i = 1; |
|
| 1575 | + $j = 0; |
|
| 1576 | 1576 | foreach ($TLineTitle as $k => &$line) |
| 1577 | 1577 | { |
| 1578 | 1578 | if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
@@ -1582,7 +1582,7 @@ discard block |
||
| 1582 | 1582 | { |
| 1583 | 1583 | $TTitle[$j]['numerotation'] = ($prefix_num == 0) ? $i : $prefix_num.'.'.$i; |
| 1584 | 1584 | //var_dump('Prefix == '.$prefix_num.' // '.$line->desc.' ==> numerotation == '.$TTitle[$j]['numerotation'].' ### '.$line->qty .'=='. $level); |
| 1585 | - if (empty($line->label) && (float)DOL_VERSION < 6) |
|
| 1585 | + if (empty($line->label) && (float) DOL_VERSION < 6) |
|
| 1586 | 1586 | { |
| 1587 | 1587 | $line->label = !empty($line->desc) ? $line->desc : $line->description; |
| 1588 | 1588 | $line->desc = $line->description = ''; |
@@ -1608,26 +1608,26 @@ discard block |
||
| 1608 | 1608 | |
| 1609 | 1609 | function setDocTVA(&$pdf, &$object) { |
| 1610 | 1610 | |
| 1611 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
| 1611 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
| 1612 | 1612 | |
| 1613 | - if(empty($hidedetails)) return false; |
|
| 1613 | + if (empty($hidedetails)) return false; |
|
| 1614 | 1614 | |
| 1615 | 1615 | // TODO can't add VAT to document without lines... :-/ |
| 1616 | 1616 | |
| 1617 | 1617 | return true; |
| 1618 | 1618 | } |
| 1619 | 1619 | |
| 1620 | - function beforePDFCreation($parameters=array(), &$object, &$action) |
|
| 1620 | + function beforePDFCreation($parameters = array(), &$object, &$action) |
|
| 1621 | 1621 | { |
| 1622 | 1622 | /** |
| 1623 | 1623 | * @var $pdf TCPDF |
| 1624 | 1624 | */ |
| 1625 | - global $pdf,$conf, $langs; |
|
| 1625 | + global $pdf, $conf, $langs; |
|
| 1626 | 1626 | |
| 1627 | 1627 | // var_dump($object->lines); |
| 1628 | 1628 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 1629 | 1629 | |
| 1630 | - foreach($parameters as $key=>$value) { |
|
| 1630 | + foreach ($parameters as $key=>$value) { |
|
| 1631 | 1631 | ${$key} = $value; |
| 1632 | 1632 | } |
| 1633 | 1633 | |
@@ -1635,43 +1635,43 @@ discard block |
||
| 1635 | 1635 | |
| 1636 | 1636 | $this->add_numerotation($object); |
| 1637 | 1637 | |
| 1638 | - foreach($object->lines as $k => &$l) { |
|
| 1639 | - if(TSubtotal::isSubtotal($l)) { |
|
| 1638 | + foreach ($object->lines as $k => &$l) { |
|
| 1639 | + if (TSubtotal::isSubtotal($l)) { |
|
| 1640 | 1640 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); |
| 1641 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1642 | - if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1643 | - $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
|
| 1641 | + if (is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1642 | + if (!empty($parentTitle->id) && !empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1643 | + $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
|
| 1644 | 1644 | } |
| 1645 | 1645 | } |
| 1646 | 1646 | |
| 1647 | 1647 | |
| 1648 | 1648 | // Pas de hook sur les colonnes du PDF expédition, on unset les bonnes variables |
| 1649 | - if(($object->element == 'shipping' || $object->element == 'delivery') && $this->isModSubtotalLine($k, $object)) |
|
| 1649 | + if (($object->element == 'shipping' || $object->element == 'delivery') && $this->isModSubtotalLine($k, $object)) |
|
| 1650 | 1650 | { |
| 1651 | 1651 | $l->qty = $l->qty_asked; |
| 1652 | 1652 | unset($l->qty_asked, $l->qty_shipped, $l->volume, $l->weight); |
| 1653 | 1653 | } |
| 1654 | 1654 | } |
| 1655 | 1655 | |
| 1656 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
| 1657 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
| 1656 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
| 1657 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
| 1658 | 1658 | |
| 1659 | 1659 | if ($hideInnerLines) { // si c une ligne de titre |
| 1660 | - $fk_parent_line=0; |
|
| 1661 | - $TLines =array(); |
|
| 1660 | + $fk_parent_line = 0; |
|
| 1661 | + $TLines = array(); |
|
| 1662 | 1662 | |
| 1663 | - $original_count=count($object->lines); |
|
| 1663 | + $original_count = count($object->lines); |
|
| 1664 | 1664 | $TTvas = array(); // tableau de tva |
| 1665 | 1665 | |
| 1666 | - foreach($object->lines as $k=>&$line) |
|
| 1666 | + foreach ($object->lines as $k=>&$line) |
|
| 1667 | 1667 | { |
| 1668 | 1668 | |
| 1669 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1669 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
| 1670 | 1670 | { |
| 1671 | 1671 | $fk_parent_line = $line->rowid; |
| 1672 | 1672 | |
| 1673 | 1673 | // Fix tk7201 - si on cache le détail, la TVA est renseigné au niveau du sous-total, l'erreur c'est s'il y a plusieurs sous-totaux pour les même lignes, ça va faire la somme |
| 1674 | - if(TSubtotal::isSubtotal($line)) |
|
| 1674 | + if (TSubtotal::isSubtotal($line)) |
|
| 1675 | 1675 | { |
| 1676 | 1676 | /*$total = $this->getTotalLineFromObject($object, $line, ''); |
| 1677 | 1677 | |
@@ -1700,22 +1700,22 @@ discard block |
||
| 1700 | 1700 | |
| 1701 | 1701 | if ($hideInnerLines) |
| 1702 | 1702 | { |
| 1703 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1703 | + if (!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1704 | 1704 | { |
| 1705 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
| 1705 | + if ($line->tva_tx != '0.000' && $line->product_type != 9) { |
|
| 1706 | 1706 | |
| 1707 | 1707 | // on remplit le tableau de tva pour substituer les lignes cachées |
| 1708 | 1708 | $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
| 1709 | 1709 | $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
| 1710 | 1710 | $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
| 1711 | 1711 | } |
| 1712 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1712 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
| 1713 | 1713 | { |
| 1714 | 1714 | //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
| 1715 | 1715 | // génère des lignes d'affichage des montants HT soumis à tva |
| 1716 | 1716 | $nbtva = count($TTvas); |
| 1717 | - if(!empty($nbtva)){ |
|
| 1718 | - foreach ($TTvas as $tx =>$val){ |
|
| 1717 | + if (!empty($nbtva)) { |
|
| 1718 | + foreach ($TTvas as $tx =>$val) { |
|
| 1719 | 1719 | $l = clone $line; |
| 1720 | 1720 | $l->product_type = 1; |
| 1721 | 1721 | $l->special_code = ''; |
@@ -1736,7 +1736,7 @@ discard block |
||
| 1736 | 1736 | } |
| 1737 | 1737 | } else { |
| 1738 | 1738 | |
| 1739 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1739 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
| 1740 | 1740 | { |
| 1741 | 1741 | // ajoute la ligne de sous-total |
| 1742 | 1742 | $TLines[] = $line; |
@@ -1764,9 +1764,9 @@ discard block |
||
| 1764 | 1764 | |
| 1765 | 1765 | // cas incongru où il y aurait des produits en dessous du dernier sous-total |
| 1766 | 1766 | $nbtva = count($TTvas); |
| 1767 | - if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1767 | + if (!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1768 | 1768 | { |
| 1769 | - foreach ($TTvas as $tx =>$val){ |
|
| 1769 | + foreach ($TTvas as $tx =>$val) { |
|
| 1770 | 1770 | $l = clone $line; |
| 1771 | 1771 | $l->product_type = 1; |
| 1772 | 1772 | $l->special_code = ''; |
@@ -1783,11 +1783,11 @@ discard block |
||
| 1783 | 1783 | } |
| 1784 | 1784 | |
| 1785 | 1785 | global $nblignes; |
| 1786 | - $nblignes=count($TLines); |
|
| 1786 | + $nblignes = count($TLines); |
|
| 1787 | 1787 | |
| 1788 | 1788 | $object->lines = $TLines; |
| 1789 | 1789 | |
| 1790 | - if($i>count($object->lines)) { |
|
| 1790 | + if ($i > count($object->lines)) { |
|
| 1791 | 1791 | $this->resprints = ''; |
| 1792 | 1792 | return 0; |
| 1793 | 1793 | } |
@@ -1796,55 +1796,55 @@ discard block |
||
| 1796 | 1796 | return 0; |
| 1797 | 1797 | } |
| 1798 | 1798 | |
| 1799 | - function pdf_writelinedesc($parameters=array(), &$object, &$action) |
|
| 1799 | + function pdf_writelinedesc($parameters = array(), &$object, &$action) |
|
| 1800 | 1800 | { |
| 1801 | 1801 | /** |
| 1802 | 1802 | * @var $pdf TCPDF |
| 1803 | 1803 | */ |
| 1804 | - global $pdf,$conf; |
|
| 1804 | + global $pdf, $conf; |
|
| 1805 | 1805 | |
| 1806 | - foreach($parameters as $key=>$value) { |
|
| 1806 | + foreach ($parameters as $key=>$value) { |
|
| 1807 | 1807 | ${$key} = $value; |
| 1808 | 1808 | } |
| 1809 | 1809 | |
| 1810 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
| 1811 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
| 1810 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
| 1811 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
| 1812 | 1812 | |
| 1813 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1813 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1814 | 1814 | |
| 1815 | 1815 | global $hideprices; |
| 1816 | 1816 | |
| 1817 | - if(!empty($hideprices)) { |
|
| 1818 | - foreach($object->lines as &$line) { |
|
| 1819 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
| 1817 | + if (!empty($hideprices)) { |
|
| 1818 | + foreach ($object->lines as &$line) { |
|
| 1819 | + if ($line->fk_product_type != 9) $line->fk_parent_line = -1; |
|
| 1820 | 1820 | } |
| 1821 | 1821 | } |
| 1822 | 1822 | |
| 1823 | 1823 | $line = &$object->lines[$i]; |
| 1824 | 1824 | |
| 1825 | - if($object->element == 'delivery' && ! empty($object->commande->expeditions[$line->fk_origin_line])) unset($object->commande->expeditions[$line->fk_origin_line]); |
|
| 1825 | + if ($object->element == 'delivery' && !empty($object->commande->expeditions[$line->fk_origin_line])) unset($object->commande->expeditions[$line->fk_origin_line]); |
|
| 1826 | 1826 | |
| 1827 | - if($line->info_bits>0) { // PAGE BREAK |
|
| 1827 | + if ($line->info_bits > 0) { // PAGE BREAK |
|
| 1828 | 1828 | $pdf->addPage(); |
| 1829 | 1829 | $posy = $pdf->GetY(); |
| 1830 | 1830 | } |
| 1831 | 1831 | |
| 1832 | 1832 | $label = $line->label; |
| 1833 | - $description= !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
| 1833 | + $description = !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
| 1834 | 1834 | |
| 1835 | - if(empty($label)) { |
|
| 1835 | + if (empty($label)) { |
|
| 1836 | 1836 | $label = $description; |
| 1837 | - $description=''; |
|
| 1837 | + $description = ''; |
|
| 1838 | 1838 | } |
| 1839 | 1839 | |
| 1840 | - if($line->qty>90) { |
|
| 1840 | + if ($line->qty > 90) { |
|
| 1841 | 1841 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
| 1842 | 1842 | |
| 1843 | 1843 | $pageBefore = $pdf->getPage(); |
| 1844 | - $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
| 1844 | + $this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
| 1845 | 1845 | $pageAfter = $pdf->getPage(); |
| 1846 | 1846 | |
| 1847 | - if($pageAfter>$pageBefore) { |
|
| 1847 | + if ($pageAfter > $pageBefore) { |
|
| 1848 | 1848 | //print "ST $pageAfter>$pageBefore<br>"; |
| 1849 | 1849 | $pdf->rollbackTransaction(true); |
| 1850 | 1850 | $pdf->addPage('', '', true); |
@@ -1855,9 +1855,9 @@ discard block |
||
| 1855 | 1855 | } |
| 1856 | 1856 | |
| 1857 | 1857 | // On delivery PDF, we don't want quantities to appear and there are no hooks => setting text color to background color; |
| 1858 | - if($object->element == 'delivery') |
|
| 1858 | + if ($object->element == 'delivery') |
|
| 1859 | 1859 | { |
| 1860 | - switch($line->qty) |
|
| 1860 | + switch ($line->qty) |
|
| 1861 | 1861 | { |
| 1862 | 1862 | case 99: |
| 1863 | 1863 | $grey = 220; |
@@ -1880,7 +1880,7 @@ discard block |
||
| 1880 | 1880 | else if ($line->qty < 10) { |
| 1881 | 1881 | $pageBefore = $pdf->getPage(); |
| 1882 | 1882 | |
| 1883 | - $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
| 1883 | + $this->pdf_add_title($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
| 1884 | 1884 | $pageAfter = $pdf->getPage(); |
| 1885 | 1885 | |
| 1886 | 1886 | |
@@ -1896,9 +1896,9 @@ discard block |
||
| 1896 | 1896 | } |
| 1897 | 1897 | */ |
| 1898 | 1898 | |
| 1899 | - if($object->element == 'delivery') |
|
| 1899 | + if ($object->element == 'delivery') |
|
| 1900 | 1900 | { |
| 1901 | - $pdf->SetTextColor(255,255,255); |
|
| 1901 | + $pdf->SetTextColor(255, 255, 255); |
|
| 1902 | 1902 | } |
| 1903 | 1903 | |
| 1904 | 1904 | $posy = $pdf->GetY(); |
@@ -1961,9 +1961,9 @@ discard block |
||
| 1961 | 1961 | * @param $hookmanager HookManager |
| 1962 | 1962 | * @return int |
| 1963 | 1963 | */ |
| 1964 | - function printObjectLine ($parameters, &$object, &$action, $hookmanager){ |
|
| 1964 | + function printObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
| 1965 | 1965 | |
| 1966 | - global $conf,$langs,$user,$db,$bc; |
|
| 1966 | + global $conf, $langs, $user, $db, $bc; |
|
| 1967 | 1967 | |
| 1968 | 1968 | $num = &$parameters['num']; |
| 1969 | 1969 | $line = &$parameters['line']; |
@@ -1971,33 +1971,33 @@ discard block |
||
| 1971 | 1971 | |
| 1972 | 1972 | $var = &$parameters['var']; |
| 1973 | 1973 | |
| 1974 | - $contexts = explode(':',$parameters['context']); |
|
| 1974 | + $contexts = explode(':', $parameters['context']); |
|
| 1975 | 1975 | |
| 1976 | 1976 | $originline = null; |
| 1977 | 1977 | |
| 1978 | 1978 | $createRight = $user->rights->{$object->element}->creer; |
| 1979 | - if($object->element == 'facturerec' ) |
|
| 1979 | + if ($object->element == 'facturerec') |
|
| 1980 | 1980 | { |
| 1981 | 1981 | $object->statut = 0; // hack for facture rec |
| 1982 | 1982 | $createRight = $user->rights->facture->creer; |
| 1983 | 1983 | } |
| 1984 | - elseif($object->element == 'order_supplier' ) |
|
| 1984 | + elseif ($object->element == 'order_supplier') |
|
| 1985 | 1985 | { |
| 1986 | 1986 | $createRight = $user->rights->fournisseur->commande->creer; |
| 1987 | 1987 | } |
| 1988 | - elseif($object->element == 'invoice_supplier' ) |
|
| 1988 | + elseif ($object->element == 'invoice_supplier') |
|
| 1989 | 1989 | { |
| 1990 | 1990 | $createRight = $user->rights->fournisseur->facture->creer; |
| 1991 | 1991 | } |
| 1992 | - elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) |
|
| 1992 | + elseif ($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) |
|
| 1993 | 1993 | { |
| 1994 | 1994 | // H4cK 4n0nYm0u$-style : $line n'est pas un objet instancié mais provient d'un fetch_object d'une requête SQL |
| 1995 | 1995 | $line->id = $line->rowid; |
| 1996 | 1996 | $line->product_type = $line->type; |
| 1997 | 1997 | } |
| 1998 | - elseif($object->element == 'shipping' || $object->element == 'delivery') |
|
| 1998 | + elseif ($object->element == 'shipping' || $object->element == 'delivery') |
|
| 1999 | 1999 | { |
| 2000 | - if(empty($line->origin_line_id) && ! empty($line->fk_origin_line)) |
|
| 2000 | + if (empty($line->origin_line_id) && !empty($line->fk_origin_line)) |
|
| 2001 | 2001 | { |
| 2002 | 2002 | $line->origin_line_id = $line->fk_origin_line; |
| 2003 | 2003 | } |
@@ -2005,9 +2005,9 @@ discard block |
||
| 2005 | 2005 | $originline = new OrderLine($db); |
| 2006 | 2006 | $originline->fetch($line->fk_origin_line); |
| 2007 | 2007 | |
| 2008 | - foreach(get_object_vars($line) as $property => $value) |
|
| 2008 | + foreach (get_object_vars($line) as $property => $value) |
|
| 2009 | 2009 | { |
| 2010 | - if(empty($originline->{ $property })) |
|
| 2010 | + if (empty($originline->{ $property })) |
|
| 2011 | 2011 | { |
| 2012 | 2012 | $originline->{ $property } = $value; |
| 2013 | 2013 | } |
@@ -2016,15 +2016,15 @@ discard block |
||
| 2016 | 2016 | $line = $originline; |
| 2017 | 2017 | } |
| 2018 | 2018 | |
| 2019 | - if($line->special_code!=$this->module_number || $line->product_type!=9) { |
|
| 2019 | + if ($line->special_code != $this->module_number || $line->product_type != 9) { |
|
| 2020 | 2020 | null; |
| 2021 | 2021 | } |
| 2022 | - else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) |
|
| 2022 | + else if (in_array('invoicecard', $contexts) || in_array('invoicesuppliercard', $contexts) || in_array('propalcard', $contexts) || in_array('supplier_proposalcard', $contexts) || in_array('ordercard', $contexts) || in_array('ordersuppliercard', $contexts) || in_array('invoicereccard', $contexts)) |
|
| 2023 | 2023 | { |
| 2024 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 2025 | - else $idvar='id'; |
|
| 2024 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
| 2025 | + else $idvar = 'id'; |
|
| 2026 | 2026 | |
| 2027 | - if((float)DOL_VERSION <= 3.4) |
|
| 2027 | + if ((float) DOL_VERSION <= 3.4) |
|
| 2028 | 2028 | { |
| 2029 | 2029 | ?> |
| 2030 | 2030 | <script type="text/javascript"> |
@@ -2048,22 +2048,22 @@ discard block |
||
| 2048 | 2048 | <?php |
| 2049 | 2049 | } |
| 2050 | 2050 | |
| 2051 | - if(empty($line->description)) $line->description = $line->desc; |
|
| 2051 | + if (empty($line->description)) $line->description = $line->desc; |
|
| 2052 | 2052 | |
| 2053 | 2053 | $colspan = 5; |
| 2054 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
| 2055 | - if($object->element == 'order_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 3 : $colspan = 6; |
|
| 2056 | - if($object->element == 'invoice_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 4: $colspan = 7; |
|
| 2057 | - if($object->element == 'supplier_proposal') (float) DOL_VERSION < 6.0 ? $colspan = 4 : $colspan = 3; |
|
| 2058 | - if(!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) { |
|
| 2054 | + if ($object->element == 'facturerec') $colspan = 3; |
|
| 2055 | + if ($object->element == 'order_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 3 : $colspan = 6; |
|
| 2056 | + if ($object->element == 'invoice_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 4 : $colspan = 7; |
|
| 2057 | + if ($object->element == 'supplier_proposal') (float) DOL_VERSION < 6.0 ? $colspan = 4 : $colspan = 3; |
|
| 2058 | + if (!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) { |
|
| 2059 | 2059 | $colspan++; // Colonne PU Devise |
| 2060 | 2060 | } |
| 2061 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
| 2062 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
| 2063 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
| 2064 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
| 2065 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
| 2066 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
| 2061 | + if ($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
| 2062 | + if (!empty($conf->margin->enabled)) $colspan++; |
|
| 2063 | + if (!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
| 2064 | + if (!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
| 2065 | + if ($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
| 2066 | + if (!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
| 2067 | 2067 | |
| 2068 | 2068 | /* Titre */ |
| 2069 | 2069 | //var_dump($line); |
@@ -2073,39 +2073,39 @@ discard block |
||
| 2073 | 2073 | |
| 2074 | 2074 | |
| 2075 | 2075 | ?> |
| 2076 | - <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
| 2076 | + <tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
| 2077 | 2077 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 2078 | 2078 | { |
| 2079 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 2080 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2081 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 2082 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 2083 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 2084 | - else if($line->qty==50) print ''; |
|
| 2079 | + if ($line->qty == 99) print 'background:#adadcf'; |
|
| 2080 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
| 2081 | + else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;'; |
|
| 2082 | + else if ($line->qty == 1) print 'background:#adadcf;'; |
|
| 2083 | + else if ($line->qty == 2) print 'background:#ddddff;'; |
|
| 2084 | + else if ($line->qty == 50) print ''; |
|
| 2085 | 2085 | else print 'background:#eeeeff;'; |
| 2086 | 2086 | |
| 2087 | 2087 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 2088 | 2088 | } |
| 2089 | 2089 | else |
| 2090 | 2090 | { |
| 2091 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 2092 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2093 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 2094 | - else if($line->qty==50) print ''; |
|
| 2095 | - else print 'background:#eeffee;' ; |
|
| 2091 | + if ($line->qty == 99) print 'background:#ddffdd'; |
|
| 2092 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
| 2093 | + else if ($line->qty == 2) print 'background:#eeeeff; '; |
|
| 2094 | + else if ($line->qty == 50) print ''; |
|
| 2095 | + else print 'background:#eeffee;'; |
|
| 2096 | 2096 | } |
| 2097 | 2097 | |
| 2098 | 2098 | ?>;"> |
| 2099 | 2099 | |
| 2100 | - <?php if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> |
|
| 2100 | + <?php if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> |
|
| 2101 | 2101 | <td class="linecolnum"><?php echo $i + 1; ?></td> |
| 2102 | 2102 | <?php } ?> |
| 2103 | 2103 | |
| 2104 | - <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php |
|
| 2105 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
| 2104 | + <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php |
|
| 2105 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
| 2106 | 2106 | |
| 2107 | - $params=array('line'=>$line); |
|
| 2108 | - $reshook=$hookmanager->executeHooks('formEditProductOptions',$params,$object,$action); |
|
| 2107 | + $params = array('line'=>$line); |
|
| 2108 | + $reshook = $hookmanager->executeHooks('formEditProductOptions', $params, $object, $action); |
|
| 2109 | 2109 | |
| 2110 | 2110 | echo '<div id="line_'.$line->id.'"></div>'; // Imitation Dolibarr |
| 2111 | 2111 | echo '<input type="hidden" value="'.$line->id.'" name="lineid">'; |
@@ -2113,7 +2113,7 @@ discard block |
||
| 2113 | 2113 | echo '<input id="product_id" type="hidden" value="'.$line->fk_product.'" name="type">'; |
| 2114 | 2114 | echo '<input id="special_code" type="hidden" value="'.$line->special_code.'" name="type">'; |
| 2115 | 2115 | |
| 2116 | - $isFreeText=false; |
|
| 2116 | + $isFreeText = false; |
|
| 2117 | 2117 | if (TSubtotal::isTitle($line)) |
| 2118 | 2118 | { |
| 2119 | 2119 | $qty_displayed = $line->qty; |
@@ -2135,13 +2135,13 @@ discard block |
||
| 2135 | 2135 | $line->description = ''; |
| 2136 | 2136 | } |
| 2137 | 2137 | $newlabel = $line->label; |
| 2138 | - if($line->label=='' && !$isFreeText) { |
|
| 2139 | - if(TSubtotal::isSubtotal($line)) { |
|
| 2138 | + if ($line->label == '' && !$isFreeText) { |
|
| 2139 | + if (TSubtotal::isSubtotal($line)) { |
|
| 2140 | 2140 | $newlabel = $line->description.' '.$this->getTitle($object, $line); |
| 2141 | - $line->description=''; |
|
| 2142 | - } elseif( (float)DOL_VERSION < 6 ) { |
|
| 2143 | - $newlabel= $line->description; |
|
| 2144 | - $line->description=''; |
|
| 2141 | + $line->description = ''; |
|
| 2142 | + } elseif ((float) DOL_VERSION < 6) { |
|
| 2143 | + $newlabel = $line->description; |
|
| 2144 | + $line->description = ''; |
|
| 2145 | 2145 | } |
| 2146 | 2146 | } |
| 2147 | 2147 | |
@@ -2150,10 +2150,10 @@ discard block |
||
| 2150 | 2150 | |
| 2151 | 2151 | if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
| 2152 | 2152 | |
| 2153 | - if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
|
| 2153 | + if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line))) |
|
| 2154 | 2154 | { |
| 2155 | 2155 | $select = '<select name="subtotal_level">'; |
| 2156 | - for ($j=1; $j<10; $j++) |
|
| 2156 | + for ($j = 1; $j < 10; $j++) |
|
| 2157 | 2157 | { |
| 2158 | 2158 | if (!empty($readonlyForSituation)) { |
| 2159 | 2159 | if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
@@ -2167,7 +2167,7 @@ discard block |
||
| 2167 | 2167 | |
| 2168 | 2168 | echo '<div class="subtotal_underline" style="margin-left:24px; line-height: 25px;">'; |
| 2169 | 2169 | echo '<div>'; |
| 2170 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2170 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '').' /> '; |
|
| 2171 | 2171 | echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>'; |
| 2172 | 2172 | echo '</div>'; |
| 2173 | 2173 | |
@@ -2188,21 +2188,21 @@ discard block |
||
| 2188 | 2188 | echo '</div>'; |
| 2189 | 2189 | } |
| 2190 | 2190 | echo '<div>'; |
| 2191 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2191 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '').' /> '; |
|
| 2192 | 2192 | echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>'; |
| 2193 | 2193 | echo '</div>'; |
| 2194 | 2194 | |
| 2195 | 2195 | echo '<div>'; |
| 2196 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2196 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '').' /> '; |
|
| 2197 | 2197 | echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
| 2198 | 2198 | echo '</div>'; |
| 2199 | 2199 | } |
| 2200 | 2200 | else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
| 2201 | 2201 | echo '</div>'; |
| 2202 | 2202 | |
| 2203 | - if($line->qty<10) { |
|
| 2203 | + if ($line->qty < 10) { |
|
| 2204 | 2204 | // WYSIWYG editor |
| 2205 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
| 2205 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
| 2206 | 2206 | $nbrows = ROWS_2; |
| 2207 | 2207 | $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
| 2208 | 2208 | if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
@@ -2222,25 +2222,25 @@ discard block |
||
| 2222 | 2222 | |
| 2223 | 2223 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
| 2224 | 2224 | { |
| 2225 | - if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
| 2225 | + if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
| 2226 | 2226 | { |
| 2227 | - echo str_repeat(' ', $line->qty-1); |
|
| 2227 | + echo str_repeat(' ', $line->qty - 1); |
|
| 2228 | 2228 | |
| 2229 | 2229 | if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
| 2230 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2230 | + else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span> '; |
|
| 2231 | 2231 | } |
| 2232 | 2232 | } |
| 2233 | 2233 | else |
| 2234 | 2234 | { |
| 2235 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2236 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2235 | + if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal'); |
|
| 2236 | + else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2237 | 2237 | } |
| 2238 | 2238 | |
| 2239 | 2239 | |
| 2240 | 2240 | // Get display styles and apply them |
| 2241 | 2241 | $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;'; |
| 2242 | - $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
| 2243 | - $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
| 2242 | + $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
| 2243 | + $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
| 2244 | 2244 | |
| 2245 | 2245 | if (empty($line->label)) { |
| 2246 | 2246 | if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
@@ -2248,16 +2248,16 @@ discard block |
||
| 2248 | 2248 | } |
| 2249 | 2249 | else { |
| 2250 | 2250 | |
| 2251 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
| 2251 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
| 2252 | 2252 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2253 | 2253 | } |
| 2254 | - else{ |
|
| 2254 | + else { |
|
| 2255 | 2255 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2256 | 2256 | } |
| 2257 | 2257 | |
| 2258 | 2258 | } |
| 2259 | - if($line->qty>90) print ' : '; |
|
| 2260 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2259 | + if ($line->qty > 90) print ' : '; |
|
| 2260 | + if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2261 | 2261 | |
| 2262 | 2262 | |
| 2263 | 2263 | |
@@ -2266,7 +2266,7 @@ discard block |
||
| 2266 | 2266 | ?></td> |
| 2267 | 2267 | |
| 2268 | 2268 | <?php |
| 2269 | - if($line->qty>90) { |
|
| 2269 | + if ($line->qty > 90) { |
|
| 2270 | 2270 | /* Total */ |
| 2271 | 2271 | $total_line = $this->getTotalLineFromObject($object, $line, ''); |
| 2272 | 2272 | echo '<td class="linecolht nowrap" align="right" style="font-weight:bold;" rel="subtotal_total">'.price($total_line).'</td>'; |
@@ -2285,7 +2285,7 @@ discard block |
||
| 2285 | 2285 | <?php |
| 2286 | 2286 | if ($action != 'selectlines') { |
| 2287 | 2287 | |
| 2288 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
| 2288 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
| 2289 | 2289 | ?> |
| 2290 | 2290 | <input id="savelinebutton" class="button" type="submit" name="save" value="<?php echo $langs->trans('Save') ?>" /> |
| 2291 | 2291 | <br /> |
@@ -2301,13 +2301,13 @@ discard block |
||
| 2301 | 2301 | <?php |
| 2302 | 2302 | |
| 2303 | 2303 | } |
| 2304 | - else{ |
|
| 2305 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
| 2304 | + else { |
|
| 2305 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
| 2306 | 2306 | { |
| 2307 | - if(TSubtotal::isTitle($line) && ( $line->fk_prev_id === null )) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
| 2307 | + if (TSubtotal::isTitle($line) && ($line->fk_prev_id === null)) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'.img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
| 2308 | 2308 | } |
| 2309 | 2309 | |
| 2310 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
| 2310 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
| 2311 | 2311 | { |
| 2312 | 2312 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=editline&lineid='.$line->id.'">'.img_edit().'</a>'; |
| 2313 | 2313 | } |
@@ -2322,7 +2322,7 @@ discard block |
||
| 2322 | 2322 | <?php |
| 2323 | 2323 | |
| 2324 | 2324 | if ($action != 'editline' && $action != 'selectlines') { |
| 2325 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
| 2325 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
| 2326 | 2326 | { |
| 2327 | 2327 | |
| 2328 | 2328 | if ($line->fk_prev_id === null) |
@@ -2330,12 +2330,12 @@ discard block |
||
| 2330 | 2330 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteline&lineid='.$line->id.'">'.img_delete().'</a>'; |
| 2331 | 2331 | } |
| 2332 | 2332 | |
| 2333 | - if(TSubtotal::isTitle($line) && ($line->fk_prev_id === null) ) |
|
| 2333 | + if (TSubtotal::isTitle($line) && ($line->fk_prev_id === null)) |
|
| 2334 | 2334 | { |
| 2335 | 2335 | if ((float) DOL_VERSION >= 8.0) { |
| 2336 | 2336 | $img_delete = img_delete($langs->trans('deleteWithAllLines'), ' class="pictodelete pictodeleteallline"'); |
| 2337 | 2337 | } elseif ((float) DOL_VERSION >= 3.8) { |
| 2338 | - $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal',' class="pictodelete" '); |
|
| 2338 | + $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal', ' class="pictodelete" '); |
|
| 2339 | 2339 | } else { |
| 2340 | 2340 | $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all@subtotal'); |
| 2341 | 2341 | } |
@@ -2345,7 +2345,7 @@ discard block |
||
| 2345 | 2345 | /* Depuis la 8.0, les icônes "standard" utilisent FontAwesome et sont préconfigurées selon la clé de l'image |
| 2346 | 2346 | * Impossible d'en customiser par exemple la couleur, même en utilisant img_picto() directement |
| 2347 | 2347 | */ |
| 2348 | - if((float) DOL_VERSION >= 8.0) { |
|
| 2348 | + if ((float) DOL_VERSION >= 8.0) { |
|
| 2349 | 2349 | ?> |
| 2350 | 2350 | <script> |
| 2351 | 2351 | $(document).ready(function () { |
@@ -2361,7 +2361,7 @@ discard block |
||
| 2361 | 2361 | </td> |
| 2362 | 2362 | |
| 2363 | 2363 | <?php |
| 2364 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
| 2364 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
| 2365 | 2365 | { |
| 2366 | 2366 | echo '<td class="subtotal_nc">'; |
| 2367 | 2367 | echo '<input id="subtotal_nc-'.$line->id.'" class="subtotal_nc_chkbx" data-lineid="'.$line->id.'" type="checkbox" name="subtotal_nc" value="1" '.(!empty($line->array_options['options_subtotal_nc']) ? 'checked="checked"' : '').' />'; |
@@ -2372,12 +2372,12 @@ discard block |
||
| 2372 | 2372 | <td align="center" class="linecolmove tdlineupdown"> |
| 2373 | 2373 | </td> |
| 2374 | 2374 | <?php } else { ?> |
| 2375 | - <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight ))?' class="tdlineupdown"':''); ?>></td> |
|
| 2375 | + <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight)) ? ' class="tdlineupdown"' : ''); ?>></td> |
|
| 2376 | 2376 | <?php } ?> |
| 2377 | 2377 | |
| 2378 | 2378 | |
| 2379 | - <?php if($action == 'selectlines'){ // dolibarr 8 ?> |
|
| 2380 | - <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
| 2379 | + <?php if ($action == 'selectlines') { // dolibarr 8 ?> |
|
| 2380 | + <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i + 1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
| 2381 | 2381 | <?php } ?> |
| 2382 | 2382 | |
| 2383 | 2383 | </tr> |
@@ -2385,29 +2385,29 @@ discard block |
||
| 2385 | 2385 | |
| 2386 | 2386 | |
| 2387 | 2387 | // Affichage des extrafields à la Dolibarr (car sinon non affiché sur les titres) |
| 2388 | - if(TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
| 2388 | + if (TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
| 2389 | 2389 | |
| 2390 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
| 2390 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
| 2391 | 2391 | |
| 2392 | 2392 | // Extrafields |
| 2393 | 2393 | $extrafieldsline = new ExtraFields($db); |
| 2394 | 2394 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
| 2395 | 2395 | |
| 2396 | - $colspan+=3; $mode = 'view'; |
|
| 2397 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
| 2396 | + $colspan += 3; $mode = 'view'; |
|
| 2397 | + if ($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
| 2398 | 2398 | |
| 2399 | 2399 | $ex_element = $line->element; |
| 2400 | 2400 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
| 2401 | - print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ','colspan'=>$colspan)); |
|
| 2401 | + print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ', 'colspan'=>$colspan)); |
|
| 2402 | 2402 | $isExtraSelected = false; |
| 2403 | - foreach($line->array_options as $option) { |
|
| 2404 | - if(!empty($option) && $option != "-1") { |
|
| 2403 | + foreach ($line->array_options as $option) { |
|
| 2404 | + if (!empty($option) && $option != "-1") { |
|
| 2405 | 2405 | $isExtraSelected = true; |
| 2406 | 2406 | break; |
| 2407 | 2407 | } |
| 2408 | 2408 | } |
| 2409 | 2409 | |
| 2410 | - if($mode === 'edit') { |
|
| 2410 | + if ($mode === 'edit') { |
|
| 2411 | 2411 | ?> |
| 2412 | 2412 | <script> |
| 2413 | 2413 | $(document).ready(function(){ |
@@ -2415,7 +2415,7 @@ discard block |
||
| 2415 | 2415 | var all_tr_extrafields = $("tr.tr_extrafield_title"); |
| 2416 | 2416 | <?php |
| 2417 | 2417 | // Si un extrafield est rempli alors on affiche directement les extrafields |
| 2418 | - if(!$isExtraSelected) { |
|
| 2418 | + if (!$isExtraSelected) { |
|
| 2419 | 2419 | echo 'all_tr_extrafields.hide();'; |
| 2420 | 2420 | echo 'var trad = "'.$langs->trans('showExtrafields').'";'; |
| 2421 | 2421 | echo 'var extra = 0;'; |
@@ -2454,61 +2454,61 @@ discard block |
||
| 2454 | 2454 | return 1; |
| 2455 | 2455 | |
| 2456 | 2456 | } |
| 2457 | - elseif(($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) || (in_array('expeditioncard', $contexts) && $action == 'create')) |
|
| 2457 | + elseif (($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) || (in_array('expeditioncard', $contexts) && $action == 'create')) |
|
| 2458 | 2458 | { |
| 2459 | 2459 | $colspan = 4; |
| 2460 | 2460 | |
| 2461 | 2461 | // HTML 5 data for js |
| 2462 | 2462 | $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
| 2463 | 2463 | ?> |
| 2464 | - <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
| 2464 | + <tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
| 2465 | 2465 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 2466 | 2466 | { |
| 2467 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 2468 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2469 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 2470 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 2471 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 2472 | - else if($line->qty==50) print ''; |
|
| 2467 | + if ($line->qty == 99) print 'background:#adadcf'; |
|
| 2468 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
| 2469 | + else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;'; |
|
| 2470 | + else if ($line->qty == 1) print 'background:#adadcf;'; |
|
| 2471 | + else if ($line->qty == 2) print 'background:#ddddff;'; |
|
| 2472 | + else if ($line->qty == 50) print ''; |
|
| 2473 | 2473 | else print 'background:#eeeeff;'; |
| 2474 | 2474 | |
| 2475 | 2475 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 2476 | 2476 | } |
| 2477 | 2477 | else |
| 2478 | 2478 | { |
| 2479 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 2480 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2481 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 2482 | - else if($line->qty==50) print ''; |
|
| 2483 | - else print 'background:#eeffee;' ; |
|
| 2479 | + if ($line->qty == 99) print 'background:#ddffdd'; |
|
| 2480 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
| 2481 | + else if ($line->qty == 2) print 'background:#eeeeff; '; |
|
| 2482 | + else if ($line->qty == 50) print ''; |
|
| 2483 | + else print 'background:#eeffee;'; |
|
| 2484 | 2484 | } |
| 2485 | 2485 | |
| 2486 | 2486 | ?>;"> |
| 2487 | 2487 | |
| 2488 | - <td style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php |
|
| 2488 | + <td style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php |
|
| 2489 | 2489 | |
| 2490 | 2490 | |
| 2491 | 2491 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
| 2492 | 2492 | { |
| 2493 | - if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
| 2493 | + if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
| 2494 | 2494 | { |
| 2495 | - echo str_repeat(' ', $line->qty-1); |
|
| 2495 | + echo str_repeat(' ', $line->qty - 1); |
|
| 2496 | 2496 | |
| 2497 | 2497 | if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
| 2498 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2498 | + else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span> '; |
|
| 2499 | 2499 | } |
| 2500 | 2500 | } |
| 2501 | 2501 | else |
| 2502 | 2502 | { |
| 2503 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2504 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2503 | + if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal'); |
|
| 2504 | + else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2505 | 2505 | } |
| 2506 | 2506 | |
| 2507 | 2507 | |
| 2508 | 2508 | // Get display styles and apply them |
| 2509 | 2509 | $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;'; |
| 2510 | - $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
| 2511 | - $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
| 2510 | + $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
| 2511 | + $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
| 2512 | 2512 | |
| 2513 | 2513 | if (empty($line->label)) { |
| 2514 | 2514 | if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
@@ -2516,22 +2516,22 @@ discard block |
||
| 2516 | 2516 | } |
| 2517 | 2517 | else { |
| 2518 | 2518 | |
| 2519 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
| 2519 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
| 2520 | 2520 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2521 | 2521 | } |
| 2522 | - else{ |
|
| 2522 | + else { |
|
| 2523 | 2523 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2524 | 2524 | } |
| 2525 | 2525 | |
| 2526 | 2526 | } |
| 2527 | 2527 | //if($line->qty>90) print ' : '; |
| 2528 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2528 | + if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2529 | 2529 | |
| 2530 | 2530 | ?> |
| 2531 | 2531 | </td> |
| 2532 | 2532 | <td colspan="<?php echo $colspan; ?>"> |
| 2533 | 2533 | <?php |
| 2534 | - if(in_array('expeditioncard', $contexts) && $action == 'create') |
|
| 2534 | + if (in_array('expeditioncard', $contexts) && $action == 'create') |
|
| 2535 | 2535 | { |
| 2536 | 2536 | $fk_entrepot = GETPOST('entrepot_id', 'int'); |
| 2537 | 2537 | ?> |
@@ -2558,100 +2558,100 @@ discard block |
||
| 2558 | 2558 | $shipment_static = new Expedition($db); |
| 2559 | 2559 | $warehousestatic = new Entrepot($db); |
| 2560 | 2560 | $extrafieldsline = new ExtraFields($db); |
| 2561 | - $extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
|
| 2561 | + $extralabelslines = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
|
| 2562 | 2562 | |
| 2563 | 2563 | $colspan = 4; |
| 2564 | - if($object->origin && $object->origin_id > 0) $colspan++; |
|
| 2565 | - if(! empty($conf->stock->enabled)) $colspan++; |
|
| 2566 | - if(! empty($conf->productbatch->enabled)) $colspan++; |
|
| 2567 | - if($object->statut == 0) $colspan++; |
|
| 2568 | - if($object->statut == 0 && empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) $colspan++; |
|
| 2564 | + if ($object->origin && $object->origin_id > 0) $colspan++; |
|
| 2565 | + if (!empty($conf->stock->enabled)) $colspan++; |
|
| 2566 | + if (!empty($conf->productbatch->enabled)) $colspan++; |
|
| 2567 | + if ($object->statut == 0) $colspan++; |
|
| 2568 | + if ($object->statut == 0 && empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) $colspan++; |
|
| 2569 | 2569 | |
| 2570 | - if($object->element == 'delivery') $colspan = 2; |
|
| 2570 | + if ($object->element == 'delivery') $colspan = 2; |
|
| 2571 | 2571 | |
| 2572 | 2572 | print '<!-- origin line id = '.$line->origin_line_id.' -->'; // id of order line |
| 2573 | 2573 | |
| 2574 | 2574 | // HTML 5 data for js |
| 2575 | 2575 | $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
| 2576 | 2576 | ?> |
| 2577 | - <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
| 2577 | + <tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
| 2578 | 2578 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 2579 | 2579 | { |
| 2580 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 2581 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2582 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 2583 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 2584 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 2585 | - else if($line->qty==50) print ''; |
|
| 2580 | + if ($line->qty == 99) print 'background:#adadcf'; |
|
| 2581 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
| 2582 | + else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;'; |
|
| 2583 | + else if ($line->qty == 1) print 'background:#adadcf;'; |
|
| 2584 | + else if ($line->qty == 2) print 'background:#ddddff;'; |
|
| 2585 | + else if ($line->qty == 50) print ''; |
|
| 2586 | 2586 | else print 'background:#eeeeff;'; |
| 2587 | 2587 | |
| 2588 | 2588 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 2589 | 2589 | } |
| 2590 | 2590 | else |
| 2591 | 2591 | { |
| 2592 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 2593 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2594 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 2595 | - else if($line->qty==50) print ''; |
|
| 2596 | - else print 'background:#eeffee;' ; |
|
| 2592 | + if ($line->qty == 99) print 'background:#ddffdd'; |
|
| 2593 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
| 2594 | + else if ($line->qty == 2) print 'background:#eeeeff; '; |
|
| 2595 | + else if ($line->qty == 50) print ''; |
|
| 2596 | + else print 'background:#eeffee;'; |
|
| 2597 | 2597 | } |
| 2598 | 2598 | |
| 2599 | 2599 | ?>;"> |
| 2600 | 2600 | |
| 2601 | 2601 | <?php |
| 2602 | 2602 | // # |
| 2603 | - if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) |
|
| 2603 | + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) |
|
| 2604 | 2604 | { |
| 2605 | - print '<td align="center">'.($i+1).'</td>'; |
|
| 2605 | + print '<td align="center">'.($i + 1).'</td>'; |
|
| 2606 | 2606 | } |
| 2607 | 2607 | ?> |
| 2608 | 2608 | |
| 2609 | - <td style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php |
|
| 2609 | + <td style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php |
|
| 2610 | 2610 | |
| 2611 | 2611 | |
| 2612 | 2612 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
| 2613 | 2613 | { |
| 2614 | - if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
| 2614 | + if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
| 2615 | 2615 | { |
| 2616 | - echo str_repeat(' ', $line->qty-1); |
|
| 2616 | + echo str_repeat(' ', $line->qty - 1); |
|
| 2617 | 2617 | |
| 2618 | 2618 | if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
| 2619 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2619 | + else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span> '; |
|
| 2620 | 2620 | } |
| 2621 | 2621 | } |
| 2622 | 2622 | else |
| 2623 | 2623 | { |
| 2624 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2625 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2624 | + if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal'); |
|
| 2625 | + else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2626 | 2626 | } |
| 2627 | 2627 | |
| 2628 | 2628 | |
| 2629 | 2629 | // Get display styles and apply them |
| 2630 | 2630 | $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;'; |
| 2631 | - $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
| 2632 | - $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
| 2631 | + $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
| 2632 | + $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
| 2633 | 2633 | |
| 2634 | 2634 | if (empty($line->label)) { |
| 2635 | 2635 | if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
| 2636 | 2636 | else print $line->description; |
| 2637 | 2637 | } |
| 2638 | 2638 | else { |
| 2639 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
| 2639 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
| 2640 | 2640 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2641 | 2641 | } |
| 2642 | - else{ |
|
| 2642 | + else { |
|
| 2643 | 2643 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2644 | 2644 | } |
| 2645 | 2645 | } |
| 2646 | 2646 | //if($line->qty>90) print ' : '; |
| 2647 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2647 | + if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2648 | 2648 | |
| 2649 | 2649 | ?> |
| 2650 | 2650 | </td> |
| 2651 | 2651 | <td colspan="<?php echo $colspan; ?>"> </td> |
| 2652 | 2652 | <?php |
| 2653 | 2653 | |
| 2654 | - if ($object->element == 'shipping' && $object->statut == 0 && ! empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
| 2654 | + if ($object->element == 'shipping' && $object->statut == 0 && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
| 2655 | 2655 | { |
| 2656 | 2656 | print '<td class="linecoldelete nowrap" width="10">'; |
| 2657 | 2657 | |
@@ -2660,12 +2660,12 @@ discard block |
||
| 2660 | 2660 | echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=deleteline&lineid='.$line->id.'">'.img_delete().'</a>'; |
| 2661 | 2661 | } |
| 2662 | 2662 | |
| 2663 | - if(TSubtotal::isTitle($line) && ($line->fk_prev_id === null) ) |
|
| 2663 | + if (TSubtotal::isTitle($line) && ($line->fk_prev_id === null)) |
|
| 2664 | 2664 | { |
| 2665 | 2665 | if ((float) DOL_VERSION >= 8.0) { |
| 2666 | 2666 | $img_delete = img_delete($langs->trans('deleteWithAllLines'), ' class="pictodelete pictodeleteallline"'); |
| 2667 | 2667 | } elseif ((float) DOL_VERSION >= 3.8) { |
| 2668 | - $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal',' class="pictodelete" '); |
|
| 2668 | + $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal', ' class="pictodelete" '); |
|
| 2669 | 2669 | } else { |
| 2670 | 2670 | $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all@subtotal'); |
| 2671 | 2671 | } |
@@ -2675,7 +2675,7 @@ discard block |
||
| 2675 | 2675 | /* Depuis la 8.0, les icônes "standard" utilisent FontAwesome et sont préconfigurées selon la clé de l'image |
| 2676 | 2676 | * Impossible d'en customiser par exemple la couleur, même en utilisant img_picto() directement |
| 2677 | 2677 | */ |
| 2678 | - if((float) DOL_VERSION >= 8.0) { |
|
| 2678 | + if ((float) DOL_VERSION >= 8.0) { |
|
| 2679 | 2679 | ?> |
| 2680 | 2680 | <script> |
| 2681 | 2681 | $(document).ready(function () { |
@@ -2693,11 +2693,11 @@ discard block |
||
| 2693 | 2693 | print "</tr>"; |
| 2694 | 2694 | |
| 2695 | 2695 | // Display lines extrafields |
| 2696 | - if ($object->element == 'shipping' && ! empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE) && is_array($extralabelslines) && count($extralabelslines)>0) { |
|
| 2696 | + if ($object->element == 'shipping' && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE) && is_array($extralabelslines) && count($extralabelslines) > 0) { |
|
| 2697 | 2697 | $line = new ExpeditionLigne($db); |
| 2698 | 2698 | $line->fetch_optionals($line->id); |
| 2699 | 2699 | print '<tr class="oddeven">'; |
| 2700 | - print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan),$i); |
|
| 2700 | + print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan), $i); |
|
| 2701 | 2701 | } |
| 2702 | 2702 | |
| 2703 | 2703 | return 1; |
@@ -2709,20 +2709,20 @@ discard block |
||
| 2709 | 2709 | |
| 2710 | 2710 | |
| 2711 | 2711 | function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) { |
| 2712 | - global $conf,$langs; |
|
| 2712 | + global $conf, $langs; |
|
| 2713 | 2713 | |
| 2714 | 2714 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
| 2715 | 2715 | { |
| 2716 | 2716 | |
| 2717 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
| 2717 | + if ($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
| 2718 | 2718 | { |
| 2719 | 2719 | foreach ($object->lines as $line) |
| 2720 | 2720 | { |
| 2721 | 2721 | // fetch optionals attributes and labels |
| 2722 | 2722 | require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
| 2723 | - $extrafields=new ExtraFields($this->db); |
|
| 2724 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
| 2725 | - $line->fetch_optionals($line->id,$extralabels); |
|
| 2723 | + $extrafields = new ExtraFields($this->db); |
|
| 2724 | + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element_line, true); |
|
| 2725 | + $line->fetch_optionals($line->id, $extralabels); |
|
| 2726 | 2726 | } |
| 2727 | 2727 | } |
| 2728 | 2728 | |
@@ -2822,23 +2822,23 @@ discard block |
||
| 2822 | 2822 | $ThtmlData['data-qty'] = 0; //$line->qty; |
| 2823 | 2823 | $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
| 2824 | 2824 | |
| 2825 | - if(TSubtotal::isTitle($line)){ |
|
| 2825 | + if (TSubtotal::isTitle($line)) { |
|
| 2826 | 2826 | $ThtmlData['data-issubtotal'] = 'title'; |
| 2827 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2827 | + }elseif (TSubtotal::isSubtotal($line)) { |
|
| 2828 | 2828 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
| 2829 | 2829 | } |
| 2830 | - else{ |
|
| 2830 | + else { |
|
| 2831 | 2831 | $ThtmlData['data-issubtotal'] = 'freetext'; |
| 2832 | 2832 | } |
| 2833 | 2833 | |
| 2834 | 2834 | |
| 2835 | 2835 | // Change or add data from hooks |
| 2836 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
| 2836 | + $parameters = array_replace($parameters, array('ThtmlData' => $ThtmlData)); |
|
| 2837 | 2837 | |
| 2838 | 2838 | // hook |
| 2839 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
| 2839 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 2840 | 2840 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 2841 | - if ($reshook>0) |
|
| 2841 | + if ($reshook > 0) |
|
| 2842 | 2842 | { |
| 2843 | 2843 | $ThtmlData = $hookmanager->resArray; |
| 2844 | 2844 | } |
@@ -2851,14 +2851,14 @@ discard block |
||
| 2851 | 2851 | function implodeHtmlData($ThtmlData = array()) |
| 2852 | 2852 | { |
| 2853 | 2853 | $data = ''; |
| 2854 | - foreach($ThtmlData as $k => $h ) |
|
| 2854 | + foreach ($ThtmlData as $k => $h) |
|
| 2855 | 2855 | { |
| 2856 | - if(is_array($h)) |
|
| 2856 | + if (is_array($h)) |
|
| 2857 | 2857 | { |
| 2858 | 2858 | $h = json_encode($h); |
| 2859 | 2859 | } |
| 2860 | 2860 | |
| 2861 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2861 | + $data .= $k.'="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2862 | 2862 | } |
| 2863 | 2863 | |
| 2864 | 2864 | return $data; |
@@ -2866,26 +2866,26 @@ discard block |
||
| 2866 | 2866 | |
| 2867 | 2867 | function _ajax_block_order_js($object) |
| 2868 | 2868 | { |
| 2869 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
| 2869 | + global $conf, $tagidfortablednd, $filepath, $langs; |
|
| 2870 | 2870 | |
| 2871 | 2871 | /* |
| 2872 | 2872 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
| 2873 | 2873 | * for compatibility reasons we don't use tableDnD but jquery sortable |
| 2874 | 2874 | */ |
| 2875 | 2875 | |
| 2876 | - $id=$object->id; |
|
| 2877 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
| 2878 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
| 2876 | + $id = $object->id; |
|
| 2877 | + $nboflines = (isset($object->lines) ?count($object->lines) : 0); |
|
| 2878 | + $forcereloadpage = empty($conf->global->MAIN_FORCE_RELOAD_PAGE) ? 0 : 1; |
|
| 2879 | 2879 | |
| 2880 | - $id=$object->id; |
|
| 2881 | - $fk_element=$object->fk_element; |
|
| 2882 | - $table_element_line=$object->table_element_line; |
|
| 2883 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
| 2884 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
| 2885 | - $filepath=(empty($filepath)?'':$filepath); |
|
| 2880 | + $id = $object->id; |
|
| 2881 | + $fk_element = $object->fk_element; |
|
| 2882 | + $table_element_line = $object->table_element_line; |
|
| 2883 | + $nboflines = (isset($object->lines) ?count($object->lines) : (empty($nboflines) ? 0 : $nboflines)); |
|
| 2884 | + $tagidfortablednd = (empty($tagidfortablednd) ? 'tablelines' : $tagidfortablednd); |
|
| 2885 | + $filepath = (empty($filepath) ? '' : $filepath); |
|
| 2886 | 2886 | |
| 2887 | 2887 | |
| 2888 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
| 2888 | + if (GETPOST('action', 'aZ09') != 'editline' && $nboflines > 1) |
|
| 2889 | 2889 | { |
| 2890 | 2890 | |
| 2891 | 2891 | ?> |
@@ -2903,7 +2903,7 @@ discard block |
||
| 2903 | 2903 | moveBlockCol.disableSelection(); // prevent selection |
| 2904 | 2904 | <?php if ($object->statut == 0) { ?> |
| 2905 | 2905 | // apply some graphical stuff |
| 2906 | - moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png',2); ?>)'); |
|
| 2906 | + moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png', 2); ?>)'); |
|
| 2907 | 2907 | moveBlockCol.css("background-repeat","no-repeat"); |
| 2908 | 2908 | moveBlockCol.css("background-position","center center"); |
| 2909 | 2909 | moveBlockCol.css("cursor","move"); |
@@ -45,7 +45,9 @@ discard block |
||
| 45 | 45 | $value = ''; |
| 46 | 46 | $sql = 'SELECT content FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text WHERE rowid = '.GETPOST('rowid'); |
| 47 | 47 | $resql = $this->db->query($sql); |
| 48 | - if ($resql && ($obj = $this->db->fetch_object($resql))) $value = $obj->content; |
|
| 48 | + if ($resql && ($obj = $this->db->fetch_object($resql))) { |
|
| 49 | + $value = $obj->content; |
|
| 50 | + } |
|
| 49 | 51 | } |
| 50 | 52 | |
| 51 | 53 | ?> |
@@ -124,8 +126,7 @@ discard block |
||
| 124 | 126 | } elseif($object->element == 'invoice_supplier' ) |
| 125 | 127 | { |
| 126 | 128 | $createRight = $user->rights->fournisseur->facture->creer; |
| 127 | - } |
|
| 128 | - elseif($object->element == 'shipping') |
|
| 129 | + } elseif($object->element == 'shipping') |
|
| 129 | 130 | { |
| 130 | 131 | $createRight = true; // No rights management for shipments |
| 131 | 132 | } |
@@ -133,8 +134,11 @@ discard block |
||
| 133 | 134 | if ($object->statut == 0 && $createRight) { |
| 134 | 135 | |
| 135 | 136 | |
| 136 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 137 | - else $idvar='id'; |
|
| 137 | + if($object->element=='facture') { |
|
| 138 | + $idvar = 'facid'; |
|
| 139 | + } else { |
|
| 140 | + $idvar='id'; |
|
| 141 | + } |
|
| 138 | 142 | |
| 139 | 143 | if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
| 140 | 144 | { |
@@ -142,10 +146,11 @@ discard block |
||
| 142 | 146 | |
| 143 | 147 | if($action=='add_title_line') { |
| 144 | 148 | $title = GETPOST('title'); |
| 145 | - if(empty($title)) $title = $langs->trans('title'); |
|
| 149 | + if(empty($title)) { |
|
| 150 | + $title = $langs->trans('title'); |
|
| 151 | + } |
|
| 146 | 152 | $qty = $level<1 ? 1 : $level ; |
| 147 | - } |
|
| 148 | - else if($action=='add_free_text') { |
|
| 153 | + } else if($action=='add_free_text') { |
|
| 149 | 154 | $title = GETPOST('title'); |
| 150 | 155 | |
| 151 | 156 | if (empty($title)) { |
@@ -157,29 +162,31 @@ discard block |
||
| 157 | 162 | } |
| 158 | 163 | } |
| 159 | 164 | } |
| 160 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
| 165 | + if(empty($title)) { |
|
| 166 | + $title = $langs->trans('subtotalAddLineDescription'); |
|
| 167 | + } |
|
| 161 | 168 | $qty = 50; |
| 162 | - } |
|
| 163 | - else if($action=='add_subtitle_line') { |
|
| 169 | + } else if($action=='add_subtitle_line') { |
|
| 164 | 170 | $title = GETPOST('title'); |
| 165 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
| 171 | + if(empty($title)) { |
|
| 172 | + $title = $langs->trans('subtitle'); |
|
| 173 | + } |
|
| 166 | 174 | $qty = 2; |
| 167 | - } |
|
| 168 | - else if($action=='add_subtotal_line') { |
|
| 175 | + } else if($action=='add_subtotal_line') { |
|
| 169 | 176 | $title = $langs->trans('SubSubTotal'); |
| 170 | 177 | $qty = 98; |
| 171 | - } |
|
| 172 | - else { |
|
| 178 | + } else { |
|
| 173 | 179 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
| 174 | 180 | $qty = $level ? 100-$level : 99; |
| 175 | 181 | } |
| 176 | 182 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 177 | 183 | |
| 178 | - if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
|
| 184 | + if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) { |
|
| 185 | + TSubtotal::addSubtotalMissing($object, $qty); |
|
| 186 | + } |
|
| 179 | 187 | |
| 180 | 188 | TSubtotal::addSubTotalLine($object, $title, $qty); |
| 181 | - } |
|
| 182 | - else if($action==='ask_deleteallline') { |
|
| 189 | + } else if($action==='ask_deleteallline') { |
|
| 183 | 190 | $form=new Form($db); |
| 184 | 191 | |
| 185 | 192 | $lineid = GETPOST('lineid','integer'); |
@@ -202,8 +209,7 @@ discard block |
||
| 202 | 209 | $this->printNewFormat($object, $conf, $langs, $idvar); |
| 203 | 210 | } |
| 204 | 211 | } |
| 205 | - } |
|
| 206 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
| 212 | + } elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
| 207 | 213 | { |
| 208 | 214 | ?> |
| 209 | 215 | <script type="text/javascript"> |
@@ -221,8 +227,13 @@ discard block |
||
| 221 | 227 | |
| 222 | 228 | function printNewFormat(&$object, &$conf, &$langs, $idvar) |
| 223 | 229 | { |
| 224 | - if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) return false; |
|
| 225 | - if ($line->fk_prev_id != null && !empty($line->fk_prev_id)) return false; // Si facture de situation |
|
| 230 | + if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) { |
|
| 231 | + return false; |
|
| 232 | + } |
|
| 233 | + if ($line->fk_prev_id != null && !empty($line->fk_prev_id)) { |
|
| 234 | + return false; |
|
| 235 | + } |
|
| 236 | + // Si facture de situation |
|
| 226 | 237 | ?> |
| 227 | 238 | <script type="text/javascript"> |
| 228 | 239 | $(document).ready(function() { |
@@ -508,8 +519,7 @@ discard block |
||
| 508 | 519 | } |
| 509 | 520 | |
| 510 | 521 | |
| 511 | - } |
|
| 512 | - else{ |
|
| 522 | + } else{ |
|
| 513 | 523 | $substitutionarray['line_not_modsubtotal'] = true; |
| 514 | 524 | $substitutionarray['line_modsubtotal'] = 0; |
| 515 | 525 | } |
@@ -567,8 +577,11 @@ discard block |
||
| 567 | 577 | |
| 568 | 578 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
| 569 | 579 | |
| 570 | - if($object->element=='facture') $idvar = 'facid'; |
|
| 571 | - else $idvar = 'id'; |
|
| 580 | + if($object->element=='facture') { |
|
| 581 | + $idvar = 'facid'; |
|
| 582 | + } else { |
|
| 583 | + $idvar = 'id'; |
|
| 584 | + } |
|
| 572 | 585 | |
| 573 | 586 | if ($action == 'updateligne' || $action == 'updateline') |
| 574 | 587 | { |
@@ -598,8 +611,7 @@ discard block |
||
| 598 | 611 | header('Location: '.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id); |
| 599 | 612 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
| 600 | 613 | } |
| 601 | - } |
|
| 602 | - else if($action === 'builddoc') { |
|
| 614 | + } else if($action === 'builddoc') { |
|
| 603 | 615 | |
| 604 | 616 | if ( |
| 605 | 617 | in_array('invoicecard',explode(':',$parameters['context'])) |
@@ -614,33 +626,27 @@ discard block |
||
| 614 | 626 | $sessname = 'subtotal_hideInnerLines_facture'; |
| 615 | 627 | $sessname2 = 'subtotal_hidedetails_facture'; |
| 616 | 628 | $sessname3 = 'subtotal_hideprices_facture'; |
| 617 | - } |
|
| 618 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
| 629 | + } elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
| 619 | 630 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
| 620 | 631 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
| 621 | 632 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
| 622 | - } |
|
| 623 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
| 633 | + } elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
| 624 | 634 | $sessname = 'subtotal_hideInnerLines_propal'; |
| 625 | 635 | $sessname2 = 'subtotal_hidedetails_propal'; |
| 626 | 636 | $sessname3 = 'subtotal_hideprices_propal'; |
| 627 | - } |
|
| 628 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
| 637 | + } elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
| 629 | 638 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
| 630 | 639 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
| 631 | 640 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
| 632 | - } |
|
| 633 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
| 641 | + } elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
| 634 | 642 | $sessname = 'subtotal_hideInnerLines_commande'; |
| 635 | 643 | $sessname2 = 'subtotal_hidedetails_commande'; |
| 636 | 644 | $sessname3 = 'subtotal_hideprices_commande'; |
| 637 | - } |
|
| 638 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
| 645 | + } elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
| 639 | 646 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
| 640 | 647 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
| 641 | 648 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
| 642 | - } |
|
| 643 | - else { |
|
| 649 | + } else { |
|
| 644 | 650 | $sessname = 'subtotal_hideInnerLines_unknown'; |
| 645 | 651 | $sessname2 = 'subtotal_hidedetails_unknown'; |
| 646 | 652 | $sessname3 = 'subtotal_hideprices_unknown'; |
@@ -649,15 +655,24 @@ discard block |
||
| 649 | 655 | global $hideprices; |
| 650 | 656 | |
| 651 | 657 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
| 652 | - if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) $_SESSION[$sessname] = array(); // prevent old system |
|
| 658 | + if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) { |
|
| 659 | + $_SESSION[$sessname] = array(); |
|
| 660 | + } |
|
| 661 | + // prevent old system |
|
| 653 | 662 | $_SESSION[$sessname][$object->id] = $hideInnerLines; |
| 654 | 663 | |
| 655 | 664 | $hidedetails= (int)GETPOST('hidedetails'); |
| 656 | - if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) $_SESSION[$sessname2] = array(); // prevent old system |
|
| 665 | + if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) { |
|
| 666 | + $_SESSION[$sessname2] = array(); |
|
| 667 | + } |
|
| 668 | + // prevent old system |
|
| 657 | 669 | $_SESSION[$sessname2][$object->id] = $hidedetails; |
| 658 | 670 | |
| 659 | 671 | $hideprices= (int)GETPOST('hideprices'); |
| 660 | - if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) $_SESSION[$sessname3] = array(); // prevent old system |
|
| 672 | + if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) { |
|
| 673 | + $_SESSION[$sessname3] = array(); |
|
| 674 | + } |
|
| 675 | + // prevent old system |
|
| 661 | 676 | $_SESSION[$sessname3][$object->id] = $hideprices; |
| 662 | 677 | |
| 663 | 678 | foreach($object->lines as &$line) { |
@@ -665,8 +680,7 @@ discard block |
||
| 665 | 680 | |
| 666 | 681 | if($line->qty>=90) { |
| 667 | 682 | $line->modsubtotal_total = 1; |
| 668 | - } |
|
| 669 | - else{ |
|
| 683 | + } else{ |
|
| 670 | 684 | $line->modsubtotal_title = 1; |
| 671 | 685 | } |
| 672 | 686 | |
@@ -675,8 +689,7 @@ discard block |
||
| 675 | 689 | } |
| 676 | 690 | } |
| 677 | 691 | |
| 678 | - } |
|
| 679 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
| 692 | + } else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
| 680 | 693 | |
| 681 | 694 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
| 682 | 695 | |
@@ -684,7 +697,9 @@ discard block |
||
| 684 | 697 | /** |
| 685 | 698 | * @var $object Facture |
| 686 | 699 | */ |
| 687 | - if($object->element=='facture') $object->deleteline($idLine); |
|
| 700 | + if($object->element=='facture') { |
|
| 701 | + $object->deleteline($idLine); |
|
| 702 | + } |
|
| 688 | 703 | /** |
| 689 | 704 | * @var $object Facture fournisseur |
| 690 | 705 | */ |
@@ -695,18 +710,25 @@ discard block |
||
| 695 | 710 | /** |
| 696 | 711 | * @var $object Propal |
| 697 | 712 | */ |
| 698 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
| 713 | + else if($object->element=='propal') { |
|
| 714 | + $object->deleteline($idLine); |
|
| 715 | + } |
|
| 699 | 716 | /** |
| 700 | 717 | * @var $object Propal Fournisseur |
| 701 | 718 | */ |
| 702 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
| 719 | + else if($object->element=='supplier_proposal') { |
|
| 720 | + $object->deleteline($idLine); |
|
| 721 | + } |
|
| 703 | 722 | /** |
| 704 | 723 | * @var $object Commande |
| 705 | 724 | */ |
| 706 | 725 | else if($object->element=='commande') |
| 707 | 726 | { |
| 708 | - if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
|
| 709 | - else $object->deleteline($idLine); |
|
| 727 | + if ((float) DOL_VERSION >= 5.0) { |
|
| 728 | + $object->deleteline($user, $idLine); |
|
| 729 | + } else { |
|
| 730 | + $object->deleteline($idLine); |
|
| 731 | + } |
|
| 710 | 732 | } |
| 711 | 733 | /** |
| 712 | 734 | * @var $object Commande fournisseur |
@@ -718,25 +740,32 @@ discard block |
||
| 718 | 740 | /** |
| 719 | 741 | * @var $object Facturerec |
| 720 | 742 | */ |
| 721 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
| 743 | + else if($object->element=='facturerec') { |
|
| 744 | + $object->deleteline($idLine); |
|
| 745 | + } |
|
| 722 | 746 | /** |
| 723 | 747 | * @var $object Expedition |
| 724 | 748 | */ |
| 725 | - else if($object->element=='shipping') $object->deleteline($user, $idLine); |
|
| 749 | + else if($object->element=='shipping') { |
|
| 750 | + $object->deleteline($user, $idLine); |
|
| 751 | + } |
|
| 726 | 752 | } |
| 727 | 753 | |
| 728 | 754 | header('location:?id='.$object->id); |
| 729 | 755 | exit; |
| 730 | 756 | |
| 731 | - } |
|
| 732 | - else if ($action == 'duplicate') |
|
| 757 | + } else if ($action == 'duplicate') |
|
| 733 | 758 | { |
| 734 | 759 | $lineid = GETPOST('lineid', 'int'); |
| 735 | 760 | $nbDuplicate = TSubtotal::duplicateLines($object, $lineid, true); |
| 736 | 761 | |
| 737 | - if ($nbDuplicate > 0) setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
| 738 | - elseif ($nbDuplicate == 0) setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
| 739 | - else setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
| 762 | + if ($nbDuplicate > 0) { |
|
| 763 | + setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
| 764 | + } elseif ($nbDuplicate == 0) { |
|
| 765 | + setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
| 766 | + } else { |
|
| 767 | + setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
| 768 | + } |
|
| 740 | 769 | |
| 741 | 770 | header('Location: ?id='.$object->id); |
| 742 | 771 | exit; |
@@ -754,21 +783,26 @@ discard block |
||
| 754 | 783 | global $conf; |
| 755 | 784 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && !empty($object->table_element_line) && in_array($object->element, array('commande', 'facture', 'propal'))) |
| 756 | 785 | { |
| 757 | - if ($object->element == 'commande') |
|
| 758 | - $obj = new OrderLine($object->db); |
|
| 759 | - if ($object->element == 'propal') |
|
| 760 | - $obj = new PropaleLigne($object->db); |
|
| 761 | - if ($object->element == 'facture') |
|
| 762 | - $obj = new FactureLigne($object->db); |
|
| 786 | + if ($object->element == 'commande') { |
|
| 787 | + $obj = new OrderLine($object->db); |
|
| 788 | + } |
|
| 789 | + if ($object->element == 'propal') { |
|
| 790 | + $obj = new PropaleLigne($object->db); |
|
| 791 | + } |
|
| 792 | + if ($object->element == 'facture') { |
|
| 793 | + $obj = new FactureLigne($object->db); |
|
| 794 | + } |
|
| 763 | 795 | if (!empty($parameters['fk_element'])) |
| 764 | 796 | { |
| 765 | 797 | |
| 766 | 798 | if($obj->fetch($parameters['fk_element'])){ |
| 767 | 799 | $obj->id= $obj->rowid; |
| 768 | - if (empty($obj->array_options)) |
|
| 769 | - $obj->fetch_optionals(); |
|
| 770 | - if (!empty($obj->array_options['options_subtotal_nc'])) |
|
| 771 | - return 1; |
|
| 800 | + if (empty($obj->array_options)) { |
|
| 801 | + $obj->fetch_optionals(); |
|
| 802 | + } |
|
| 803 | + if (!empty($obj->array_options['options_subtotal_nc'])) { |
|
| 804 | + return 1; |
|
| 805 | + } |
|
| 772 | 806 | } |
| 773 | 807 | } |
| 774 | 808 | } |
@@ -840,27 +874,33 @@ discard block |
||
| 840 | 874 | $TTotal_tva = array(); |
| 841 | 875 | |
| 842 | 876 | $sign=1; |
| 843 | - if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; |
|
| 877 | + if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) { |
|
| 878 | + $sign=-1; |
|
| 879 | + } |
|
| 844 | 880 | |
| 845 | - if (GETPOST('action') == 'builddoc') $builddoc = true; |
|
| 846 | - else $builddoc = false; |
|
| 881 | + if (GETPOST('action') == 'builddoc') { |
|
| 882 | + $builddoc = true; |
|
| 883 | + } else { |
|
| 884 | + $builddoc = false; |
|
| 885 | + } |
|
| 847 | 886 | |
| 848 | 887 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 849 | 888 | foreach($object->lines as $l) { |
| 850 | 889 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
| 851 | 890 | if($l->rang>=$rang) { |
| 852 | 891 | //echo 'return!<br>'; |
| 853 | - if (!$return_all) return $total; |
|
| 854 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 855 | - } |
|
| 856 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
| 892 | + if (!$return_all) { |
|
| 893 | + return $total; |
|
| 894 | + } else { |
|
| 895 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 896 | + } |
|
| 897 | + } else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
| 857 | 898 | { |
| 858 | 899 | $total = 0; |
| 859 | 900 | $total_tva = 0; |
| 860 | 901 | $total_ttc = 0; |
| 861 | 902 | $TTotal_tva = array(); |
| 862 | - } |
|
| 863 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
| 903 | + } elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
| 864 | 904 | |
| 865 | 905 | // TODO retirer le test avec $builddoc quand Dolibarr affichera le total progression sur la card et pas seulement dans le PDF |
| 866 | 906 | if ($builddoc && $object->element == 'facture' && $object->type==Facture::TYPE_SITUATION) |
@@ -882,8 +922,7 @@ discard block |
||
| 882 | 922 | $TTotal_tva[$l->tva_tx] += $sign * ($l->total_tva / ($l->situation_percent / 100)) * $progress; |
| 883 | 923 | $total_ttc += $sign * ($l->total_tva / ($l->total_ttc / 100)) * $progress; |
| 884 | 924 | } |
| 885 | - } |
|
| 886 | - else |
|
| 925 | + } else |
|
| 887 | 926 | { |
| 888 | 927 | $total += $l->total_ht; |
| 889 | 928 | $total_tva += $l->total_tva; |
@@ -893,8 +932,11 @@ discard block |
||
| 893 | 932 | } |
| 894 | 933 | |
| 895 | 934 | } |
| 896 | - if (!$return_all) return $total; |
|
| 897 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 935 | + if (!$return_all) { |
|
| 936 | + return $total; |
|
| 937 | + } else { |
|
| 938 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 939 | + } |
|
| 898 | 940 | } |
| 899 | 941 | |
| 900 | 942 | /** |
@@ -941,15 +983,18 @@ discard block |
||
| 941 | 983 | } |
| 942 | 984 | |
| 943 | 985 | |
| 944 | - if($line->qty==99) |
|
| 945 | - $pdf->SetFillColor(220,220,220); |
|
| 946 | - elseif ($line->qty==98) |
|
| 947 | - $pdf->SetFillColor(230,230,230); |
|
| 948 | - else |
|
| 949 | - $pdf->SetFillColor(240,240,240); |
|
| 986 | + if($line->qty==99) { |
|
| 987 | + $pdf->SetFillColor(220,220,220); |
|
| 988 | + } elseif ($line->qty==98) { |
|
| 989 | + $pdf->SetFillColor(230,230,230); |
|
| 990 | + } else { |
|
| 991 | + $pdf->SetFillColor(240,240,240); |
|
| 992 | + } |
|
| 950 | 993 | |
| 951 | 994 | $style = 'B'; |
| 952 | - if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
| 995 | + if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) { |
|
| 996 | + $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
| 997 | + } |
|
| 953 | 998 | |
| 954 | 999 | $pdf->SetFont('', $style, 9); |
| 955 | 1000 | |
@@ -991,8 +1036,7 @@ discard block |
||
| 991 | 1036 | // $line->total_tva |
| 992 | 1037 | // $line->total |
| 993 | 1038 | // $line->total_ttc |
| 994 | - } |
|
| 995 | - else |
|
| 1039 | + } else |
|
| 996 | 1040 | { |
| 997 | 1041 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 998 | 1042 | $total_to_print = price($total); |
@@ -1005,11 +1049,14 @@ discard block |
||
| 1005 | 1049 | } |
| 1006 | 1050 | |
| 1007 | 1051 | $pdf->SetXY($pdf->postotalht, $posy); |
| 1008 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 1052 | + if($set_pagebreak_margin) { |
|
| 1053 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 1054 | + } |
|
| 1009 | 1055 | $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
| 1010 | - } |
|
| 1011 | - else{ |
|
| 1012 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 1056 | + } else{ |
|
| 1057 | + if($set_pagebreak_margin) { |
|
| 1058 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 1059 | + } |
|
| 1013 | 1060 | } |
| 1014 | 1061 | |
| 1015 | 1062 | $posy = $posy + $cell_height; |
@@ -1041,25 +1088,40 @@ discard block |
||
| 1041 | 1088 | |
| 1042 | 1089 | |
| 1043 | 1090 | $style = ($line->qty==1) ? 'BU' : 'BUI'; |
| 1044 | - if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
| 1091 | + if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) { |
|
| 1092 | + $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
| 1093 | + } |
|
| 1045 | 1094 | |
| 1046 | 1095 | if($hideInnerLines) { |
| 1047 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
| 1048 | - else |
|
| 1096 | + if($line->qty==1) { |
|
| 1097 | + $pdf->SetFont('', $style, 9); |
|
| 1098 | + } else |
|
| 1049 | 1099 | { |
| 1050 | - if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
| 1100 | + if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) { |
|
| 1101 | + $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
| 1102 | + } |
|
| 1051 | 1103 | $pdf->SetFont('', $style, 9); |
| 1052 | 1104 | } |
| 1053 | - } |
|
| 1054 | - else { |
|
| 1105 | + } else { |
|
| 1055 | 1106 | |
| 1056 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
| 1057 | - else $pdf->SetFont('', $style, 9); |
|
| 1107 | + if($line->qty==1) { |
|
| 1108 | + $pdf->SetFont('', $style, 9); |
|
| 1109 | + } |
|
| 1110 | + //TODO if super utile |
|
| 1111 | + else { |
|
| 1112 | + $pdf->SetFont('', $style, 9); |
|
| 1113 | + } |
|
| 1058 | 1114 | |
| 1059 | 1115 | } |
| 1060 | 1116 | |
| 1061 | - if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) $pdf->MultiCell($w, $h, $label, 0, 'L'); // Pas de HTML dans la chaine |
|
| 1062 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
| 1117 | + if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) { |
|
| 1118 | + $pdf->MultiCell($w, $h, $label, 0, 'L'); |
|
| 1119 | + } |
|
| 1120 | + // Pas de HTML dans la chaine |
|
| 1121 | + else { |
|
| 1122 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); |
|
| 1123 | + } |
|
| 1124 | + // et maintenant avec du HTML |
|
| 1063 | 1125 | |
| 1064 | 1126 | if($description && !$hidedesc) { |
| 1065 | 1127 | $posy = $pdf->GetY(); |
@@ -1083,8 +1145,7 @@ discard block |
||
| 1083 | 1145 | |
| 1084 | 1146 | if(is_array($parameters)) { |
| 1085 | 1147 | $i = & $parameters['i']; |
| 1086 | - } |
|
| 1087 | - else { |
|
| 1148 | + } else { |
|
| 1088 | 1149 | $i = (int)$parameters; |
| 1089 | 1150 | } |
| 1090 | 1151 | |
@@ -1114,17 +1175,14 @@ discard block |
||
| 1114 | 1175 | |
| 1115 | 1176 | if((float)DOL_VERSION<=3.6) { |
| 1116 | 1177 | return ''; |
| 1117 | - } |
|
| 1118 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1178 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1119 | 1179 | return 1; |
| 1120 | 1180 | } |
| 1121 | 1181 | |
| 1122 | - } |
|
| 1123 | - elseif(!empty($hideprices)) { |
|
| 1182 | + } elseif(!empty($hideprices)) { |
|
| 1124 | 1183 | $this->resprints = $object->lines[$parameters['i']]->qty; |
| 1125 | 1184 | return 1; |
| 1126 | - } |
|
| 1127 | - elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
| 1185 | + } elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
| 1128 | 1186 | { |
| 1129 | 1187 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
| 1130 | 1188 | $hidedetails = (int)GETPOST('hidedetails'); |
@@ -1134,12 +1192,20 @@ discard block |
||
| 1134 | 1192 | } |
| 1135 | 1193 | } |
| 1136 | 1194 | |
| 1137 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1138 | - else $i = (int)$parameters; |
|
| 1195 | + if(is_array($parameters)) { |
|
| 1196 | + $i = & $parameters['i']; |
|
| 1197 | + } else { |
|
| 1198 | + $i = (int)$parameters; |
|
| 1199 | + } |
|
| 1139 | 1200 | |
| 1140 | - if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
| 1201 | + if (empty($object->lines[$i])) { |
|
| 1202 | + return 0; |
|
| 1203 | + } |
|
| 1204 | + // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
| 1141 | 1205 | |
| 1142 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
| 1206 | + if(empty($object->lines[$i]->array_options)) { |
|
| 1207 | + $object->lines[$i]->fetch_optionals(); |
|
| 1208 | + } |
|
| 1143 | 1209 | |
| 1144 | 1210 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1145 | 1211 | { |
@@ -1156,8 +1222,11 @@ discard block |
||
| 1156 | 1222 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
| 1157 | 1223 | global $conf, $hideprices, $hookmanager; |
| 1158 | 1224 | |
| 1159 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1160 | - else $i = (int)$parameters; |
|
| 1225 | + if(is_array($parameters)) { |
|
| 1226 | + $i = & $parameters['i']; |
|
| 1227 | + } else { |
|
| 1228 | + $i = (int)$parameters; |
|
| 1229 | + } |
|
| 1161 | 1230 | |
| 1162 | 1231 | if($this->isModSubtotalLine($parameters,$object) ){ |
| 1163 | 1232 | |
@@ -1165,13 +1234,11 @@ discard block |
||
| 1165 | 1234 | |
| 1166 | 1235 | if((float)DOL_VERSION<=3.6) { |
| 1167 | 1236 | return ''; |
| 1168 | - } |
|
| 1169 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1237 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1170 | 1238 | return 1; |
| 1171 | 1239 | } |
| 1172 | 1240 | |
| 1173 | - } |
|
| 1174 | - elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
| 1241 | + } elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
| 1175 | 1242 | { |
| 1176 | 1243 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1177 | 1244 | { |
@@ -1243,12 +1310,10 @@ discard block |
||
| 1243 | 1310 | $this->error = $hookmanager->error; |
| 1244 | 1311 | $this->errors = $hookmanager->errors; |
| 1245 | 1312 | return -1; |
| 1246 | - } |
|
| 1247 | - elseif (empty($reshook)) |
|
| 1313 | + } elseif (empty($reshook)) |
|
| 1248 | 1314 | { |
| 1249 | 1315 | $this->resprints .= $hookmanager->resprints; |
| 1250 | - } |
|
| 1251 | - else |
|
| 1316 | + } else |
|
| 1252 | 1317 | { |
| 1253 | 1318 | $this->resprints = $hookmanager->resprints; |
| 1254 | 1319 | |
@@ -1271,14 +1336,16 @@ discard block |
||
| 1271 | 1336 | |
| 1272 | 1337 | if((float)DOL_VERSION<=3.6) { |
| 1273 | 1338 | return ''; |
| 1274 | - } |
|
| 1275 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1339 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1276 | 1340 | return 1; |
| 1277 | 1341 | } |
| 1278 | 1342 | } |
| 1279 | 1343 | |
| 1280 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1281 | - else $i = (int)$parameters; |
|
| 1344 | + if(is_array($parameters)) { |
|
| 1345 | + $i = & $parameters['i']; |
|
| 1346 | + } else { |
|
| 1347 | + $i = (int)$parameters; |
|
| 1348 | + } |
|
| 1282 | 1349 | |
| 1283 | 1350 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1284 | 1351 | { |
@@ -1300,14 +1367,16 @@ discard block |
||
| 1300 | 1367 | |
| 1301 | 1368 | if((float)DOL_VERSION<=3.6) { |
| 1302 | 1369 | return ''; |
| 1303 | - } |
|
| 1304 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1370 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1305 | 1371 | return 1; |
| 1306 | 1372 | } |
| 1307 | 1373 | } |
| 1308 | 1374 | |
| 1309 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1310 | - else $i = (int)$parameters; |
|
| 1375 | + if(is_array($parameters)) { |
|
| 1376 | + $i = & $parameters['i']; |
|
| 1377 | + } else { |
|
| 1378 | + $i = (int)$parameters; |
|
| 1379 | + } |
|
| 1311 | 1380 | |
| 1312 | 1381 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1313 | 1382 | { |
@@ -1324,8 +1393,11 @@ discard block |
||
| 1324 | 1393 | function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
| 1325 | 1394 | global $conf,$hideprices,$hookmanager; |
| 1326 | 1395 | |
| 1327 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1328 | - else $i = (int)$parameters; |
|
| 1396 | + if(is_array($parameters)) { |
|
| 1397 | + $i = & $parameters['i']; |
|
| 1398 | + } else { |
|
| 1399 | + $i = (int)$parameters; |
|
| 1400 | + } |
|
| 1329 | 1401 | |
| 1330 | 1402 | if($this->isModSubtotalLine($parameters,$object) ) { |
| 1331 | 1403 | $this->resprints = ' '; |
@@ -1336,7 +1408,9 @@ discard block |
||
| 1336 | 1408 | if(TSubtotal::isSubtotal($line)) { |
| 1337 | 1409 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
| 1338 | 1410 | |
| 1339 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1411 | + if(is_object($parentTitle) && empty($parentTitle->array_options)) { |
|
| 1412 | + $parentTitle->fetch_optionals(); |
|
| 1413 | + } |
|
| 1340 | 1414 | if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
| 1341 | 1415 | $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
| 1342 | 1416 | $this->resprints = price($TTotal['total_subprice']); |
@@ -1345,8 +1419,7 @@ discard block |
||
| 1345 | 1419 | |
| 1346 | 1420 | if((float)DOL_VERSION<=3.6) { |
| 1347 | 1421 | return ''; |
| 1348 | - } |
|
| 1349 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1422 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1350 | 1423 | return 1; |
| 1351 | 1424 | } |
| 1352 | 1425 | } |
@@ -1391,8 +1464,11 @@ discard block |
||
| 1391 | 1464 | function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') { |
| 1392 | 1465 | global $conf,$hideprices,$hookmanager; |
| 1393 | 1466 | |
| 1394 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1395 | - else $i = (int) $parameters; |
|
| 1467 | + if(is_array($parameters)) { |
|
| 1468 | + $i = & $parameters['i']; |
|
| 1469 | + } else { |
|
| 1470 | + $i = (int) $parameters; |
|
| 1471 | + } |
|
| 1396 | 1472 | |
| 1397 | 1473 | if($this->isModSubtotalLine($parameters,$object) ) { |
| 1398 | 1474 | $this->resprints = ' '; |
@@ -1403,7 +1479,9 @@ discard block |
||
| 1403 | 1479 | if(TSubtotal::isSubtotal($line)) { |
| 1404 | 1480 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
| 1405 | 1481 | |
| 1406 | - if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1482 | + if(empty($parentTitle->array_options)) { |
|
| 1483 | + $parentTitle->fetch_optionals(); |
|
| 1484 | + } |
|
| 1407 | 1485 | if(! empty($parentTitle->array_options['options_show_reduc'])) { |
| 1408 | 1486 | $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
| 1409 | 1487 | $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%'; |
@@ -1412,12 +1490,10 @@ discard block |
||
| 1412 | 1490 | |
| 1413 | 1491 | if((float)DOL_VERSION<=3.6) { |
| 1414 | 1492 | return ''; |
| 1415 | - } |
|
| 1416 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1493 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1417 | 1494 | return 1; |
| 1418 | 1495 | } |
| 1419 | - } |
|
| 1420 | - elseif (!empty($hideprices) |
|
| 1496 | + } elseif (!empty($hideprices) |
|
| 1421 | 1497 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1422 | 1498 | ) |
| 1423 | 1499 | { |
@@ -1438,14 +1514,16 @@ discard block |
||
| 1438 | 1514 | $this->resprints = ' '; |
| 1439 | 1515 | if((float)DOL_VERSION<=3.6) { |
| 1440 | 1516 | return ''; |
| 1441 | - } |
|
| 1442 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1517 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1443 | 1518 | return 1; |
| 1444 | 1519 | } |
| 1445 | 1520 | } |
| 1446 | 1521 | |
| 1447 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1448 | - else $i = (int)$parameters; |
|
| 1522 | + if(is_array($parameters)) { |
|
| 1523 | + $i = & $parameters['i']; |
|
| 1524 | + } else { |
|
| 1525 | + $i = (int)$parameters; |
|
| 1526 | + } |
|
| 1449 | 1527 | |
| 1450 | 1528 | if (!empty($hideprices) |
| 1451 | 1529 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
@@ -1469,16 +1547,21 @@ discard block |
||
| 1469 | 1547 | |
| 1470 | 1548 | if((float)DOL_VERSION<=3.6) { |
| 1471 | 1549 | return ''; |
| 1472 | - } |
|
| 1473 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1550 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1474 | 1551 | return 1; |
| 1475 | 1552 | } |
| 1476 | 1553 | } |
| 1477 | 1554 | |
| 1478 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1479 | - else $i = (int)$parameters; |
|
| 1555 | + if(is_array($parameters)) { |
|
| 1556 | + $i = & $parameters['i']; |
|
| 1557 | + } else { |
|
| 1558 | + $i = (int)$parameters; |
|
| 1559 | + } |
|
| 1480 | 1560 | |
| 1481 | - if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
| 1561 | + if (empty($object->lines[$i])) { |
|
| 1562 | + return 0; |
|
| 1563 | + } |
|
| 1564 | + // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
| 1482 | 1565 | |
| 1483 | 1566 | $object->lines[$i]->fetch_optionals(); |
| 1484 | 1567 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1524,14 +1607,16 @@ discard block |
||
| 1524 | 1607 | $this->resprints = ' '; |
| 1525 | 1608 | if((float)DOL_VERSION<=3.6) { |
| 1526 | 1609 | return ''; |
| 1527 | - } |
|
| 1528 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1610 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1529 | 1611 | return 1; |
| 1530 | 1612 | } |
| 1531 | 1613 | } |
| 1532 | 1614 | |
| 1533 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1534 | - else $i = (int)$parameters; |
|
| 1615 | + if(is_array($parameters)) { |
|
| 1616 | + $i = & $parameters['i']; |
|
| 1617 | + } else { |
|
| 1618 | + $i = (int)$parameters; |
|
| 1619 | + } |
|
| 1535 | 1620 | |
| 1536 | 1621 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1537 | 1622 | { |
@@ -1561,7 +1646,9 @@ discard block |
||
| 1561 | 1646 | } |
| 1562 | 1647 | } |
| 1563 | 1648 | |
| 1564 | - if (!empty($TLineTitle)) $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
| 1649 | + if (!empty($TLineTitle)) { |
|
| 1650 | + $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
| 1651 | + } |
|
| 1565 | 1652 | } |
| 1566 | 1653 | |
| 1567 | 1654 | } |
@@ -1575,8 +1662,12 @@ discard block |
||
| 1575 | 1662 | $j=0; |
| 1576 | 1663 | foreach ($TLineTitle as $k => &$line) |
| 1577 | 1664 | { |
| 1578 | - if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
|
| 1579 | - if (!empty($line_reference) && $line->qty <= $line_reference->qty) break; |
|
| 1665 | + if (!empty($line_reference) && $line->rang <= $line_reference->rang) { |
|
| 1666 | + continue; |
|
| 1667 | + } |
|
| 1668 | + if (!empty($line_reference) && $line->qty <= $line_reference->qty) { |
|
| 1669 | + break; |
|
| 1670 | + } |
|
| 1580 | 1671 | |
| 1581 | 1672 | if ($line->qty == $level) |
| 1582 | 1673 | { |
@@ -1610,7 +1701,9 @@ discard block |
||
| 1610 | 1701 | |
| 1611 | 1702 | $hidedetails = (int)GETPOST('hidedetails'); |
| 1612 | 1703 | |
| 1613 | - if(empty($hidedetails)) return false; |
|
| 1704 | + if(empty($hidedetails)) { |
|
| 1705 | + return false; |
|
| 1706 | + } |
|
| 1614 | 1707 | |
| 1615 | 1708 | // TODO can't add VAT to document without lines... :-/ |
| 1616 | 1709 | |
@@ -1638,7 +1731,9 @@ discard block |
||
| 1638 | 1731 | foreach($object->lines as $k => &$l) { |
| 1639 | 1732 | if(TSubtotal::isSubtotal($l)) { |
| 1640 | 1733 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); |
| 1641 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1734 | + if(is_object($parentTitle) && empty($parentTitle->array_options)) { |
|
| 1735 | + $parentTitle->fetch_optionals(); |
|
| 1736 | + } |
|
| 1642 | 1737 | if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_total_ht'])) { |
| 1643 | 1738 | $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
| 1644 | 1739 | } |
@@ -1680,7 +1775,9 @@ discard block |
||
| 1680 | 1775 | */ |
| 1681 | 1776 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 1682 | 1777 | |
| 1683 | - if (TSubtotal::getNiveau($line) == 1) $line->TTotal_tva = $TTotal_tva; |
|
| 1778 | + if (TSubtotal::getNiveau($line) == 1) { |
|
| 1779 | + $line->TTotal_tva = $TTotal_tva; |
|
| 1780 | + } |
|
| 1684 | 1781 | $line->total_ht = $total; |
| 1685 | 1782 | $line->total_tva = $total_tva; |
| 1686 | 1783 | $line->total = $line->total_ht; |
@@ -1744,8 +1841,7 @@ discard block |
||
| 1744 | 1841 | } |
| 1745 | 1842 | |
| 1746 | 1843 | |
| 1747 | - } |
|
| 1748 | - elseif ($hidedetails) |
|
| 1844 | + } elseif ($hidedetails) |
|
| 1749 | 1845 | { |
| 1750 | 1846 | $TLines[] = $line; //Cas où je cache uniquement les prix des produits |
| 1751 | 1847 | } |
@@ -1816,13 +1912,17 @@ discard block |
||
| 1816 | 1912 | |
| 1817 | 1913 | if(!empty($hideprices)) { |
| 1818 | 1914 | foreach($object->lines as &$line) { |
| 1819 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
| 1915 | + if($line->fk_product_type!=9) { |
|
| 1916 | + $line->fk_parent_line = -1; |
|
| 1917 | + } |
|
| 1820 | 1918 | } |
| 1821 | 1919 | } |
| 1822 | 1920 | |
| 1823 | 1921 | $line = &$object->lines[$i]; |
| 1824 | 1922 | |
| 1825 | - if($object->element == 'delivery' && ! empty($object->commande->expeditions[$line->fk_origin_line])) unset($object->commande->expeditions[$line->fk_origin_line]); |
|
| 1923 | + if($object->element == 'delivery' && ! empty($object->commande->expeditions[$line->fk_origin_line])) { |
|
| 1924 | + unset($object->commande->expeditions[$line->fk_origin_line]); |
|
| 1925 | + } |
|
| 1826 | 1926 | |
| 1827 | 1927 | if($line->info_bits>0) { // PAGE BREAK |
| 1828 | 1928 | $pdf->addPage(); |
@@ -1838,7 +1938,9 @@ discard block |
||
| 1838 | 1938 | } |
| 1839 | 1939 | |
| 1840 | 1940 | if($line->qty>90) { |
| 1841 | - if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
|
| 1941 | + if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
| 1942 | + $label .= ' '.$this->getTitle($object, $line); |
|
| 1943 | + } |
|
| 1842 | 1944 | |
| 1843 | 1945 | $pageBefore = $pdf->getPage(); |
| 1844 | 1946 | $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1876,8 +1978,7 @@ discard block |
||
| 1876 | 1978 | |
| 1877 | 1979 | $posy = $pdf->GetY(); |
| 1878 | 1980 | return 1; |
| 1879 | - } |
|
| 1880 | - else if ($line->qty < 10) { |
|
| 1981 | + } else if ($line->qty < 10) { |
|
| 1881 | 1982 | $pageBefore = $pdf->getPage(); |
| 1882 | 1983 | |
| 1883 | 1984 | $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1907,8 +2008,7 @@ discard block |
||
| 1907 | 2008 | // if($line->rowid==47) exit; |
| 1908 | 2009 | |
| 1909 | 2010 | return 0; |
| 1910 | - } |
|
| 1911 | - elseif (empty($object->lines[$parameters['i']])) |
|
| 2011 | + } elseif (empty($object->lines[$parameters['i']])) |
|
| 1912 | 2012 | { |
| 1913 | 2013 | $this->resprints = -1; |
| 1914 | 2014 | } |
@@ -1941,7 +2041,9 @@ discard block |
||
| 1941 | 2041 | |
| 1942 | 2042 | foreach ($object->lines as $line) |
| 1943 | 2043 | { |
| 1944 | - if ($line->id == $currentLine->id) break; |
|
| 2044 | + if ($line->id == $currentLine->id) { |
|
| 2045 | + break; |
|
| 2046 | + } |
|
| 1945 | 2047 | |
| 1946 | 2048 | $qty_search = 100 - $currentLine->qty; |
| 1947 | 2049 | |
@@ -1980,22 +2082,18 @@ discard block |
||
| 1980 | 2082 | { |
| 1981 | 2083 | $object->statut = 0; // hack for facture rec |
| 1982 | 2084 | $createRight = $user->rights->facture->creer; |
| 1983 | - } |
|
| 1984 | - elseif($object->element == 'order_supplier' ) |
|
| 2085 | + } elseif($object->element == 'order_supplier' ) |
|
| 1985 | 2086 | { |
| 1986 | 2087 | $createRight = $user->rights->fournisseur->commande->creer; |
| 1987 | - } |
|
| 1988 | - elseif($object->element == 'invoice_supplier' ) |
|
| 2088 | + } elseif($object->element == 'invoice_supplier' ) |
|
| 1989 | 2089 | { |
| 1990 | 2090 | $createRight = $user->rights->fournisseur->facture->creer; |
| 1991 | - } |
|
| 1992 | - elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) |
|
| 2091 | + } elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) |
|
| 1993 | 2092 | { |
| 1994 | 2093 | // H4cK 4n0nYm0u$-style : $line n'est pas un objet instancié mais provient d'un fetch_object d'une requête SQL |
| 1995 | 2094 | $line->id = $line->rowid; |
| 1996 | 2095 | $line->product_type = $line->type; |
| 1997 | - } |
|
| 1998 | - elseif($object->element == 'shipping' || $object->element == 'delivery') |
|
| 2096 | + } elseif($object->element == 'shipping' || $object->element == 'delivery') |
|
| 1999 | 2097 | { |
| 2000 | 2098 | if(empty($line->origin_line_id) && ! empty($line->fk_origin_line)) |
| 2001 | 2099 | { |
@@ -2018,11 +2116,13 @@ discard block |
||
| 2018 | 2116 | |
| 2019 | 2117 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
| 2020 | 2118 | null; |
| 2021 | - } |
|
| 2022 | - else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) |
|
| 2119 | + } else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) |
|
| 2023 | 2120 | { |
| 2024 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 2025 | - else $idvar='id'; |
|
| 2121 | + if($object->element=='facture') { |
|
| 2122 | + $idvar = 'facid'; |
|
| 2123 | + } else { |
|
| 2124 | + $idvar='id'; |
|
| 2125 | + } |
|
| 2026 | 2126 | |
| 2027 | 2127 | if((float)DOL_VERSION <= 3.4) |
| 2028 | 2128 | { |
@@ -2048,22 +2148,44 @@ discard block |
||
| 2048 | 2148 | <?php |
| 2049 | 2149 | } |
| 2050 | 2150 | |
| 2051 | - if(empty($line->description)) $line->description = $line->desc; |
|
| 2151 | + if(empty($line->description)) { |
|
| 2152 | + $line->description = $line->desc; |
|
| 2153 | + } |
|
| 2052 | 2154 | |
| 2053 | 2155 | $colspan = 5; |
| 2054 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
| 2055 | - if($object->element == 'order_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 3 : $colspan = 6; |
|
| 2056 | - if($object->element == 'invoice_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 4: $colspan = 7; |
|
| 2057 | - if($object->element == 'supplier_proposal') (float) DOL_VERSION < 6.0 ? $colspan = 4 : $colspan = 3; |
|
| 2156 | + if($object->element == 'facturerec' ) { |
|
| 2157 | + $colspan = 3; |
|
| 2158 | + } |
|
| 2159 | + if($object->element == 'order_supplier') { |
|
| 2160 | + (float) DOL_VERSION < 7.0 ? $colspan = 3 : $colspan = 6; |
|
| 2161 | + } |
|
| 2162 | + if($object->element == 'invoice_supplier') { |
|
| 2163 | + (float) DOL_VERSION < 7.0 ? $colspan = 4: $colspan = 7; |
|
| 2164 | + } |
|
| 2165 | + if($object->element == 'supplier_proposal') { |
|
| 2166 | + (float) DOL_VERSION < 6.0 ? $colspan = 4 : $colspan = 3; |
|
| 2167 | + } |
|
| 2058 | 2168 | if(!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) { |
| 2059 | 2169 | $colspan++; // Colonne PU Devise |
| 2060 | 2170 | } |
| 2061 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
| 2062 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
| 2063 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
| 2064 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
| 2065 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
| 2066 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
| 2171 | + if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) { |
|
| 2172 | + $colspan++; |
|
| 2173 | + } |
|
| 2174 | + if(!empty($conf->margin->enabled)) { |
|
| 2175 | + $colspan++; |
|
| 2176 | + } |
|
| 2177 | + if(!empty($conf->global->DISPLAY_MARGIN_RATES)) { |
|
| 2178 | + $colspan++; |
|
| 2179 | + } |
|
| 2180 | + if(!empty($conf->global->DISPLAY_MARK_RATES)) { |
|
| 2181 | + $colspan++; |
|
| 2182 | + } |
|
| 2183 | + if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) { |
|
| 2184 | + $colspan++; |
|
| 2185 | + } |
|
| 2186 | + if(!empty($conf->global->PRODUCT_USE_UNITS)) { |
|
| 2187 | + $colspan++; |
|
| 2188 | + } |
|
| 2067 | 2189 | |
| 2068 | 2190 | /* Titre */ |
| 2069 | 2191 | //var_dump($line); |
@@ -2076,23 +2198,36 @@ discard block |
||
| 2076 | 2198 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
| 2077 | 2199 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 2078 | 2200 | { |
| 2079 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 2080 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2081 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 2082 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 2083 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 2084 | - else if($line->qty==50) print ''; |
|
| 2085 | - else print 'background:#eeeeff;'; |
|
| 2201 | + if($line->qty==99) { |
|
| 2202 | + print 'background:#adadcf'; |
|
| 2203 | + } else if($line->qty==98) { |
|
| 2204 | + print 'background:#ddddff;'; |
|
| 2205 | + } else if($line->qty<=97 && $line->qty>=91) { |
|
| 2206 | + print 'background:#eeeeff;'; |
|
| 2207 | + } else if($line->qty==1) { |
|
| 2208 | + print 'background:#adadcf;'; |
|
| 2209 | + } else if($line->qty==2) { |
|
| 2210 | + print 'background:#ddddff;'; |
|
| 2211 | + } else if($line->qty==50) { |
|
| 2212 | + print ''; |
|
| 2213 | + } else { |
|
| 2214 | + print 'background:#eeeeff;'; |
|
| 2215 | + } |
|
| 2086 | 2216 | |
| 2087 | 2217 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 2088 | - } |
|
| 2089 | - else |
|
| 2218 | + } else |
|
| 2090 | 2219 | { |
| 2091 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 2092 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2093 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 2094 | - else if($line->qty==50) print ''; |
|
| 2095 | - else print 'background:#eeffee;' ; |
|
| 2220 | + if($line->qty==99) { |
|
| 2221 | + print 'background:#ddffdd'; |
|
| 2222 | + } else if($line->qty==98) { |
|
| 2223 | + print 'background:#ddddff;'; |
|
| 2224 | + } else if($line->qty==2) { |
|
| 2225 | + print 'background:#eeeeff; '; |
|
| 2226 | + } else if($line->qty==50) { |
|
| 2227 | + print ''; |
|
| 2228 | + } else { |
|
| 2229 | + print 'background:#eeffee;' ; |
|
| 2230 | + } |
|
| 2096 | 2231 | } |
| 2097 | 2232 | |
| 2098 | 2233 | ?>;"> |
@@ -2119,13 +2254,11 @@ discard block |
||
| 2119 | 2254 | $qty_displayed = $line->qty; |
| 2120 | 2255 | print img_picto('', 'subsubtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;color:#0075DE;">'.$qty_displayed.'</span> '; |
| 2121 | 2256 | |
| 2122 | - } |
|
| 2123 | - else if (TSubtotal::isSubtotal($line)) |
|
| 2257 | + } else if (TSubtotal::isSubtotal($line)) |
|
| 2124 | 2258 | { |
| 2125 | 2259 | $qty_displayed = 100 - $line->qty; |
| 2126 | 2260 | print img_picto('', 'subsubtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;color:#0075DE;">'.$qty_displayed.'</span> '; |
| 2127 | - } |
|
| 2128 | - else |
|
| 2261 | + } else |
|
| 2129 | 2262 | { |
| 2130 | 2263 | $isFreeText = true; |
| 2131 | 2264 | } |
@@ -2146,9 +2279,13 @@ discard block |
||
| 2146 | 2279 | } |
| 2147 | 2280 | |
| 2148 | 2281 | $readonlyForSituation = ''; |
| 2149 | - if (!empty($line->fk_prev_id) && $line->fk_prev_id != null) $readonlyForSituation = 'readonly'; |
|
| 2282 | + if (!empty($line->fk_prev_id) && $line->fk_prev_id != null) { |
|
| 2283 | + $readonlyForSituation = 'readonly'; |
|
| 2284 | + } |
|
| 2150 | 2285 | |
| 2151 | - if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
| 2286 | + if (!$isFreeText) { |
|
| 2287 | + echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
| 2288 | + } |
|
| 2152 | 2289 | |
| 2153 | 2290 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
| 2154 | 2291 | { |
@@ -2156,8 +2293,12 @@ discard block |
||
| 2156 | 2293 | for ($j=1; $j<10; $j++) |
| 2157 | 2294 | { |
| 2158 | 2295 | if (!empty($readonlyForSituation)) { |
| 2159 | - if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2160 | - } else $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2296 | + if ($qty_displayed == $j) { |
|
| 2297 | + $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2298 | + } |
|
| 2299 | + } else { |
|
| 2300 | + $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2301 | + } |
|
| 2161 | 2302 | } |
| 2162 | 2303 | $select .= '</select> '; |
| 2163 | 2304 | |
@@ -2177,7 +2318,9 @@ discard block |
||
| 2177 | 2318 | echo '<div>'; |
| 2178 | 2319 | echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
| 2179 | 2320 | echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
| 2180 | - if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2321 | + if (empty($readonlyForSituation)) { |
|
| 2322 | + echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2323 | + } |
|
| 2181 | 2324 | echo '</select>'; |
| 2182 | 2325 | echo '</div>'; |
| 2183 | 2326 | |
@@ -2196,8 +2339,9 @@ discard block |
||
| 2196 | 2339 | echo '<input style="vertical-align:sub;" type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' /> '; |
| 2197 | 2340 | echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
| 2198 | 2341 | echo '</div>'; |
| 2342 | + } else if ($isFreeText) { |
|
| 2343 | + echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 2199 | 2344 | } |
| 2200 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 2201 | 2345 | echo '</div>'; |
| 2202 | 2346 | |
| 2203 | 2347 | if($line->qty<10) { |
@@ -2217,8 +2361,7 @@ discard block |
||
| 2217 | 2361 | $doleditor->Create(); |
| 2218 | 2362 | } |
| 2219 | 2363 | |
| 2220 | - } |
|
| 2221 | - else { |
|
| 2364 | + } else { |
|
| 2222 | 2365 | |
| 2223 | 2366 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
| 2224 | 2367 | { |
@@ -2226,14 +2369,19 @@ discard block |
||
| 2226 | 2369 | { |
| 2227 | 2370 | echo str_repeat(' ', $line->qty-1); |
| 2228 | 2371 | |
| 2229 | - if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2230 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2372 | + if (TSubtotal::isTitle($line)) { |
|
| 2373 | + print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2374 | + } else { |
|
| 2375 | + print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2376 | + } |
|
| 2231 | 2377 | } |
| 2232 | - } |
|
| 2233 | - else |
|
| 2378 | + } else |
|
| 2234 | 2379 | { |
| 2235 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2236 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2380 | + if($line->qty<=1) { |
|
| 2381 | + print img_picto('', 'subtotal@subtotal'); |
|
| 2382 | + } else if($line->qty==2) { |
|
| 2383 | + print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2384 | + } |
|
| 2237 | 2385 | } |
| 2238 | 2386 | |
| 2239 | 2387 | |
@@ -2243,21 +2391,26 @@ discard block |
||
| 2243 | 2391 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
| 2244 | 2392 | |
| 2245 | 2393 | if (empty($line->label)) { |
| 2246 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
|
| 2247 | - else print $line->description; |
|
| 2248 | - } |
|
| 2249 | - else { |
|
| 2394 | + if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
| 2395 | + print $line->description.' '.$this->getTitle($object, $line); |
|
| 2396 | + } else { |
|
| 2397 | + print $line->description; |
|
| 2398 | + } |
|
| 2399 | + } else { |
|
| 2250 | 2400 | |
| 2251 | 2401 | if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
| 2252 | 2402 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2253 | - } |
|
| 2254 | - else{ |
|
| 2403 | + } else{ |
|
| 2255 | 2404 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2256 | 2405 | } |
| 2257 | 2406 | |
| 2258 | 2407 | } |
| 2259 | - if($line->qty>90) print ' : '; |
|
| 2260 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2408 | + if($line->qty>90) { |
|
| 2409 | + print ' : '; |
|
| 2410 | + } |
|
| 2411 | + if($line->info_bits > 0) { |
|
| 2412 | + echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2413 | + } |
|
| 2261 | 2414 | |
| 2262 | 2415 | |
| 2263 | 2416 | |
@@ -2300,11 +2453,12 @@ discard block |
||
| 2300 | 2453 | </script> |
| 2301 | 2454 | <?php |
| 2302 | 2455 | |
| 2303 | - } |
|
| 2304 | - else{ |
|
| 2456 | + } else{ |
|
| 2305 | 2457 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
| 2306 | 2458 | { |
| 2307 | - if(TSubtotal::isTitle($line) && ( $line->fk_prev_id === null )) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
| 2459 | + if(TSubtotal::isTitle($line) && ( $line->fk_prev_id === null )) { |
|
| 2460 | + echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
| 2461 | + } |
|
| 2308 | 2462 | } |
| 2309 | 2463 | |
| 2310 | 2464 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
@@ -2394,7 +2548,9 @@ discard block |
||
| 2394 | 2548 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
| 2395 | 2549 | |
| 2396 | 2550 | $colspan+=3; $mode = 'view'; |
| 2397 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
| 2551 | + if($action === 'editline' && $line->rowid == GETPOST('lineid')) { |
|
| 2552 | + $mode = 'edit'; |
|
| 2553 | + } |
|
| 2398 | 2554 | |
| 2399 | 2555 | $ex_element = $line->element; |
| 2400 | 2556 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
@@ -2453,8 +2609,7 @@ discard block |
||
| 2453 | 2609 | |
| 2454 | 2610 | return 1; |
| 2455 | 2611 | |
| 2456 | - } |
|
| 2457 | - elseif(($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) || (in_array('expeditioncard', $contexts) && $action == 'create')) |
|
| 2612 | + } elseif(($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) || (in_array('expeditioncard', $contexts) && $action == 'create')) |
|
| 2458 | 2613 | { |
| 2459 | 2614 | $colspan = 4; |
| 2460 | 2615 | |
@@ -2464,23 +2619,36 @@ discard block |
||
| 2464 | 2619 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
| 2465 | 2620 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 2466 | 2621 | { |
| 2467 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 2468 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2469 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 2470 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 2471 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 2472 | - else if($line->qty==50) print ''; |
|
| 2473 | - else print 'background:#eeeeff;'; |
|
| 2622 | + if($line->qty==99) { |
|
| 2623 | + print 'background:#adadcf'; |
|
| 2624 | + } else if($line->qty==98) { |
|
| 2625 | + print 'background:#ddddff;'; |
|
| 2626 | + } else if($line->qty<=97 && $line->qty>=91) { |
|
| 2627 | + print 'background:#eeeeff;'; |
|
| 2628 | + } else if($line->qty==1) { |
|
| 2629 | + print 'background:#adadcf;'; |
|
| 2630 | + } else if($line->qty==2) { |
|
| 2631 | + print 'background:#ddddff;'; |
|
| 2632 | + } else if($line->qty==50) { |
|
| 2633 | + print ''; |
|
| 2634 | + } else { |
|
| 2635 | + print 'background:#eeeeff;'; |
|
| 2636 | + } |
|
| 2474 | 2637 | |
| 2475 | 2638 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 2476 | - } |
|
| 2477 | - else |
|
| 2639 | + } else |
|
| 2478 | 2640 | { |
| 2479 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 2480 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2481 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 2482 | - else if($line->qty==50) print ''; |
|
| 2483 | - else print 'background:#eeffee;' ; |
|
| 2641 | + if($line->qty==99) { |
|
| 2642 | + print 'background:#ddffdd'; |
|
| 2643 | + } else if($line->qty==98) { |
|
| 2644 | + print 'background:#ddddff;'; |
|
| 2645 | + } else if($line->qty==2) { |
|
| 2646 | + print 'background:#eeeeff; '; |
|
| 2647 | + } else if($line->qty==50) { |
|
| 2648 | + print ''; |
|
| 2649 | + } else { |
|
| 2650 | + print 'background:#eeffee;' ; |
|
| 2651 | + } |
|
| 2484 | 2652 | } |
| 2485 | 2653 | |
| 2486 | 2654 | ?>;"> |
@@ -2494,14 +2662,19 @@ discard block |
||
| 2494 | 2662 | { |
| 2495 | 2663 | echo str_repeat(' ', $line->qty-1); |
| 2496 | 2664 | |
| 2497 | - if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2498 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2665 | + if (TSubtotal::isTitle($line)) { |
|
| 2666 | + print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2667 | + } else { |
|
| 2668 | + print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2669 | + } |
|
| 2499 | 2670 | } |
| 2500 | - } |
|
| 2501 | - else |
|
| 2671 | + } else |
|
| 2502 | 2672 | { |
| 2503 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2504 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2673 | + if($line->qty<=1) { |
|
| 2674 | + print img_picto('', 'subtotal@subtotal'); |
|
| 2675 | + } else if($line->qty==2) { |
|
| 2676 | + print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2677 | + } |
|
| 2505 | 2678 | } |
| 2506 | 2679 | |
| 2507 | 2680 | |
@@ -2511,21 +2684,24 @@ discard block |
||
| 2511 | 2684 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
| 2512 | 2685 | |
| 2513 | 2686 | if (empty($line->label)) { |
| 2514 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
|
| 2515 | - else print $line->description; |
|
| 2516 | - } |
|
| 2517 | - else { |
|
| 2687 | + if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
| 2688 | + print $line->description.' '.$this->getTitle($object, $line); |
|
| 2689 | + } else { |
|
| 2690 | + print $line->description; |
|
| 2691 | + } |
|
| 2692 | + } else { |
|
| 2518 | 2693 | |
| 2519 | 2694 | if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
| 2520 | 2695 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2521 | - } |
|
| 2522 | - else{ |
|
| 2696 | + } else{ |
|
| 2523 | 2697 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2524 | 2698 | } |
| 2525 | 2699 | |
| 2526 | 2700 | } |
| 2527 | 2701 | //if($line->qty>90) print ' : '; |
| 2528 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2702 | + if($line->info_bits > 0) { |
|
| 2703 | + echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2704 | + } |
|
| 2529 | 2705 | |
| 2530 | 2706 | ?> |
| 2531 | 2707 | </td> |
@@ -2548,8 +2724,7 @@ discard block |
||
| 2548 | 2724 | </tr> |
| 2549 | 2725 | <?php |
| 2550 | 2726 | return 1; |
| 2551 | - } |
|
| 2552 | - elseif ($object->element == 'shipping' || $object->element == 'delivery') |
|
| 2727 | + } elseif ($object->element == 'shipping' || $object->element == 'delivery') |
|
| 2553 | 2728 | { |
| 2554 | 2729 | global $form; |
| 2555 | 2730 | |
@@ -2561,13 +2736,25 @@ discard block |
||
| 2561 | 2736 | $extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
| 2562 | 2737 | |
| 2563 | 2738 | $colspan = 4; |
| 2564 | - if($object->origin && $object->origin_id > 0) $colspan++; |
|
| 2565 | - if(! empty($conf->stock->enabled)) $colspan++; |
|
| 2566 | - if(! empty($conf->productbatch->enabled)) $colspan++; |
|
| 2567 | - if($object->statut == 0) $colspan++; |
|
| 2568 | - if($object->statut == 0 && empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) $colspan++; |
|
| 2739 | + if($object->origin && $object->origin_id > 0) { |
|
| 2740 | + $colspan++; |
|
| 2741 | + } |
|
| 2742 | + if(! empty($conf->stock->enabled)) { |
|
| 2743 | + $colspan++; |
|
| 2744 | + } |
|
| 2745 | + if(! empty($conf->productbatch->enabled)) { |
|
| 2746 | + $colspan++; |
|
| 2747 | + } |
|
| 2748 | + if($object->statut == 0) { |
|
| 2749 | + $colspan++; |
|
| 2750 | + } |
|
| 2751 | + if($object->statut == 0 && empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) { |
|
| 2752 | + $colspan++; |
|
| 2753 | + } |
|
| 2569 | 2754 | |
| 2570 | - if($object->element == 'delivery') $colspan = 2; |
|
| 2755 | + if($object->element == 'delivery') { |
|
| 2756 | + $colspan = 2; |
|
| 2757 | + } |
|
| 2571 | 2758 | |
| 2572 | 2759 | print '<!-- origin line id = '.$line->origin_line_id.' -->'; // id of order line |
| 2573 | 2760 | |
@@ -2577,23 +2764,36 @@ discard block |
||
| 2577 | 2764 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
| 2578 | 2765 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 2579 | 2766 | { |
| 2580 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 2581 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2582 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 2583 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 2584 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 2585 | - else if($line->qty==50) print ''; |
|
| 2586 | - else print 'background:#eeeeff;'; |
|
| 2767 | + if($line->qty==99) { |
|
| 2768 | + print 'background:#adadcf'; |
|
| 2769 | + } else if($line->qty==98) { |
|
| 2770 | + print 'background:#ddddff;'; |
|
| 2771 | + } else if($line->qty<=97 && $line->qty>=91) { |
|
| 2772 | + print 'background:#eeeeff;'; |
|
| 2773 | + } else if($line->qty==1) { |
|
| 2774 | + print 'background:#adadcf;'; |
|
| 2775 | + } else if($line->qty==2) { |
|
| 2776 | + print 'background:#ddddff;'; |
|
| 2777 | + } else if($line->qty==50) { |
|
| 2778 | + print ''; |
|
| 2779 | + } else { |
|
| 2780 | + print 'background:#eeeeff;'; |
|
| 2781 | + } |
|
| 2587 | 2782 | |
| 2588 | 2783 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 2589 | - } |
|
| 2590 | - else |
|
| 2784 | + } else |
|
| 2591 | 2785 | { |
| 2592 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 2593 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2594 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 2595 | - else if($line->qty==50) print ''; |
|
| 2596 | - else print 'background:#eeffee;' ; |
|
| 2786 | + if($line->qty==99) { |
|
| 2787 | + print 'background:#ddffdd'; |
|
| 2788 | + } else if($line->qty==98) { |
|
| 2789 | + print 'background:#ddddff;'; |
|
| 2790 | + } else if($line->qty==2) { |
|
| 2791 | + print 'background:#eeeeff; '; |
|
| 2792 | + } else if($line->qty==50) { |
|
| 2793 | + print ''; |
|
| 2794 | + } else { |
|
| 2795 | + print 'background:#eeffee;' ; |
|
| 2796 | + } |
|
| 2597 | 2797 | } |
| 2598 | 2798 | |
| 2599 | 2799 | ?>;"> |
@@ -2615,14 +2815,19 @@ discard block |
||
| 2615 | 2815 | { |
| 2616 | 2816 | echo str_repeat(' ', $line->qty-1); |
| 2617 | 2817 | |
| 2618 | - if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2619 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2818 | + if (TSubtotal::isTitle($line)) { |
|
| 2819 | + print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2820 | + } else { |
|
| 2821 | + print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2822 | + } |
|
| 2620 | 2823 | } |
| 2621 | - } |
|
| 2622 | - else |
|
| 2824 | + } else |
|
| 2623 | 2825 | { |
| 2624 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2625 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2826 | + if($line->qty<=1) { |
|
| 2827 | + print img_picto('', 'subtotal@subtotal'); |
|
| 2828 | + } else if($line->qty==2) { |
|
| 2829 | + print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2830 | + } |
|
| 2626 | 2831 | } |
| 2627 | 2832 | |
| 2628 | 2833 | |
@@ -2632,19 +2837,22 @@ discard block |
||
| 2632 | 2837 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
| 2633 | 2838 | |
| 2634 | 2839 | if (empty($line->label)) { |
| 2635 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
|
| 2636 | - else print $line->description; |
|
| 2637 | - } |
|
| 2638 | - else { |
|
| 2840 | + if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
| 2841 | + print $line->description.' '.$this->getTitle($object, $line); |
|
| 2842 | + } else { |
|
| 2843 | + print $line->description; |
|
| 2844 | + } |
|
| 2845 | + } else { |
|
| 2639 | 2846 | if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
| 2640 | 2847 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2641 | - } |
|
| 2642 | - else{ |
|
| 2848 | + } else{ |
|
| 2643 | 2849 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2644 | 2850 | } |
| 2645 | 2851 | } |
| 2646 | 2852 | //if($line->qty>90) print ' : '; |
| 2647 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2853 | + if($line->info_bits > 0) { |
|
| 2854 | + echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2855 | + } |
|
| 2648 | 2856 | |
| 2649 | 2857 | ?> |
| 2650 | 2858 | </td> |
@@ -2824,10 +3032,9 @@ discard block |
||
| 2824 | 3032 | |
| 2825 | 3033 | if(TSubtotal::isTitle($line)){ |
| 2826 | 3034 | $ThtmlData['data-issubtotal'] = 'title'; |
| 2827 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
| 3035 | + } elseif(TSubtotal::isSubtotal($line)){ |
|
| 2828 | 3036 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
| 2829 | - } |
|
| 2830 | - else{ |
|
| 3037 | + } else{ |
|
| 2831 | 3038 | $ThtmlData['data-issubtotal'] = 'freetext'; |
| 2832 | 3039 | } |
| 2833 | 3040 | |
@@ -2837,7 +3044,9 @@ discard block |
||
| 2837 | 3044 | |
| 2838 | 3045 | // hook |
| 2839 | 3046 | $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
| 2840 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 3047 | + if ($reshook < 0) { |
|
| 3048 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 3049 | + } |
|
| 2841 | 3050 | if ($reshook>0) |
| 2842 | 3051 | { |
| 2843 | 3052 | $ThtmlData = $hookmanager->resArray; |