@@ -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,52 +385,52 @@ 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) || !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE))) |
|
| 424 | + if ($object->statut == 0 && $createRight && (!empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) || !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE))) |
|
| 425 | 425 | { |
| 426 | 426 | dol_include_once('/subtotal/lib/subtotal.lib.php'); |
| 427 | 427 | |
| 428 | - if(!empty($object->lines)) { |
|
| 429 | - foreach($object->lines as $line) { |
|
| 430 | - if($line->id == $lineid) $duplicateLine = $line; |
|
| 428 | + if (!empty($object->lines)) { |
|
| 429 | + foreach ($object->lines as $line) { |
|
| 430 | + if ($line->id == $lineid) $duplicateLine = $line; |
|
| 431 | 431 | } |
| 432 | 432 | } |
| 433 | - if(!empty($duplicateLine) && !self::isModSubtotalLine($duplicateLine)) $TLine = array($duplicateLine); |
|
| 433 | + if (!empty($duplicateLine) && !self::isModSubtotalLine($duplicateLine)) $TLine = array($duplicateLine); |
|
| 434 | 434 | else $TLine = self::getLinesFromTitleId($object, $lineid, $withBlockLine); |
| 435 | 435 | |
| 436 | 436 | if (!empty($TLine)) |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | case 'order_supplier': |
| 461 | 461 | $object->line = $line; |
| 462 | 462 | $object->line->fk_commande = $object->id; |
| 463 | - $object->line->rang = $object->line_max() +1; |
|
| 463 | + $object->line->rang = $object->line_max() + 1; |
|
| 464 | 464 | $res = $object->line->insert(1); |
| 465 | 465 | break; |
| 466 | 466 | |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | { |
| 501 | 501 | $object->line_from = $line; |
| 502 | 502 | // Call trigger |
| 503 | - $result=$object->call_trigger('LINE_DUPLICATE',$user); // $object->line |
|
| 503 | + $result = $object->call_trigger('LINE_DUPLICATE', $user); // $object->line |
|
| 504 | 504 | if ($result < 0) |
| 505 | 505 | { |
| 506 | 506 | $object->db->rollback(); |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | } |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | - public static function getLinesFromTitle(&$object, $key_trad, $level=1, $under_title='', $withBlockLine=false, $key_is_id=false) |
|
| 533 | + public static function getLinesFromTitle(&$object, $key_trad, $level = 1, $under_title = '', $withBlockLine = false, $key_is_id = false) |
|
| 534 | 534 | { |
| 535 | 535 | global $langs; |
| 536 | 536 | |
@@ -542,17 +542,17 @@ discard block |
||
| 542 | 542 | |
| 543 | 543 | $TLine = array(); |
| 544 | 544 | $add_line = false; |
| 545 | - $under_title_found=false; |
|
| 545 | + $under_title_found = false; |
|
| 546 | 546 | |
| 547 | 547 | foreach ($object->lines as $key => &$line) |
| 548 | 548 | { |
| 549 | 549 | if (!$under_title_found && !empty($TTitle_under_search)) |
| 550 | 550 | { |
| 551 | - if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) $under_title_found = true; |
|
| 551 | + if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search))) $under_title_found = true; |
|
| 552 | 552 | } |
| 553 | 553 | else |
| 554 | 554 | { |
| 555 | - 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) ))) |
|
| 555 | + 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)))) |
|
| 556 | 556 | { |
| 557 | 557 | if ($key_is_id) $level = $line->qty; |
| 558 | 558 | |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | |
| 569 | 569 | if ($add_line) |
| 570 | 570 | { |
| 571 | - if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) continue; |
|
| 571 | + if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line))) continue; |
|
| 572 | 572 | else $TLine[] = $line; |
| 573 | 573 | } |
| 574 | 574 | } |
@@ -577,12 +577,12 @@ discard block |
||
| 577 | 577 | return $TLine; |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | - public static function getLinesFromTitleId(&$object, $lineid, $withBlockLine=false) |
|
| 580 | + public static function getLinesFromTitleId(&$object, $lineid, $withBlockLine = false) |
|
| 581 | 581 | { |
| 582 | 582 | return self::getLinesFromTitle($object, $lineid, '', '', $withBlockLine, true); |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | - 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) |
|
| 585 | + 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) |
|
| 586 | 586 | { |
| 587 | 587 | $res = 0; |
| 588 | 588 | $object->db->begin(); |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | break; |
| 595 | 595 | |
| 596 | 596 | case 'supplier_proposal': |
| 597 | - $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); |
|
| 597 | + $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); |
|
| 598 | 598 | break; |
| 599 | 599 | |
| 600 | 600 | case 'commande': |
@@ -623,9 +623,9 @@ discard block |
||
| 623 | 623 | $factureRecLine->fetch($rowid); |
| 624 | 624 | $factureRecLine->array_options = $array_options; |
| 625 | 625 | $factureRecLine->insertExtraFields(); |
| 626 | - $rang=$factureRecLine->rang; |
|
| 626 | + $rang = $factureRecLine->rang; |
|
| 627 | 627 | |
| 628 | - $fk_product=0; $fk_remise_except=''; $pu_ttc=0; |
|
| 628 | + $fk_product = 0; $fk_remise_except = ''; $pu_ttc = 0; |
|
| 629 | 629 | $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); |
| 630 | 630 | break; |
| 631 | 631 | } |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | global $db, $object; |
| 642 | 642 | |
| 643 | 643 | $TTitle = array(); |
| 644 | - if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
| 644 | + if (!empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
| 645 | 645 | else { |
| 646 | 646 | if ($origin_line->element == 'propaldet') |
| 647 | 647 | { |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | */ |
| 722 | 722 | public static function addRecapPage(&$parameters, &$origin_pdf) |
| 723 | 723 | { |
| 724 | - global $user,$conf,$langs; |
|
| 724 | + global $user, $conf, $langs; |
|
| 725 | 725 | |
| 726 | 726 | $origin_file = $parameters['file']; |
| 727 | 727 | $outputlangs = $parameters['outputlangs']; |
@@ -737,21 +737,21 @@ discard block |
||
| 737 | 737 | $objmarge->marge_droite = 10; |
| 738 | 738 | |
| 739 | 739 | $objectref = dol_sanitizeFileName($object->ref); |
| 740 | - if ($object->element == 'propal') $dir = $conf->propal->dir_output . '/' . $objectref; |
|
| 741 | - elseif ($object->element == 'commande') $dir = $conf->commande->dir_output . '/' . $objectref; |
|
| 742 | - elseif ($object->element == 'facture') $dir = $conf->facture->dir_output . '/' . $objectref; |
|
| 740 | + if ($object->element == 'propal') $dir = $conf->propal->dir_output.'/'.$objectref; |
|
| 741 | + elseif ($object->element == 'commande') $dir = $conf->commande->dir_output.'/'.$objectref; |
|
| 742 | + elseif ($object->element == 'facture') $dir = $conf->facture->dir_output.'/'.$objectref; |
|
| 743 | 743 | elseif ($object->element == 'facturerec') return; // no PDF for facturerec |
| 744 | 744 | else |
| 745 | 745 | { |
| 746 | 746 | setEventMessage($langs->trans('warning_subtotal_recap_object_element_unknown', $object->element), 'warnings'); |
| 747 | 747 | return -1; |
| 748 | 748 | } |
| 749 | - $file = $dir . '/' . $objectref . '_recap.pdf'; |
|
| 749 | + $file = $dir.'/'.$objectref.'_recap.pdf'; |
|
| 750 | 750 | |
| 751 | 751 | // $pdf=pdf_getInstance($origin_pdf->format); |
| 752 | - $pdf=pdf_getInstance(array(210, 297)); // Format A4 Portrait |
|
| 753 | - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
| 754 | - $pdf->SetAutoPageBreak(1,0); |
|
| 752 | + $pdf = pdf_getInstance(array(210, 297)); // Format A4 Portrait |
|
| 753 | + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
| 754 | + $pdf->SetAutoPageBreak(1, 0); |
|
| 755 | 755 | |
| 756 | 756 | if (class_exists('TCPDF')) |
| 757 | 757 | { |
@@ -760,49 +760,49 @@ discard block |
||
| 760 | 760 | } |
| 761 | 761 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
| 762 | 762 | // Set path to the background PDF File |
| 763 | - if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
| 763 | + if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
| 764 | 764 | { |
| 765 | 765 | $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
| 766 | 766 | $tplidx = $pdf->importPage(1); |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | $pdf->Open(); |
| 770 | - $pagenb=0; |
|
| 771 | - $pdf->SetDrawColor(128,128,128); |
|
| 770 | + $pagenb = 0; |
|
| 771 | + $pdf->SetDrawColor(128, 128, 128); |
|
| 772 | 772 | |
| 773 | 773 | $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
| 774 | 774 | $pdf->SetSubject($outputlangs->transnoentities("subtotalRecap")); |
| 775 | 775 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
| 776 | 776 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
| 777 | 777 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("subtotalRecap")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); |
| 778 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 778 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 779 | 779 | |
| 780 | - $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
|
| 780 | + $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
|
| 781 | 781 | |
| 782 | - $pagenb=0; |
|
| 783 | - $pdf->SetDrawColor(128,128,128); |
|
| 782 | + $pagenb = 0; |
|
| 783 | + $pdf->SetDrawColor(128, 128, 128); |
|
| 784 | 784 | |
| 785 | 785 | |
| 786 | 786 | // New page |
| 787 | 787 | $pdf->AddPage(); |
| 788 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 788 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 789 | 789 | $pagenb++; |
| 790 | 790 | |
| 791 | 791 | |
| 792 | 792 | self::pagehead($objmarge, $pdf, $object, 1, $outputlangs); |
| 793 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 794 | - $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
| 795 | - $pdf->SetTextColor(0,0,0); |
|
| 793 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 794 | + $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
| 795 | + $pdf->SetTextColor(0, 0, 0); |
|
| 796 | 796 | |
| 797 | - $heightforinfotot = 25; // Height reserved to output the info and total part |
|
| 798 | - $heightforfooter = $objmarge->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
| 797 | + $heightforinfotot = 25; // Height reserved to output the info and total part |
|
| 798 | + $heightforfooter = $objmarge->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
| 799 | 799 | |
| 800 | 800 | $posx_designation = 25; |
| 801 | 801 | $posx_options = 150; |
| 802 | 802 | $posx_montant = 170; |
| 803 | 803 | |
| 804 | 804 | $tab_top = 72; |
| 805 | - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?72:20); // TODO à vérifier |
|
| 805 | + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 72 : 20); // TODO à vérifier |
|
| 806 | 806 | |
| 807 | 807 | $TTot = array('total_ht' => 0, 'total_ttc' => 0, 'TTotal_tva' => array()); |
| 808 | 808 | |
@@ -816,14 +816,14 @@ discard block |
||
| 816 | 816 | $nexY = $tab_top + 10; |
| 817 | 817 | |
| 818 | 818 | $nblignes = count($TLine); |
| 819 | - foreach($TLine as $i => &$line) |
|
| 819 | + foreach ($TLine as $i => &$line) |
|
| 820 | 820 | { |
| 821 | 821 | $curY = $nexY; |
| 822 | 822 | |
| 823 | 823 | if (self::getNiveau($line) == 1) |
| 824 | 824 | { |
| 825 | - $pdf->SetFont('','B', $default_font_size - 1); // Into loop to work with multipage |
|
| 826 | - $curY+=2; |
|
| 825 | + $pdf->SetFont('', 'B', $default_font_size - 1); // Into loop to work with multipage |
|
| 826 | + $curY += 2; |
|
| 827 | 827 | |
| 828 | 828 | $TTot['total_ht'] += $line->total_ht; |
| 829 | 829 | $TTot['total_tva'] += $line->total_tva; |
@@ -842,67 +842,67 @@ discard block |
||
| 842 | 842 | $TTot['TTotal_tva_multicurrency'][$tx] += $amount; |
| 843 | 843 | } |
| 844 | 844 | } |
| 845 | - else $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
| 845 | + else $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage |
|
| 846 | 846 | |
| 847 | - $pdf->SetTextColor(0,0,0); |
|
| 847 | + $pdf->SetTextColor(0, 0, 0); |
|
| 848 | 848 | |
| 849 | 849 | $pdf->setTopMargin($tab_top_newpage + 10); |
| 850 | - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
| 851 | - $pageposbefore=$pdf->getPage(); |
|
| 850 | + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
| 851 | + $pageposbefore = $pdf->getPage(); |
|
| 852 | 852 | |
| 853 | - $showpricebeforepagebreak=1; |
|
| 853 | + $showpricebeforepagebreak = 1; |
|
| 854 | 854 | |
| 855 | 855 | $decalage = (self::getNiveau($line) - 1) * 2; |
| 856 | 856 | |
| 857 | 857 | // Print: Designation |
| 858 | 858 | $label = $line->label; |
| 859 | - if( (float)DOL_VERSION < 6 ) { |
|
| 859 | + if ((float) DOL_VERSION < 6) { |
|
| 860 | 860 | $label = !empty($line->label) ? $line->label : $line->desc; |
| 861 | 861 | } |
| 862 | 862 | |
| 863 | 863 | |
| 864 | 864 | $pdf->startTransaction(); |
| 865 | - $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
|
| 866 | - $pageposafter=$pdf->getPage(); |
|
| 865 | + $pdf->writeHTMLCell($posx_options - $posx_designation - $decalage, 3, $posx_designation + $decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J', true); |
|
| 866 | + $pageposafter = $pdf->getPage(); |
|
| 867 | 867 | if ($pageposafter > $pageposbefore) // There is a pagebreak |
| 868 | 868 | { |
| 869 | 869 | $pdf->rollbackTransaction(true); |
| 870 | - $pageposafter=$pageposbefore; |
|
| 870 | + $pageposafter = $pageposbefore; |
|
| 871 | 871 | //print $pageposafter.'-'.$pageposbefore;exit; |
| 872 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
| 873 | - $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
|
| 872 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
| 873 | + $pdf->writeHTMLCell($posx_options - $posx_designation - $decalage, 3, $posx_designation + $decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J', true); |
|
| 874 | 874 | |
| 875 | - $pageposafter=$pdf->getPage(); |
|
| 876 | - $posyafter=$pdf->GetY(); |
|
| 875 | + $pageposafter = $pdf->getPage(); |
|
| 876 | + $posyafter = $pdf->GetY(); |
|
| 877 | 877 | //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
| 878 | - if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) // There is no space left for total+free text |
|
| 878 | + if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter + $heightforinfotot))) // There is no space left for total+free text |
|
| 879 | 879 | { |
| 880 | - if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
|
| 880 | + if ($i == ($nblignes - 1)) // No more lines, and no space left to show total, so we create a new page |
|
| 881 | 881 | { |
| 882 | - $pdf->AddPage('','',true); |
|
| 883 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 882 | + $pdf->AddPage('', '', true); |
|
| 883 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 884 | 884 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
| 885 | - $pdf->setPage($pageposafter+1); |
|
| 885 | + $pdf->setPage($pageposafter + 1); |
|
| 886 | 886 | } |
| 887 | 887 | } |
| 888 | 888 | else |
| 889 | 889 | { |
| 890 | 890 | // We found a page break |
| 891 | - $showpricebeforepagebreak=0; |
|
| 891 | + $showpricebeforepagebreak = 0; |
|
| 892 | 892 | } |
| 893 | 893 | } |
| 894 | 894 | else // No pagebreak |
| 895 | 895 | { |
| 896 | 896 | $pdf->commitTransaction(); |
| 897 | 897 | } |
| 898 | - $posYAfterDescription=$pdf->GetY(); |
|
| 898 | + $posYAfterDescription = $pdf->GetY(); |
|
| 899 | 899 | |
| 900 | 900 | $nexY = $pdf->GetY(); |
| 901 | - $pageposafter=$pdf->getPage(); |
|
| 901 | + $pageposafter = $pdf->getPage(); |
|
| 902 | 902 | |
| 903 | 903 | $pdf->setPage($pageposbefore); |
| 904 | 904 | $pdf->setTopMargin($objmarge->marge_haute); |
| 905 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 905 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 906 | 906 | |
| 907 | 907 | // We suppose that a too long description or photo were moved completely on next page |
| 908 | 908 | if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { |
@@ -915,14 +915,14 @@ discard block |
||
| 915 | 915 | if (!empty($line->total_options)) |
| 916 | 916 | { |
| 917 | 917 | $pdf->SetXY($posx_options, $curY); |
| 918 | - $pdf->MultiCell($posx_montant-$posx_options-0.8, 3, price($line->total_options, 0, $outputlangs), 0, 'R', 0); |
|
| 918 | + $pdf->MultiCell($posx_montant - $posx_options - 0.8, 3, price($line->total_options, 0, $outputlangs), 0, 'R', 0); |
|
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | // Print: Montant |
| 922 | 922 | $pdf->SetXY($posx_montant, $curY); |
| 923 | - $pdf->MultiCell($objmarge->page_largeur-$objmarge->marge_droite-$posx_montant-0.8, 3, price($line->total_ht, 0, $outputlangs), 0, 'R', 0); |
|
| 923 | + $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant - 0.8, 3, price($line->total_ht, 0, $outputlangs), 0, 'R', 0); |
|
| 924 | 924 | |
| 925 | - $nexY+=2; // Passe espace entre les lignes |
|
| 925 | + $nexY += 2; // Passe espace entre les lignes |
|
| 926 | 926 | |
| 927 | 927 | // Detect if some page were added automatically and output _tableau for past pages |
| 928 | 928 | while ($pagenb < $pageposafter) |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | |
| 940 | 940 | $pagenb++; |
| 941 | 941 | $pdf->setPage($pagenb); |
| 942 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 942 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 943 | 943 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
| 944 | 944 | } |
| 945 | 945 | } |
@@ -949,19 +949,19 @@ discard block |
||
| 949 | 949 | if ($pagenb == 1) |
| 950 | 950 | { |
| 951 | 951 | 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); |
| 952 | - $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
| 952 | + $bottomlasttab = $objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
| 953 | 953 | } |
| 954 | 954 | else |
| 955 | 955 | { |
| 956 | 956 | 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); |
| 957 | - $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
| 957 | + $bottomlasttab = $objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
| 958 | 958 | } |
| 959 | 959 | |
| 960 | 960 | // Affiche zone totaux |
| 961 | - $posy=self::tableau_tot($objmarge, $pdf, $object, $bottomlasttab, $outputlangs, $TTot); |
|
| 961 | + $posy = self::tableau_tot($objmarge, $pdf, $object, $bottomlasttab, $outputlangs, $TTot); |
|
| 962 | 962 | |
| 963 | 963 | $pdf->Close(); |
| 964 | - $pdf->Output($file,'F'); |
|
| 964 | + $pdf->Output($file, 'F'); |
|
| 965 | 965 | |
| 966 | 966 | $pagecount = self::concat($outputlangs, array($origin_file, $file), $origin_file); |
| 967 | 967 | |
@@ -973,7 +973,7 @@ discard block |
||
| 973 | 973 | $level = $line->qty; // TODO à améliorer |
| 974 | 974 | |
| 975 | 975 | $pdf->SetXY($objmarge->marge_gauche, $curY); |
| 976 | - $pdf->MultiCell($posx_designation-$objmarge->marge_gauche-0.8, 5, $level, 0, 'L', 0); |
|
| 976 | + $pdf->MultiCell($posx_designation - $objmarge->marge_gauche - 0.8, 5, $level, 0, 'L', 0); |
|
| 977 | 977 | } |
| 978 | 978 | |
| 979 | 979 | /** |
@@ -987,50 +987,50 @@ discard block |
||
| 987 | 987 | */ |
| 988 | 988 | private static function pagehead(&$objmarge, &$pdf, &$object, $showdetail, $outputlangs) |
| 989 | 989 | { |
| 990 | - global $conf,$mysoc; |
|
| 990 | + global $conf, $mysoc; |
|
| 991 | 991 | |
| 992 | 992 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 993 | 993 | |
| 994 | - pdf_pagehead($pdf,$outputlangs,$objmarge->page_hauteur); |
|
| 994 | + pdf_pagehead($pdf, $outputlangs, $objmarge->page_hauteur); |
|
| 995 | 995 | |
| 996 | - $pdf->SetTextColor(0,0,60); |
|
| 997 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
| 996 | + $pdf->SetTextColor(0, 0, 60); |
|
| 997 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
| 998 | 998 | |
| 999 | - $posy=$objmarge->marge_haute; |
|
| 1000 | - $posx=$objmarge->page_largeur-$objmarge->marge_droite-100; |
|
| 999 | + $posy = $objmarge->marge_haute; |
|
| 1000 | + $posx = $objmarge->page_largeur - $objmarge->marge_droite - 100; |
|
| 1001 | 1001 | |
| 1002 | - $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
| 1002 | + $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
| 1003 | 1003 | |
| 1004 | - $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
| 1004 | + $logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
| 1005 | 1005 | if ($mysoc->logo) |
| 1006 | 1006 | { |
| 1007 | 1007 | if (is_readable($logo)) |
| 1008 | 1008 | { |
| 1009 | - $height=pdf_getHeightForLogo($logo); |
|
| 1010 | - $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 1009 | + $height = pdf_getHeightForLogo($logo); |
|
| 1010 | + $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 1011 | 1011 | } |
| 1012 | 1012 | else |
| 1013 | 1013 | { |
| 1014 | - $pdf->SetTextColor(200,0,0); |
|
| 1015 | - $pdf->SetFont('','B',$default_font_size - 2); |
|
| 1016 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
|
| 1014 | + $pdf->SetTextColor(200, 0, 0); |
|
| 1015 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 1016 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); |
|
| 1017 | 1017 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); |
| 1018 | 1018 | } |
| 1019 | 1019 | |
| 1020 | - $posy+=35; |
|
| 1020 | + $posy += 35; |
|
| 1021 | 1021 | } |
| 1022 | 1022 | else |
| 1023 | 1023 | { |
| 1024 | - $text=$mysoc->name; |
|
| 1024 | + $text = $mysoc->name; |
|
| 1025 | 1025 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
| 1026 | 1026 | |
| 1027 | - $posy+=15; |
|
| 1027 | + $posy += 15; |
|
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | 1030 | |
| 1031 | - $pdf->SetTextColor(0,0,0); |
|
| 1032 | - $pdf->SetFont('','B', $default_font_size + 2); |
|
| 1033 | - $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
| 1031 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1032 | + $pdf->SetFont('', 'B', $default_font_size + 2); |
|
| 1033 | + $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
| 1034 | 1034 | |
| 1035 | 1035 | $key = 'subtotalPropalTitle'; |
| 1036 | 1036 | if ($object->element == 'commande') $key = 'subtotalCommandeTitle'; |
@@ -1039,14 +1039,14 @@ discard block |
||
| 1039 | 1039 | |
| 1040 | 1040 | $pdf->MultiCell(150, 4, $outputlangs->transnoentities($key, $object->ref, $object->thirdparty->name), '', 'L'); |
| 1041 | 1041 | |
| 1042 | - $pdf->SetFont('','', $default_font_size); |
|
| 1043 | - $pdf->SetXY($objmarge->page_largeur-$objmarge->marge_droite-40,$posy); |
|
| 1042 | + $pdf->SetFont('', '', $default_font_size); |
|
| 1043 | + $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - 40, $posy); |
|
| 1044 | 1044 | $pdf->MultiCell(40, 4, dol_print_date($object->date, 'daytext'), '', 'R'); |
| 1045 | 1045 | |
| 1046 | 1046 | $posy += 8; |
| 1047 | 1047 | |
| 1048 | - $pdf->SetFont('','B', $default_font_size + 2); |
|
| 1049 | - $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
| 1048 | + $pdf->SetFont('', 'B', $default_font_size + 2); |
|
| 1049 | + $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
| 1050 | 1050 | $pdf->MultiCell(70, 4, $outputlangs->transnoentities('subtotalRecapLot'), '', 'L'); |
| 1051 | 1051 | |
| 1052 | 1052 | } |
@@ -1064,44 +1064,44 @@ discard block |
||
| 1064 | 1064 | * @param string $currency Currency code |
| 1065 | 1065 | * @return void |
| 1066 | 1066 | */ |
| 1067 | - private static function tableau(&$objmarge, &$pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') |
|
| 1067 | + private static function tableau(&$objmarge, &$pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '') |
|
| 1068 | 1068 | { |
| 1069 | 1069 | global $conf; |
| 1070 | 1070 | |
| 1071 | 1071 | // Force to disable hidetop and hidebottom |
| 1072 | - $hidebottom=0; |
|
| 1073 | - if ($hidetop) $hidetop=-1; |
|
| 1072 | + $hidebottom = 0; |
|
| 1073 | + if ($hidetop) $hidetop = -1; |
|
| 1074 | 1074 | |
| 1075 | 1075 | $currency = !empty($currency) ? $currency : $conf->currency; |
| 1076 | 1076 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 1077 | 1077 | |
| 1078 | 1078 | // Amount in (at tab_top - 1) |
| 1079 | - $pdf->SetTextColor(0,0,0); |
|
| 1080 | - $pdf->SetFont('','',$default_font_size); |
|
| 1079 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1080 | + $pdf->SetFont('', '', $default_font_size); |
|
| 1081 | 1081 | |
| 1082 | 1082 | if (empty($hidetop)) |
| 1083 | 1083 | { |
| 1084 | - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); |
|
| 1085 | - $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4.5); |
|
| 1084 | + $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); |
|
| 1085 | + $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4.5); |
|
| 1086 | 1086 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
| 1087 | 1087 | |
| 1088 | - 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)); |
|
| 1088 | + 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)); |
|
| 1089 | 1089 | |
| 1090 | 1090 | |
| 1091 | - $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 |
|
| 1091 | + $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 | 1092 | |
| 1093 | - $pdf->SetXY($posx_designation, $tab_top+2); |
|
| 1094 | - $pdf->MultiCell($posx_options - $posx_designation,2, $outputlangs->transnoentities("Designation"),'','L'); |
|
| 1095 | - $pdf->SetXY($posx_options, $tab_top+2); |
|
| 1096 | - $pdf->MultiCell($posx_montant - $posx_options,2, $outputlangs->transnoentities("Options"),'','R'); |
|
| 1097 | - $pdf->SetXY($posx_montant, $tab_top+2); |
|
| 1098 | - $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant,2, $outputlangs->transnoentities("Amount"),'','R'); |
|
| 1093 | + $pdf->SetXY($posx_designation, $tab_top + 2); |
|
| 1094 | + $pdf->MultiCell($posx_options - $posx_designation, 2, $outputlangs->transnoentities("Designation"), '', 'L'); |
|
| 1095 | + $pdf->SetXY($posx_options, $tab_top + 2); |
|
| 1096 | + $pdf->MultiCell($posx_montant - $posx_options, 2, $outputlangs->transnoentities("Options"), '', 'R'); |
|
| 1097 | + $pdf->SetXY($posx_montant, $tab_top + 2); |
|
| 1098 | + $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant, 2, $outputlangs->transnoentities("Amount"), '', 'R'); |
|
| 1099 | 1099 | |
| 1100 | - $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 |
|
| 1100 | + $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 |
|
| 1101 | 1101 | } |
| 1102 | 1102 | else |
| 1103 | 1103 | { |
| 1104 | - $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 |
|
| 1104 | + $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 |
|
| 1105 | 1105 | } |
| 1106 | 1106 | |
| 1107 | 1107 | } |
@@ -1110,29 +1110,29 @@ discard block |
||
| 1110 | 1110 | { |
| 1111 | 1111 | global $conf; |
| 1112 | 1112 | |
| 1113 | - $pdf->line($objmarge->marge_gauche, $posy, $objmarge->page_largeur-$objmarge->marge_droite, $posy); // line prend une position y en 2eme param et 4eme param |
|
| 1113 | + $pdf->line($objmarge->marge_gauche, $posy, $objmarge->page_largeur - $objmarge->marge_droite, $posy); // line prend une position y en 2eme param et 4eme param |
|
| 1114 | 1114 | |
| 1115 | 1115 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 1116 | 1116 | |
| 1117 | - $tab2_top = $posy+2; |
|
| 1117 | + $tab2_top = $posy + 2; |
|
| 1118 | 1118 | $tab2_hl = 4; |
| 1119 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 1119 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 1120 | 1120 | |
| 1121 | 1121 | // Tableau total |
| 1122 | 1122 | $col1x = 120; $col2x = 170; |
| 1123 | 1123 | if ($objmarge->page_largeur < 210) // To work with US executive format |
| 1124 | 1124 | { |
| 1125 | - $col2x-=20; |
|
| 1125 | + $col2x -= 20; |
|
| 1126 | 1126 | } |
| 1127 | 1127 | $largcol2 = ($objmarge->page_largeur - $objmarge->marge_droite - $col2x); |
| 1128 | 1128 | |
| 1129 | - $useborder=0; |
|
| 1129 | + $useborder = 0; |
|
| 1130 | 1130 | $index = 0; |
| 1131 | 1131 | |
| 1132 | 1132 | // Total HT |
| 1133 | - $pdf->SetFillColor(255,255,255); |
|
| 1133 | + $pdf->SetFillColor(255, 255, 255); |
|
| 1134 | 1134 | $pdf->SetXY($col1x, $tab2_top + 0); |
| 1135 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
| 1135 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
| 1136 | 1136 | |
| 1137 | 1137 | // $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1) ? $TTot['multicurrency_total_ht'] : $TTot['total_ht']; |
| 1138 | 1138 | $total_ht = $TTot['total_ht']; |
@@ -1140,10 +1140,10 @@ discard block |
||
| 1140 | 1140 | $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht, 0, $outputlangs), 0, 'R', 1); |
| 1141 | 1141 | |
| 1142 | 1142 | // Show VAT by rates and total |
| 1143 | - $pdf->SetFillColor(248,248,248); |
|
| 1143 | + $pdf->SetFillColor(248, 248, 248); |
|
| 1144 | 1144 | |
| 1145 | - $atleastoneratenotnull=0; |
|
| 1146 | - foreach($TTot['TTotal_tva'] as $tvakey => $tvaval) |
|
| 1145 | + $atleastoneratenotnull = 0; |
|
| 1146 | + foreach ($TTot['TTotal_tva'] as $tvakey => $tvaval) |
|
| 1147 | 1147 | { |
| 1148 | 1148 | if ($tvakey != 0) // On affiche pas taux 0 |
| 1149 | 1149 | { |
@@ -1152,15 +1152,15 @@ discard block |
||
| 1152 | 1152 | $index++; |
| 1153 | 1153 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1154 | 1154 | |
| 1155 | - $tvacompl=''; |
|
| 1156 | - if (preg_match('/\*/',$tvakey)) |
|
| 1155 | + $tvacompl = ''; |
|
| 1156 | + if (preg_match('/\*/', $tvakey)) |
|
| 1157 | 1157 | { |
| 1158 | - $tvakey=str_replace('*','',$tvakey); |
|
| 1158 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 1159 | 1159 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 1160 | 1160 | } |
| 1161 | - $totalvat =$outputlangs->transnoentities("TotalVAT").' '; |
|
| 1162 | - $totalvat.=vatrate($tvakey,1).$tvacompl; |
|
| 1163 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1161 | + $totalvat = $outputlangs->transnoentities("TotalVAT").' '; |
|
| 1162 | + $totalvat .= vatrate($tvakey, 1).$tvacompl; |
|
| 1163 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1164 | 1164 | |
| 1165 | 1165 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1166 | 1166 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -1170,16 +1170,16 @@ discard block |
||
| 1170 | 1170 | // Total TTC |
| 1171 | 1171 | $index++; |
| 1172 | 1172 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1173 | - $pdf->SetTextColor(0,0,60); |
|
| 1174 | - $pdf->SetFillColor(224,224,224); |
|
| 1175 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
| 1173 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1174 | + $pdf->SetFillColor(224, 224, 224); |
|
| 1175 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
| 1176 | 1176 | |
| 1177 | 1177 | // $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $TTot['multicurrency_total_ttc'] : $TTot['total_ttc']; |
| 1178 | 1178 | $total_ttc = $TTot['total_ttc']; |
| 1179 | 1179 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1180 | 1180 | $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1); |
| 1181 | 1181 | |
| 1182 | - $pdf->SetTextColor(0,0,0); |
|
| 1182 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1183 | 1183 | |
| 1184 | 1184 | $index++; |
| 1185 | 1185 | return ($tab2_top + ($tab2_hl * $index)); |
@@ -1198,22 +1198,22 @@ discard block |
||
| 1198 | 1198 | * @param int $hidebottom Hide bottom |
| 1199 | 1199 | * @return void |
| 1200 | 1200 | */ |
| 1201 | - private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
| 1201 | + private static function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0) |
|
| 1202 | 1202 | { |
| 1203 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
| 1204 | - $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
| 1205 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1206 | - $pdf->line($x, $y+$h, $x, $y); |
|
| 1203 | + if (empty($hidetop) || $hidetop == -1) $pdf->line($x, $y, $x + $l, $y); |
|
| 1204 | + $pdf->line($x + $l, $y, $x + $l, $y + $h); |
|
| 1205 | + if (empty($hidebottom)) $pdf->line($x + $l, $y + $h, $x, $y + $h); |
|
| 1206 | + $pdf->line($x, $y + $h, $x, $y); |
|
| 1207 | 1207 | } |
| 1208 | 1208 | |
| 1209 | 1209 | |
| 1210 | - public static function concat(&$outputlangs, $files, $fileoutput='') |
|
| 1210 | + public static function concat(&$outputlangs, $files, $fileoutput = '') |
|
| 1211 | 1211 | { |
| 1212 | 1212 | global $conf; |
| 1213 | 1213 | |
| 1214 | 1214 | if (empty($fileoutput)) $fileoutput = $file[0]; |
| 1215 | 1215 | |
| 1216 | - $pdf=pdf_getInstance(); |
|
| 1216 | + $pdf = pdf_getInstance(); |
|
| 1217 | 1217 | if (class_exists('TCPDF')) |
| 1218 | 1218 | { |
| 1219 | 1219 | $pdf->setPrintHeader(false); |
@@ -1221,10 +1221,10 @@ discard block |
||
| 1221 | 1221 | } |
| 1222 | 1222 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
| 1223 | 1223 | |
| 1224 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1224 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1225 | 1225 | |
| 1226 | 1226 | |
| 1227 | - foreach($files as $file) |
|
| 1227 | + foreach ($files as $file) |
|
| 1228 | 1228 | { |
| 1229 | 1229 | $pagecount = $pdf->setSourceFile($file); |
| 1230 | 1230 | for ($i = 1; $i <= $pagecount; $i++) |
@@ -1236,8 +1236,8 @@ discard block |
||
| 1236 | 1236 | } |
| 1237 | 1237 | } |
| 1238 | 1238 | |
| 1239 | - $pdf->Output($fileoutput,'F'); |
|
| 1240 | - if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1239 | + $pdf->Output($fileoutput, 'F'); |
|
| 1240 | + if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1241 | 1241 | |
| 1242 | 1242 | return $pagecount; |
| 1243 | 1243 | } |
@@ -1250,7 +1250,7 @@ discard block |
||
| 1250 | 1250 | */ |
| 1251 | 1251 | public static function hasNcTitle(&$line) |
| 1252 | 1252 | { |
| 1253 | - if(isset($line->has_nc_title)) return $line->has_nc_title; |
|
| 1253 | + if (isset($line->has_nc_title)) return $line->has_nc_title; |
|
| 1254 | 1254 | |
| 1255 | 1255 | $TTitle = self::getAllTitleFromLine($line); |
| 1256 | 1256 | foreach ($TTitle as &$line_title) |
@@ -27,37 +27,37 @@ discard block |
||
| 27 | 27 | // Change this following line to use the correct relative path (../, ../../, etc) |
| 28 | 28 | // Dolibarr environment |
| 29 | 29 | $res = @include("../../main.inc.php"); // From htdocs directory |
| 30 | -if (! $res) { |
|
| 30 | +if (!$res) { |
|
| 31 | 31 | $res = @include("../../../main.inc.php"); // From "custom" directory |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // Libraries |
| 35 | -require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; |
|
| 35 | +require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; |
|
| 36 | 36 | require_once '../lib/subtotal.lib.php'; |
| 37 | 37 | |
| 38 | 38 | $langs->load("subtotal@subtotal"); |
| 39 | 39 | |
| 40 | 40 | // Access control |
| 41 | -if (! $user->admin) { |
|
| 41 | +if (!$user->admin) { |
|
| 42 | 42 | accessforbidden(); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Parameters |
| 46 | 46 | $action = GETPOST('action', 'alpha'); |
| 47 | 47 | |
| 48 | -if($action=='save') { |
|
| 48 | +if ($action == 'save') { |
|
| 49 | 49 | |
| 50 | - foreach($_REQUEST['TDivers'] as $name=>$param) { |
|
| 50 | + foreach ($_REQUEST['TDivers'] as $name=>$param) { |
|
| 51 | 51 | |
| 52 | - dolibarr_set_const($db, $name, $param,'chaine', 0, '', $conf->entity); |
|
| 52 | + dolibarr_set_const($db, $name, $param, 'chaine', 0, '', $conf->entity); |
|
| 53 | 53 | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | -if (preg_match('/set_(.*)/',$action,$reg)) |
|
| 58 | +if (preg_match('/set_(.*)/', $action, $reg)) |
|
| 59 | 59 | { |
| 60 | - $code=$reg[1]; |
|
| 60 | + $code = $reg[1]; |
|
| 61 | 61 | $value = GETPOST($code); |
| 62 | 62 | if ($code == 'SUBTOTAL_TFIELD_TO_KEEP_WITH_NC') $value = implode(',', $value); |
| 63 | 63 | |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | |
| 85 | 85 | |
| 86 | -llxHeader('','Gestion de sous-total, à propos',''); |
|
| 86 | +llxHeader('', 'Gestion de sous-total, à propos', ''); |
|
| 87 | 87 | |
| 88 | -$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; |
|
| 89 | -print_fiche_titre('Gestion de subtotal',$linkback,'setup'); |
|
| 88 | +$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; |
|
| 89 | +print_fiche_titre('Gestion de subtotal', $linkback, 'setup'); |
|
| 90 | 90 | |
| 91 | 91 | // Configuration header |
| 92 | 92 | $head = subtotalAdminPrepareHead(); |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | showParameters(); |
| 102 | 102 | |
| 103 | 103 | function showParameters() { |
| 104 | - global $db,$conf,$langs,$bc; |
|
| 104 | + global $db, $conf, $langs, $bc; |
|
| 105 | 105 | |
| 106 | - $html=new Form($db); |
|
| 106 | + $html = new Form($db); |
|
| 107 | 107 | |
| 108 | - $var=false; |
|
| 108 | + $var = false; |
|
| 109 | 109 | print '<table class="noborder" width="100%">'; |
| 110 | 110 | print '<tr class="liste_titre">'; |
| 111 | 111 | print '<td>'.$langs->trans("Parameters").'</td>'."\n"; |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n"; |
| 114 | 114 | print '</tr>'; |
| 115 | 115 | |
| 116 | - $var=!$var; |
|
| 116 | + $var = !$var; |
|
| 117 | 117 | print '<tr '.$bc[$var].'>'; |
| 118 | 118 | print '<td>'.$langs->trans("SUBTOTAL_USE_NEW_FORMAT").'</td>'; |
| 119 | 119 | print '<td align="center" width="20"> </td>'; |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | print ajax_constantonoff('SUBTOTAL_USE_NEW_FORMAT'); |
| 122 | 122 | print '</td></tr>'; |
| 123 | 123 | |
| 124 | - if((float)DOL_VERSION>=3.8) |
|
| 124 | + if ((float) DOL_VERSION >= 3.8) |
|
| 125 | 125 | { |
| 126 | - $var=!$var; |
|
| 126 | + $var = !$var; |
|
| 127 | 127 | print '<tr '.$bc[$var].'>'; |
| 128 | 128 | print '<td>'.$langs->trans("SUBTOTAL_USE_NUMEROTATION").'</td>'; |
| 129 | 129 | print '<td align="center" width="20"> </td>'; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | print '</td></tr>'; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $var=!$var; |
|
| 135 | + $var = !$var; |
|
| 136 | 136 | print '<tr '.$bc[$var].'>'; |
| 137 | 137 | print '<td>'.$langs->trans("SUBTOTAL_ALLOW_ADD_BLOCK").'</td>'; |
| 138 | 138 | print '<td align="center" width="20"> </td>'; |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | print ajax_constantonoff('SUBTOTAL_ALLOW_ADD_BLOCK'); |
| 141 | 141 | print '</td></tr>'; |
| 142 | 142 | |
| 143 | - $var=!$var; |
|
| 143 | + $var = !$var; |
|
| 144 | 144 | print '<tr '.$bc[$var].'>'; |
| 145 | 145 | print '<td>'.$langs->trans("SUBTOTAL_ALLOW_EDIT_BLOCK").'</td>'; |
| 146 | 146 | print '<td align="center" width="20"> </td>'; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | print ajax_constantonoff('SUBTOTAL_ALLOW_EDIT_BLOCK'); |
| 149 | 149 | print '</td></tr>'; |
| 150 | 150 | |
| 151 | - $var=!$var; |
|
| 151 | + $var = !$var; |
|
| 152 | 152 | print '<tr '.$bc[$var].'>'; |
| 153 | 153 | print '<td>'.$langs->trans("SUBTOTAL_ALLOW_REMOVE_BLOCK").'</td>'; |
| 154 | 154 | print '<td align="center" width="20"> </td>'; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | print ajax_constantonoff('SUBTOTAL_ALLOW_REMOVE_BLOCK'); |
| 157 | 157 | print '</td></tr>'; |
| 158 | 158 | |
| 159 | - $var=!$var; |
|
| 159 | + $var = !$var; |
|
| 160 | 160 | print '<tr '.$bc[$var].'>'; |
| 161 | 161 | print '<td>'.$langs->trans("SUBTOTAL_ALLOW_DUPLICATE_BLOCK").'</td>'; |
| 162 | 162 | print '<td align="center" width="20"> </td>'; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | print ajax_constantonoff('SUBTOTAL_ALLOW_DUPLICATE_BLOCK'); |
| 165 | 165 | print '</td></tr>'; |
| 166 | 166 | |
| 167 | - $var=!$var; |
|
| 167 | + $var = !$var; |
|
| 168 | 168 | print '<tr '.$bc[$var].'>'; |
| 169 | 169 | print '<td>'.$langs->trans("SUBTOTAL_ALLOW_DUPLICATE_LINE").'</td>'; |
| 170 | 170 | print '<td align="center" width="20"> </td>'; |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | print ajax_constantonoff('SUBTOTAL_ALLOW_DUPLICATE_LINE'); |
| 173 | 173 | print '</td></tr>'; |
| 174 | 174 | |
| 175 | - $var=!$var; |
|
| 175 | + $var = !$var; |
|
| 176 | 176 | print '<tr '.$bc[$var].'>'; |
| 177 | 177 | print '<td>'.$langs->trans("SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE").'</td>'; |
| 178 | 178 | print '<td align="center" width="20"> </td>'; |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | print ajax_constantonoff('SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE'); |
| 181 | 181 | print '</td></tr>'; |
| 182 | 182 | |
| 183 | - $var=!$var; |
|
| 183 | + $var = !$var; |
|
| 184 | 184 | print '<tr '.$bc[$var].'>'; |
| 185 | 185 | print '<td>'.$langs->trans("SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK").'</td>'; |
| 186 | 186 | print '<td align="center" width="20"> </td>'; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | print ajax_constantonoff('SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK'); |
| 189 | 189 | print '</td></tr>'; |
| 190 | 190 | |
| 191 | - $var=!$var; |
|
| 191 | + $var = !$var; |
|
| 192 | 192 | print '<tr '.$bc[$var].'>'; |
| 193 | 193 | print '<td>'.$html->textwithpicto($langs->trans("SUBTOTAL_TEXT_FOR_TITLE_ORDETSTOINVOICE"), $langs->trans("SUBTOTAL_TEXT_FOR_TITLE_ORDETSTOINVOICE_info")).'</td>'; |
| 194 | 194 | print '<td align="center" width="20"> </td>'; |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | print '</form>'; |
| 202 | 202 | print '</td></tr>'; |
| 203 | 203 | |
| 204 | - $var=!$var; |
|
| 204 | + $var = !$var; |
|
| 205 | 205 | print '<tr '.$bc[$var].'>'; |
| 206 | 206 | print '<td>'.$langs->trans("SUBTOTAL_TITLE_STYLE").'</td>'; |
| 207 | 207 | print '<td align="center" width="20"> </td>'; |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | print '</form>'; |
| 215 | 215 | print '</td></tr>'; |
| 216 | 216 | |
| 217 | - $var=!$var; |
|
| 217 | + $var = !$var; |
|
| 218 | 218 | print '<tr '.$bc[$var].'>'; |
| 219 | 219 | print '<td>'.$langs->trans("SUBTOTAL_SUBTOTAL_STYLE").'</td>'; |
| 220 | 220 | print '<td align="center" width="20"> </td>'; |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | print '</form>'; |
| 228 | 228 | print '</td></tr>'; |
| 229 | 229 | |
| 230 | - $var=!$var; |
|
| 230 | + $var = !$var; |
|
| 231 | 231 | print '<tr '.$bc[$var].'>'; |
| 232 | 232 | print '<td>'.$langs->trans("SUBTOTAL_ONE_LINE_IF_HIDE_INNERLINES", $langs->transnoentitiesnoconv('HideInnerLines')).'</td>'; |
| 233 | 233 | print '<td align="center" width="20"> </td>'; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | print ajax_constantonoff('SUBTOTAL_ONE_LINE_IF_HIDE_INNERLINES'); |
| 236 | 236 | print '</td></tr>'; |
| 237 | 237 | |
| 238 | - $var=!$var; |
|
| 238 | + $var = !$var; |
|
| 239 | 239 | print '<tr '.$bc[$var].'>'; |
| 240 | 240 | print '<td>'.$langs->trans("SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES", $langs->transnoentitiesnoconv('HideInnerLines')).'</td>'; |
| 241 | 241 | print '<td align="center" width="20"> </td>'; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | if ((double) DOL_VERSION >= 4.0) |
| 247 | 247 | { |
| 248 | - $var=!$var; |
|
| 248 | + $var = !$var; |
|
| 249 | 249 | print '<tr '.$bc[$var].'>'; |
| 250 | 250 | print '<td>'.$langs->trans("SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS").'</td>'; |
| 251 | 251 | print '<td align="center" width="20"> </td>'; |
@@ -253,12 +253,12 @@ discard block |
||
| 253 | 253 | print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">'; |
| 254 | 254 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
| 255 | 255 | print '<input type="hidden" name="action" value="set_SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS">'; |
| 256 | - print $html->selectyesno("SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS",$conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS,1); |
|
| 256 | + print $html->selectyesno("SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS", $conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS, 1); |
|
| 257 | 257 | print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; |
| 258 | 258 | print '</form>'; |
| 259 | 259 | print '</td></tr>'; |
| 260 | 260 | |
| 261 | - $var=!$var; |
|
| 261 | + $var = !$var; |
|
| 262 | 262 | print '<tr '.$bc[$var].'>'; |
| 263 | 263 | print '<td>'.$langs->trans("SUBTOTAL_TFIELD_TO_KEEP_WITH_NC").'</td>'; |
| 264 | 264 | print '<td align="center" width="20"> </td>'; |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | print '</td></tr>'; |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | - $var=!$var; |
|
| 283 | + $var = !$var; |
|
| 284 | 284 | print '<tr '.$bc[$var].'>'; |
| 285 | 285 | print '<td>'.$langs->trans('SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE').'</td>'; |
| 286 | 286 | print '<td align="center" width="20"> </td>'; |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | print ajax_constantonoff('SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE'); |
| 289 | 289 | print '</td></tr>'; |
| 290 | 290 | |
| 291 | - $var=!$var; |
|
| 291 | + $var = !$var; |
|
| 292 | 292 | print '<tr '.$bc[$var].'>'; |
| 293 | 293 | print '<td>'.$langs->trans('SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE').'</td>'; |
| 294 | 294 | print '<td align="center" width="20"> </td>'; |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | |
| 301 | 301 | |
| 302 | 302 | |
| 303 | - $var=false; |
|
| 303 | + $var = false; |
|
| 304 | 304 | print '<table class="noborder" width="100%">'; |
| 305 | 305 | print '<tr class="liste_titre">'; |
| 306 | 306 | print '<td>'.$langs->trans("RecapGeneration").'</td>'."\n"; |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n"; |
| 309 | 309 | print '</tr>'; |
| 310 | 310 | |
| 311 | - $var=!$var; |
|
| 311 | + $var = !$var; |
|
| 312 | 312 | print '<tr '.$bc[$var].'>'; |
| 313 | 313 | print '<td>'.$langs->trans('SUBTOTAL_KEEP_RECAP_FILE').'</td>'; |
| 314 | 314 | print '<td align="center" width="20"> </td>'; |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | print ajax_constantonoff('SUBTOTAL_KEEP_RECAP_FILE'); |
| 317 | 317 | print '</td></tr>'; |
| 318 | 318 | |
| 319 | - $var=!$var; |
|
| 319 | + $var = !$var; |
|
| 320 | 320 | print '<tr '.$bc[$var].'>'; |
| 321 | 321 | print '<td>'.$langs->trans('SUBTOTAL_PROPAL_ADD_RECAP').'</td>'; |
| 322 | 322 | print '<td align="center" width="20"> </td>'; |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | print ajax_constantonoff('SUBTOTAL_PROPAL_ADD_RECAP'); |
| 325 | 325 | print '</td></tr>'; |
| 326 | 326 | |
| 327 | - $var=!$var; |
|
| 327 | + $var = !$var; |
|
| 328 | 328 | print '<tr '.$bc[$var].'>'; |
| 329 | 329 | print '<td>'.$langs->trans('SUBTOTAL_COMMANDE_ADD_RECAP').'</td>'; |
| 330 | 330 | print '<td align="center" width="20"> </td>'; |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | print '</td></tr>'; |
| 334 | 334 | |
| 335 | 335 | |
| 336 | - $var=!$var; |
|
| 336 | + $var = !$var; |
|
| 337 | 337 | print '<tr '.$bc[$var].'>'; |
| 338 | 338 | print '<td>'.$langs->trans('SUBTOTAL_INVOICE_ADD_RECAP').'</td>'; |
| 339 | 339 | print '<td align="center" width="20"> </td>'; |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | <form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>"> |
| 366 | 366 | <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken'] ?>"> |
| 367 | 367 | <input type="hidden" name="action" value="set_SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY" /> |
| 368 | - <?php echo $html->selectyesno("SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY",$conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY,1); ?> |
|
| 368 | + <?php echo $html->selectyesno("SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY", $conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY, 1); ?> |
|
| 369 | 369 | <input type="submit" class="button" value="<?php echo $langs->trans("Modify") ?>"> |
| 370 | 370 | </form> |
| 371 | 371 | </td> |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | <form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>"> |
| 378 | 378 | <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken'] ?>"> |
| 379 | 379 | <input type="hidden" name="action" value="set_SUBTOTAL_HIDE_DOCUMENT_TOTAL" /> |
| 380 | - <?php echo $html->selectyesno("SUBTOTAL_HIDE_DOCUMENT_TOTAL",$conf->global->SUBTOTAL_HIDE_DOCUMENT_TOTAL,1); ?> |
|
| 380 | + <?php echo $html->selectyesno("SUBTOTAL_HIDE_DOCUMENT_TOTAL", $conf->global->SUBTOTAL_HIDE_DOCUMENT_TOTAL, 1); ?> |
|
| 381 | 381 | <input type="submit" class="button" value="<?php echo $langs->trans("Modify") ?>"> |
| 382 | 382 | </form> |
| 383 | 383 | </td> |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | <form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>"> |
| 391 | 391 | <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken'] ?>"> |
| 392 | 392 | <input type="hidden" name="action" value="set_SUBTOTAL_SHOW_QTY_ON_TITLES" /> |
| 393 | - <?php echo $html->selectyesno("SUBTOTAL_SHOW_QTY_ON_TITLES",$conf->global->SUBTOTAL_SHOW_QTY_ON_TITLES,1); ?> |
|
| 393 | + <?php echo $html->selectyesno("SUBTOTAL_SHOW_QTY_ON_TITLES", $conf->global->SUBTOTAL_SHOW_QTY_ON_TITLES, 1); ?> |
|
| 394 | 394 | <input type="submit" class="button" value="<?php echo $langs->trans("Modify") ?>"> |
| 395 | 395 | </form> |
| 396 | 396 | </td> |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | <form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>"> |
| 403 | 403 | <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken'] ?>"> |
| 404 | 404 | <input type="hidden" name="action" value="set_SUBTOTAL_ONLY_HIDE_SUBPRODUCTS_PRICES" /> |
| 405 | - <?php echo $html->selectyesno("SUBTOTAL_ONLY_HIDE_SUBPRODUCTS_PRICES",$conf->global->SUBTOTAL_ONLY_HIDE_SUBPRODUCTS_PRICES,1); ?> |
|
| 405 | + <?php echo $html->selectyesno("SUBTOTAL_ONLY_HIDE_SUBPRODUCTS_PRICES", $conf->global->SUBTOTAL_ONLY_HIDE_SUBPRODUCTS_PRICES, 1); ?> |
|
| 406 | 406 | <input type="submit" class="button" value="<?php echo $langs->trans("Modify") ?>"> |
| 407 | 407 | </form> |
| 408 | 408 | </td> |
@@ -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 | } |
@@ -2015,13 +2015,13 @@ discard block |
||
| 2015 | 2015 | |
| 2016 | 2016 | $line = $originline; |
| 2017 | 2017 | } |
| 2018 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 2019 | - else $idvar='id'; |
|
| 2020 | - if($line->special_code!=$this->module_number || $line->product_type!=9) { |
|
| 2021 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE) && $object->element !== 'invoice_supplier') |
|
| 2018 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
| 2019 | + else $idvar = 'id'; |
|
| 2020 | + if ($line->special_code != $this->module_number || $line->product_type != 9) { |
|
| 2021 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE) && $object->element !== 'invoice_supplier') |
|
| 2022 | 2022 | { |
| 2023 | - if(!(TSubtotal::isModSubtotalLine($line)) && ( $line->fk_prev_id === null ) && !($action == "editline" && GETPOST('lineid') == $line->id)) { |
|
| 2024 | - echo '<a name="duplicate-'.$line->id.'" href="' . $_SERVER['PHP_SELF'] . '?' . $idvar . '=' . $object->id . '&action=duplicate&lineid=' . $line->id . '"><i class="fa fa-clone" aria-hidden="true"></i></a>'; |
|
| 2023 | + if (!(TSubtotal::isModSubtotalLine($line)) && ($line->fk_prev_id === null) && !($action == "editline" && GETPOST('lineid') == $line->id)) { |
|
| 2024 | + echo '<a name="duplicate-'.$line->id.'" href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'"><i class="fa fa-clone" aria-hidden="true"></i></a>'; |
|
| 2025 | 2025 | |
| 2026 | 2026 | ?> |
| 2027 | 2027 | <script type="text/javascript"> |
@@ -2035,11 +2035,11 @@ discard block |
||
| 2035 | 2035 | } |
| 2036 | 2036 | return 0; |
| 2037 | 2037 | } |
| 2038 | - 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)) |
|
| 2038 | + 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)) |
|
| 2039 | 2039 | { |
| 2040 | 2040 | |
| 2041 | 2041 | |
| 2042 | - if((float)DOL_VERSION <= 3.4) |
|
| 2042 | + if ((float) DOL_VERSION <= 3.4) |
|
| 2043 | 2043 | { |
| 2044 | 2044 | ?> |
| 2045 | 2045 | <script type="text/javascript"> |
@@ -2063,22 +2063,22 @@ discard block |
||
| 2063 | 2063 | <?php |
| 2064 | 2064 | } |
| 2065 | 2065 | |
| 2066 | - if(empty($line->description)) $line->description = $line->desc; |
|
| 2066 | + if (empty($line->description)) $line->description = $line->desc; |
|
| 2067 | 2067 | |
| 2068 | 2068 | $colspan = 5; |
| 2069 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
| 2070 | - if($object->element == 'order_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 3 : $colspan = 6; |
|
| 2071 | - if($object->element == 'invoice_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 4: $colspan = 7; |
|
| 2072 | - if($object->element == 'supplier_proposal') (float) DOL_VERSION < 6.0 ? $colspan = 4 : $colspan = 3; |
|
| 2073 | - if(!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) { |
|
| 2069 | + if ($object->element == 'facturerec') $colspan = 3; |
|
| 2070 | + if ($object->element == 'order_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 3 : $colspan = 6; |
|
| 2071 | + if ($object->element == 'invoice_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 4 : $colspan = 7; |
|
| 2072 | + if ($object->element == 'supplier_proposal') (float) DOL_VERSION < 6.0 ? $colspan = 4 : $colspan = 3; |
|
| 2073 | + if (!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) { |
|
| 2074 | 2074 | $colspan++; // Colonne PU Devise |
| 2075 | 2075 | } |
| 2076 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
| 2077 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
| 2078 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
| 2079 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
| 2080 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
| 2081 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
| 2076 | + if ($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
| 2077 | + if (!empty($conf->margin->enabled)) $colspan++; |
|
| 2078 | + if (!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
| 2079 | + if (!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
| 2080 | + if ($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
| 2081 | + if (!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
| 2082 | 2082 | |
| 2083 | 2083 | /* Titre */ |
| 2084 | 2084 | //var_dump($line); |
@@ -2088,39 +2088,39 @@ discard block |
||
| 2088 | 2088 | |
| 2089 | 2089 | |
| 2090 | 2090 | ?> |
| 2091 | - <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
| 2091 | + <tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
| 2092 | 2092 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 2093 | 2093 | { |
| 2094 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 2095 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2096 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 2097 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 2098 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 2099 | - else if($line->qty==50) print ''; |
|
| 2094 | + if ($line->qty == 99) print 'background:#adadcf'; |
|
| 2095 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
| 2096 | + else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;'; |
|
| 2097 | + else if ($line->qty == 1) print 'background:#adadcf;'; |
|
| 2098 | + else if ($line->qty == 2) print 'background:#ddddff;'; |
|
| 2099 | + else if ($line->qty == 50) print ''; |
|
| 2100 | 2100 | else print 'background:#eeeeff;'; |
| 2101 | 2101 | |
| 2102 | 2102 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 2103 | 2103 | } |
| 2104 | 2104 | else |
| 2105 | 2105 | { |
| 2106 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 2107 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2108 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 2109 | - else if($line->qty==50) print ''; |
|
| 2110 | - else print 'background:#eeffee;' ; |
|
| 2106 | + if ($line->qty == 99) print 'background:#ddffdd'; |
|
| 2107 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
| 2108 | + else if ($line->qty == 2) print 'background:#eeeeff; '; |
|
| 2109 | + else if ($line->qty == 50) print ''; |
|
| 2110 | + else print 'background:#eeffee;'; |
|
| 2111 | 2111 | } |
| 2112 | 2112 | |
| 2113 | 2113 | ?>;"> |
| 2114 | 2114 | |
| 2115 | - <?php if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> |
|
| 2115 | + <?php if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> |
|
| 2116 | 2116 | <td class="linecolnum"><?php echo $i + 1; ?></td> |
| 2117 | 2117 | <?php } ?> |
| 2118 | 2118 | |
| 2119 | - <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php |
|
| 2120 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
| 2119 | + <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php |
|
| 2120 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
| 2121 | 2121 | |
| 2122 | - $params=array('line'=>$line); |
|
| 2123 | - $reshook=$hookmanager->executeHooks('formEditProductOptions',$params,$object,$action); |
|
| 2122 | + $params = array('line'=>$line); |
|
| 2123 | + $reshook = $hookmanager->executeHooks('formEditProductOptions', $params, $object, $action); |
|
| 2124 | 2124 | |
| 2125 | 2125 | echo '<div id="line_'.$line->id.'"></div>'; // Imitation Dolibarr |
| 2126 | 2126 | echo '<input type="hidden" value="'.$line->id.'" name="lineid">'; |
@@ -2128,7 +2128,7 @@ discard block |
||
| 2128 | 2128 | echo '<input id="product_id" type="hidden" value="'.$line->fk_product.'" name="type">'; |
| 2129 | 2129 | echo '<input id="special_code" type="hidden" value="'.$line->special_code.'" name="type">'; |
| 2130 | 2130 | |
| 2131 | - $isFreeText=false; |
|
| 2131 | + $isFreeText = false; |
|
| 2132 | 2132 | if (TSubtotal::isTitle($line)) |
| 2133 | 2133 | { |
| 2134 | 2134 | $qty_displayed = $line->qty; |
@@ -2150,13 +2150,13 @@ discard block |
||
| 2150 | 2150 | $line->description = ''; |
| 2151 | 2151 | } |
| 2152 | 2152 | $newlabel = $line->label; |
| 2153 | - if($line->label=='' && !$isFreeText) { |
|
| 2154 | - if(TSubtotal::isSubtotal($line)) { |
|
| 2153 | + if ($line->label == '' && !$isFreeText) { |
|
| 2154 | + if (TSubtotal::isSubtotal($line)) { |
|
| 2155 | 2155 | $newlabel = $line->description.' '.$this->getTitle($object, $line); |
| 2156 | - $line->description=''; |
|
| 2157 | - } elseif( (float)DOL_VERSION < 6 ) { |
|
| 2158 | - $newlabel= $line->description; |
|
| 2159 | - $line->description=''; |
|
| 2156 | + $line->description = ''; |
|
| 2157 | + } elseif ((float) DOL_VERSION < 6) { |
|
| 2158 | + $newlabel = $line->description; |
|
| 2159 | + $line->description = ''; |
|
| 2160 | 2160 | } |
| 2161 | 2161 | } |
| 2162 | 2162 | |
@@ -2165,10 +2165,10 @@ discard block |
||
| 2165 | 2165 | |
| 2166 | 2166 | if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
| 2167 | 2167 | |
| 2168 | - if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
|
| 2168 | + if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line))) |
|
| 2169 | 2169 | { |
| 2170 | 2170 | $select = '<select name="subtotal_level">'; |
| 2171 | - for ($j=1; $j<10; $j++) |
|
| 2171 | + for ($j = 1; $j < 10; $j++) |
|
| 2172 | 2172 | { |
| 2173 | 2173 | if (!empty($readonlyForSituation)) { |
| 2174 | 2174 | if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
@@ -2182,7 +2182,7 @@ discard block |
||
| 2182 | 2182 | |
| 2183 | 2183 | echo '<div class="subtotal_underline" style="margin-left:24px; line-height: 25px;">'; |
| 2184 | 2184 | echo '<div>'; |
| 2185 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2185 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '').' /> '; |
|
| 2186 | 2186 | echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>'; |
| 2187 | 2187 | echo '</div>'; |
| 2188 | 2188 | |
@@ -2203,21 +2203,21 @@ discard block |
||
| 2203 | 2203 | echo '</div>'; |
| 2204 | 2204 | } |
| 2205 | 2205 | echo '<div>'; |
| 2206 | - 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"' : '') .' /> '; |
|
| 2206 | + 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"' : '').' /> '; |
|
| 2207 | 2207 | echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>'; |
| 2208 | 2208 | echo '</div>'; |
| 2209 | 2209 | |
| 2210 | 2210 | echo '<div>'; |
| 2211 | - 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"' : '') .' /> '; |
|
| 2211 | + 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"' : '').' /> '; |
|
| 2212 | 2212 | echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
| 2213 | 2213 | echo '</div>'; |
| 2214 | 2214 | } |
| 2215 | 2215 | else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
| 2216 | 2216 | echo '</div>'; |
| 2217 | 2217 | |
| 2218 | - if($line->qty<10) { |
|
| 2218 | + if ($line->qty < 10) { |
|
| 2219 | 2219 | // WYSIWYG editor |
| 2220 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
| 2220 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
| 2221 | 2221 | $nbrows = ROWS_2; |
| 2222 | 2222 | $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
| 2223 | 2223 | if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
@@ -2237,25 +2237,25 @@ discard block |
||
| 2237 | 2237 | |
| 2238 | 2238 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
| 2239 | 2239 | { |
| 2240 | - if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
| 2240 | + if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
| 2241 | 2241 | { |
| 2242 | - echo str_repeat(' ', $line->qty-1); |
|
| 2242 | + echo str_repeat(' ', $line->qty - 1); |
|
| 2243 | 2243 | |
| 2244 | 2244 | if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
| 2245 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2245 | + else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span> '; |
|
| 2246 | 2246 | } |
| 2247 | 2247 | } |
| 2248 | 2248 | else |
| 2249 | 2249 | { |
| 2250 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2251 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2250 | + if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal'); |
|
| 2251 | + else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2252 | 2252 | } |
| 2253 | 2253 | |
| 2254 | 2254 | |
| 2255 | 2255 | // Get display styles and apply them |
| 2256 | 2256 | $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;'; |
| 2257 | - $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
| 2258 | - $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
| 2257 | + $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
| 2258 | + $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
| 2259 | 2259 | |
| 2260 | 2260 | if (empty($line->label)) { |
| 2261 | 2261 | if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
@@ -2263,16 +2263,16 @@ discard block |
||
| 2263 | 2263 | } |
| 2264 | 2264 | else { |
| 2265 | 2265 | |
| 2266 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
| 2266 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
| 2267 | 2267 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2268 | 2268 | } |
| 2269 | - else{ |
|
| 2269 | + else { |
|
| 2270 | 2270 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2271 | 2271 | } |
| 2272 | 2272 | |
| 2273 | 2273 | } |
| 2274 | - if($line->qty>90) print ' : '; |
|
| 2275 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2274 | + if ($line->qty > 90) print ' : '; |
|
| 2275 | + if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2276 | 2276 | |
| 2277 | 2277 | |
| 2278 | 2278 | |
@@ -2281,7 +2281,7 @@ discard block |
||
| 2281 | 2281 | ?></td> |
| 2282 | 2282 | |
| 2283 | 2283 | <?php |
| 2284 | - if($line->qty>90) { |
|
| 2284 | + if ($line->qty > 90) { |
|
| 2285 | 2285 | /* Total */ |
| 2286 | 2286 | $total_line = $this->getTotalLineFromObject($object, $line, ''); |
| 2287 | 2287 | echo '<td class="linecolht nowrap" align="right" style="font-weight:bold;" rel="subtotal_total">'.price($total_line).'</td>'; |
@@ -2300,7 +2300,7 @@ discard block |
||
| 2300 | 2300 | <?php |
| 2301 | 2301 | if ($action != 'selectlines') { |
| 2302 | 2302 | |
| 2303 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
| 2303 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
| 2304 | 2304 | ?> |
| 2305 | 2305 | <input id="savelinebutton" class="button" type="submit" name="save" value="<?php echo $langs->trans('Save') ?>" /> |
| 2306 | 2306 | <br /> |
@@ -2316,13 +2316,13 @@ discard block |
||
| 2316 | 2316 | <?php |
| 2317 | 2317 | |
| 2318 | 2318 | } |
| 2319 | - else{ |
|
| 2320 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
| 2319 | + else { |
|
| 2320 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
| 2321 | 2321 | { |
| 2322 | - 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>'; |
|
| 2322 | + 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>'; |
|
| 2323 | 2323 | } |
| 2324 | 2324 | |
| 2325 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
| 2325 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
| 2326 | 2326 | { |
| 2327 | 2327 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=editline&lineid='.$line->id.'">'.img_edit().'</a>'; |
| 2328 | 2328 | } |
@@ -2337,7 +2337,7 @@ discard block |
||
| 2337 | 2337 | <?php |
| 2338 | 2338 | |
| 2339 | 2339 | if ($action != 'editline' && $action != 'selectlines') { |
| 2340 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
| 2340 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
| 2341 | 2341 | { |
| 2342 | 2342 | |
| 2343 | 2343 | if ($line->fk_prev_id === null) |
@@ -2345,12 +2345,12 @@ discard block |
||
| 2345 | 2345 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteline&lineid='.$line->id.'">'.img_delete().'</a>'; |
| 2346 | 2346 | } |
| 2347 | 2347 | |
| 2348 | - if(TSubtotal::isTitle($line) && ($line->fk_prev_id === null) ) |
|
| 2348 | + if (TSubtotal::isTitle($line) && ($line->fk_prev_id === null)) |
|
| 2349 | 2349 | { |
| 2350 | 2350 | if ((float) DOL_VERSION >= 8.0) { |
| 2351 | 2351 | $img_delete = img_delete($langs->trans('deleteWithAllLines'), ' class="pictodelete pictodeleteallline"'); |
| 2352 | 2352 | } elseif ((float) DOL_VERSION >= 3.8) { |
| 2353 | - $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal',' class="pictodelete" '); |
|
| 2353 | + $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal', ' class="pictodelete" '); |
|
| 2354 | 2354 | } else { |
| 2355 | 2355 | $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all@subtotal'); |
| 2356 | 2356 | } |
@@ -2360,7 +2360,7 @@ discard block |
||
| 2360 | 2360 | /* Depuis la 8.0, les icônes "standard" utilisent FontAwesome et sont préconfigurées selon la clé de l'image |
| 2361 | 2361 | * Impossible d'en customiser par exemple la couleur, même en utilisant img_picto() directement |
| 2362 | 2362 | */ |
| 2363 | - if((float) DOL_VERSION >= 8.0) { |
|
| 2363 | + if ((float) DOL_VERSION >= 8.0) { |
|
| 2364 | 2364 | ?> |
| 2365 | 2365 | <script> |
| 2366 | 2366 | $(document).ready(function () { |
@@ -2376,7 +2376,7 @@ discard block |
||
| 2376 | 2376 | </td> |
| 2377 | 2377 | |
| 2378 | 2378 | <?php |
| 2379 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
| 2379 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
| 2380 | 2380 | { |
| 2381 | 2381 | echo '<td class="subtotal_nc">'; |
| 2382 | 2382 | 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"' : '').' />'; |
@@ -2387,12 +2387,12 @@ discard block |
||
| 2387 | 2387 | <td align="center" class="linecolmove tdlineupdown"> |
| 2388 | 2388 | </td> |
| 2389 | 2389 | <?php } else { ?> |
| 2390 | - <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight ))?' class="tdlineupdown"':''); ?>></td> |
|
| 2390 | + <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight)) ? ' class="tdlineupdown"' : ''); ?>></td> |
|
| 2391 | 2391 | <?php } ?> |
| 2392 | 2392 | |
| 2393 | 2393 | |
| 2394 | - <?php if($action == 'selectlines'){ // dolibarr 8 ?> |
|
| 2395 | - <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
| 2394 | + <?php if ($action == 'selectlines') { // dolibarr 8 ?> |
|
| 2395 | + <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i + 1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
| 2396 | 2396 | <?php } ?> |
| 2397 | 2397 | |
| 2398 | 2398 | </tr> |
@@ -2400,29 +2400,29 @@ discard block |
||
| 2400 | 2400 | |
| 2401 | 2401 | |
| 2402 | 2402 | // Affichage des extrafields à la Dolibarr (car sinon non affiché sur les titres) |
| 2403 | - if(TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
| 2403 | + if (TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
| 2404 | 2404 | |
| 2405 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
| 2405 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
| 2406 | 2406 | |
| 2407 | 2407 | // Extrafields |
| 2408 | 2408 | $extrafieldsline = new ExtraFields($db); |
| 2409 | 2409 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
| 2410 | 2410 | |
| 2411 | - $colspan+=3; $mode = 'view'; |
|
| 2412 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
| 2411 | + $colspan += 3; $mode = 'view'; |
|
| 2412 | + if ($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
| 2413 | 2413 | |
| 2414 | 2414 | $ex_element = $line->element; |
| 2415 | 2415 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
| 2416 | - print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ','colspan'=>$colspan)); |
|
| 2416 | + print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ', 'colspan'=>$colspan)); |
|
| 2417 | 2417 | $isExtraSelected = false; |
| 2418 | - foreach($line->array_options as $option) { |
|
| 2419 | - if(!empty($option) && $option != "-1") { |
|
| 2418 | + foreach ($line->array_options as $option) { |
|
| 2419 | + if (!empty($option) && $option != "-1") { |
|
| 2420 | 2420 | $isExtraSelected = true; |
| 2421 | 2421 | break; |
| 2422 | 2422 | } |
| 2423 | 2423 | } |
| 2424 | 2424 | |
| 2425 | - if($mode === 'edit') { |
|
| 2425 | + if ($mode === 'edit') { |
|
| 2426 | 2426 | ?> |
| 2427 | 2427 | <script> |
| 2428 | 2428 | $(document).ready(function(){ |
@@ -2430,7 +2430,7 @@ discard block |
||
| 2430 | 2430 | var all_tr_extrafields = $("tr.tr_extrafield_title"); |
| 2431 | 2431 | <?php |
| 2432 | 2432 | // Si un extrafield est rempli alors on affiche directement les extrafields |
| 2433 | - if(!$isExtraSelected) { |
|
| 2433 | + if (!$isExtraSelected) { |
|
| 2434 | 2434 | echo 'all_tr_extrafields.hide();'; |
| 2435 | 2435 | echo 'var trad = "'.$langs->trans('showExtrafields').'";'; |
| 2436 | 2436 | echo 'var extra = 0;'; |
@@ -2469,61 +2469,61 @@ discard block |
||
| 2469 | 2469 | return 1; |
| 2470 | 2470 | |
| 2471 | 2471 | } |
| 2472 | - elseif(($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) || (in_array('expeditioncard', $contexts) && $action == 'create')) |
|
| 2472 | + elseif (($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) || (in_array('expeditioncard', $contexts) && $action == 'create')) |
|
| 2473 | 2473 | { |
| 2474 | 2474 | $colspan = 4; |
| 2475 | 2475 | |
| 2476 | 2476 | // HTML 5 data for js |
| 2477 | 2477 | $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
| 2478 | 2478 | ?> |
| 2479 | - <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
| 2479 | + <tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
| 2480 | 2480 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 2481 | 2481 | { |
| 2482 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 2483 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2484 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 2485 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 2486 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 2487 | - else if($line->qty==50) print ''; |
|
| 2482 | + if ($line->qty == 99) print 'background:#adadcf'; |
|
| 2483 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
| 2484 | + else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;'; |
|
| 2485 | + else if ($line->qty == 1) print 'background:#adadcf;'; |
|
| 2486 | + else if ($line->qty == 2) print 'background:#ddddff;'; |
|
| 2487 | + else if ($line->qty == 50) print ''; |
|
| 2488 | 2488 | else print 'background:#eeeeff;'; |
| 2489 | 2489 | |
| 2490 | 2490 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 2491 | 2491 | } |
| 2492 | 2492 | else |
| 2493 | 2493 | { |
| 2494 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 2495 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2496 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 2497 | - else if($line->qty==50) print ''; |
|
| 2498 | - else print 'background:#eeffee;' ; |
|
| 2494 | + if ($line->qty == 99) print 'background:#ddffdd'; |
|
| 2495 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
| 2496 | + else if ($line->qty == 2) print 'background:#eeeeff; '; |
|
| 2497 | + else if ($line->qty == 50) print ''; |
|
| 2498 | + else print 'background:#eeffee;'; |
|
| 2499 | 2499 | } |
| 2500 | 2500 | |
| 2501 | 2501 | ?>;"> |
| 2502 | 2502 | |
| 2503 | - <td style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php |
|
| 2503 | + <td style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php |
|
| 2504 | 2504 | |
| 2505 | 2505 | |
| 2506 | 2506 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
| 2507 | 2507 | { |
| 2508 | - if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
| 2508 | + if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
| 2509 | 2509 | { |
| 2510 | - echo str_repeat(' ', $line->qty-1); |
|
| 2510 | + echo str_repeat(' ', $line->qty - 1); |
|
| 2511 | 2511 | |
| 2512 | 2512 | if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
| 2513 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2513 | + else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span> '; |
|
| 2514 | 2514 | } |
| 2515 | 2515 | } |
| 2516 | 2516 | else |
| 2517 | 2517 | { |
| 2518 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2519 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2518 | + if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal'); |
|
| 2519 | + else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2520 | 2520 | } |
| 2521 | 2521 | |
| 2522 | 2522 | |
| 2523 | 2523 | // Get display styles and apply them |
| 2524 | 2524 | $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;'; |
| 2525 | - $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
| 2526 | - $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
| 2525 | + $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
| 2526 | + $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
| 2527 | 2527 | |
| 2528 | 2528 | if (empty($line->label)) { |
| 2529 | 2529 | if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
@@ -2531,22 +2531,22 @@ discard block |
||
| 2531 | 2531 | } |
| 2532 | 2532 | else { |
| 2533 | 2533 | |
| 2534 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
| 2534 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
| 2535 | 2535 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2536 | 2536 | } |
| 2537 | - else{ |
|
| 2537 | + else { |
|
| 2538 | 2538 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2539 | 2539 | } |
| 2540 | 2540 | |
| 2541 | 2541 | } |
| 2542 | 2542 | //if($line->qty>90) print ' : '; |
| 2543 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2543 | + if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2544 | 2544 | |
| 2545 | 2545 | ?> |
| 2546 | 2546 | </td> |
| 2547 | 2547 | <td colspan="<?php echo $colspan; ?>"> |
| 2548 | 2548 | <?php |
| 2549 | - if(in_array('expeditioncard', $contexts) && $action == 'create') |
|
| 2549 | + if (in_array('expeditioncard', $contexts) && $action == 'create') |
|
| 2550 | 2550 | { |
| 2551 | 2551 | $fk_entrepot = GETPOST('entrepot_id', 'int'); |
| 2552 | 2552 | ?> |
@@ -2573,100 +2573,100 @@ discard block |
||
| 2573 | 2573 | $shipment_static = new Expedition($db); |
| 2574 | 2574 | $warehousestatic = new Entrepot($db); |
| 2575 | 2575 | $extrafieldsline = new ExtraFields($db); |
| 2576 | - $extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
|
| 2576 | + $extralabelslines = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
|
| 2577 | 2577 | |
| 2578 | 2578 | $colspan = 4; |
| 2579 | - if($object->origin && $object->origin_id > 0) $colspan++; |
|
| 2580 | - if(! empty($conf->stock->enabled)) $colspan++; |
|
| 2581 | - if(! empty($conf->productbatch->enabled)) $colspan++; |
|
| 2582 | - if($object->statut == 0) $colspan++; |
|
| 2583 | - if($object->statut == 0 && empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) $colspan++; |
|
| 2579 | + if ($object->origin && $object->origin_id > 0) $colspan++; |
|
| 2580 | + if (!empty($conf->stock->enabled)) $colspan++; |
|
| 2581 | + if (!empty($conf->productbatch->enabled)) $colspan++; |
|
| 2582 | + if ($object->statut == 0) $colspan++; |
|
| 2583 | + if ($object->statut == 0 && empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) $colspan++; |
|
| 2584 | 2584 | |
| 2585 | - if($object->element == 'delivery') $colspan = 2; |
|
| 2585 | + if ($object->element == 'delivery') $colspan = 2; |
|
| 2586 | 2586 | |
| 2587 | 2587 | print '<!-- origin line id = '.$line->origin_line_id.' -->'; // id of order line |
| 2588 | 2588 | |
| 2589 | 2589 | // HTML 5 data for js |
| 2590 | 2590 | $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
| 2591 | 2591 | ?> |
| 2592 | - <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
| 2592 | + <tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
| 2593 | 2593 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 2594 | 2594 | { |
| 2595 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 2596 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2597 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 2598 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 2599 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 2600 | - else if($line->qty==50) print ''; |
|
| 2595 | + if ($line->qty == 99) print 'background:#adadcf'; |
|
| 2596 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
| 2597 | + else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;'; |
|
| 2598 | + else if ($line->qty == 1) print 'background:#adadcf;'; |
|
| 2599 | + else if ($line->qty == 2) print 'background:#ddddff;'; |
|
| 2600 | + else if ($line->qty == 50) print ''; |
|
| 2601 | 2601 | else print 'background:#eeeeff;'; |
| 2602 | 2602 | |
| 2603 | 2603 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 2604 | 2604 | } |
| 2605 | 2605 | else |
| 2606 | 2606 | { |
| 2607 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 2608 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2609 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 2610 | - else if($line->qty==50) print ''; |
|
| 2611 | - else print 'background:#eeffee;' ; |
|
| 2607 | + if ($line->qty == 99) print 'background:#ddffdd'; |
|
| 2608 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
| 2609 | + else if ($line->qty == 2) print 'background:#eeeeff; '; |
|
| 2610 | + else if ($line->qty == 50) print ''; |
|
| 2611 | + else print 'background:#eeffee;'; |
|
| 2612 | 2612 | } |
| 2613 | 2613 | |
| 2614 | 2614 | ?>;"> |
| 2615 | 2615 | |
| 2616 | 2616 | <?php |
| 2617 | 2617 | // # |
| 2618 | - if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) |
|
| 2618 | + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) |
|
| 2619 | 2619 | { |
| 2620 | - print '<td align="center">'.($i+1).'</td>'; |
|
| 2620 | + print '<td align="center">'.($i + 1).'</td>'; |
|
| 2621 | 2621 | } |
| 2622 | 2622 | ?> |
| 2623 | 2623 | |
| 2624 | - <td style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php |
|
| 2624 | + <td style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php |
|
| 2625 | 2625 | |
| 2626 | 2626 | |
| 2627 | 2627 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
| 2628 | 2628 | { |
| 2629 | - if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
| 2629 | + if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
| 2630 | 2630 | { |
| 2631 | - echo str_repeat(' ', $line->qty-1); |
|
| 2631 | + echo str_repeat(' ', $line->qty - 1); |
|
| 2632 | 2632 | |
| 2633 | 2633 | if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
| 2634 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2634 | + else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span> '; |
|
| 2635 | 2635 | } |
| 2636 | 2636 | } |
| 2637 | 2637 | else |
| 2638 | 2638 | { |
| 2639 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2640 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2639 | + if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal'); |
|
| 2640 | + else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2641 | 2641 | } |
| 2642 | 2642 | |
| 2643 | 2643 | |
| 2644 | 2644 | // Get display styles and apply them |
| 2645 | 2645 | $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;'; |
| 2646 | - $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
| 2647 | - $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
| 2646 | + $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
| 2647 | + $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
| 2648 | 2648 | |
| 2649 | 2649 | if (empty($line->label)) { |
| 2650 | 2650 | if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
| 2651 | 2651 | else print $line->description; |
| 2652 | 2652 | } |
| 2653 | 2653 | else { |
| 2654 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
| 2654 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
| 2655 | 2655 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2656 | 2656 | } |
| 2657 | - else{ |
|
| 2657 | + else { |
|
| 2658 | 2658 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2659 | 2659 | } |
| 2660 | 2660 | } |
| 2661 | 2661 | //if($line->qty>90) print ' : '; |
| 2662 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2662 | + if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2663 | 2663 | |
| 2664 | 2664 | ?> |
| 2665 | 2665 | </td> |
| 2666 | 2666 | <td colspan="<?php echo $colspan; ?>"> </td> |
| 2667 | 2667 | <?php |
| 2668 | 2668 | |
| 2669 | - if ($object->element == 'shipping' && $object->statut == 0 && ! empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
| 2669 | + if ($object->element == 'shipping' && $object->statut == 0 && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
| 2670 | 2670 | { |
| 2671 | 2671 | print '<td class="linecoldelete nowrap" width="10">'; |
| 2672 | 2672 | |
@@ -2675,12 +2675,12 @@ discard block |
||
| 2675 | 2675 | echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=deleteline&lineid='.$line->id.'">'.img_delete().'</a>'; |
| 2676 | 2676 | } |
| 2677 | 2677 | |
| 2678 | - if(TSubtotal::isTitle($line) && ($line->fk_prev_id === null) ) |
|
| 2678 | + if (TSubtotal::isTitle($line) && ($line->fk_prev_id === null)) |
|
| 2679 | 2679 | { |
| 2680 | 2680 | if ((float) DOL_VERSION >= 8.0) { |
| 2681 | 2681 | $img_delete = img_delete($langs->trans('deleteWithAllLines'), ' class="pictodelete pictodeleteallline"'); |
| 2682 | 2682 | } elseif ((float) DOL_VERSION >= 3.8) { |
| 2683 | - $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal',' class="pictodelete" '); |
|
| 2683 | + $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal', ' class="pictodelete" '); |
|
| 2684 | 2684 | } else { |
| 2685 | 2685 | $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all@subtotal'); |
| 2686 | 2686 | } |
@@ -2690,7 +2690,7 @@ discard block |
||
| 2690 | 2690 | /* Depuis la 8.0, les icônes "standard" utilisent FontAwesome et sont préconfigurées selon la clé de l'image |
| 2691 | 2691 | * Impossible d'en customiser par exemple la couleur, même en utilisant img_picto() directement |
| 2692 | 2692 | */ |
| 2693 | - if((float) DOL_VERSION >= 8.0) { |
|
| 2693 | + if ((float) DOL_VERSION >= 8.0) { |
|
| 2694 | 2694 | ?> |
| 2695 | 2695 | <script> |
| 2696 | 2696 | $(document).ready(function () { |
@@ -2708,11 +2708,11 @@ discard block |
||
| 2708 | 2708 | print "</tr>"; |
| 2709 | 2709 | |
| 2710 | 2710 | // Display lines extrafields |
| 2711 | - if ($object->element == 'shipping' && ! empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE) && is_array($extralabelslines) && count($extralabelslines)>0) { |
|
| 2711 | + if ($object->element == 'shipping' && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE) && is_array($extralabelslines) && count($extralabelslines) > 0) { |
|
| 2712 | 2712 | $line = new ExpeditionLigne($db); |
| 2713 | 2713 | $line->fetch_optionals($line->id); |
| 2714 | 2714 | print '<tr class="oddeven">'; |
| 2715 | - print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan),$i); |
|
| 2715 | + print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan), $i); |
|
| 2716 | 2716 | } |
| 2717 | 2717 | |
| 2718 | 2718 | return 1; |
@@ -2724,20 +2724,20 @@ discard block |
||
| 2724 | 2724 | |
| 2725 | 2725 | |
| 2726 | 2726 | function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) { |
| 2727 | - global $conf,$langs; |
|
| 2727 | + global $conf, $langs; |
|
| 2728 | 2728 | |
| 2729 | 2729 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
| 2730 | 2730 | { |
| 2731 | 2731 | |
| 2732 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
| 2732 | + if ($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
| 2733 | 2733 | { |
| 2734 | 2734 | foreach ($object->lines as $line) |
| 2735 | 2735 | { |
| 2736 | 2736 | // fetch optionals attributes and labels |
| 2737 | 2737 | require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
| 2738 | - $extrafields=new ExtraFields($this->db); |
|
| 2739 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
| 2740 | - $line->fetch_optionals($line->id,$extralabels); |
|
| 2738 | + $extrafields = new ExtraFields($this->db); |
|
| 2739 | + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element_line, true); |
|
| 2740 | + $line->fetch_optionals($line->id, $extralabels); |
|
| 2741 | 2741 | } |
| 2742 | 2742 | } |
| 2743 | 2743 | |
@@ -2837,23 +2837,23 @@ discard block |
||
| 2837 | 2837 | $ThtmlData['data-qty'] = 0; //$line->qty; |
| 2838 | 2838 | $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
| 2839 | 2839 | |
| 2840 | - if(TSubtotal::isTitle($line)){ |
|
| 2840 | + if (TSubtotal::isTitle($line)) { |
|
| 2841 | 2841 | $ThtmlData['data-issubtotal'] = 'title'; |
| 2842 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2842 | + }elseif (TSubtotal::isSubtotal($line)) { |
|
| 2843 | 2843 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
| 2844 | 2844 | } |
| 2845 | - else{ |
|
| 2845 | + else { |
|
| 2846 | 2846 | $ThtmlData['data-issubtotal'] = 'freetext'; |
| 2847 | 2847 | } |
| 2848 | 2848 | |
| 2849 | 2849 | |
| 2850 | 2850 | // Change or add data from hooks |
| 2851 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
| 2851 | + $parameters = array_replace($parameters, array('ThtmlData' => $ThtmlData)); |
|
| 2852 | 2852 | |
| 2853 | 2853 | // hook |
| 2854 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
| 2854 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 2855 | 2855 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 2856 | - if ($reshook>0) |
|
| 2856 | + if ($reshook > 0) |
|
| 2857 | 2857 | { |
| 2858 | 2858 | $ThtmlData = $hookmanager->resArray; |
| 2859 | 2859 | } |
@@ -2866,14 +2866,14 @@ discard block |
||
| 2866 | 2866 | function implodeHtmlData($ThtmlData = array()) |
| 2867 | 2867 | { |
| 2868 | 2868 | $data = ''; |
| 2869 | - foreach($ThtmlData as $k => $h ) |
|
| 2869 | + foreach ($ThtmlData as $k => $h) |
|
| 2870 | 2870 | { |
| 2871 | - if(is_array($h)) |
|
| 2871 | + if (is_array($h)) |
|
| 2872 | 2872 | { |
| 2873 | 2873 | $h = json_encode($h); |
| 2874 | 2874 | } |
| 2875 | 2875 | |
| 2876 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2876 | + $data .= $k.'="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2877 | 2877 | } |
| 2878 | 2878 | |
| 2879 | 2879 | return $data; |
@@ -2881,26 +2881,26 @@ discard block |
||
| 2881 | 2881 | |
| 2882 | 2882 | function _ajax_block_order_js($object) |
| 2883 | 2883 | { |
| 2884 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
| 2884 | + global $conf, $tagidfortablednd, $filepath, $langs; |
|
| 2885 | 2885 | |
| 2886 | 2886 | /* |
| 2887 | 2887 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
| 2888 | 2888 | * for compatibility reasons we don't use tableDnD but jquery sortable |
| 2889 | 2889 | */ |
| 2890 | 2890 | |
| 2891 | - $id=$object->id; |
|
| 2892 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
| 2893 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
| 2891 | + $id = $object->id; |
|
| 2892 | + $nboflines = (isset($object->lines) ?count($object->lines) : 0); |
|
| 2893 | + $forcereloadpage = empty($conf->global->MAIN_FORCE_RELOAD_PAGE) ? 0 : 1; |
|
| 2894 | 2894 | |
| 2895 | - $id=$object->id; |
|
| 2896 | - $fk_element=$object->fk_element; |
|
| 2897 | - $table_element_line=$object->table_element_line; |
|
| 2898 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
| 2899 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
| 2900 | - $filepath=(empty($filepath)?'':$filepath); |
|
| 2895 | + $id = $object->id; |
|
| 2896 | + $fk_element = $object->fk_element; |
|
| 2897 | + $table_element_line = $object->table_element_line; |
|
| 2898 | + $nboflines = (isset($object->lines) ?count($object->lines) : (empty($nboflines) ? 0 : $nboflines)); |
|
| 2899 | + $tagidfortablednd = (empty($tagidfortablednd) ? 'tablelines' : $tagidfortablednd); |
|
| 2900 | + $filepath = (empty($filepath) ? '' : $filepath); |
|
| 2901 | 2901 | |
| 2902 | 2902 | |
| 2903 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
| 2903 | + if (GETPOST('action', 'aZ09') != 'editline' && $nboflines > 1) |
|
| 2904 | 2904 | { |
| 2905 | 2905 | |
| 2906 | 2906 | ?> |
@@ -2918,7 +2918,7 @@ discard block |
||
| 2918 | 2918 | moveBlockCol.disableSelection(); // prevent selection |
| 2919 | 2919 | <?php if ($object->statut == 0) { ?> |
| 2920 | 2920 | // apply some graphical stuff |
| 2921 | - moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png',2); ?>)'); |
|
| 2921 | + moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png', 2); ?>)'); |
|
| 2922 | 2922 | moveBlockCol.css("background-repeat","no-repeat"); |
| 2923 | 2923 | moveBlockCol.css("background-position","center center"); |
| 2924 | 2924 | moveBlockCol.css("cursor","move"); |