@@ -291,12 +291,12 @@ discard block |
||
291 | 291 | $lettre = 'AAA'; |
292 | 292 | |
293 | 293 | $sql = "SELECT DISTINCT ab2.lettering_code"; |
294 | - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab"; |
|
295 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab2 ON ab2.subledger_account = ab.subledger_account"; |
|
296 | - $sql .= " WHERE ab.rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ")"; |
|
297 | - $sql .= " AND ab2.lettering_code != ''"; |
|
298 | - $sql .= " ORDER BY ab2.lettering_code DESC"; |
|
299 | - $sql .= " LIMIT 1 "; |
|
294 | + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS ab"; |
|
295 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_bookkeeping AS ab2 ON ab2.subledger_account = ab.subledger_account"; |
|
296 | + $sql .= " WHERE ab.rowid IN (".$this->db->sanitize(implode(',', $ids)).")"; |
|
297 | + $sql .= " AND ab2.lettering_code != ''"; |
|
298 | + $sql .= " ORDER BY ab2.lettering_code DESC"; |
|
299 | + $sql .= " LIMIT 1 "; |
|
300 | 300 | |
301 | 301 | $resqla = $this->db->query($sql); |
302 | 302 | if ($resqla) { |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | */ |
401 | 401 | public function bookkeepingLetteringAll($bookkeeping_ids, $unlettering = false) |
402 | 402 | { |
403 | - dol_syslog(__METHOD__ . " - ", LOG_DEBUG); |
|
403 | + dol_syslog(__METHOD__." - ", LOG_DEBUG); |
|
404 | 404 | |
405 | 405 | $error = 0; |
406 | 406 | $errors = array(); |
@@ -517,25 +517,25 @@ discard block |
||
517 | 517 | |
518 | 518 | // Get all bookkeeping lines |
519 | 519 | $sql = "SELECT DISTINCT ab.doc_type, ab.fk_doc"; |
520 | - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab"; |
|
521 | - $sql .= " WHERE ab.entity IN (" . getEntity('accountancy') . ")"; |
|
520 | + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS ab"; |
|
521 | + $sql .= " WHERE ab.entity IN (".getEntity('accountancy').")"; |
|
522 | 522 | $sql .= " AND ab.fk_doc > 0"; |
523 | 523 | if (!empty($bookkeeping_ids)) { |
524 | 524 | // Get all bookkeeping lines of piece number |
525 | 525 | $sql .= " AND EXISTS ("; |
526 | 526 | $sql .= " SELECT rowid"; |
527 | - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS pn"; |
|
528 | - $sql .= " WHERE pn.entity IN (" . getEntity('accountancy') . ")"; |
|
529 | - $sql .= " AND pn.rowid IN (" . $this->db->sanitize(implode(',', $bookkeeping_ids)) . ")"; |
|
527 | + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS pn"; |
|
528 | + $sql .= " WHERE pn.entity IN (".getEntity('accountancy').")"; |
|
529 | + $sql .= " AND pn.rowid IN (".$this->db->sanitize(implode(',', $bookkeeping_ids)).")"; |
|
530 | 530 | $sql .= " AND pn.piece_num = ab.piece_num"; |
531 | 531 | $sql .= " )"; |
532 | 532 | } |
533 | 533 | if ($only_has_subledger_account) $sql .= " AND ab.subledger_account != ''"; |
534 | 534 | |
535 | - dol_syslog(__METHOD__ . " - Get all bookkeeping lines", LOG_DEBUG); |
|
535 | + dol_syslog(__METHOD__." - Get all bookkeeping lines", LOG_DEBUG); |
|
536 | 536 | $resql = $this->db->query($sql); |
537 | 537 | if (!$resql) { |
538 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
538 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
539 | 539 | return -1; |
540 | 540 | } |
541 | 541 | |
@@ -582,34 +582,34 @@ discard block |
||
582 | 582 | |
583 | 583 | // Get all bookkeeping lines linked |
584 | 584 | $sql = "SELECT DISTINCT ab.rowid, ab.piece_num, ab.debit, ab.credit, ab.lettering_code"; |
585 | - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab"; |
|
586 | - $sql .= " WHERE ab.entity IN (" . getEntity('accountancy') . ")"; |
|
585 | + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS ab"; |
|
586 | + $sql .= " WHERE ab.entity IN (".getEntity('accountancy').")"; |
|
587 | 587 | $sql .= " AND ("; |
588 | 588 | if (!empty($bank_ids)) { |
589 | 589 | $sql .= " EXISTS ("; |
590 | 590 | $sql .= " SELECT bpn.rowid"; |
591 | - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS bpn"; |
|
592 | - $sql .= " WHERE bpn.entity IN (" . getEntity('accountancy') . ")"; |
|
591 | + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS bpn"; |
|
592 | + $sql .= " WHERE bpn.entity IN (".getEntity('accountancy').")"; |
|
593 | 593 | $sql .= " AND bpn.doc_type = 'bank'"; |
594 | - $sql .= " AND bpn.fk_doc IN (" . $this->db->sanitize(implode(',', $bank_ids)) . ")"; |
|
594 | + $sql .= " AND bpn.fk_doc IN (".$this->db->sanitize(implode(',', $bank_ids)).")"; |
|
595 | 595 | $sql .= " AND bpn.piece_num = ab.piece_num"; |
596 | 596 | $sql .= " ) OR "; |
597 | 597 | } |
598 | 598 | $sql .= " EXISTS ("; |
599 | 599 | $sql .= " SELECT dpn.rowid"; |
600 | - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS dpn"; |
|
601 | - $sql .= " WHERE dpn.entity IN (" . getEntity('accountancy') . ")"; |
|
602 | - $sql .= " AND dpn.doc_type = '" . $this->db->escape($doc_type) . "'"; |
|
603 | - $sql .= " AND dpn.fk_doc IN (" . $this->db->sanitize(implode(',', $doc_ids)) . ")"; |
|
600 | + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS dpn"; |
|
601 | + $sql .= " WHERE dpn.entity IN (".getEntity('accountancy').")"; |
|
602 | + $sql .= " AND dpn.doc_type = '".$this->db->escape($doc_type)."'"; |
|
603 | + $sql .= " AND dpn.fk_doc IN (".$this->db->sanitize(implode(',', $doc_ids)).")"; |
|
604 | 604 | $sql .= " AND dpn.piece_num = ab.piece_num"; |
605 | 605 | $sql .= " )"; |
606 | 606 | $sql .= ")"; |
607 | 607 | if ($only_has_subledger_account) $sql .= " AND ab.subledger_account != ''"; |
608 | 608 | |
609 | - dol_syslog(__METHOD__ . " - Get all bookkeeping lines linked", LOG_DEBUG); |
|
609 | + dol_syslog(__METHOD__." - Get all bookkeeping lines linked", LOG_DEBUG); |
|
610 | 610 | $resql = $this->db->query($sql); |
611 | 611 | if (!$resql) { |
612 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
612 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
613 | 613 | return -1; |
614 | 614 | } |
615 | 615 | |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | */ |
641 | 641 | public function getDocTypeAndFkDocFromBankLines($bank_ids) |
642 | 642 | { |
643 | - dol_syslog(__METHOD__ . " - bank_ids=".json_encode($bank_ids), LOG_DEBUG); |
|
643 | + dol_syslog(__METHOD__." - bank_ids=".json_encode($bank_ids), LOG_DEBUG); |
|
644 | 644 | |
645 | 645 | // Clean parameters |
646 | 646 | $bank_ids = is_array($bank_ids) ? $bank_ids : array(); |
@@ -652,16 +652,16 @@ discard block |
||
652 | 652 | $bookkeeping_lines_by_type = array(); |
653 | 653 | foreach (self::$doc_type_infos as $doc_type => $doc_type_info) { |
654 | 654 | // Get all fk_doc by doc_type from bank ids |
655 | - $sql = "SELECT DISTINCT dp." . $doc_type_info['doc_payment_table_fk_doc'] . " AS fk_doc"; |
|
656 | - $sql .= " FROM " . MAIN_DB_PREFIX . $doc_type_info['payment_table'] . " AS p"; |
|
657 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $doc_type_info['doc_payment_table'] . " AS dp ON dp." . $doc_type_info['doc_payment_table_fk_payment'] . " = p.rowid"; |
|
658 | - $sql .= " WHERE p." . $doc_type_info['payment_table_fk_bank'] . " IN (" . $this->db->sanitize(implode(',', $bank_ids)) . ")"; |
|
659 | - $sql .= " AND dp." . $doc_type_info['doc_payment_table_fk_doc'] . " > 0"; |
|
655 | + $sql = "SELECT DISTINCT dp.".$doc_type_info['doc_payment_table_fk_doc']." AS fk_doc"; |
|
656 | + $sql .= " FROM ".MAIN_DB_PREFIX.$doc_type_info['payment_table']." AS p"; |
|
657 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$doc_type_info['doc_payment_table']." AS dp ON dp.".$doc_type_info['doc_payment_table_fk_payment']." = p.rowid"; |
|
658 | + $sql .= " WHERE p.".$doc_type_info['payment_table_fk_bank']." IN (".$this->db->sanitize(implode(',', $bank_ids)).")"; |
|
659 | + $sql .= " AND dp.".$doc_type_info['doc_payment_table_fk_doc']." > 0"; |
|
660 | 660 | |
661 | - dol_syslog(__METHOD__ . " - Get all fk_doc by doc_type from list of bank ids for '" . $doc_type . "'", LOG_DEBUG); |
|
661 | + dol_syslog(__METHOD__." - Get all fk_doc by doc_type from list of bank ids for '".$doc_type."'", LOG_DEBUG); |
|
662 | 662 | $resql = $this->db->query($sql); |
663 | 663 | if (!$resql) { |
664 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
664 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
665 | 665 | return -1; |
666 | 666 | } |
667 | 667 | |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | { |
686 | 686 | global $langs; |
687 | 687 | |
688 | - dol_syslog(__METHOD__ . " - bank_ids=".json_encode($document_ids) . ", doc_type=$doc_type", LOG_DEBUG); |
|
688 | + dol_syslog(__METHOD__." - bank_ids=".json_encode($document_ids).", doc_type=$doc_type", LOG_DEBUG); |
|
689 | 689 | |
690 | 690 | // Clean parameters |
691 | 691 | $document_ids = is_array($document_ids) ? $document_ids : array(); |
@@ -704,16 +704,16 @@ discard block |
||
704 | 704 | $bank_ids = array(); |
705 | 705 | |
706 | 706 | // Get all fk_doc by doc_type from bank ids |
707 | - $sql = "SELECT DISTINCT p." . $doc_type_info['payment_table_fk_bank'] . " AS fk_doc"; |
|
708 | - $sql .= " FROM " . MAIN_DB_PREFIX . $doc_type_info['payment_table'] . " AS p"; |
|
709 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $doc_type_info['doc_payment_table'] . " AS dp ON dp." . $doc_type_info['doc_payment_table_fk_payment'] . " = p.rowid"; |
|
710 | - $sql .= " WHERE dp." . $doc_type_info['doc_payment_table_fk_doc'] . " IN (" . $this->db->sanitize(implode(',', $document_ids)) . ")"; |
|
711 | - $sql .= " AND p." . $doc_type_info['payment_table_fk_bank'] . " > 0"; |
|
707 | + $sql = "SELECT DISTINCT p.".$doc_type_info['payment_table_fk_bank']." AS fk_doc"; |
|
708 | + $sql .= " FROM ".MAIN_DB_PREFIX.$doc_type_info['payment_table']." AS p"; |
|
709 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$doc_type_info['doc_payment_table']." AS dp ON dp.".$doc_type_info['doc_payment_table_fk_payment']." = p.rowid"; |
|
710 | + $sql .= " WHERE dp.".$doc_type_info['doc_payment_table_fk_doc']." IN (".$this->db->sanitize(implode(',', $document_ids)).")"; |
|
711 | + $sql .= " AND p.".$doc_type_info['payment_table_fk_bank']." > 0"; |
|
712 | 712 | |
713 | - dol_syslog(__METHOD__ . " - Get all bank ids from list of document ids of a type '" . $doc_type . "'", LOG_DEBUG); |
|
713 | + dol_syslog(__METHOD__." - Get all bank ids from list of document ids of a type '".$doc_type."'", LOG_DEBUG); |
|
714 | 714 | $resql = $this->db->query($sql); |
715 | 715 | if (!$resql) { |
716 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
716 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
717 | 717 | return -1; |
718 | 718 | } |
719 | 719 | |
@@ -756,15 +756,15 @@ discard block |
||
756 | 756 | $link_by_element = array(); |
757 | 757 | $element_by_link = array(); |
758 | 758 | foreach ($doc_type_info['linked_info'] as $linked_info) { |
759 | - $sql = "SELECT DISTINCT tl2." . $linked_info['fk_link'] . " AS fk_link, tl2." . $linked_info['fk_doc'] . " AS fk_doc"; |
|
760 | - $sql .= " FROM " . MAIN_DB_PREFIX . $linked_info['table'] . " AS tl"; |
|
761 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $linked_info['table'] . " AS tl2 ON tl2." . $linked_info['fk_link'] . " = tl." . $linked_info['fk_link']; |
|
762 | - $sql .= " WHERE tl." . $linked_info['fk_doc'] . " IN (" . $this->db->sanitize(implode(',', $document_ids)) . ")"; |
|
759 | + $sql = "SELECT DISTINCT tl2.".$linked_info['fk_link']." AS fk_link, tl2.".$linked_info['fk_doc']." AS fk_doc"; |
|
760 | + $sql .= " FROM ".MAIN_DB_PREFIX.$linked_info['table']." AS tl"; |
|
761 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$linked_info['table']." AS tl2 ON tl2.".$linked_info['fk_link']." = tl.".$linked_info['fk_link']; |
|
762 | + $sql .= " WHERE tl.".$linked_info['fk_doc']." IN (".$this->db->sanitize(implode(',', $document_ids)).")"; |
|
763 | 763 | |
764 | - dol_syslog(__METHOD__ . " - Get document lines", LOG_DEBUG); |
|
764 | + dol_syslog(__METHOD__." - Get document lines", LOG_DEBUG); |
|
765 | 765 | $resql = $this->db->query($sql); |
766 | 766 | if (!$resql) { |
767 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
767 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
768 | 768 | return -1; |
769 | 769 | } |
770 | 770 | |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | while ($obj = $this->db->fetch_object($resql)) { |
773 | 773 | $current_document_ids[$obj->fk_doc] = $obj->fk_doc; |
774 | 774 | |
775 | - $link_key = $linked_info['prefix'] . $obj->fk_link; |
|
775 | + $link_key = $linked_info['prefix'].$obj->fk_link; |
|
776 | 776 | $element_by_link[$link_key][$obj->fk_doc] = $obj->fk_doc; |
777 | 777 | $link_by_element[$obj->fk_doc][$link_key] = $link_key; |
778 | 778 | if ($is_fk_link_is_also_fk_doc) { |
@@ -468,9 +468,15 @@ discard block |
||
468 | 468 | $group_error++; |
469 | 469 | break; |
470 | 470 | } |
471 | - if (!isset($lettering_code)) $lettering_code = (string) $line_infos['lettering_code']; |
|
472 | - if (!empty($line_infos['lettering_code'])) $do_it = true; |
|
473 | - } elseif (!empty($line_infos['lettering_code'])) $do_it = false; |
|
471 | + if (!isset($lettering_code)) { |
|
472 | + $lettering_code = (string) $line_infos['lettering_code']; |
|
473 | + } |
|
474 | + if (!empty($line_infos['lettering_code'])) { |
|
475 | + $do_it = true; |
|
476 | + } |
|
477 | + } elseif (!empty($line_infos['lettering_code'])) { |
|
478 | + $do_it = false; |
|
479 | + } |
|
474 | 480 | } |
475 | 481 | |
476 | 482 | // Check balance amount |
@@ -481,8 +487,11 @@ discard block |
||
481 | 487 | |
482 | 488 | // Lettering/Unlettering the group of bookkeeping lines |
483 | 489 | if (!$group_error && $do_it) { |
484 | - if ($unlettering) $result = $this->deleteLettering($bookkeeping_lines); |
|
485 | - else $result = $this->updateLettering($bookkeeping_lines); |
|
490 | + if ($unlettering) { |
|
491 | + $result = $this->deleteLettering($bookkeeping_lines); |
|
492 | + } else { |
|
493 | + $result = $this->updateLettering($bookkeeping_lines); |
|
494 | + } |
|
486 | 495 | if ($result < 0) { |
487 | 496 | $group_error++; |
488 | 497 | } elseif ($result > 0) { |
@@ -533,7 +542,9 @@ discard block |
||
533 | 542 | $sql .= " AND pn.piece_num = ab.piece_num"; |
534 | 543 | $sql .= " )"; |
535 | 544 | } |
536 | - if ($only_has_subledger_account) $sql .= " AND ab.subledger_account != ''"; |
|
545 | + if ($only_has_subledger_account) { |
|
546 | + $sql .= " AND ab.subledger_account != ''"; |
|
547 | + } |
|
537 | 548 | |
538 | 549 | dol_syslog(__METHOD__ . " - Get all bookkeeping lines", LOG_DEBUG); |
539 | 550 | $resql = $this->db->query($sql); |
@@ -607,7 +618,9 @@ discard block |
||
607 | 618 | $sql .= " AND dpn.piece_num = ab.piece_num"; |
608 | 619 | $sql .= " )"; |
609 | 620 | $sql .= ")"; |
610 | - if ($only_has_subledger_account) $sql .= " AND ab.subledger_account != ''"; |
|
621 | + if ($only_has_subledger_account) { |
|
622 | + $sql .= " AND ab.subledger_account != ''"; |
|
623 | + } |
|
611 | 624 | |
612 | 625 | dol_syslog(__METHOD__ . " - Get all bookkeeping lines linked", LOG_DEBUG); |
613 | 626 | $resql = $this->db->query($sql); |
@@ -628,7 +641,9 @@ discard block |
||
628 | 641 | } |
629 | 642 | $this->db->free($resql); |
630 | 643 | |
631 | - if (!empty($group)) $grouped_lines[] = $group; |
|
644 | + if (!empty($group)) { |
|
645 | + $grouped_lines[] = $group; |
|
646 | + } |
|
632 | 647 | } |
633 | 648 | } |
634 | 649 | |
@@ -830,7 +845,9 @@ discard block |
||
830 | 845 | |
831 | 846 | foreach ($element_ids as $element_id) { |
832 | 847 | // Continue if element id in not found |
833 | - if (!isset($link_by_element[$element_id])) continue; |
|
848 | + if (!isset($link_by_element[$element_id])) { |
|
849 | + continue; |
|
850 | + } |
|
834 | 851 | |
835 | 852 | // Set the element in the current group |
836 | 853 | $current_group[$element_id] = $element_id; |
@@ -288,7 +288,7 @@ |
||
288 | 288 | print '<tr class="oddeven" height="24">'; |
289 | 289 | print '<td class="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&mode='.$mode.($socid > 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$year.'</a></td>'; |
290 | 290 | print '<td class="right">'.$val['nb'].'</td>'; |
291 | - print '<td class="right opacitylow" style="'.((!isset($val['nb_diff']) || $val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(isset($val['nb_diff']) ? round($val['nb_diff']): "0").'%</td>'; |
|
291 | + print '<td class="right opacitylow" style="'.((!isset($val['nb_diff']) || $val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(isset($val['nb_diff']) ? round($val['nb_diff']) : "0").'%</td>'; |
|
292 | 292 | print '<td class="right">'.price(price2num($val['total'], 'MT'), 1).'</td>'; |
293 | 293 | print '<td class="right opacitylow" style="'.((!isset($val['total_diff']) || $val['total_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(isset($val['total_diff']) ? round($val['total_diff']) : "0").'%</td>'; |
294 | 294 | print '<td class="right">'.price(price2num($val['avg'], 'MT'), 1).'</td>'; |
@@ -357,7 +357,7 @@ |
||
357 | 357 | if (isModEnabled('contrat')) { |
358 | 358 | $formcontract = new FormContract($db); |
359 | 359 | print "<tr><td>".$langs->trans("Contract")."</td><td>"; |
360 | - $contractid = GETPOST('contractid') ? GETPOST('contractid') : (!empty($object->fk_contract) ? $object->fk_contract : 0) ; |
|
360 | + $contractid = GETPOST('contractid') ? GETPOST('contractid') : (!empty($object->fk_contract) ? $object->fk_contract : 0); |
|
361 | 361 | $numcontract = $formcontract->select_contract($object->thirdparty->id, $contractid, 'contracttid'); |
362 | 362 | print "</td></tr>"; |
363 | 363 | } |
@@ -3640,9 +3640,12 @@ |
||
3640 | 3640 | |
3641 | 3641 | $parameters = array(); |
3642 | 3642 | $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
3643 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
3644 | - if (empty($reshook)) |
|
3645 | - $object->formAddObjectLine(1, $societe, $mysoc); |
|
3643 | + if ($reshook < 0) { |
|
3644 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
3645 | + } |
|
3646 | + if (empty($reshook)) { |
|
3647 | + $object->formAddObjectLine(1, $societe, $mysoc); |
|
3648 | + } |
|
3646 | 3649 | } |
3647 | 3650 | } |
3648 | 3651 |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | $error++; |
721 | 721 | } |
722 | 722 | |
723 | - $dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server |
|
723 | + $dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server |
|
724 | 724 | $datedue = dol_mktime(0, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'), 'tzserver'); |
725 | 725 | //var_dump($dateinvoice.' '.dol_print_date($dateinvoice, 'dayhour')); |
726 | 726 | //var_dump(dol_now('tzuserrel').' '.dol_get_last_hour(dol_now('tzuserrel')).' '.dol_print_date(dol_now('tzuserrel'),'dayhour').' '.dol_print_date(dol_get_last_hour(dol_now('tzuserrel')), 'dayhour')); |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | $object->ref = GETPOST('ref', 'alphanohtml'); |
759 | 759 | $object->ref_supplier = GETPOST('ref_supplier', 'alpha'); |
760 | 760 | $object->socid = GETPOST('socid', 'int'); |
761 | - $object->libelle = GETPOST('label', 'alphanohtml'); // deprecated |
|
761 | + $object->libelle = GETPOST('label', 'alphanohtml'); // deprecated |
|
762 | 762 | $object->label = GETPOST('label', 'alphanohtml'); |
763 | 763 | $object->date = $dateinvoice; |
764 | 764 | $object->date_echeance = $datedue; |
@@ -976,27 +976,27 @@ discard block |
||
976 | 976 | $tmpproject = GETPOST('projectid', 'int'); |
977 | 977 | |
978 | 978 | // Creation invoice |
979 | + $object->socid = GETPOST('socid', 'int'); |
|
980 | + $object->type = GETPOST('type', 'alphanohtml'); |
|
981 | + $object->ref = GETPOST('ref', 'alphanohtml'); |
|
982 | + $object->ref_supplier = GETPOST('ref_supplier', 'alphanohtml'); |
|
979 | 983 | $object->socid = GETPOST('socid', 'int'); |
980 | - $object->type = GETPOST('type', 'alphanohtml'); |
|
981 | - $object->ref = GETPOST('ref', 'alphanohtml'); |
|
982 | - $object->ref_supplier = GETPOST('ref_supplier', 'alphanohtml'); |
|
983 | - $object->socid = GETPOST('socid', 'int'); |
|
984 | - $object->libelle = GETPOST('label', 'alphanohtml'); // deprecated |
|
984 | + $object->libelle = GETPOST('label', 'alphanohtml'); // deprecated |
|
985 | 985 | $object->label = GETPOST('label', 'alphanohtml'); |
986 | - $object->date = $dateinvoice; |
|
987 | - $object->date_echeance = $datedue; |
|
988 | - $object->note_public = GETPOST('note_public', 'restricthtml'); |
|
989 | - $object->note_private = GETPOST('note_private', 'restricthtml'); |
|
986 | + $object->date = $dateinvoice; |
|
987 | + $object->date_echeance = $datedue; |
|
988 | + $object->note_public = GETPOST('note_public', 'restricthtml'); |
|
989 | + $object->note_private = GETPOST('note_private', 'restricthtml'); |
|
990 | 990 | $object->cond_reglement_id = GETPOST('cond_reglement_id'); |
991 | 991 | $object->mode_reglement_id = GETPOST('mode_reglement_id'); |
992 | 992 | $object->fk_account = GETPOST('fk_account', 'int'); |
993 | 993 | $object->vat_reverse_charge = GETPOST('vat_reverse_charge') == 'on' ? 1 : 0; |
994 | 994 | $object->fk_project = ($tmpproject > 0) ? $tmpproject : null; |
995 | - $object->fk_incoterms = GETPOST('incoterm_id', 'int'); |
|
995 | + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); |
|
996 | 996 | $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); |
997 | 997 | $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); |
998 | - $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); |
|
999 | - $object->transport_mode_id = GETPOST('transport_mode_id'); |
|
998 | + $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); |
|
999 | + $object->transport_mode_id = GETPOST('transport_mode_id'); |
|
1000 | 1000 | |
1001 | 1001 | // Auto calculation of date due if not filled by user |
1002 | 1002 | if (empty($object->date_echeance)) { |
@@ -1335,7 +1335,7 @@ discard block |
||
1335 | 1335 | // Edit line |
1336 | 1336 | $db->begin(); |
1337 | 1337 | |
1338 | - if (! $object->fetch($id) > 0) { |
|
1338 | + if (!$object->fetch($id) > 0) { |
|
1339 | 1339 | dol_print_error($db); |
1340 | 1340 | } |
1341 | 1341 | $object->fetch_thirdparty(); |
@@ -1479,7 +1479,7 @@ discard block |
||
1479 | 1479 | $idprod = GETPOST('idprod', 'int'); |
1480 | 1480 | } |
1481 | 1481 | |
1482 | - $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' |
|
1482 | + $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' |
|
1483 | 1483 | |
1484 | 1484 | $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); |
1485 | 1485 | $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2); |
@@ -2246,7 +2246,7 @@ discard block |
||
2246 | 2246 | |
2247 | 2247 | $sql = 'SELECT r.rowid, r.titre as title, r.total_ttc'; |
2248 | 2248 | $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_rec as r'; |
2249 | - $sql .= ' WHERE r.fk_soc = '. (int) $invoice_predefined->socid; |
|
2249 | + $sql .= ' WHERE r.fk_soc = '.(int) $invoice_predefined->socid; |
|
2250 | 2250 | |
2251 | 2251 | $resql = $db->query($sql); |
2252 | 2252 | if ($resql) { |
@@ -2304,7 +2304,7 @@ discard block |
||
2304 | 2304 | |
2305 | 2305 | // Standard invoice |
2306 | 2306 | print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; |
2307 | - $tmp = '<input type="radio" id="radio_standard" name="type" value="0"'.(GETPOST('type', 'int')? '' : 'checked').'> '; |
|
2307 | + $tmp = '<input type="radio" id="radio_standard" name="type" value="0"'.(GETPOST('type', 'int') ? '' : 'checked').'> '; |
|
2308 | 2308 | $desc = $form->textwithpicto($tmp.'<label for="radio_standard">'.$langs->trans("InvoiceStandardAsk").'</label>', $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3); |
2309 | 2309 | print $desc; |
2310 | 2310 | print '</div></div>'; |
@@ -2313,7 +2313,7 @@ discard block |
||
2313 | 2313 | // Deposit - Down payment |
2314 | 2314 | if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) { |
2315 | 2315 | print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; |
2316 | - $tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> '; |
|
2316 | + $tmp = '<input type="radio" id="radio_deposit" name="type" value="3"'.(GETPOST('type') == 3 ? ' checked' : '').'> '; |
|
2317 | 2317 | print '<script type="text/javascript"> |
2318 | 2318 | jQuery(document).ready(function() { |
2319 | 2319 | jQuery("#typestandardinvoice, #valuestandardinvoice").click(function() { |
@@ -2359,7 +2359,7 @@ discard block |
||
2359 | 2359 | print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit', 'aZ09'), 0, 0, 0, '', 1); |
2360 | 2360 | print '</td>'; |
2361 | 2361 | print '<td class="nowrap" style="padding-left: 5px">'; |
2362 | - print '<span class="opacitymedium paddingleft">'.$langs->trans("AmountOrPercent").'</span><input type="text" id="valuedeposit" name="valuedeposit" class="width75 right" value="' . GETPOST('valuedeposit', 'int') . '"/>'; |
|
2362 | + print '<span class="opacitymedium paddingleft">'.$langs->trans("AmountOrPercent").'</span><input type="text" id="valuedeposit" name="valuedeposit" class="width75 right" value="'.GETPOST('valuedeposit', 'int').'"/>'; |
|
2363 | 2363 | print '</td>'; |
2364 | 2364 | } |
2365 | 2365 | print '</tr></table>'; |
@@ -2514,7 +2514,7 @@ discard block |
||
2514 | 2514 | if (empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) { |
2515 | 2515 | $tmp = '<input type="radio" name="type" id="radio_creditnote" value="0" disabled> '; |
2516 | 2516 | } else { |
2517 | - $tmp='<input type="radio" name="type" id="radio_creditnote" value="2"> '; |
|
2517 | + $tmp = '<input type="radio" name="type" id="radio_creditnote" value="2"> '; |
|
2518 | 2518 | } |
2519 | 2519 | $text = $tmp.$langs->trans("InvoiceAvoir").' '; |
2520 | 2520 | $text .= '<span class="opacitymedium">('.$langs->trans("YouMustCreateInvoiceFromSupplierThird").')</span> '; |
@@ -2597,7 +2597,7 @@ discard block |
||
2597 | 2597 | |
2598 | 2598 | // Vat reverse-charge by default |
2599 | 2599 | if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) { |
2600 | - print '<tr><td>' . $langs->trans('VATReverseCharge') . '</td><td>'; |
|
2600 | + print '<tr><td>'.$langs->trans('VATReverseCharge').'</td><td>'; |
|
2601 | 2601 | // Try to propose to use VAT reverse charge even if the VAT reverse charge is not activated in the supplier card, if this corresponds to the context of use, the activation is proposed |
2602 | 2602 | if ($vat_reverse_charge == 1 || $societe->vat_reverse_charge == 1 || ($societe->country_code != 'FR' && isInEEC($societe) && !empty($societe->tva_intra))) { |
2603 | 2603 | $vat_reverse_charge = 1; |
@@ -2605,7 +2605,7 @@ discard block |
||
2605 | 2605 | $vat_reverse_charge = 0; |
2606 | 2606 | } |
2607 | 2607 | |
2608 | - print '<input type="checkbox" name="vat_reverse_charge"'. (!empty($vat_reverse_charge) ? ' checked ' : '') . '>'; |
|
2608 | + print '<input type="checkbox" name="vat_reverse_charge"'.(!empty($vat_reverse_charge) ? ' checked ' : '').'>'; |
|
2609 | 2609 | print '</td></tr>'; |
2610 | 2610 | } |
2611 | 2611 | |
@@ -3113,7 +3113,7 @@ discard block |
||
3113 | 3113 | $facavoir->fetch($id); |
3114 | 3114 | $invoicecredits[] = $facavoir->getNomUrl(1); |
3115 | 3115 | } |
3116 | - print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("InvoiceHasAvoir") . (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits); |
|
3116 | + print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("InvoiceHasAvoir").(count($invoicecredits) ? ' ' : '').implode(',', $invoicecredits); |
|
3117 | 3117 | print '</span>'; |
3118 | 3118 | } |
3119 | 3119 | if (isset($objectidnext) && $objectidnext > 0) { |
@@ -3309,12 +3309,12 @@ discard block |
||
3309 | 3309 | print '<input type="hidden" name="action" value="setvatreversecharge">'; |
3310 | 3310 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
3311 | 3311 | |
3312 | - print '<input type="checkbox" name="vat_reverse_charge"' . ($object->vat_reverse_charge == '1' ? ' checked ' : '') . '>'; |
|
3312 | + print '<input type="checkbox" name="vat_reverse_charge"'.($object->vat_reverse_charge == '1' ? ' checked ' : '').'>'; |
|
3313 | 3313 | |
3314 | 3314 | print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
3315 | 3315 | print '</form>'; |
3316 | 3316 | } else { |
3317 | - print '<input type="checkbox" name="vat_reverse_charge"'. ($object->vat_reverse_charge == '1' ? ' checked ' : '') . ' disabled>'; |
|
3317 | + print '<input type="checkbox" name="vat_reverse_charge"'.($object->vat_reverse_charge == '1' ? ' checked ' : '').' disabled>'; |
|
3318 | 3318 | } |
3319 | 3319 | print '</td></tr>'; |
3320 | 3320 | } |
@@ -3375,15 +3375,15 @@ discard block |
||
3375 | 3375 | print '<table class="border tableforfield centpercent">'; |
3376 | 3376 | |
3377 | 3377 | print '<tr>'; |
3378 | - print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>'; |
|
3379 | - print '<td class="nowrap amountcard right">' . price($object->total_ht, '', $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
3378 | + print '<td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>'; |
|
3379 | + print '<td class="nowrap amountcard right">'.price($object->total_ht, '', $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
3380 | 3380 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
3381 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
3381 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
3382 | 3382 | } |
3383 | 3383 | print '</tr>'; |
3384 | 3384 | |
3385 | 3385 | print '<tr>'; |
3386 | - print '<td>' . $langs->trans('AmountVAT') . '</td>'; |
|
3386 | + print '<td>'.$langs->trans('AmountVAT').'</td>'; |
|
3387 | 3387 | print '<td class="nowrap amountcard right">'; |
3388 | 3388 | if (GETPOST('calculationrule')) { |
3389 | 3389 | $calculationrule = GETPOST('calculationrule', 'alpha'); |
@@ -3397,40 +3397,40 @@ discard block |
||
3397 | 3397 | } |
3398 | 3398 | // Show link for "recalculate" |
3399 | 3399 | if ($object->getVentilExportCompta() == 0) { |
3400 | - $s = '<span class="hideonsmartphone opacitymedium">' . $langs->trans("ReCalculate") . ' </span>'; |
|
3401 | - $s .= '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=calculate&calculationrule=totalofround">' . $langs->trans("Mode1") . '</a>'; |
|
3400 | + $s = '<span class="hideonsmartphone opacitymedium">'.$langs->trans("ReCalculate").' </span>'; |
|
3401 | + $s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=totalofround">'.$langs->trans("Mode1").'</a>'; |
|
3402 | 3402 | $s .= ' / '; |
3403 | - $s .= '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=calculate&calculationrule=roundoftotal">' . $langs->trans("Mode2") . '</a>'; |
|
3403 | + $s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=roundoftotal">'.$langs->trans("Mode2").'</a>'; |
|
3404 | 3404 | print '<div class="inline-block">'; |
3405 | - print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum) . '<br>' . $langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'), '', 3, '', 0, 'recalculate'); |
|
3405 | + print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum).'<br>'.$langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'), '', 3, '', 0, 'recalculate'); |
|
3406 | 3406 | print ' '; |
3407 | 3407 | print '</div>'; |
3408 | 3408 | } |
3409 | 3409 | print price($object->total_tva, 1, $langs, 0, -1, -1, $conf->currency); |
3410 | 3410 | print '</td>'; |
3411 | 3411 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
3412 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
3412 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
3413 | 3413 | } |
3414 | 3414 | print '</tr>'; |
3415 | 3415 | |
3416 | 3416 | if ($societe->localtax1_assuj == "1") { //Localtax1 |
3417 | 3417 | print '<tr>'; |
3418 | - print '<td>' . $langs->transcountry("AmountLT1", $societe->country_code) . '</td>'; |
|
3419 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
3418 | + print '<td>'.$langs->transcountry("AmountLT1", $societe->country_code).'</td>'; |
|
3419 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
3420 | 3420 | print '</tr>'; |
3421 | 3421 | } |
3422 | 3422 | if ($societe->localtax2_assuj == "1") { //Localtax2 |
3423 | 3423 | print '<tr>'; |
3424 | - print '<td>' . $langs->transcountry("AmountLT2", $societe->country_code) . '</td>'; |
|
3425 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
3424 | + print '<td>'.$langs->transcountry("AmountLT2", $societe->country_code).'</td>'; |
|
3425 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
3426 | 3426 | print '</tr>'; |
3427 | 3427 | } |
3428 | 3428 | |
3429 | 3429 | print '<tr>'; |
3430 | - print '<td>' . $langs->trans('AmountTTC') . '</td>'; |
|
3431 | - print '<td class="nowrap amountcard right">' . price($object->total_ttc, '', $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
3430 | + print '<td>'.$langs->trans('AmountTTC').'</td>'; |
|
3431 | + print '<td class="nowrap amountcard right">'.price($object->total_ttc, '', $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
3432 | 3432 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
3433 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
3433 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
3434 | 3434 | } |
3435 | 3435 | print '</tr>'; |
3436 | 3436 | |
@@ -3736,7 +3736,7 @@ discard block |
||
3736 | 3736 | print '<tr><td colspan="'.$nbcols.'" class="right">'; |
3737 | 3737 | print '<span class="opacitymedium">'; |
3738 | 3738 | print $langs->trans('RemainderToPayBackMulticurrency'); |
3739 | - if ($resteapayeraffiche> 0) { |
|
3739 | + if ($resteapayeraffiche > 0) { |
|
3740 | 3740 | print ' ('.$langs->trans('NegativeIfExcessRefunded').')'; |
3741 | 3741 | } |
3742 | 3742 | print '</span>'; |
@@ -3965,7 +3965,7 @@ discard block |
||
3965 | 3965 | } |
3966 | 3966 | |
3967 | 3967 | // Clone as predefined / Create template |
3968 | - if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_DEPOSIT) && $object->statut == 0 && $usercancreate) { |
|
3968 | + if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_DEPOSIT) && $object->statut == 0 && $usercancreate) { |
|
3969 | 3969 | if (!$objectidnext && count($object->lines) > 0) { |
3970 | 3970 | print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card-rec.php?facid='.$object->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>'; |
3971 | 3971 | } |
@@ -126,7 +126,7 @@ |
||
126 | 126 | $morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1); |
127 | 127 | |
128 | 128 | // Amount |
129 | - $morehtmlref .= '<br>'.$langs->trans('Amount').' : '. price($object->amount, '', $langs, 0, 0, -1, $conf->currency); |
|
129 | + $morehtmlref .= '<br>'.$langs->trans('Amount').' : '.price($object->amount, '', $langs, 0, 0, -1, $conf->currency); |
|
130 | 130 | |
131 | 131 | $allow_delete = 1; |
132 | 132 | // Bank account |
@@ -687,8 +687,9 @@ discard block |
||
687 | 687 | $newlang = ''; |
688 | 688 | if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { |
689 | 689 | $newlang = $object->thirdparty->default_lang; |
690 | - if (GETPOST('lang_id', 'aZ09')) |
|
691 | - $newlang = GETPOST('lang_id', 'aZ09'); |
|
690 | + if (GETPOST('lang_id', 'aZ09')) { |
|
691 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
692 | + } |
|
692 | 693 | } |
693 | 694 | if (!empty($newlang)) { |
694 | 695 | $outputlangs = new Translate("", $conf); |
@@ -2427,9 +2428,12 @@ discard block |
||
2427 | 2428 | |
2428 | 2429 | $parameters = array(); |
2429 | 2430 | $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
2430 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2431 | - if (empty($reshook)) |
|
2432 | - $object->formAddObjectLine(1, $societe, $mysoc); |
|
2431 | + if ($reshook < 0) { |
|
2432 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2433 | + } |
|
2434 | + if (empty($reshook)) { |
|
2435 | + $object->formAddObjectLine(1, $societe, $mysoc); |
|
2436 | + } |
|
2433 | 2437 | } |
2434 | 2438 | } |
2435 | 2439 | print '</table>'; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $result = restrictedArea($user, 'fournisseur', $object, 'commande_fournisseur', 'commande', 'fk_soc', 'rowid', $isdraft); |
138 | 138 | |
139 | 139 | // Common permissions |
140 | -$usercanread = ($user->hasRight("fournisseur", "commande", "lire") || $user->hasRight("supplier_order", "lire")); |
|
140 | +$usercanread = ($user->hasRight("fournisseur", "commande", "lire") || $user->hasRight("supplier_order", "lire")); |
|
141 | 141 | $usercancreate = ($user->hasRight("fournisseur", "commande", "creer") || $user->hasRight("supplier_order", "creer")); |
142 | 142 | $usercandelete = (($user->hasRight("fournisseur", "commande", "supprimer") || $user->hasRight("supplier_order", "supprimer")) || ($usercancreate && isset($object->statut) && $object->statut == $object::STATUS_DRAFT)); |
143 | 143 | |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight("fournisseur", "supplier_order_advance", "validate"))); |
146 | 146 | |
147 | 147 | // Additional area permissions |
148 | -$usercanapprove = $user->hasRight("fournisseur", "commande", "approuver"); |
|
149 | -$usercanapprovesecond = $user->hasRight("fournisseur", "commande", "approve2"); |
|
150 | -$usercanorder = $user->hasRight("fournisseur", "commande", "commander"); |
|
148 | +$usercanapprove = $user->hasRight("fournisseur", "commande", "approuver"); |
|
149 | +$usercanapprovesecond = $user->hasRight("fournisseur", "commande", "approve2"); |
|
150 | +$usercanorder = $user->hasRight("fournisseur", "commande", "commander"); |
|
151 | 151 | if (empty($conf->reception->enabled)) { |
152 | 152 | $usercanreceive = $user->hasRight("fournisseur", "commande", "receptionner"); |
153 | 153 | } else { |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | |
157 | 157 | // Permissions for includes |
158 | 158 | $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php |
159 | -$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php |
|
160 | -$permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php |
|
159 | +$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php |
|
160 | +$permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php |
|
161 | 161 | $permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php |
162 | 162 | |
163 | 163 | // Project permission |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | if (empty($reshook)) { |
183 | - $backurlforlist = DOL_URL_ROOT.'/fourn/commande/list.php'.($socid > 0 ? '?socid='.((int) $socid) : ''); |
|
183 | + $backurlforlist = DOL_URL_ROOT.'/fourn/commande/list.php'.($socid > 0 ? '?socid='.((int) $socid) : ''); |
|
184 | 184 | |
185 | 185 | if (empty($backtopage) || ($cancel && empty($id))) { |
186 | 186 | if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $idprod = GETPOST('idprod', 'int'); |
436 | 436 | } |
437 | 437 | |
438 | - $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' |
|
438 | + $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' |
|
439 | 439 | |
440 | 440 | $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); |
441 | 441 | $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2); |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | |
554 | 554 | //If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time |
555 | 555 | if (trim($product_desc) == trim($desc) && !empty($conf->global->PRODUIT_AUTOFILL_DESC)) { |
556 | - $product_desc=''; |
|
556 | + $product_desc = ''; |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) { |
@@ -1743,7 +1743,7 @@ discard block |
||
1743 | 1743 | // Payment term |
1744 | 1744 | print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>'; |
1745 | 1745 | print img_picto('', 'payment', 'class="pictofixedwidth"'); |
1746 | - print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id', -1, 1); |
|
1746 | + print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id', -1, 1); |
|
1747 | 1747 | print '</td></tr>'; |
1748 | 1748 | |
1749 | 1749 | // Payment mode |
@@ -1991,7 +1991,7 @@ discard block |
||
1991 | 1991 | 'morecss' => 'minwidth300' |
1992 | 1992 | ) |
1993 | 1993 | ); |
1994 | - $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("DenyingThisOrder"), $langs->trans("ConfirmDenyingThisOrder", $object->ref), "confirm_refuse", $formquestion, 0, 1); |
|
1994 | + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("DenyingThisOrder"), $langs->trans("ConfirmDenyingThisOrder", $object->ref), "confirm_refuse", $formquestion, 0, 1); |
|
1995 | 1995 | } |
1996 | 1996 | |
1997 | 1997 | // Confirmation of cancellation |
@@ -2320,40 +2320,40 @@ discard block |
||
2320 | 2320 | |
2321 | 2321 | print '<tr>'; |
2322 | 2322 | // Amount HT |
2323 | - print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>'; |
|
2324 | - print '<td class="nowrap amountcard right">' . price($object->total_ht, '', $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
2323 | + print '<td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>'; |
|
2324 | + print '<td class="nowrap amountcard right">'.price($object->total_ht, '', $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
2325 | 2325 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
2326 | 2326 | // Multicurrency Amount HT |
2327 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
2327 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
2328 | 2328 | } |
2329 | 2329 | print '</tr>'; |
2330 | 2330 | |
2331 | 2331 | print '<tr>'; |
2332 | 2332 | // Amount VAT |
2333 | - print '<td class="titlefieldmiddle">' . $langs->trans('AmountVAT') . '</td>'; |
|
2334 | - print '<td class="nowrap amountcard right">' . price($object->total_tva, '', $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
2333 | + print '<td class="titlefieldmiddle">'.$langs->trans('AmountVAT').'</td>'; |
|
2334 | + print '<td class="nowrap amountcard right">'.price($object->total_tva, '', $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
2335 | 2335 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
2336 | 2336 | // Multicurrency Amount VAT |
2337 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
2337 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
2338 | 2338 | } |
2339 | 2339 | print '</tr>'; |
2340 | 2340 | |
2341 | 2341 | // Amount Local Taxes |
2342 | 2342 | if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { |
2343 | 2343 | print '<tr>'; |
2344 | - print '<td class="titlefieldmiddle">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>'; |
|
2345 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax1, '', $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
2344 | + print '<td class="titlefieldmiddle">'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>'; |
|
2345 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax1, '', $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
2346 | 2346 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
2347 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax1, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
2347 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax1, '', $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
2348 | 2348 | } |
2349 | 2349 | print '</tr>'; |
2350 | 2350 | |
2351 | 2351 | if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { |
2352 | 2352 | print '<tr>'; |
2353 | - print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>'; |
|
2354 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax2, '', $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
2353 | + print '<td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>'; |
|
2354 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax2, '', $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
2355 | 2355 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
2356 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax2, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
2356 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax2, '', $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
2357 | 2357 | } |
2358 | 2358 | print '</tr>'; |
2359 | 2359 | } |
@@ -2361,16 +2361,16 @@ discard block |
||
2361 | 2361 | |
2362 | 2362 | $alert = ''; |
2363 | 2363 | if (!empty($conf->global->ORDER_MANAGE_MIN_AMOUNT) && $object->total_ht < $object->thirdparty->supplier_order_min_amount) { |
2364 | - $alert = ' ' . img_warning($langs->trans('OrderMinAmount') . ': ' . price($object->thirdparty->supplier_order_min_amount)); |
|
2364 | + $alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->supplier_order_min_amount)); |
|
2365 | 2365 | } |
2366 | 2366 | |
2367 | 2367 | print '<tr>'; |
2368 | 2368 | // Amount TTC |
2369 | - print '<td>' . $langs->trans('AmountTTC') . '</td>'; |
|
2370 | - print '<td class="nowrap amountcard right">' . price($object->total_ttc, '', $langs, 0, -1, -1, $conf->currency) . $alert . '</td>'; |
|
2369 | + print '<td>'.$langs->trans('AmountTTC').'</td>'; |
|
2370 | + print '<td class="nowrap amountcard right">'.price($object->total_ttc, '', $langs, 0, -1, -1, $conf->currency).$alert.'</td>'; |
|
2371 | 2371 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
2372 | 2372 | // Multicurrency Amount TTC |
2373 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
2373 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
2374 | 2374 | } |
2375 | 2375 | print '</tr>'; |
2376 | 2376 | |
@@ -2696,7 +2696,7 @@ discard block |
||
2696 | 2696 | $action = 'presend'; |
2697 | 2697 | } |
2698 | 2698 | |
2699 | - if ($action != 'createorder' && $action != 'presend' ) { |
|
2699 | + if ($action != 'createorder' && $action != 'presend') { |
|
2700 | 2700 | print '<div class="fichecenter"><div class="fichehalfleft">'; |
2701 | 2701 | |
2702 | 2702 | // Generated documents |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $search_date_endday = GETPOST('search_date_endday', 'int'); |
75 | 75 | $search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
76 | 76 | $search_date_endyear = GETPOST('search_date_endyear', 'int'); |
77 | -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
77 | +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
78 | 78 | $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
79 | 79 | $search_date_valid_startday = GETPOST('search_date_valid_startday', 'int'); |
80 | 80 | $search_date_valid_startmonth = GETPOST('search_date_valid_startmonth', 'int'); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $search_date_valid_endday = GETPOST('search_date_valid_endday', 'int'); |
83 | 83 | $search_date_valid_endmonth = GETPOST('search_date_valid_endmonth', 'int'); |
84 | 84 | $search_date_valid_endyear = GETPOST('search_date_valid_endyear', 'int'); |
85 | -$search_date_valid_start = dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear); // Use tzserver |
|
85 | +$search_date_valid_start = dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear); // Use tzserver |
|
86 | 86 | $search_date_valid_end = dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear); |
87 | 87 | $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); |
88 | 88 | $search_montant_ht = GETPOST('search_montant_ht', 'alpha'); |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | if ($searchCategoryProductOperator == 0) { |
443 | 443 | $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."supplier_proposaldet as sd WHERE sd.fk_supplier_proposal = sp.rowid AND sd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")"; |
444 | 444 | } else { |
445 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct); |
|
445 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryProduct); |
|
446 | 446 | } |
447 | 447 | } |
448 | 448 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * \brief Main page for ECM section area |
24 | 24 | */ |
25 | 25 | |
26 | -if (! defined('DISABLE_JS_GRAHP')) define('DISABLE_JS_GRAPH', 1); |
|
26 | +if (!defined('DISABLE_JS_GRAHP')) define('DISABLE_JS_GRAPH', 1); |
|
27 | 27 | |
28 | 28 | // Load Dolibarr environment |
29 | 29 | require '../main.inc.php'; |
@@ -23,7 +23,9 @@ |
||
23 | 23 | * \brief Main page for ECM section area |
24 | 24 | */ |
25 | 25 | |
26 | -if (! defined('DISABLE_JS_GRAHP')) define('DISABLE_JS_GRAPH', 1); |
|
26 | +if (! defined('DISABLE_JS_GRAHP')) { |
|
27 | + define('DISABLE_JS_GRAPH', 1); |
|
28 | +} |
|
27 | 29 | |
28 | 30 | // Load Dolibarr environment |
29 | 31 | require '../main.inc.php'; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | 'enabled'=>(isModEnabled('commande') && isModEnabled('facture')), |
73 | 73 | 'picto'=>'bill' |
74 | 74 | ), |
75 | - 'WORKFLOW_TICKET_CREATE_INTERVENTION' => array ( |
|
75 | + 'WORKFLOW_TICKET_CREATE_INTERVENTION' => array( |
|
76 | 76 | 'family'=>'create', |
77 | 77 | 'position'=>25, |
78 | 78 | 'enabled'=>(isModEnabled('ticket') && isModEnabled('ficheinter')), |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } |
193 | 193 | |
194 | 194 | // remove not available workflows (based on activated modules and global defined keys) |
195 | -$workflowcodes = array_filter($workflowcodes, function ($var) { |
|
195 | +$workflowcodes = array_filter($workflowcodes, function($var) { |
|
196 | 196 | return $var['enabled']; |
197 | 197 | }); |
198 | 198 |