@@ -61,9 +61,13 @@ discard block |
||
| 61 | 61 | $id=(GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int')); |
| 62 | 62 | $lineid=GETPOST('lineid','int'); |
| 63 | 63 | $ref=GETPOST('ref','alpha'); |
| 64 | -if ($user->societe_id) $socid=$user->societe_id; |
|
| 64 | +if ($user->societe_id) { |
|
| 65 | + $socid=$user->societe_id; |
|
| 66 | +} |
|
| 65 | 67 | $objecttype = 'facture_rec'; |
| 66 | -if ($action == "create" || $action == "add") $objecttype = ''; |
|
| 68 | +if ($action == "create" || $action == "add") { |
|
| 69 | + $objecttype = ''; |
|
| 70 | +} |
|
| 67 | 71 | $result = restrictedArea($user, 'facture', $id, $objecttype); |
| 68 | 72 | $projectid = GETPOST('projectid','int'); |
| 69 | 73 | |
@@ -76,8 +80,12 @@ discard block |
||
| 76 | 80 | $page = GETPOST("page",'int'); |
| 77 | 81 | if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 |
| 78 | 82 | $offset = $limit * $page; |
| 79 | -if (! $sortorder) $sortorder='DESC'; |
|
| 80 | -if (! $sortfield) $sortfield='f.titre'; |
|
| 83 | +if (! $sortorder) { |
|
| 84 | + $sortorder='DESC'; |
|
| 85 | +} |
|
| 86 | +if (! $sortfield) { |
|
| 87 | + $sortfield='f.titre'; |
|
| 88 | +} |
|
| 81 | 89 | $pageprev = $page - 1; |
| 82 | 90 | $pagenext = $page + 1; |
| 83 | 91 | |
@@ -115,11 +123,15 @@ discard block |
||
| 115 | 123 | |
| 116 | 124 | $parameters = array('socid' => $socid); |
| 117 | 125 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
| 118 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 126 | +if ($reshook < 0) { |
|
| 127 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 128 | +} |
|
| 119 | 129 | |
| 120 | 130 | if (empty($reshook)) |
| 121 | 131 | { |
| 122 | - if (GETPOST('cancel','alpha')) $action=''; |
|
| 132 | + if (GETPOST('cancel','alpha')) { |
|
| 133 | + $action=''; |
|
| 134 | + } |
|
| 123 | 135 | |
| 124 | 136 | // Selection of new fields |
| 125 | 137 | include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
@@ -225,8 +237,7 @@ discard block |
||
| 225 | 237 | setEventMessages($oldinvoice->error, $oldinvoice->errors, 'errors'); |
| 226 | 238 | $action = "create"; |
| 227 | 239 | } |
| 228 | - } |
|
| 229 | - else |
|
| 240 | + } else |
|
| 230 | 241 | { |
| 231 | 242 | $error++; |
| 232 | 243 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -239,8 +250,7 @@ discard block |
||
| 239 | 250 | |
| 240 | 251 | header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $object->id); |
| 241 | 252 | exit; |
| 242 | - } |
|
| 243 | - else |
|
| 253 | + } else |
|
| 244 | 254 | { |
| 245 | 255 | $db->rollback(); |
| 246 | 256 | |
@@ -286,8 +296,9 @@ discard block |
||
| 286 | 296 | { |
| 287 | 297 | $object->titre = GETPOST('ref', 'alpha'); |
| 288 | 298 | $object->ref = $object->titre; |
| 299 | + } else { |
|
| 300 | + dol_print_error($db, $object->error, $object->errors); |
|
| 289 | 301 | } |
| 290 | - else dol_print_error($db, $object->error, $object->errors); |
|
| 291 | 302 | } |
| 292 | 303 | // Set bank account |
| 293 | 304 | elseif ($action == 'setbankaccount' && $user->rights->facture->creer) |
@@ -303,7 +314,9 @@ discard block |
||
| 303 | 314 | elseif ($action == 'setdate_when' && $user->rights->facture->creer) |
| 304 | 315 | { |
| 305 | 316 | $date = dol_mktime(GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear')); |
| 306 | - if (!empty($date)) $object->setNextDate($date); |
|
| 317 | + if (!empty($date)) { |
|
| 318 | + $object->setNextDate($date); |
|
| 319 | + } |
|
| 307 | 320 | } |
| 308 | 321 | // Set max period |
| 309 | 322 | elseif ($action == 'setnb_gen_max' && $user->rights->facture->creer) |
@@ -342,8 +355,7 @@ discard block |
||
| 342 | 355 | if (! $error) |
| 343 | 356 | { |
| 344 | 357 | $db->commit(); |
| 345 | - } |
|
| 346 | - else |
|
| 358 | + } else |
|
| 347 | 359 | { |
| 348 | 360 | $db->rollback(); |
| 349 | 361 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -366,8 +378,7 @@ discard block |
||
| 366 | 378 | if (! $error) |
| 367 | 379 | { |
| 368 | 380 | $db->commit(); |
| 369 | - } |
|
| 370 | - else |
|
| 381 | + } else |
|
| 371 | 382 | { |
| 372 | 383 | $db->rollback(); |
| 373 | 384 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -395,27 +406,26 @@ discard block |
||
| 395 | 406 | { |
| 396 | 407 | $db->commit(); |
| 397 | 408 | $object->fetch($object->id); // Reload lines |
| 398 | - } |
|
| 399 | - else |
|
| 409 | + } else |
|
| 400 | 410 | { |
| 401 | 411 | $db->rollback(); |
| 402 | 412 | setEventMessages($db->lasterror(), null, 'errors'); |
| 403 | 413 | } |
| 404 | - } |
|
| 405 | - else |
|
| 414 | + } else |
|
| 406 | 415 | { |
| 407 | 416 | $db->rollback(); |
| 408 | 417 | setEventMessages($line->error, $line->errors, 'errors'); |
| 409 | 418 | } |
| 410 | - } |
|
| 411 | - else if ($action == 'update_extras') |
|
| 419 | + } else if ($action == 'update_extras') |
|
| 412 | 420 | { |
| 413 | 421 | $object->oldcopy = dol_clone($object); |
| 414 | 422 | |
| 415 | 423 | // Fill array 'array_options' with data from update form |
| 416 | 424 | $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); |
| 417 | 425 | $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none')); |
| 418 | - if ($ret < 0) $error++; |
|
| 426 | + if ($ret < 0) { |
|
| 427 | + $error++; |
|
| 428 | + } |
|
| 419 | 429 | |
| 420 | 430 | if (! $error) |
| 421 | 431 | { |
@@ -442,8 +452,7 @@ discard block |
||
| 442 | 452 | { |
| 443 | 453 | $idprod=0; |
| 444 | 454 | $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); |
| 445 | - } |
|
| 446 | - else |
|
| 455 | + } else |
|
| 447 | 456 | { |
| 448 | 457 | $idprod=GETPOST('idprod', 'int'); |
| 449 | 458 | $tva_tx = ''; |
@@ -473,9 +482,11 @@ discard block |
||
| 473 | 482 | setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); |
| 474 | 483 | $error ++; |
| 475 | 484 | } |
| 476 | - if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not '' |
|
| 485 | + if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) { |
|
| 486 | + // Unit price can be 0 but not '' |
|
| 477 | 487 | { |
| 478 | 488 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); |
| 489 | + } |
|
| 479 | 490 | $error ++; |
| 480 | 491 | } |
| 481 | 492 | if ($qty == '') { |
@@ -525,7 +536,9 @@ discard block |
||
| 525 | 536 | // Update if prices fields are defined |
| 526 | 537 | $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); |
| 527 | 538 | $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); |
| 528 | - if (empty($tva_tx)) $tva_npr=0; |
|
| 539 | + if (empty($tva_tx)) { |
|
| 540 | + $tva_npr=0; |
|
| 541 | + } |
|
| 529 | 542 | |
| 530 | 543 | $pu_ht = $prod->price; |
| 531 | 544 | $pu_ttc = $prod->price_ttc; |
@@ -539,14 +552,19 @@ discard block |
||
| 539 | 552 | $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; |
| 540 | 553 | $price_min = $prod->multiprices_min[$object->thirdparty->price_level]; |
| 541 | 554 | $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; |
| 542 | - if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility |
|
| 555 | + if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { |
|
| 556 | + // using this option is a bug. kept for backward compatibility |
|
| 543 | 557 | { |
| 544 | 558 | if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; |
| 545 | - if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; |
|
| 546 | - if (empty($tva_tx)) $tva_npr=0; |
|
| 547 | 559 | } |
| 548 | - } |
|
| 549 | - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) |
|
| 560 | + if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) { |
|
| 561 | + $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; |
|
| 562 | + } |
|
| 563 | + if (empty($tva_tx)) { |
|
| 564 | + $tva_npr=0; |
|
| 565 | + } |
|
| 566 | + } |
|
| 567 | + } elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) |
|
| 550 | 568 | { |
| 551 | 569 | include_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; |
| 552 | 570 | |
@@ -563,9 +581,13 @@ discard block |
||
| 563 | 581 | $pu_ttc = price($prodcustprice->lines[0]->price_ttc); |
| 564 | 582 | $price_base_type = $prodcustprice->lines[0]->price_base_type; |
| 565 | 583 | $tva_tx = $prodcustprice->lines[0]->tva_tx; |
| 566 | - if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; |
|
| 584 | + if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) { |
|
| 585 | + $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; |
|
| 586 | + } |
|
| 567 | 587 | $tva_npr = $prodcustprice->lines[0]->recuperableonly; |
| 568 | - if (empty($tva_tx)) $tva_npr=0; |
|
| 588 | + if (empty($tva_tx)) { |
|
| 589 | + $tva_npr=0; |
|
| 590 | + } |
|
| 569 | 591 | } |
| 570 | 592 | } |
| 571 | 593 | } |
@@ -586,8 +608,7 @@ discard block |
||
| 586 | 608 | if ($price_base_type != 'HT') |
| 587 | 609 | { |
| 588 | 610 | $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); |
| 589 | - } |
|
| 590 | - else |
|
| 611 | + } else |
|
| 591 | 612 | { |
| 592 | 613 | $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); |
| 593 | 614 | } |
@@ -600,10 +621,12 @@ discard block |
||
| 600 | 621 | { |
| 601 | 622 | $outputlangs = $langs; |
| 602 | 623 | $newlang = ''; |
| 603 | - if (empty($newlang) && GETPOST('lang_id','aZ09')) |
|
| 604 | - $newlang = GETPOST('lang_id','aZ09'); |
|
| 605 | - if (empty($newlang)) |
|
| 606 | - $newlang = $object->thirdparty->default_lang; |
|
| 624 | + if (empty($newlang) && GETPOST('lang_id','aZ09')) { |
|
| 625 | + $newlang = GETPOST('lang_id','aZ09'); |
|
| 626 | + } |
|
| 627 | + if (empty($newlang)) { |
|
| 628 | + $newlang = $object->thirdparty->default_lang; |
|
| 629 | + } |
|
| 607 | 630 | if (! empty($newlang)) |
| 608 | 631 | { |
| 609 | 632 | $outputlangs = new Translate("", $conf); |
@@ -611,8 +634,7 @@ discard block |
||
| 611 | 634 | } |
| 612 | 635 | |
| 613 | 636 | $desc = (! empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description; |
| 614 | - } |
|
| 615 | - else |
|
| 637 | + } else |
|
| 616 | 638 | { |
| 617 | 639 | $desc = $prod->description; |
| 618 | 640 | } |
@@ -623,26 +645,30 @@ discard block |
||
| 623 | 645 | if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) |
| 624 | 646 | { |
| 625 | 647 | $tmptxt = '('; |
| 626 | - if (! empty($prod->customcode)) |
|
| 627 | - $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; |
|
| 628 | - if (! empty($prod->customcode) && ! empty($prod->country_code)) |
|
| 629 | - $tmptxt .= ' - '; |
|
| 630 | - if (! empty($prod->country_code)) |
|
| 631 | - $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); |
|
| 648 | + if (! empty($prod->customcode)) { |
|
| 649 | + $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; |
|
| 650 | + } |
|
| 651 | + if (! empty($prod->customcode) && ! empty($prod->country_code)) { |
|
| 652 | + $tmptxt .= ' - '; |
|
| 653 | + } |
|
| 654 | + if (! empty($prod->country_code)) { |
|
| 655 | + $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); |
|
| 656 | + } |
|
| 632 | 657 | $tmptxt .= ')'; |
| 633 | 658 | $desc = dol_concatdesc($desc, $tmptxt); |
| 634 | 659 | } |
| 635 | 660 | |
| 636 | 661 | $type = $prod->type; |
| 637 | 662 | $fk_unit = $prod->fk_unit; |
| 638 | - } |
|
| 639 | - else |
|
| 663 | + } else |
|
| 640 | 664 | { |
| 641 | 665 | $pu_ht = price2num($price_ht, 'MU'); |
| 642 | 666 | $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); |
| 643 | 667 | $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); |
| 644 | 668 | $tva_tx = str_replace('*', '', $tva_tx); |
| 645 | - if (empty($tva_tx)) $tva_npr=0; |
|
| 669 | + if (empty($tva_tx)) { |
|
| 670 | + $tva_npr=0; |
|
| 671 | + } |
|
| 646 | 672 | $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); |
| 647 | 673 | $desc = $product_desc; |
| 648 | 674 | $type = GETPOST('type'); |
@@ -661,15 +687,15 @@ discard block |
||
| 661 | 687 | $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); |
| 662 | 688 | |
| 663 | 689 | $info_bits = 0; |
| 664 | - if ($tva_npr) |
|
| 665 | - $info_bits |= 0x01; |
|
| 690 | + if ($tva_npr) { |
|
| 691 | + $info_bits |= 0x01; |
|
| 692 | + } |
|
| 666 | 693 | |
| 667 | 694 | if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) )&& (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) |
| 668 | 695 | { |
| 669 | 696 | $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); |
| 670 | 697 | setEventMessages($mesg, null, 'errors'); |
| 671 | - } |
|
| 672 | - else |
|
| 698 | + } else |
|
| 673 | 699 | { |
| 674 | 700 | // Insert line |
| 675 | 701 | $result = $object->addline($desc, $pu_ht, $qty, $tva_tx,$localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill); |
@@ -733,8 +759,7 @@ discard block |
||
| 733 | 759 | |
| 734 | 760 | unset($_POST['situations']); |
| 735 | 761 | unset($_POST['progress']); |
| 736 | - } |
|
| 737 | - else |
|
| 762 | + } else |
|
| 738 | 763 | { |
| 739 | 764 | setEventMessages($object->error, $object->errors, 'errors'); |
| 740 | 765 | } |
@@ -742,11 +767,11 @@ discard block |
||
| 742 | 767 | $action = ''; |
| 743 | 768 | } |
| 744 | 769 | } |
| 745 | - } |
|
| 746 | - |
|
| 747 | - elseif ($action == 'updateline' && $user->rights->facture->creer && ! GETPOST('cancel','alpha')) |
|
| 770 | + } elseif ($action == 'updateline' && $user->rights->facture->creer && ! GETPOST('cancel','alpha')) |
|
| 748 | 771 | { |
| 749 | - if (! $object->fetch($id) > 0) dol_print_error($db); |
|
| 772 | + if (! $object->fetch($id) > 0) { |
|
| 773 | + dol_print_error($db); |
|
| 774 | + } |
|
| 750 | 775 | $object->fetch_thirdparty(); |
| 751 | 776 | |
| 752 | 777 | // Clean parameters |
@@ -762,7 +787,9 @@ discard block |
||
| 762 | 787 | |
| 763 | 788 | // Define info_bits |
| 764 | 789 | $info_bits = 0; |
| 765 | - if (preg_match('/\*/', $vat_rate)) $info_bits |= 0x01; |
|
| 790 | + if (preg_match('/\*/', $vat_rate)) { |
|
| 791 | + $info_bits |= 0x01; |
|
| 792 | + } |
|
| 766 | 793 | |
| 767 | 794 | // Define vat_rate |
| 768 | 795 | $vat_rate = str_replace('*', '', $vat_rate); |
@@ -801,7 +828,9 @@ discard block |
||
| 801 | 828 | |
| 802 | 829 | // Define special_code for special lines |
| 803 | 830 | $special_code=GETPOST('special_code'); |
| 804 | - if (! GETPOST('qty')) $special_code=3; |
|
| 831 | + if (! GETPOST('qty')) { |
|
| 832 | + $special_code=3; |
|
| 833 | + } |
|
| 805 | 834 | |
| 806 | 835 | /*$line = new FactureLigne($db); |
| 807 | 836 | $line->fetch(GETPOST('lineid')); |
@@ -825,8 +854,9 @@ discard block |
||
| 825 | 854 | $type = $product->type; |
| 826 | 855 | |
| 827 | 856 | $price_min = $product->price_min; |
| 828 | - if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level)) |
|
| 829 | - $price_min = $product->multiprices_min[$object->thirdparty->price_level]; |
|
| 857 | + if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level)) { |
|
| 858 | + $price_min = $product->multiprices_min[$object->thirdparty->price_level]; |
|
| 859 | + } |
|
| 830 | 860 | |
| 831 | 861 | $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); |
| 832 | 862 | |
@@ -939,8 +969,7 @@ discard block |
||
| 939 | 969 | |
| 940 | 970 | unset($_POST['situations']); |
| 941 | 971 | unset($_POST['progress']); |
| 942 | - } |
|
| 943 | - else |
|
| 972 | + } else |
|
| 944 | 973 | { |
| 945 | 974 | setEventMessages($object->error, $object->errors, 'errors'); |
| 946 | 975 | } |
@@ -988,8 +1017,12 @@ discard block |
||
| 988 | 1017 | dol_fiche_head(null, '', '', 0); |
| 989 | 1018 | |
| 990 | 1019 | $rowspan=4; |
| 991 | - if (! empty($conf->projet->enabled)) $rowspan++; |
|
| 992 | - if ($object->fk_account > 0) $rowspan++; |
|
| 1020 | + if (! empty($conf->projet->enabled)) { |
|
| 1021 | + $rowspan++; |
|
| 1022 | + } |
|
| 1023 | + if ($object->fk_account > 0) { |
|
| 1024 | + $rowspan++; |
|
| 1025 | + } |
|
| 993 | 1026 | |
| 994 | 1027 | print '<table class="border" width="100%">'; |
| 995 | 1028 | |
@@ -1134,8 +1167,7 @@ discard block |
||
| 1134 | 1167 | $select = array('0'=>$langs->trans('DoNotGenerateDoc'),'1'=>$langs->trans('AutoGenerateDoc')); |
| 1135 | 1168 | print $form->selectarray('generate_pdf', $select, GETPOST('generate_pdf')); |
| 1136 | 1169 | print "</td></tr>"; |
| 1137 | - } |
|
| 1138 | - else |
|
| 1170 | + } else |
|
| 1139 | 1171 | { |
| 1140 | 1172 | print '<input type="hidden" name="generate_pdf" value="1">'; |
| 1141 | 1173 | } |
@@ -1146,10 +1178,11 @@ discard block |
||
| 1146 | 1178 | |
| 1147 | 1179 | |
| 1148 | 1180 | $title = $langs->trans("ProductsAndServices"); |
| 1149 | - if (empty($conf->service->enabled)) |
|
| 1150 | - $title = $langs->trans("Products"); |
|
| 1151 | - else if (empty($conf->product->enabled)) |
|
| 1152 | - $title = $langs->trans("Services"); |
|
| 1181 | + if (empty($conf->service->enabled)) { |
|
| 1182 | + $title = $langs->trans("Products"); |
|
| 1183 | + } else if (empty($conf->product->enabled)) { |
|
| 1184 | + $title = $langs->trans("Services"); |
|
| 1185 | + } |
|
| 1153 | 1186 | |
| 1154 | 1187 | print load_fiche_titre($title, '', ''); |
| 1155 | 1188 | |
@@ -1188,13 +1221,11 @@ discard block |
||
| 1188 | 1221 | print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">'; |
| 1189 | 1222 | print '</div>'; |
| 1190 | 1223 | print "</form>\n"; |
| 1191 | - } |
|
| 1192 | - else |
|
| 1224 | + } else |
|
| 1193 | 1225 | { |
| 1194 | 1226 | dol_print_error('',"Error, no invoice ".$object->id); |
| 1195 | 1227 | } |
| 1196 | -} |
|
| 1197 | -else |
|
| 1228 | +} else |
|
| 1198 | 1229 | { |
| 1199 | 1230 | /* |
| 1200 | 1231 | * View mode |
@@ -1227,8 +1258,11 @@ discard block |
||
| 1227 | 1258 | $linkback = '<a href="' . BASE_URI . '?controller=compta/facture&method=invoicetemplate_list&restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
| 1228 | 1259 | |
| 1229 | 1260 | $morehtmlref=''; |
| 1230 | - if ($action != 'editref') $morehtmlref.=$form->editfieldkey($object->ref, 'ref', $object->ref, $object, $user->rights->facture->creer, '', '', 0, 2); |
|
| 1231 | - else $morehtmlref.= $form->editfieldval('', 'ref', $object->ref, $object, $user->rights->facture->creer, 'string'); |
|
| 1261 | + if ($action != 'editref') { |
|
| 1262 | + $morehtmlref.=$form->editfieldkey($object->ref, 'ref', $object->ref, $object, $user->rights->facture->creer, '', '', 0, 2); |
|
| 1263 | + } else { |
|
| 1264 | + $morehtmlref.= $form->editfieldval('', 'ref', $object->ref, $object, $user->rights->facture->creer, 'string'); |
|
| 1265 | + } |
|
| 1232 | 1266 | |
| 1233 | 1267 | $morehtmlref.='<div class="refidno">'; |
| 1234 | 1268 | // Ref customer |
@@ -1243,8 +1277,9 @@ discard block |
||
| 1243 | 1277 | $morehtmlref.='<br>'.$langs->trans('Project') . ' '; |
| 1244 | 1278 | if ($user->rights->facture->creer) |
| 1245 | 1279 | { |
| 1246 | - if ($action != 'classify') |
|
| 1247 | - $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 1280 | + if ($action != 'classify') { |
|
| 1281 | + $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 1282 | + } |
|
| 1248 | 1283 | if ($action == 'classify') { |
| 1249 | 1284 | //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); |
| 1250 | 1285 | $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; |
@@ -1288,14 +1323,18 @@ discard block |
||
| 1288 | 1323 | print '</tr>'; |
| 1289 | 1324 | |
| 1290 | 1325 | // Amount Local Taxes |
| 1291 | - if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) // Localtax1 |
|
| 1326 | + if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) { |
|
| 1327 | + // Localtax1 |
|
| 1292 | 1328 | { |
| 1293 | 1329 | print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>'; |
| 1330 | + } |
|
| 1294 | 1331 | print '<td class="nowrap">' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>'; |
| 1295 | 1332 | } |
| 1296 | - if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) // Localtax2 |
|
| 1333 | + if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) { |
|
| 1334 | + // Localtax2 |
|
| 1297 | 1335 | { |
| 1298 | 1336 | print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>'; |
| 1337 | + } |
|
| 1299 | 1338 | print '<td class=nowrap">' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>'; |
| 1300 | 1339 | } |
| 1301 | 1340 | |
@@ -1308,8 +1347,9 @@ discard block |
||
| 1308 | 1347 | print '<table class="nobordernopadding" width="100%"><tr><td>'; |
| 1309 | 1348 | print $langs->trans('PaymentConditionsShort'); |
| 1310 | 1349 | print '</td>'; |
| 1311 | - if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) |
|
| 1312 | - print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&facid=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>'; |
|
| 1350 | + if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) { |
|
| 1351 | + print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&facid=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>'; |
|
| 1352 | + } |
|
| 1313 | 1353 | print '</tr></table>'; |
| 1314 | 1354 | print '</td><td>'; |
| 1315 | 1355 | if ($object->type != Facture::TYPE_CREDIT_NOTE) |
@@ -1317,8 +1357,7 @@ discard block |
||
| 1317 | 1357 | if ($action == 'editconditions') |
| 1318 | 1358 | { |
| 1319 | 1359 | $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id'); |
| 1320 | - } |
|
| 1321 | - else |
|
| 1360 | + } else |
|
| 1322 | 1361 | { |
| 1323 | 1362 | $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'none'); |
| 1324 | 1363 | } |
@@ -1332,15 +1371,15 @@ discard block |
||
| 1332 | 1371 | print '<table class="nobordernopadding" width="100%"><tr><td>'; |
| 1333 | 1372 | print $langs->trans('PaymentMode'); |
| 1334 | 1373 | print '</td>'; |
| 1335 | - if ($action != 'editmode' && ! empty($object->brouillon) && $user->rights->facture->creer) |
|
| 1336 | - print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&facid=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>'; |
|
| 1374 | + if ($action != 'editmode' && ! empty($object->brouillon) && $user->rights->facture->creer) { |
|
| 1375 | + print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&facid=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>'; |
|
| 1376 | + } |
|
| 1337 | 1377 | print '</tr></table>'; |
| 1338 | 1378 | print '</td><td>'; |
| 1339 | 1379 | if ($action == 'editmode') |
| 1340 | 1380 | { |
| 1341 | 1381 | $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT'); |
| 1342 | - } |
|
| 1343 | - else |
|
| 1382 | + } else |
|
| 1344 | 1383 | { |
| 1345 | 1384 | $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none', 'CRDT'); |
| 1346 | 1385 | } |
@@ -1348,7 +1387,9 @@ discard block |
||
| 1348 | 1387 | |
| 1349 | 1388 | // Help of substitution key |
| 1350 | 1389 | $dateexample=dol_now(); |
| 1351 | - if (! empty($object->frequency) && ! empty($object->date_when)) $dateexample=$object->date_when; |
|
| 1390 | + if (! empty($object->frequency) && ! empty($object->date_when)) { |
|
| 1391 | + $dateexample=$object->date_when; |
|
| 1392 | + } |
|
| 1352 | 1393 | |
| 1353 | 1394 | $substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object); |
| 1354 | 1395 | |
@@ -1395,15 +1436,15 @@ discard block |
||
| 1395 | 1436 | print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">'; |
| 1396 | 1437 | print $langs->trans('RIB'); |
| 1397 | 1438 | print '<td>'; |
| 1398 | - if (($action != 'editbankaccount') && $user->rights->facture->creer && ! empty($object->brouillon)) |
|
| 1399 | - print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>'; |
|
| 1439 | + if (($action != 'editbankaccount') && $user->rights->facture->creer && ! empty($object->brouillon)) { |
|
| 1440 | + print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>'; |
|
| 1441 | + } |
|
| 1400 | 1442 | print '</tr></table>'; |
| 1401 | 1443 | print '</td><td>'; |
| 1402 | 1444 | if ($action == 'editbankaccount') |
| 1403 | 1445 | { |
| 1404 | 1446 | $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); |
| 1405 | - } |
|
| 1406 | - else |
|
| 1447 | + } else |
|
| 1407 | 1448 | { |
| 1408 | 1449 | $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); |
| 1409 | 1450 | } |
@@ -1417,8 +1458,9 @@ discard block |
||
| 1417 | 1458 | print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">'; |
| 1418 | 1459 | print $langs->trans('Model'); |
| 1419 | 1460 | print '<td>'; |
| 1420 | - if (($action != 'editmodelpdf') && $user->rights->facture->creer && ! empty($object->brouillon)) |
|
| 1421 | - print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmodelpdf&id='.$object->id.'">'.img_edit($langs->trans('SetModel'),1).'</a></td>'; |
|
| 1461 | + if (($action != 'editmodelpdf') && $user->rights->facture->creer && ! empty($object->brouillon)) { |
|
| 1462 | + print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmodelpdf&id='.$object->id.'">'.img_edit($langs->trans('SetModel'),1).'</a></td>'; |
|
| 1463 | + } |
|
| 1422 | 1464 | print '</tr></table>'; |
| 1423 | 1465 | print '</td><td>'; |
| 1424 | 1466 | if ($action == 'editmodelpdf') |
@@ -1431,8 +1473,7 @@ discard block |
||
| 1431 | 1473 | } |
| 1432 | 1474 | $select = 'select;'.implode(',', $list); |
| 1433 | 1475 | print $form->editfieldval($langs->trans("Model"), 'modelpdf', $object->modelpdf, $object, $user->rights->facture->creer, $select); |
| 1434 | - } |
|
| 1435 | - else |
|
| 1476 | + } else |
|
| 1436 | 1477 | { |
| 1437 | 1478 | print $object->modelpdf; |
| 1438 | 1479 | } |
@@ -1466,8 +1507,9 @@ discard block |
||
| 1466 | 1507 | print '<table class="nobordernopadding" width="100%"><tr><td>'; |
| 1467 | 1508 | print $langs->trans('Frequency'); |
| 1468 | 1509 | print '</td>'; |
| 1469 | - if ($action != 'editfrequency' && ! empty($object->brouillon) && $user->rights->facture->creer) |
|
| 1470 | - print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editfrequency&facid=' . $object->id . '">' . img_edit($langs->trans('Edit'), 1) . '</a></td>'; |
|
| 1510 | + if ($action != 'editfrequency' && ! empty($object->brouillon) && $user->rights->facture->creer) { |
|
| 1511 | + print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editfrequency&facid=' . $object->id . '">' . img_edit($langs->trans('Edit'), 1) . '</a></td>'; |
|
| 1512 | + } |
|
| 1471 | 1513 | print '</tr></table>'; |
| 1472 | 1514 | print '</td><td>'; |
| 1473 | 1515 | if ($action == 'editfrequency') |
@@ -1481,14 +1523,12 @@ discard block |
||
| 1481 | 1523 | print '</td>'; |
| 1482 | 1524 | print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; |
| 1483 | 1525 | print '</tr></table></form>'; |
| 1484 | - } |
|
| 1485 | - else |
|
| 1526 | + } else |
|
| 1486 | 1527 | { |
| 1487 | 1528 | if ($object->frequency > 0) |
| 1488 | 1529 | { |
| 1489 | 1530 | print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency); |
| 1490 | - } |
|
| 1491 | - else |
|
| 1531 | + } else |
|
| 1492 | 1532 | { |
| 1493 | 1533 | print $langs->trans("NotARecurringInvoiceTemplate"); |
| 1494 | 1534 | } |
@@ -1500,8 +1540,7 @@ discard block |
||
| 1500 | 1540 | if ($action == 'date_when' || $object->frequency > 0) |
| 1501 | 1541 | { |
| 1502 | 1542 | print $form->editfieldkey($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'day'); |
| 1503 | - } |
|
| 1504 | - else |
|
| 1543 | + } else |
|
| 1505 | 1544 | { |
| 1506 | 1545 | print $langs->trans("NextDateToExecution"); |
| 1507 | 1546 | } |
@@ -1513,9 +1552,10 @@ discard block |
||
| 1513 | 1552 | //var_dump(dol_print_date($object->date_when+60, 'dayhour').' - '.dol_print_date($now, 'dayhour')); |
| 1514 | 1553 | if (! $object->isMaxNbGenReached()) |
| 1515 | 1554 | { |
| 1516 | - if (! $object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) print img_warning($langs->trans("Late")); |
|
| 1517 | - } |
|
| 1518 | - else |
|
| 1555 | + if (! $object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) { |
|
| 1556 | + print img_warning($langs->trans("Late")); |
|
| 1557 | + } |
|
| 1558 | + } else |
|
| 1519 | 1559 | { |
| 1520 | 1560 | print img_info($langs->trans("MaxNumberOfGenerationReached")); |
| 1521 | 1561 | } |
@@ -1527,8 +1567,7 @@ discard block |
||
| 1527 | 1567 | if ($action == 'nb_gen_max' || $object->frequency > 0) |
| 1528 | 1568 | { |
| 1529 | 1569 | print $form->editfieldkey($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $user->rights->facture->creer); |
| 1530 | - } |
|
| 1531 | - else |
|
| 1570 | + } else |
|
| 1532 | 1571 | { |
| 1533 | 1572 | print $langs->trans("MaxPeriodNumber"); |
| 1534 | 1573 | } |
@@ -1536,8 +1575,7 @@ discard block |
||
| 1536 | 1575 | if ($action == 'nb_gen_max' || $object->frequency > 0) |
| 1537 | 1576 | { |
| 1538 | 1577 | print $form->editfieldval($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max?$object->nb_gen_max:'', $object, $user->rights->facture->creer); |
| 1539 | - } |
|
| 1540 | - else |
|
| 1578 | + } else |
|
| 1541 | 1579 | { |
| 1542 | 1580 | print ''; |
| 1543 | 1581 | } |
@@ -1546,10 +1584,11 @@ discard block |
||
| 1546 | 1584 | |
| 1547 | 1585 | // Status of generated invoices |
| 1548 | 1586 | print '<tr><td>'; |
| 1549 | - if ($action == 'auto_validate' || $object->frequency > 0) |
|
| 1550 | - print $form->editfieldkey($langs->trans("StatusOfGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $user->rights->facture->creer); |
|
| 1551 | - else |
|
| 1552 | - print $langs->trans("StatusOfGeneratedInvoices"); |
|
| 1587 | + if ($action == 'auto_validate' || $object->frequency > 0) { |
|
| 1588 | + print $form->editfieldkey($langs->trans("StatusOfGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $user->rights->facture->creer); |
|
| 1589 | + } else { |
|
| 1590 | + print $langs->trans("StatusOfGeneratedInvoices"); |
|
| 1591 | + } |
|
| 1553 | 1592 | print '</td><td>'; |
| 1554 | 1593 | $select = 'select;0:'.$langs->trans('BillStatusDraft').',1:'.$langs->trans('BillStatusValidated'); |
| 1555 | 1594 | if ($action == 'auto_validate' || $object->frequency > 0) |
@@ -1562,10 +1601,11 @@ discard block |
||
| 1562 | 1601 | { |
| 1563 | 1602 | print '<tr>'; |
| 1564 | 1603 | print '<td>'; |
| 1565 | - if ($action == 'generate_pdf' || $object->frequency > 0) |
|
| 1566 | - print $form->editfieldkey($langs->trans("StatusOfGeneratedDocuments"), 'generate_pdf', $object->generate_pdf, $object, $user->rights->facture->creer); |
|
| 1567 | - else |
|
| 1568 | - print $langs->trans("StatusOfGeneratedDocuments"); |
|
| 1604 | + if ($action == 'generate_pdf' || $object->frequency > 0) { |
|
| 1605 | + print $form->editfieldkey($langs->trans("StatusOfGeneratedDocuments"), 'generate_pdf', $object->generate_pdf, $object, $user->rights->facture->creer); |
|
| 1606 | + } else { |
|
| 1607 | + print $langs->trans("StatusOfGeneratedDocuments"); |
|
| 1608 | + } |
|
| 1569 | 1609 | print '</td>'; |
| 1570 | 1610 | print '<td>'; |
| 1571 | 1611 | $select = 'select;0:'.$langs->trans('DoNotGenerateDoc').',1:'.$langs->trans('AutogenerateDoc'); |
@@ -1575,8 +1615,7 @@ discard block |
||
| 1575 | 1615 | } |
| 1576 | 1616 | print '</td>'; |
| 1577 | 1617 | print '</tr>'; |
| 1578 | - } |
|
| 1579 | - else |
|
| 1618 | + } else |
|
| 1580 | 1619 | { |
| 1581 | 1620 | print '<input type="hidden" name="generate_pdf" value="1">'; |
| 1582 | 1621 | } |
@@ -1678,20 +1717,17 @@ discard block |
||
| 1678 | 1717 | if (! empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) |
| 1679 | 1718 | { |
| 1680 | 1719 | print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("MaxGenerationReached")).'">'.$langs->trans("CreateBill").'</a></div>'; |
| 1681 | - } |
|
| 1682 | - else |
|
| 1720 | + } else |
|
| 1683 | 1721 | { |
| 1684 | 1722 | if (empty($object->frequency) || $object->date_when <= $today) |
| 1685 | 1723 | { |
| 1686 | 1724 | print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=compta/facture&method=card&action=create&socid=' . $object->thirdparty->id . '&fac_rec=' . $object->id . '">' . $langs->trans("CreateBill") . '</a></div>'; |
| 1687 | - } |
|
| 1688 | - else |
|
| 1725 | + } else |
|
| 1689 | 1726 | { |
| 1690 | 1727 | print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>'; |
| 1691 | 1728 | } |
| 1692 | 1729 | } |
| 1693 | - } |
|
| 1694 | - else |
|
| 1730 | + } else |
|
| 1695 | 1731 | { |
| 1696 | 1732 | print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateBill").'</a></div>'; |
| 1697 | 1733 | } |
@@ -1702,8 +1738,7 @@ discard block |
||
| 1702 | 1738 | if (empty($object->suspended)) |
| 1703 | 1739 | { |
| 1704 | 1740 | print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . BASE_URI . '?controller=compta/facture&method=fiche-rec&action=disable&id=' . $object->id . '">' . $langs->trans("Disable") . '</a></div>'; |
| 1705 | - } |
|
| 1706 | - else |
|
| 1741 | + } else |
|
| 1707 | 1742 | { |
| 1708 | 1743 | print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=compta/facture&method=fiche-rec&action=enable&id=' . $object->id . '">' . $langs->trans("Enable") . '</a></div>'; |
| 1709 | 1744 | } |
@@ -151,13 +151,15 @@ discard block |
||
| 151 | 151 | if(count($echeance->lines)>0) |
| 152 | 152 | { |
| 153 | 153 | print '<input type="hidden" name="action" value="updateecheancier">'; |
| 154 | -}else{ |
|
| 154 | +} else{ |
|
| 155 | 155 | print '<input type="hidden" name="action" value="createecheancier">'; |
| 156 | 156 | } |
| 157 | 157 | print '<table class="border" width="100%">'; |
| 158 | 158 | print '<tr class="liste_titre">'; |
| 159 | 159 | $colspan = 6; |
| 160 | -if (count($echeance->lines)>0) $colspan++; |
|
| 160 | +if (count($echeance->lines)>0) { |
|
| 161 | + $colspan++; |
|
| 162 | +} |
|
| 161 | 163 | print '<th align="center" colspan="'.$colspan.'">'; |
| 162 | 164 | print $langs->trans("FinancialCommitment"); |
| 163 | 165 | print '</th>'; |
@@ -173,7 +175,9 @@ discard block |
||
| 173 | 175 | print ' ('.price2num($object->capital).')'; |
| 174 | 176 | print '<input type="hidden" name="hi_capital0" id ="hi_capital0" value="'.$object->capital.'">'; |
| 175 | 177 | print '</th>'; |
| 176 | -if (count($echeance->lines)>0) print '<th>'.$langs->trans('DoPayment').'</th>'; |
|
| 178 | +if (count($echeance->lines)>0) { |
|
| 179 | + print '<th>'.$langs->trans('DoPayment').'</th>'; |
|
| 180 | +} |
|
| 177 | 181 | print '</tr>'."\n"; |
| 178 | 182 | |
| 179 | 183 | if ($object->nbterm > 0 && count($echeance->lines)==0) |
@@ -201,8 +205,7 @@ discard block |
||
| 201 | 205 | $i++; |
| 202 | 206 | $capital = $cap_rest; |
| 203 | 207 | } |
| 204 | -} |
|
| 205 | -elseif(count($echeance->lines)>0) |
|
| 208 | +} elseif(count($echeance->lines)>0) |
|
| 206 | 209 | { |
| 207 | 210 | $i=1; |
| 208 | 211 | $capital = $object->capital; |
@@ -223,14 +226,15 @@ discard block |
||
| 223 | 226 | print '<td align="center" id="interets'.$i.'">'.price($int,0,'',1).' €</td><input type="hidden" name="hi_interets' .$i .'" id ="hi_interets' .$i .'" value="' . $int . '">'; |
| 224 | 227 | if($line->datep > dol_now() && empty($line->fk_bank)){ |
| 225 | 228 | print '<td align="center"><input name="mens'.$i.'" id="mens'.$i.'" size="5" value="'.$mens.'" ech="'.$i.'"> €</td>'; |
| 226 | - }else{ |
|
| 229 | + } else{ |
|
| 227 | 230 | print '<td align="center">' . price($mens) . ' €</td><input type="hidden" name="mens' .$i .'" id ="mens' .$i .'" value="' . $mens . '">'; |
| 228 | 231 | } |
| 229 | 232 | |
| 230 | 233 | print '<td align="center" id="capital'.$i.'">'.price($cap_rest).' €</td><input type="hidden" name="hi_capital' .$i .'" id ="hi_capital' .$i .'" value="' . $cap_rest . '">'; |
| 231 | 234 | print '<td align="center">'; |
| 232 | - if (!empty($line->fk_bank)) print $langs->trans('Paid'); |
|
| 233 | - elseif (!$printed) |
|
| 235 | + if (!empty($line->fk_bank)) { |
|
| 236 | + print $langs->trans('Paid'); |
|
| 237 | + } elseif (!$printed) |
|
| 234 | 238 | { |
| 235 | 239 | print '<a class="butAction" href="' . BASE_URI . '?controller=loan/payment&method=payment.php&id=' . $object->id . '&action=create&line_id=' . $line->id . '">' . $langs->trans('DoPayment') . '</a>'; |
| 236 | 240 | $printed = true; |
@@ -245,8 +249,11 @@ discard block |
||
| 245 | 249 | print '</table>'; |
| 246 | 250 | print '</br>'; |
| 247 | 251 | print '</br>'; |
| 248 | -if (count($echeance->lines)==0) $label = $langs->trans("Create"); |
|
| 249 | -else $label = $langs->trans("Save"); |
|
| 252 | +if (count($echeance->lines)==0) { |
|
| 253 | + $label = $langs->trans("Create"); |
|
| 254 | +} else { |
|
| 255 | + $label = $langs->trans("Save"); |
|
| 256 | +} |
|
| 250 | 257 | print '<div align="center"><input class="button" type="submit" value="'.$label.'"></div>'; |
| 251 | 258 | print '</form>'; |
| 252 | 259 | |