Test Failed
Push — master ( 9d1fea...db7d4f )
by Alxarafe
49:25
created
dolibarr/htdocs/admin/dict.php 1 patch
Braces   +333 added lines, -231 removed lines patch added patch discarded remove patch
@@ -568,8 +568,9 @@  discard block
 block discarded – undo
568 568
         'fichinter' => $langs->trans('InterventionCard'),
569 569
         'contrat' => $langs->trans('Contract')
570 570
     );
571
-    if (!empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES))
572
-        $elementList["societe"] = $langs->trans('ThirdParty');
571
+    if (!empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) {
572
+            $elementList["societe"] = $langs->trans('ThirdParty');
573
+    }
573 574
 
574 575
     complete_elementList_with_modules($elementList);
575 576
 
@@ -615,20 +616,30 @@  discard block
 block discarded – undo
615 616
     // Check that all fields are filled
616 617
     $ok = 1;
617 618
     foreach ($listfield as $f => $value) {
618
-        if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory')))
619
-            continue;  // For some pages, country is not mandatory
620
-        if ($value == 'country' && in_array($tablib[$id], array('DictionaryCanton', 'DictionaryCompanyType', 'DictionaryRevenueStamp')))
621
-            continue;  // For some pages, country is not mandatory
622
-        if ($value == 'localtax1' && empty($_POST['localtax1_type']))
623
-            continue;
624
-        if ($value == 'localtax2' && empty($_POST['localtax2_type']))
625
-            continue;
626
-        if ($value == 'color' && empty($_POST['color']))
627
-            continue;
628
-        if ($value == 'formula' && empty($_POST['formula']))
629
-            continue;
630
-        if ($value == 'sortorder')
631
-            continue;  // For a column name 'sortorder', we use the field name 'position'
619
+        if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) {
620
+                    continue;
621
+        }
622
+        // For some pages, country is not mandatory
623
+        if ($value == 'country' && in_array($tablib[$id], array('DictionaryCanton', 'DictionaryCompanyType', 'DictionaryRevenueStamp'))) {
624
+                    continue;
625
+        }
626
+        // For some pages, country is not mandatory
627
+        if ($value == 'localtax1' && empty($_POST['localtax1_type'])) {
628
+                    continue;
629
+        }
630
+        if ($value == 'localtax2' && empty($_POST['localtax2_type'])) {
631
+                    continue;
632
+        }
633
+        if ($value == 'color' && empty($_POST['color'])) {
634
+                    continue;
635
+        }
636
+        if ($value == 'formula' && empty($_POST['formula'])) {
637
+                    continue;
638
+        }
639
+        if ($value == 'sortorder') {
640
+                    continue;
641
+        }
642
+        // For a column name 'sortorder', we use the field name 'position'
632 643
         if ((!isset($_POST[$value]) || $_POST[$value] == '') && (!in_array($listfield[$f], array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking'))  // Fields that are not mandatory
633 644
             && (!($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
634 645
             )
@@ -636,36 +647,51 @@  discard block
 block discarded – undo
636 647
             $ok = 0;
637 648
             $fieldnamekey = $listfield[$f];
638 649
             // We take translate key of field
639
-            if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label'))
640
-                $fieldnamekey = 'Label';
641
-            if ($fieldnamekey == 'libelle_facture')
642
-                $fieldnamekey = 'LabelOnDocuments';
643
-            if ($fieldnamekey == 'nbjour')
644
-                $fieldnamekey = 'NbOfDays';
645
-            if ($fieldnamekey == 'decalage')
646
-                $fieldnamekey = 'Offset';
647
-            if ($fieldnamekey == 'module')
648
-                $fieldnamekey = 'Module';
649
-            if ($fieldnamekey == 'code')
650
-                $fieldnamekey = 'Code';
651
-            if ($fieldnamekey == 'note')
652
-                $fieldnamekey = 'Note';
653
-            if ($fieldnamekey == 'taux')
654
-                $fieldnamekey = 'Rate';
655
-            if ($fieldnamekey == 'type')
656
-                $fieldnamekey = 'Type';
657
-            if ($fieldnamekey == 'position')
658
-                $fieldnamekey = 'Position';
659
-            if ($fieldnamekey == 'unicode')
660
-                $fieldnamekey = 'Unicode';
661
-            if ($fieldnamekey == 'deductible')
662
-                $fieldnamekey = 'Deductible';
663
-            if ($fieldnamekey == 'sortorder')
664
-                $fieldnamekey = 'SortOrder';
665
-            if ($fieldnamekey == 'category_type')
666
-                $fieldnamekey = 'Calculated';
667
-            if ($fieldnamekey == 'revenuestamp_type')
668
-                $fieldnamekey = 'TypeOfRevenueStamp';
650
+            if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) {
651
+                            $fieldnamekey = 'Label';
652
+            }
653
+            if ($fieldnamekey == 'libelle_facture') {
654
+                            $fieldnamekey = 'LabelOnDocuments';
655
+            }
656
+            if ($fieldnamekey == 'nbjour') {
657
+                            $fieldnamekey = 'NbOfDays';
658
+            }
659
+            if ($fieldnamekey == 'decalage') {
660
+                            $fieldnamekey = 'Offset';
661
+            }
662
+            if ($fieldnamekey == 'module') {
663
+                            $fieldnamekey = 'Module';
664
+            }
665
+            if ($fieldnamekey == 'code') {
666
+                            $fieldnamekey = 'Code';
667
+            }
668
+            if ($fieldnamekey == 'note') {
669
+                            $fieldnamekey = 'Note';
670
+            }
671
+            if ($fieldnamekey == 'taux') {
672
+                            $fieldnamekey = 'Rate';
673
+            }
674
+            if ($fieldnamekey == 'type') {
675
+                            $fieldnamekey = 'Type';
676
+            }
677
+            if ($fieldnamekey == 'position') {
678
+                            $fieldnamekey = 'Position';
679
+            }
680
+            if ($fieldnamekey == 'unicode') {
681
+                            $fieldnamekey = 'Unicode';
682
+            }
683
+            if ($fieldnamekey == 'deductible') {
684
+                            $fieldnamekey = 'Deductible';
685
+            }
686
+            if ($fieldnamekey == 'sortorder') {
687
+                            $fieldnamekey = 'SortOrder';
688
+            }
689
+            if ($fieldnamekey == 'category_type') {
690
+                            $fieldnamekey = 'Calculated';
691
+            }
692
+            if ($fieldnamekey == 'revenuestamp_type') {
693
+                            $fieldnamekey = 'TypeOfRevenueStamp';
694
+            }
669 695
 
670 696
             setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
671 697
         }
@@ -700,16 +726,26 @@  discard block
 block discarded – undo
700 726
     }
701 727
 
702 728
     // Clean some parameters
703
-    if ((!empty($_POST["localtax1_type"]) || ($_POST['localtax1_type'] == '0')) && empty($_POST["localtax1"]))
704
-        $_POST["localtax1"] = '0'; // If empty, we force to 0
705
-    if ((!empty($_POST["localtax2_type"]) || ($_POST['localtax2_type'] == '0')) && empty($_POST["localtax2"]))
706
-        $_POST["localtax2"] = '0'; // If empty, we force to 0
707
-    if ($_POST["accountancy_code"] <= 0)
708
-        $_POST["accountancy_code"] = ''; // If empty, we force to null
709
-    if ($_POST["accountancy_code_sell"] <= 0)
710
-        $_POST["accountancy_code_sell"] = ''; // If empty, we force to null
711
-    if ($_POST["accountancy_code_buy"] <= 0)
712
-        $_POST["accountancy_code_buy"] = ''; // If empty, we force to null
729
+    if ((!empty($_POST["localtax1_type"]) || ($_POST['localtax1_type'] == '0')) && empty($_POST["localtax1"])) {
730
+            $_POST["localtax1"] = '0';
731
+    }
732
+    // If empty, we force to 0
733
+    if ((!empty($_POST["localtax2_type"]) || ($_POST['localtax2_type'] == '0')) && empty($_POST["localtax2"])) {
734
+            $_POST["localtax2"] = '0';
735
+    }
736
+    // If empty, we force to 0
737
+    if ($_POST["accountancy_code"] <= 0) {
738
+            $_POST["accountancy_code"] = '';
739
+    }
740
+    // If empty, we force to null
741
+    if ($_POST["accountancy_code_sell"] <= 0) {
742
+            $_POST["accountancy_code_sell"] = '';
743
+    }
744
+    // If empty, we force to null
745
+    if ($_POST["accountancy_code_buy"] <= 0) {
746
+            $_POST["accountancy_code_buy"] = '';
747
+    }
748
+    // If empty, we force to null
713 749
     if ($id == 10 && isset($_POST["code"])) {  // Spaces are not allowed into code
714 750
         $_POST["code"] = preg_replace('/\s/', '', $_POST["code"]);
715 751
     }
@@ -732,15 +768,17 @@  discard block
 block discarded – undo
732 768
         // Add new entry
733 769
         $sql = "INSERT INTO " . $tabname[$id] . " (";
734 770
         // List of fields
735
-        if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
736
-            $sql .= $tabrowid[$id] . ",";
771
+        if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
772
+                    $sql .= $tabrowid[$id] . ",";
773
+        }
737 774
         $sql .= $tabfieldinsert[$id];
738 775
         $sql .= ",active)";
739 776
         $sql .= " VALUES(";
740 777
 
741 778
         // List of values
742
-        if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
743
-            $sql .= $newid . ",";
779
+        if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
780
+                    $sql .= $newid . ",";
781
+        }
744 782
         $i = 0;
745 783
         foreach ($listfieldinsert as $f => $value) {
746 784
             if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') {
@@ -748,14 +786,18 @@  discard block
 block discarded – undo
748 786
             } else if ($value == 'entity') {
749 787
                 $_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]);
750 788
             }
751
-            if ($i)
752
-                $sql .= ",";
789
+            if ($i) {
790
+                            $sql .= ",";
791
+            }
753 792
             if ($listfieldvalue[$i] == 'sortorder') {  // For column name 'sortorder', we use the field name 'position'
754 793
                 $sql .= "'" . (int) $db->escape($_POST['position']) . "'";
755
-            } elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10))
756
-                $sql .= "null";  // For vat, we want/accept code = ''
757
-            else
758
-                $sql .= "'" . $db->escape($_POST[$listfieldvalue[$i]]) . "'";
794
+            } elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) {
795
+                            $sql .= "null";
796
+            }
797
+            // For vat, we want/accept code = ''
798
+            else {
799
+                            $sql .= "'" . $db->escape($_POST[$listfieldvalue[$i]]) . "'";
800
+            }
759 801
             $i++;
760 802
         }
761 803
         $sql .= ",1)";
@@ -796,20 +838,25 @@  discard block
 block discarded – undo
796 838
             } else if ($field == 'entity') {
797 839
                 $_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]);
798 840
             }
799
-            if ($i)
800
-                $sql .= ",";
841
+            if ($i) {
842
+                            $sql .= ",";
843
+            }
801 844
             $sql .= $field . "=";
802 845
             if ($listfieldvalue[$i] == 'sortorder') {  // For column name 'sortorder', we use the field name 'position'
803 846
                 $sql .= "'" . (int) $db->escape($_POST['position']) . "'";
804
-            } elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10))
805
-                $sql .= "null";  // For vat, we want/accept code = ''
806
-            else
807
-                $sql .= "'" . $db->escape($_POST[$listfieldvalue[$i]]) . "'";
847
+            } elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) {
848
+                            $sql .= "null";
849
+            }
850
+            // For vat, we want/accept code = ''
851
+            else {
852
+                            $sql .= "'" . $db->escape($_POST[$listfieldvalue[$i]]) . "'";
853
+            }
808 854
             $i++;
809 855
         }
810 856
         $sql .= " WHERE " . $rowidcol . " = '" . $rowid . "'";
811
-        if (in_array('entity', $listfieldmodify))
812
-            $sql .= " AND entity = '" . getEntity($tabname[$id]) . "'";
857
+        if (in_array('entity', $listfieldmodify)) {
858
+                    $sql .= " AND entity = '" . getEntity($tabname[$id]) . "'";
859
+        }
813 860
 
814 861
         dol_syslog("actionmodify", LOG_DEBUG);
815 862
         //print $sql;
@@ -961,19 +1008,25 @@  discard block
 block discarded – undo
961 1008
 
962 1009
 
963 1010
 $param = '&id=' . urlencode($id);
964
-if ($search_country_id > 0)
1011
+if ($search_country_id > 0) {
965 1012
     $param .= '&search_country_id=' . urlencode($search_country_id);
966
-if ($search_code != '')
1013
+}
1014
+if ($search_code != '') {
967 1015
     $param .= '&search_code=' . urlencode($search_country_id);
968
-if ($entity != '')
1016
+}
1017
+if ($entity != '') {
969 1018
     $param .= '&entity=' . (int) $entity;
1019
+}
970 1020
 $paramwithsearch = $param;
971
-if ($sortorder)
1021
+if ($sortorder) {
972 1022
     $paramwithsearch .= '&sortorder=' . urlencode($sortorder);
973
-if ($sortfield)
1023
+}
1024
+if ($sortfield) {
974 1025
     $paramwithsearch .= '&sortfield=' . urlencode($sortfield);
975
-if (GETPOST('from'))
1026
+}
1027
+if (GETPOST('from')) {
976 1028
     $paramwithsearch .= '&from=' . urlencode(GETPOST('from', 'alpha'));
1029
+}
977 1030
 
978 1031
 
979 1032
 // Confirmation de la suppression de la ligne
@@ -989,19 +1042,24 @@  discard block
 block discarded – undo
989 1042
     // Complete requete recherche valeurs avec critere de tri
990 1043
     $sql = $tabsql[$id];
991 1044
 
992
-    if (!preg_match('/ WHERE /', $sql))
993
-        $sql .= " WHERE 1 = 1";
994
-    if ($search_country_id > 0)
995
-        $sql .= " AND c.rowid = " . $search_country_id;
996
-    if ($search_code != '' && $id != 9)
997
-        $sql .= natural_search("code", $search_code);
998
-    if ($search_code != '' && $id == 9)
999
-        $sql .= natural_search("code_iso", $search_code);
1045
+    if (!preg_match('/ WHERE /', $sql)) {
1046
+            $sql .= " WHERE 1 = 1";
1047
+    }
1048
+    if ($search_country_id > 0) {
1049
+            $sql .= " AND c.rowid = " . $search_country_id;
1050
+    }
1051
+    if ($search_code != '' && $id != 9) {
1052
+            $sql .= natural_search("code", $search_code);
1053
+    }
1054
+    if ($search_code != '' && $id == 9) {
1055
+            $sql .= natural_search("code_iso", $search_code);
1056
+    }
1000 1057
 
1001 1058
     if ($sortfield) {
1002 1059
         // If sort order is "country", we use country_code instead
1003
-        if ($sortfield == 'country')
1004
-            $sortfield = 'country_code';
1060
+        if ($sortfield == 'country') {
1061
+                    $sortfield = 'country_code';
1062
+        }
1005 1063
         $sql .= " ORDER BY " . $db->escape($sortfield);
1006 1064
         if ($sortorder) {
1007 1065
             $sql .= " " . strtoupper($db->escape($sortorder));
@@ -1064,10 +1122,11 @@  discard block
 block discarded – undo
1064 1122
                 $valuetoshow = $langs->trans("PriceUHT");
1065 1123
             }
1066 1124
             if ($fieldlist[$field] == 'taux') {
1067
-                if ($tabname[$id] != MAIN_DB_PREFIX . "c_revenuestamp")
1068
-                    $valuetoshow = $langs->trans("Rate");
1069
-                else
1070
-                    $valuetoshow = $langs->trans("Amount");
1125
+                if ($tabname[$id] != MAIN_DB_PREFIX . "c_revenuestamp") {
1126
+                                    $valuetoshow = $langs->trans("Rate");
1127
+                } else {
1128
+                                    $valuetoshow = $langs->trans("Amount");
1129
+                }
1071 1130
                 $class = 'center';
1072 1131
             }
1073 1132
             if ($fieldlist[$field] == 'localtax1_type') {
@@ -1095,10 +1154,11 @@  discard block
 block discarded – undo
1095 1154
                 $valuetoshow = $langs->trans("Language");
1096 1155
             }
1097 1156
             if ($fieldlist[$field] == 'type') {
1098
-                if ($tabname[$id] == MAIN_DB_PREFIX . "c_paiement")
1099
-                    $valuetoshow = $form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
1100
-                else
1101
-                    $valuetoshow = $langs->trans("Type");
1157
+                if ($tabname[$id] == MAIN_DB_PREFIX . "c_paiement") {
1158
+                                    $valuetoshow = $form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
1159
+                } else {
1160
+                                    $valuetoshow = $langs->trans("Type");
1161
+                }
1102 1162
             }
1103 1163
             if ($fieldlist[$field] == 'code') {
1104 1164
                 $valuetoshow = $langs->trans("Code");
@@ -1247,24 +1307,28 @@  discard block
 block discarded – undo
1247 1307
 
1248 1308
             if ($valuetoshow != '') {
1249 1309
                 print '<td' . ($class ? ' class="' . $class . '"' : '') . '>';
1250
-                if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value]))
1251
-                    print '<a href="' . $tabhelp[$id][$value] . '" target="_blank">' . $valuetoshow . ' ' . img_help(1, $valuetoshow) . '</a>';
1252
-                else if (!empty($tabhelp[$id][$value]))
1253
-                    print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
1254
-                else
1255
-                    print $valuetoshow;
1310
+                if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
1311
+                                    print '<a href="' . $tabhelp[$id][$value] . '" target="_blank">' . $valuetoshow . ' ' . img_help(1, $valuetoshow) . '</a>';
1312
+                } else if (!empty($tabhelp[$id][$value])) {
1313
+                                    print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
1314
+                } else {
1315
+                                    print $valuetoshow;
1316
+                }
1256 1317
                 print '</td>';
1257 1318
             }
1258
-            if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label')
1259
-                $alabelisused = 1;
1319
+            if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
1320
+                            $alabelisused = 1;
1321
+            }
1260 1322
         }
1261 1323
 
1262
-        if ($id == 4)
1263
-            print '<td></td>';
1324
+        if ($id == 4) {
1325
+                    print '<td></td>';
1326
+        }
1264 1327
         print '<td>';
1265 1328
         print '<input type="hidden" name="id" value="' . $id . '">';
1266
-        if (!is_null($withentity))
1267
-            print '<input type="hidden" name="entity" value="' . $withentity . '">';
1329
+        if (!is_null($withentity)) {
1330
+                    print '<input type="hidden" name="entity" value="' . $withentity . '">';
1331
+        }
1268 1332
         print '</td>';
1269 1333
         print '<td style="min-width: 26px;"></td>';
1270 1334
         print '<td style="min-width: 26px;"></td>';
@@ -1277,8 +1341,9 @@  discard block
 block discarded – undo
1277 1341
         // If data was already input, we define them in obj to populate input fields.
1278 1342
         if (GETPOST('actionadd')) {
1279 1343
             foreach ($fieldlist as $key => $val) {
1280
-                if (GETPOST($val) != '')
1281
-                    $obj->$val = GETPOST($val);
1344
+                if (GETPOST($val) != '') {
1345
+                                    $obj->$val = GETPOST($val);
1346
+                }
1282 1347
             }
1283 1348
         }
1284 1349
 
@@ -1288,15 +1353,18 @@  discard block
 block discarded – undo
1288 1353
         $error = $hookmanager->error;
1289 1354
         $errors = $hookmanager->errors;
1290 1355
 
1291
-        if ($id == 3)
1292
-            unset($fieldlist[2]); // Remove field ??? if dictionary Regions
1356
+        if ($id == 3) {
1357
+                    unset($fieldlist[2]);
1358
+        }
1359
+        // Remove field ??? if dictionary Regions
1293 1360
 
1294 1361
         if (empty($reshook)) {
1295 1362
             fieldList($fieldlist, $obj, $tabname[$id], 'add');
1296 1363
         }
1297 1364
 
1298
-        if ($id == 4)
1299
-            print '<td></td>';
1365
+        if ($id == 4) {
1366
+                    print '<td></td>';
1367
+        }
1300 1368
         print '<td colspan="3" align="center">';
1301 1369
         if ($action != 'edit') {
1302 1370
             print '<input type="submit" class="button" name="actionadd" value="' . $langs->trans("Add") . '">';
@@ -1305,8 +1373,9 @@  discard block
 block discarded – undo
1305 1373
         print "</tr>";
1306 1374
 
1307 1375
         $colspan = count($fieldlist) + 3;
1308
-        if ($id == 4)
1309
-            $colspan++;
1376
+        if ($id == 4) {
1377
+                    $colspan++;
1378
+        }
1310 1379
 
1311 1380
         print '</table>';
1312 1381
         print '</div>';
@@ -1341,8 +1410,9 @@  discard block
 block discarded – undo
1341 1410
         print '<tr class="liste_titre_filter">';
1342 1411
         $filterfound = 0;
1343 1412
         foreach ($fieldlist as $field => $value) {
1344
-            if ($fieldlist[$field] == 'entity')
1345
-                continue;
1413
+            if ($fieldlist[$field] == 'entity') {
1414
+                            continue;
1415
+            }
1346 1416
 
1347 1417
             $showfield = 1; // By default
1348 1418
 
@@ -1367,8 +1437,9 @@  discard block
 block discarded – undo
1367 1437
                 }
1368 1438
             }
1369 1439
         }
1370
-        if ($id == 4)
1371
-            print '<td></td>';
1440
+        if ($id == 4) {
1441
+                    print '<td></td>';
1442
+        }
1372 1443
         print '<td class="liste_titre"></td>';
1373 1444
         print '<td class="liste_titre" colspan="2" align="right">';
1374 1445
         if ($filterfound) {
@@ -1381,8 +1452,9 @@  discard block
 block discarded – undo
1381 1452
         // Title of lines
1382 1453
         print '<tr class="liste_titre">';
1383 1454
         foreach ($fieldlist as $field => $value) {
1384
-            if ($fieldlist[$field] == 'entity')
1385
-                continue;
1455
+            if ($fieldlist[$field] == 'entity') {
1456
+                            continue;
1457
+            }
1386 1458
 
1387 1459
             // Determine le nom du champ par rapport aux noms possibles
1388 1460
             // dans les dictionnaires de donnees
@@ -1406,10 +1478,11 @@  discard block
 block discarded – undo
1406 1478
                 $valuetoshow = $langs->trans("PriceUHT");
1407 1479
             }
1408 1480
             if ($fieldlist[$field] == 'taux') {
1409
-                if ($tabname[$id] != MAIN_DB_PREFIX . "c_revenuestamp")
1410
-                    $valuetoshow = $langs->trans("Rate");
1411
-                else
1412
-                    $valuetoshow = $langs->trans("Amount");
1481
+                if ($tabname[$id] != MAIN_DB_PREFIX . "c_revenuestamp") {
1482
+                                    $valuetoshow = $langs->trans("Rate");
1483
+                } else {
1484
+                                    $valuetoshow = $langs->trans("Amount");
1485
+                }
1413 1486
                 $align = 'center';
1414 1487
             }
1415 1488
             if ($fieldlist[$field] == 'localtax1_type') {
@@ -1582,8 +1655,9 @@  discard block
 block discarded – undo
1582 1655
             }
1583 1656
         }
1584 1657
         // Favorite - Only activated on country dictionary
1585
-        if ($id == 4)
1586
-            print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page=' . $page . '&' : ''), $param, 'align="center"', $sortfield, $sortorder);
1658
+        if ($id == 4) {
1659
+                    print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page=' . $page . '&' : ''), $param, 'align="center"', $sortfield, $sortorder);
1660
+        }
1587 1661
 
1588 1662
         print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page=' . $page . '&' : ''), $param, 'align="center"', $sortfield, $sortorder);
1589 1663
         print getTitleFieldOfList('');
@@ -1612,13 +1686,13 @@  discard block
 block discarded – undo
1612 1686
                     print '<div name="' . (!empty($obj->rowid) ? $obj->rowid : $obj->code) . '"></div>';
1613 1687
                     print '<input type="hidden" name="page" value="' . $page . '">';
1614 1688
                     print '<input type="hidden" name="rowid" value="' . $rowid . '">';
1615
-                    if (!is_null($withentity))
1616
-                        print '<input type="hidden" name="entity" value="' . $withentity . '">';
1689
+                    if (!is_null($withentity)) {
1690
+                                            print '<input type="hidden" name="entity" value="' . $withentity . '">';
1691
+                    }
1617 1692
                     print '<input type="submit" class="button" name="actionmodify" value="' . $langs->trans("Modify") . '">';
1618 1693
                     print '<input type="submit" class="button" name="actioncancel" value="' . $langs->trans("Cancel") . '">';
1619 1694
                     print '</td>';
1620
-                }
1621
-                else {
1695
+                } else {
1622 1696
                     $tmpaction = 'view';
1623 1697
                     $parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
1624 1698
                     $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction);    // Note that $action and $object may have been modified by some hooks
@@ -1657,15 +1731,15 @@  discard block
 block discarded – undo
1657 1731
                                 $valuetoshow = yn($valuetoshow);
1658 1732
                                 $align = "center";
1659 1733
                             } else if ($fieldlist[$field] == 'type_cdr') {
1660
-                                if (empty($valuetoshow))
1661
-                                    $valuetoshow = $langs->trans('None');
1662
-                                elseif ($valuetoshow == 1)
1663
-                                    $valuetoshow = $langs->trans('AtEndOfMonth');
1664
-                                elseif ($valuetoshow == 2)
1665
-                                    $valuetoshow = $langs->trans('CurrentNext');
1734
+                                if (empty($valuetoshow)) {
1735
+                                                                    $valuetoshow = $langs->trans('None');
1736
+                                } elseif ($valuetoshow == 1) {
1737
+                                                                    $valuetoshow = $langs->trans('AtEndOfMonth');
1738
+                                } elseif ($valuetoshow == 2) {
1739
+                                                                    $valuetoshow = $langs->trans('CurrentNext');
1740
+                                }
1666 1741
                                 $align = "center";
1667
-                            }
1668
-                            else if ($fieldlist[$field] == 'price' || preg_match('/^amount/i', $fieldlist[$field])) {
1742
+                            } else if ($fieldlist[$field] == 'price' || preg_match('/^amount/i', $fieldlist[$field])) {
1669 1743
                                 $valuetoshow = price($valuetoshow);
1670 1744
                             }
1671 1745
                             if ($value == 'private') {
@@ -1743,20 +1817,20 @@  discard block
 block discarded – undo
1743 1817
                             } else if ($fieldlist[$field] == 'localtax1' || $fieldlist[$field] == 'localtax2') {
1744 1818
                                 $align = "center";
1745 1819
                             } else if ($fieldlist[$field] == 'localtax1_type') {
1746
-                                if ($obj->localtax1 != 0)
1747
-                                    $valuetoshow = $localtax_typeList[$valuetoshow];
1748
-                                else
1749
-                                    $valuetoshow = '';
1820
+                                if ($obj->localtax1 != 0) {
1821
+                                                                    $valuetoshow = $localtax_typeList[$valuetoshow];
1822
+                                } else {
1823
+                                                                    $valuetoshow = '';
1824
+                                }
1750 1825
                                 $align = "center";
1751
-                            }
1752
-                            else if ($fieldlist[$field] == 'localtax2_type') {
1753
-                                if ($obj->localtax2 != 0)
1754
-                                    $valuetoshow = $localtax_typeList[$valuetoshow];
1755
-                                else
1756
-                                    $valuetoshow = '';
1826
+                            } else if ($fieldlist[$field] == 'localtax2_type') {
1827
+                                if ($obj->localtax2 != 0) {
1828
+                                                                    $valuetoshow = $localtax_typeList[$valuetoshow];
1829
+                                } else {
1830
+                                                                    $valuetoshow = '';
1831
+                                }
1757 1832
                                 $align = "center";
1758
-                            }
1759
-                            else if ($fieldlist[$field] == 'taux') {
1833
+                            } else if ($fieldlist[$field] == 'taux') {
1760 1834
                                 $valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
1761 1835
                                 $align = "center";
1762 1836
                             } else if (in_array($fieldlist[$field], array('recuperableonly'))) {
@@ -1778,21 +1852,28 @@  discard block
 block discarded – undo
1778 1852
                             }
1779 1853
 
1780 1854
                             $class = 'tddict';
1781
-                            if ($fieldlist[$field] == 'note' && $id == 10)
1782
-                                $class .= ' tdoverflowmax200';
1783
-                            if ($fieldlist[$field] == 'tracking')
1784
-                                $class .= ' tdoverflowauto';
1785
-                            if ($fieldlist[$field] == 'code')
1786
-                                $class .= ' width100';
1787
-                            if ($fieldlist[$field] == 'position')
1788
-                                $class .= ' right';
1789
-                            if ($fieldlist[$field] == 'localtax1_type')
1790
-                                $class .= ' nowrap';
1791
-                            if ($fieldlist[$field] == 'localtax2_type')
1792
-                                $class .= ' nowrap';
1855
+                            if ($fieldlist[$field] == 'note' && $id == 10) {
1856
+                                                            $class .= ' tdoverflowmax200';
1857
+                            }
1858
+                            if ($fieldlist[$field] == 'tracking') {
1859
+                                                            $class .= ' tdoverflowauto';
1860
+                            }
1861
+                            if ($fieldlist[$field] == 'code') {
1862
+                                                            $class .= ' width100';
1863
+                            }
1864
+                            if ($fieldlist[$field] == 'position') {
1865
+                                                            $class .= ' right';
1866
+                            }
1867
+                            if ($fieldlist[$field] == 'localtax1_type') {
1868
+                                                            $class .= ' nowrap';
1869
+                            }
1870
+                            if ($fieldlist[$field] == 'localtax2_type') {
1871
+                                                            $class .= ' nowrap';
1872
+                            }
1793 1873
                             // Show value for field
1794
-                            if ($showfield)
1795
-                                print '<!-- ' . $fieldlist[$field] . ' --><td align="' . $align . '" class="' . $class . '">' . $valuetoshow . '</td>';
1874
+                            if ($showfield) {
1875
+                                                            print '<!-- ' . $fieldlist[$field] . ' --><td align="' . $align . '" class="' . $class . '">' . $valuetoshow . '</td>';
1876
+                            }
1796 1877
                         }
1797 1878
                     }
1798 1879
 
@@ -1821,65 +1902,75 @@  discard block
 block discarded – undo
1821 1902
                         $canbedisabled = 0;
1822 1903
                     }
1823 1904
                     $canbemodified = $iserasable;
1824
-                    if ($obj->code == 'RECEP')
1825
-                        $canbemodified = 1;
1826
-                    if ($tabname[$id] == MAIN_DB_PREFIX . "c_actioncomm")
1827
-                        $canbemodified = 1;
1905
+                    if ($obj->code == 'RECEP') {
1906
+                                            $canbemodified = 1;
1907
+                    }
1908
+                    if ($tabname[$id] == MAIN_DB_PREFIX . "c_actioncomm") {
1909
+                                            $canbemodified = 1;
1910
+                    }
1828 1911
 
1829 1912
                     // Url
1830 1913
                     $rowidcol = $tabrowid[$id];
1831 1914
                     // If rowidcol not defined
1832
-                    if (empty($rowidcol) || in_array($id, array(6, 7, 8, 13, 17, 19, 27)))
1833
-                        $rowidcol = 'rowid';
1915
+                    if (empty($rowidcol) || in_array($id, array(6, 7, 8, 13, 17, 19, 27))) {
1916
+                                            $rowidcol = 'rowid';
1917
+                    }
1834 1918
                     $url = $_SERVER["PHP_SELF"] . '?' . ($page ? 'page=' . $page . '&' : '') . 'sortfield=' . $sortfield . '&sortorder=' . $sortorder . '&rowid=' . ((!empty($obj->{$rowidcol}) || $obj->{$rowidcol} == '0') ? $obj->{$rowidcol} : (!empty($obj->code) ? urlencode($obj->code) : '')) . '&code=' . (!empty($obj->code) ? urlencode($obj->code) : '');
1835
-                    if (!empty($param))
1836
-                        $url .= '&' . $param;
1837
-                    if (!is_null($withentity))
1838
-                        $url .= '&entity=' . $withentity;
1919
+                    if (!empty($param)) {
1920
+                                            $url .= '&' . $param;
1921
+                    }
1922
+                    if (!is_null($withentity)) {
1923
+                                            $url .= '&entity=' . $withentity;
1924
+                    }
1839 1925
                     $url .= '&';
1840 1926
 
1841 1927
                     // Favorite
1842 1928
                     // Only activated on country dictionary
1843 1929
                     if ($id == 4) {
1844 1930
                         print '<td align="center" class="nowrap">';
1845
-                        if ($iserasable)
1846
-                            print '<a href="' . $url . 'action=' . $acts[$obj->favorite] . '_favorite">' . $actl[$obj->favorite] . '</a>';
1847
-                        else
1848
-                            print $langs->trans("AlwaysActive");
1931
+                        if ($iserasable) {
1932
+                                                    print '<a href="' . $url . 'action=' . $acts[$obj->favorite] . '_favorite">' . $actl[$obj->favorite] . '</a>';
1933
+                        } else {
1934
+                                                    print $langs->trans("AlwaysActive");
1935
+                        }
1849 1936
                         print '</td>';
1850 1937
                     }
1851 1938
 
1852 1939
                     // Active
1853 1940
                     print '<td align="center" class="nowrap">';
1854
-                    if ($canbedisabled)
1855
-                        print '<a href="' . $url . 'action=' . $acts[$obj->active] . '">' . $actl[$obj->active] . '</a>';
1856
-                    else {
1857
-                        if (in_array($obj->code, array('AC_OTH', 'AC_OTH_AUTO')))
1858
-                            print $langs->trans("AlwaysActive");
1859
-                        else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active))
1860
-                            print $langs->trans("Deprecated");
1861
-                        else if (isset($obj->type) && in_array($obj->type, array('system')) && !empty($obj->active) && $obj->code != 'AC_OTH')
1862
-                            print $langs->trans("UsedOnlyWithTypeOption");
1863
-                        else
1864
-                            print $langs->trans("AlwaysActive");
1941
+                    if ($canbedisabled) {
1942
+                                            print '<a href="' . $url . 'action=' . $acts[$obj->active] . '">' . $actl[$obj->active] . '</a>';
1943
+                    } else {
1944
+                        if (in_array($obj->code, array('AC_OTH', 'AC_OTH_AUTO'))) {
1945
+                                                    print $langs->trans("AlwaysActive");
1946
+                        } else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) {
1947
+                                                    print $langs->trans("Deprecated");
1948
+                        } else if (isset($obj->type) && in_array($obj->type, array('system')) && !empty($obj->active) && $obj->code != 'AC_OTH') {
1949
+                                                    print $langs->trans("UsedOnlyWithTypeOption");
1950
+                        } else {
1951
+                                                    print $langs->trans("AlwaysActive");
1952
+                        }
1865 1953
                     }
1866 1954
                     print "</td>";
1867 1955
 
1868 1956
                     // Modify link
1869
-                    if ($canbemodified)
1870
-                        print '<td align="center"><a class="reposition" href="' . $url . 'action=edit">' . img_edit() . '</a></td>';
1871
-                    else
1872
-                        print '<td>&nbsp;</td>';
1957
+                    if ($canbemodified) {
1958
+                                            print '<td align="center"><a class="reposition" href="' . $url . 'action=edit">' . img_edit() . '</a></td>';
1959
+                    } else {
1960
+                                            print '<td>&nbsp;</td>';
1961
+                    }
1873 1962
 
1874 1963
                     // Delete link
1875 1964
                     if ($iserasable) {
1876 1965
                         print '<td align="center">';
1877
-                        if ($user->admin)
1878
-                            print '<a href="' . $url . 'action=delete">' . img_delete() . '</a>';
1966
+                        if ($user->admin) {
1967
+                                                    print '<a href="' . $url . 'action=delete">' . img_delete() . '</a>';
1968
+                        }
1879 1969
                         //else print '<a href="#">'.img_delete().'</a>';    // Some dictionary can be edited by other profile than admin
1880 1970
                         print '</td>';
1881
-                    } else
1882
-                        print '<td>&nbsp;</td>';
1971
+                    } else {
1972
+                                            print '<td>&nbsp;</td>';
1973
+                    }
1883 1974
 
1884 1975
                     print "</tr>\n";
1885 1976
                 }
@@ -1889,8 +1980,7 @@  discard block
 block discarded – undo
1889 1980
 
1890 1981
         print '</table>';
1891 1982
         print '</div>';
1892
-    }
1893
-    else {
1983
+    } else {
1894 1984
         dol_print_error($db);
1895 1985
     }
1896 1986
 
@@ -1913,8 +2003,9 @@  discard block
 block discarded – undo
1913 2003
 
1914 2004
     $showemptyline = '';
1915 2005
     foreach ($taborder as $i) {
1916
-        if (isset($tabname[$i]) && empty($tabcond[$i]))
1917
-            continue;
2006
+        if (isset($tabname[$i]) && empty($tabcond[$i])) {
2007
+                    continue;
2008
+        }
1918 2009
 
1919 2010
         if ($i) {
1920 2011
             if ($showemptyline) {
@@ -1976,8 +2067,9 @@  discard block
 block discarded – undo
1976 2067
 
1977 2068
     $formadmin = new FormAdmin($db);
1978 2069
     $formcompany = new FormCompany($db);
1979
-    if (!empty($conf->accounting->enabled))
1980
-        $formaccounting = new FormAccounting($db);
2070
+    if (!empty($conf->accounting->enabled)) {
2071
+            $formaccounting = new FormAccounting($db);
2072
+    }
1981 2073
 
1982 2074
     $withentity = '';
1983 2075
 
@@ -2046,10 +2138,11 @@  discard block
 block discarded – undo
2046 2138
             print $type . '<input type="hidden" name="type" value="' . $type . '">';
2047 2139
             print '</td>';
2048 2140
         } elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
2049
-            if ($fieldlist[$field] == 'type_cdr')
2050
-                print '<td align="center">';
2051
-            else
2052
-                print '<td>';
2141
+            if ($fieldlist[$field] == 'type_cdr') {
2142
+                            print '<td align="center">';
2143
+            } else {
2144
+                            print '<td>';
2145
+            }
2053 2146
             if ($fieldlist[$field] == 'type_cdr') {
2054 2147
                 print $form->selectarray($fieldlist[$field], array(0 => $langs->trans('None'), 1 => $langs->trans('AtEndOfMonth'), 2 => $langs->trans('CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''));
2055 2148
             } else {
@@ -2058,13 +2151,14 @@  discard block
 block discarded – undo
2058 2151
             print '</td>';
2059 2152
         } elseif (in_array($fieldlist[$field], array('nbjour', 'decalage', 'taux', 'localtax1', 'localtax2'))) {
2060 2153
             $align = "left";
2061
-            if (in_array($fieldlist[$field], array('taux', 'localtax1', 'localtax2')))
2062
-                $align = "center"; // Fields aligned on right
2154
+            if (in_array($fieldlist[$field], array('taux', 'localtax1', 'localtax2'))) {
2155
+                            $align = "center";
2156
+            }
2157
+            // Fields aligned on right
2063 2158
             print '<td align="' . $align . '">';
2064 2159
             print '<input type="text" class="flat" value="' . (isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '') . '" size="3" name="' . $fieldlist[$field] . '">';
2065 2160
             print '</td>';
2066
-        }
2067
-        elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
2161
+        } elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
2068 2162
             print '<td>';
2069 2163
             $transfound = 0;
2070 2164
             // Special case for labels
@@ -2124,25 +2218,33 @@  discard block
 block discarded – undo
2124 2218
             print $form->selectExpenseRanges($obj->fk_range);
2125 2219
             print '</td>';
2126 2220
         } else {
2127
-            if ($fieldlist[$field] == 'sortorder')
2128
-                $fieldlist[$field] = 'position';
2221
+            if ($fieldlist[$field] == 'sortorder') {
2222
+                            $fieldlist[$field] = 'position';
2223
+            }
2129 2224
 
2130 2225
             $classtd = '';
2131 2226
             $class = '';
2132
-            if ($fieldlist[$field] == 'code')
2133
-                $classtd = 'width100';
2134
-            if ($fieldlist[$field] == 'affect')
2135
-                $class = 'maxwidth50';
2136
-            if ($fieldlist[$field] == 'delay')
2137
-                $class = 'maxwidth50';
2138
-            if ($fieldlist[$field] == 'position')
2139
-                $class = 'maxwidth50';
2140
-            if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label')
2141
-                $class = 'quatrevingtpercent';
2142
-            if ($fieldlist[$field] == 'tracking')
2143
-                $class = 'quatrevingtpercent';
2144
-            if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type')
2145
-                $class = 'maxwidth50';
2227
+            if ($fieldlist[$field] == 'code') {
2228
+                            $classtd = 'width100';
2229
+            }
2230
+            if ($fieldlist[$field] == 'affect') {
2231
+                            $class = 'maxwidth50';
2232
+            }
2233
+            if ($fieldlist[$field] == 'delay') {
2234
+                            $class = 'maxwidth50';
2235
+            }
2236
+            if ($fieldlist[$field] == 'position') {
2237
+                            $class = 'maxwidth50';
2238
+            }
2239
+            if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
2240
+                            $class = 'quatrevingtpercent';
2241
+            }
2242
+            if ($fieldlist[$field] == 'tracking') {
2243
+                            $class = 'quatrevingtpercent';
2244
+            }
2245
+            if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') {
2246
+                            $class = 'maxwidth50';
2247
+            }
2146 2248
             print '<td class="' . $classtd . '">';
2147 2249
             $transfound = 0;
2148 2250
             if (in_array($fieldlist[$field], array('label', 'libelle'))) {
Please login to merge, or discard this patch.
dolibarr/htdocs/comm/propal/card.php 1 patch
Braces   +126 added lines, -90 removed lines patch added patch discarded remove patch
@@ -60,10 +60,12 @@  discard block
 block discarded – undo
60 60
 
61 61
 // Load translation files required by the page
62 62
 $langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'deliveries', 'sendings'));
63
-if (!empty($conf->incoterm->enabled))
63
+if (!empty($conf->incoterm->enabled)) {
64 64
     $langs->load('incoterm');
65
-if (!empty($conf->margin->enabled))
65
+}
66
+if (!empty($conf->margin->enabled)) {
66 67
     $langs->load('margins');
68
+}
67 69
 
68 70
 $error = 0;
69 71
 
@@ -174,10 +176,12 @@  discard block
 block discarded – undo
174 176
                         if ($difference != 0) {
175 177
                             $object->date_livraison = $date_delivery;
176 178
                             foreach ($object->lines as $line) {
177
-                                if (isset($line->date_start))
178
-                                    $line->date_start = $line->date_start + $difference;
179
-                                if (isset($line->date_end))
180
-                                    $line->date_end = $line->date_end + $difference;
179
+                                if (isset($line->date_start)) {
180
+                                                                    $line->date_start = $line->date_start + $difference;
181
+                                }
182
+                                if (isset($line->date_end)) {
183
+                                                                    $line->date_end = $line->date_end + $difference;
184
+                                }
181 185
                             }
182 186
                         }
183 187
                     }
@@ -273,11 +277,11 @@  discard block
 block discarded – undo
273 277
 
274 278
         if (!$error) {
275 279
             $result = $object->set_date($user, $datep);
276
-            if ($result < 0)
277
-                dol_print_error($db, $object->error);
280
+            if ($result < 0) {
281
+                            dol_print_error($db, $object->error);
282
+            }
278 283
         }
279
-    }
280
-    else if ($action == 'setecheance' && $usercancreate) {
284
+    } else if ($action == 'setecheance' && $usercancreate) {
281 285
         $result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']));
282 286
         if ($result < 0) {
283 287
             dol_print_error($db, $object->error);
@@ -501,8 +505,9 @@  discard block
 block discarded – undo
501 505
                                 }
502 506
 
503 507
                                 $tva_tx = $lines[$i]->tva_tx;
504
-                                if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx))
505
-                                    $tva_tx .= ' (' . $lines[$i]->vat_src_code . ')';
508
+                                if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) {
509
+                                                                    $tva_tx .= ' (' . $lines[$i]->vat_src_code . ')';
510
+                                }
506 511
 
507 512
                                 $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit);
508 513
 
@@ -565,10 +570,12 @@  discard block
 block discarded – undo
565 570
                         if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
566 571
                             $outputlangs = $langs;
567 572
                             $newlang = '';
568
-                            if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09'))
569
-                                $newlang = GETPOST('lang_id', 'aZ09');
570
-                            if ($conf->global->MAIN_MULTILANGS && empty($newlang))
571
-                                $newlang = $object->thirdparty->default_lang;
573
+                            if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
574
+                                                            $newlang = GETPOST('lang_id', 'aZ09');
575
+                            }
576
+                            if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
577
+                                                            $newlang = $object->thirdparty->default_lang;
578
+                            }
572 579
                             if (!empty($newlang)) {
573 580
                                 $outputlangs = new Translate("", $conf);
574 581
                                 $outputlangs->setDefaultLang($newlang);
@@ -577,14 +584,14 @@  discard block
 block discarded – undo
577 584
 
578 585
                             $ret = $object->fetch($id); // Reload to get new records
579 586
                             $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
580
-                            if ($result < 0)
581
-                                dol_print_error($db, $result);
587
+                            if ($result < 0) {
588
+                                                            dol_print_error($db, $result);
589
+                            }
582 590
                         }
583 591
 
584 592
                         header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
585 593
                         exit();
586
-                    }
587
-                    else {
594
+                    } else {
588 595
                         $db->rollback();
589 596
                         $action = 'create';
590 597
                     }
@@ -848,8 +855,9 @@  discard block
 block discarded – undo
848 855
                 // Update if prices fields are defined
849 856
                 $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
850 857
                 $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
851
-                if (empty($tva_tx))
852
-                    $tva_npr = 0;
858
+                if (empty($tva_tx)) {
859
+                                    $tva_npr = 0;
860
+                }
853 861
 
854 862
                 // Price unique per product
855 863
                 $pu_ht = $prod->price;
@@ -864,10 +872,12 @@  discard block
 block discarded – undo
864 872
                     $price_min = $prod->multiprices_min[$object->thirdparty->price_level];
865 873
                     $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
866 874
                     if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) {  // using this option is a bug. kept for backward compatibility
867
-                        if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level]))
868
-                            $tva_tx = $prod->multiprices_tva_tx[$object->thirdparty->price_level];
869
-                        if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level]))
870
-                            $tva_npr = $prod->multiprices_recuperableonly[$object->thirdparty->price_level];
875
+                        if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) {
876
+                                                    $tva_tx = $prod->multiprices_tva_tx[$object->thirdparty->price_level];
877
+                        }
878
+                        if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) {
879
+                                                    $tva_npr = $prod->multiprices_recuperableonly[$object->thirdparty->price_level];
880
+                        }
871 881
                     }
872 882
                 }
873 883
                 // If price per customer
@@ -886,11 +896,13 @@  discard block
 block discarded – undo
886 896
                             $pu_ttc = price($prodcustprice->lines[0]->price_ttc);
887 897
                             $price_base_type = $prodcustprice->lines[0]->price_base_type;
888 898
                             $tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx . ' (' . $prodcustprice->lines[0]->default_vat_code . ' )' : $prodcustprice->lines[0]->tva_tx);
889
-                            if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx))
890
-                                $tva_tx .= ' (' . $prodcustprice->lines[0]->default_vat_code . ')';
899
+                            if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
900
+                                                            $tva_tx .= ' (' . $prodcustprice->lines[0]->default_vat_code . ')';
901
+                            }
891 902
                             $tva_npr = $prodcustprice->lines[0]->recuperableonly;
892
-                            if (empty($tva_tx))
893
-                                $tva_npr = 0;
903
+                            if (empty($tva_tx)) {
904
+                                                            $tva_npr = 0;
905
+                            }
894 906
                         }
895 907
                     }
896 908
                 }
@@ -902,8 +914,9 @@  discard block
 block discarded – undo
902 914
 
903 915
                         // Search price into product_price_by_qty from $prod->id
904 916
                         foreach ($prod->prices_by_qty_list[0] as $priceforthequantityarray) {
905
-                            if ($priceforthequantityarray['rowid'] != $pqp)
906
-                                continue;
917
+                            if ($priceforthequantityarray['rowid'] != $pqp) {
918
+                                                            continue;
919
+                            }
907 920
                             // We found the price
908 921
                             if ($priceforthequantityarray['price_base_type'] == 'HT') {
909 922
                                 $pu_ht = $priceforthequantityarray['unitprice'];
@@ -923,8 +936,9 @@  discard block
 block discarded – undo
923 936
 
924 937
                         // Search price into product_price_by_qty from $prod->id
925 938
                         foreach ($prod->prices_by_qty_list[$object->thirdparty->price_level] as $priceforthequantityarray) {
926
-                            if ($priceforthequantityarray['rowid'] != $pqp)
927
-                                continue;
939
+                            if ($priceforthequantityarray['rowid'] != $pqp) {
940
+                                                            continue;
941
+                            }
928 942
                             // We found the price
929 943
                             if ($priceforthequantityarray['price_base_type'] == 'HT') {
930 944
                                 $pu_ht = $priceforthequantityarray['unitprice'];
@@ -961,10 +975,12 @@  discard block
 block discarded – undo
961 975
                 if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
962 976
                     $outputlangs = $langs;
963 977
                     $newlang = '';
964
-                    if (empty($newlang) && GETPOST('lang_id', 'aZ09'))
965
-                        $newlang = GETPOST('lang_id', 'aZ09');
966
-                    if (empty($newlang))
967
-                        $newlang = $object->thirdparty->default_lang;
978
+                    if (empty($newlang) && GETPOST('lang_id', 'aZ09')) {
979
+                                            $newlang = GETPOST('lang_id', 'aZ09');
980
+                    }
981
+                    if (empty($newlang)) {
982
+                                            $newlang = $object->thirdparty->default_lang;
983
+                    }
968 984
                     if (!empty($newlang)) {
969 985
                         $outputlangs = new Translate("", $conf);
970 986
                         $outputlangs->setDefaultLang($newlang);
@@ -1327,8 +1343,9 @@  discard block
 block discarded – undo
1327 1343
                 $error++;
1328 1344
             }
1329 1345
         }
1330
-        if ($error)
1331
-            $action = 'edit_extras';
1346
+        if ($error) {
1347
+                    $action = 'edit_extras';
1348
+        }
1332 1349
     }
1333 1350
 
1334 1351
     if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $usercancreate) {
@@ -1406,8 +1423,9 @@  discard block
 block discarded – undo
1406 1423
     print load_fiche_titre($langs->trans("NewProp"));
1407 1424
 
1408 1425
     $soc = new Societe($db);
1409
-    if ($socid > 0)
1410
-        $res = $soc->fetch($socid);
1426
+    if ($socid > 0) {
1427
+            $res = $soc->fetch($socid);
1428
+    }
1411 1429
 
1412 1430
     // Load objectsrc
1413 1431
     if (!empty($origin) && !empty($originid)) {
@@ -1463,16 +1481,18 @@  discard block
 block discarded – undo
1463 1481
             $object->array_options = $objectsrc->array_options;
1464 1482
 
1465 1483
             if (!empty($conf->multicurrency->enabled)) {
1466
-                if (!empty($objectsrc->multicurrency_code))
1467
-                    $currency_code = $objectsrc->multicurrency_code;
1468
-                if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx))
1469
-                    $currency_tx = $objectsrc->multicurrency_tx;
1484
+                if (!empty($objectsrc->multicurrency_code)) {
1485
+                                    $currency_code = $objectsrc->multicurrency_code;
1486
+                }
1487
+                if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) {
1488
+                                    $currency_tx = $objectsrc->multicurrency_tx;
1489
+                }
1470 1490
             }
1471 1491
         }
1472
-    }
1473
-    else {
1474
-        if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code))
1475
-            $currency_code = $soc->multicurrency_code;
1492
+    } else {
1493
+        if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) {
1494
+                    $currency_code = $soc->multicurrency_code;
1495
+        }
1476 1496
     }
1477 1497
 
1478 1498
     $object = new Propal($db);
@@ -1686,14 +1706,15 @@  discard block
 block discarded – undo
1686 1706
         print '<input type="hidden" name="originid"       value="' . $objectsrc->id . '">';
1687 1707
 
1688 1708
         $newclassname = $classname;
1689
-        if ($newclassname == 'Propal')
1690
-            $newclassname = 'CommercialProposal';
1691
-        elseif ($newclassname == 'Commande')
1692
-            $newclassname = 'Order';
1693
-        elseif ($newclassname == 'Expedition')
1694
-            $newclassname = 'Sending';
1695
-        elseif ($newclassname == 'Fichinter')
1696
-            $newclassname = 'Intervention';
1709
+        if ($newclassname == 'Propal') {
1710
+                    $newclassname = 'CommercialProposal';
1711
+        } elseif ($newclassname == 'Commande') {
1712
+                    $newclassname = 'Order';
1713
+        } elseif ($newclassname == 'Expedition') {
1714
+                    $newclassname = 'Sending';
1715
+        } elseif ($newclassname == 'Fichinter') {
1716
+                    $newclassname = 'Intervention';
1717
+        }
1697 1718
 
1698 1719
         print '<tr><td>' . $langs->trans($newclassname) . '</td><td>' . $objectsrc->getNomUrl(1) . '</td></tr>';
1699 1720
         print '<tr><td>' . $langs->trans('TotalHT') . '</td><td>' . price($objectsrc->total_ht, 0, $langs, 1, -1, -1, $conf->currency) . '</td></tr>';
@@ -1715,8 +1736,9 @@  discard block
 block discarded – undo
1715 1736
      * Combobox pour la fonction de copie
1716 1737
      */
1717 1738
 
1718
-    if (empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE))
1719
-        print '<input type="hidden" name="createmode" value="empty">';
1739
+    if (empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) {
1740
+            print '<input type="hidden" name="createmode" value="empty">';
1741
+    }
1720 1742
 
1721 1743
     if (!empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) {
1722 1744
         print '<br><table>';
@@ -1757,8 +1779,9 @@  discard block
 block discarded – undo
1757 1779
         print '<td valign="top" colspan="2">' . $langs->trans("CreateEmptyPropal") . '</td></tr>';
1758 1780
     }
1759 1781
 
1760
-    if (!empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE))
1761
-        print '</table>';
1782
+    if (!empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) {
1783
+            print '</table>';
1784
+    }
1762 1785
 
1763 1786
     dol_fiche_end();
1764 1787
 
@@ -1871,17 +1894,19 @@  discard block
 block discarded – undo
1871 1894
             $text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid, $object);
1872 1895
         }
1873 1896
 
1874
-        if (!$error)
1875
-            $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate', '', 0, 1);
1897
+        if (!$error) {
1898
+                    $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate', '', 0, 1);
1899
+        }
1876 1900
     }
1877 1901
 
1878 1902
     // Call Hook formConfirm
1879 1903
     $parameters = array('lineid' => $lineid);
1880 1904
     $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1881
-    if (empty($reshook))
1882
-        $formconfirm .= $hookmanager->resPrint;
1883
-    elseif ($reshook > 0)
1884
-        $formconfirm = $hookmanager->resPrint;
1905
+    if (empty($reshook)) {
1906
+            $formconfirm .= $hookmanager->resPrint;
1907
+    } elseif ($reshook > 0) {
1908
+            $formconfirm = $hookmanager->resPrint;
1909
+    }
1885 1910
 
1886 1911
     // Print form confirm
1887 1912
     print $formconfirm;
@@ -1897,9 +1922,10 @@  discard block
 block discarded – undo
1897 1922
     $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1);
1898 1923
     // Thirdparty
1899 1924
     $morehtmlref .= '<br>' . $langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'customer');
1900
-    if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0)
1901
-        // $morehtmlref .= ' (<a href="' . DOL_URL_ROOT . '/comm/propal/list.php?socid=' . $object->thirdparty->id . '&search_societe=' . urlencode($object->thirdparty->name) . '">' . $langs->trans("OtherProposals") . '</a>)';
1925
+    if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
1926
+            // $morehtmlref .= ' (<a href="' . DOL_URL_ROOT . '/comm/propal/list.php?socid=' . $object->thirdparty->id . '&search_societe=' . urlencode($object->thirdparty->name) . '">' . $langs->trans("OtherProposals") . '</a>)';
1902 1927
         $morehtmlref .= ' (<a href = "' . BASE_URI . '?controller=comm/propal&method=list&socid=' . $object->thirdparty->id . '&search_societe=' . urlencode($object->thirdparty->name) . '">' . $langs->trans("OtherProposals") . '</a>)';
1928
+    }
1903 1929
     // Project
1904 1930
     if (!empty($conf->projet->enabled)) {
1905 1931
         $langs->load("projects");
@@ -1975,9 +2001,10 @@  discard block
 block discarded – undo
1975 2001
     print '<table class="nobordernopadding" width="100%"><tr><td>';
1976 2002
     print $langs->trans('Date');
1977 2003
     print '</td>';
1978
-    if ($action != 'editdate' && !empty($object->brouillon) && $usercancreate)
1979
-        // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdate&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
2004
+    if ($action != 'editdate' && !empty($object->brouillon) && $usercancreate) {
2005
+            // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdate&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
1980 2006
         print '<td align="right"><a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=editdate&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
2007
+    }
1981 2008
     print '</tr></table>';
1982 2009
     print '</td><td>';
1983 2010
     if (!empty($object->brouillon) && $action == 'editdate' && $usercancreate) {
@@ -2002,9 +2029,10 @@  discard block
 block discarded – undo
2002 2029
     print '<table class="nobordernopadding" width="100%"><tr><td>';
2003 2030
     print $langs->trans('DateEndPropal');
2004 2031
     print '</td>';
2005
-    if ($action != 'editecheance' && !empty($object->brouillon) && $usercancreate)
2006
-        // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editecheance&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
2032
+    if ($action != 'editecheance' && !empty($object->brouillon) && $usercancreate) {
2033
+            // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editecheance&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
2007 2034
         print '<td align="right"><a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=editecheance&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
2035
+    }
2008 2036
     print '</tr></table>';
2009 2037
     print '</td><td>';
2010 2038
     if (!empty($object->brouillon) && $action == 'editecheance' && $usercancreate) {
@@ -2018,8 +2046,9 @@  discard block
 block discarded – undo
2018 2046
     } else {
2019 2047
         if (!empty($object->fin_validite)) {
2020 2048
             print dol_print_date($object->fin_validite, 'day');
2021
-            if ($object->statut == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay))
2022
-                print img_warning($langs->trans("Late"));
2049
+            if ($object->statut == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) {
2050
+                            print img_warning($langs->trans("Late"));
2051
+            }
2023 2052
         } else {
2024 2053
             print '&nbsp;';
2025 2054
         }
@@ -2032,9 +2061,10 @@  discard block
 block discarded – undo
2032 2061
     print '<table class="nobordernopadding" width="100%"><tr><td>';
2033 2062
     print $langs->trans('PaymentConditionsShort');
2034 2063
     print '</td>';
2035
-    if ($action != 'editconditions' && !empty($object->brouillon) && $usercancreate)
2036
-        // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . '</a></td>';
2064
+    if ($action != 'editconditions' && !empty($object->brouillon) && $usercancreate) {
2065
+            // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . '</a></td>';
2037 2066
         print '<td align="right"><a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=editconditions&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . '</a></td>';
2067
+    }
2038 2068
     print '</tr></table>';
2039 2069
     print '</td><td>';
2040 2070
     if (!empty($object->brouillon) && $action == 'editconditions' && $usercancreate) {
@@ -2058,12 +2088,14 @@  discard block
 block discarded – undo
2058 2088
     print '<tr class="fielddeliverydelay"><td>';
2059 2089
     print '<table class="nobordernopadding" width="100%"><tr><td>';
2060 2090
     print $langs->trans('AvailabilityPeriod');
2061
-    if (!empty($conf->commande->enabled))
2062
-        print ' (' . $langs->trans('AfterOrder') . ')';
2091
+    if (!empty($conf->commande->enabled)) {
2092
+            print ' (' . $langs->trans('AfterOrder') . ')';
2093
+    }
2063 2094
     print '</td>';
2064
-    if ($action != 'editavailability' && !empty($object->brouillon) && $usercancreate)
2065
-        // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1) . '</a></td>';
2095
+    if ($action != 'editavailability' && !empty($object->brouillon) && $usercancreate) {
2096
+            // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1) . '</a></td>';
2066 2097
         print '<td align="right"><a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=editavailability&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1) . '</a></td>';
2098
+    }
2067 2099
     print '</tr></table>';
2068 2100
     print '</td><td>';
2069 2101
     if (!empty($object->brouillon) && $action == 'editavailability' && $usercancreate) {
@@ -2362,8 +2394,9 @@  discard block
 block discarded – undo
2362 2394
     print '<div class="div-table-responsive-no-min">';
2363 2395
     print '<table id="tablelines" class="noborder noshadow" width="100%">';
2364 2396
 
2365
-    if (!empty($object->lines))
2366
-        $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
2397
+    if (!empty($object->lines)) {
2398
+            $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
2399
+    }
2367 2400
 
2368 2401
     // Form to add new line
2369 2402
     if ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines') {
@@ -2399,8 +2432,9 @@  discard block
 block discarded – undo
2399 2432
                     if ($usercanvalidate) {
2400 2433
                         // print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=validate">' . $langs->trans('Validate') . '</a></div>';
2401 2434
                         print '<div class="inline-block divButAction"><a class="butAction" href = "' . BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id . '&amp;action=validate">' . $langs->trans('Validate') . '</a></div>';
2402
-                    } else
2403
-                        print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans('Validate') . '</a></div>';
2435
+                    } else {
2436
+                                            print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans('Validate') . '</a></div>';
2437
+                    }
2404 2438
                 }
2405 2439
                 // Create event
2406 2440
                 /* if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) 	// Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
@@ -2425,8 +2459,9 @@  discard block
 block discarded – undo
2425 2459
                     if ($usercansend) {
2426 2460
                         // print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a></div>';
2427 2461
                         print '<div class="inline-block divButAction"><a class="butAction" href = "' . BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a></div>';
2428
-                    } else
2429
-                        print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans('SendMail') . '</a></div>';
2462
+                    } else {
2463
+                                            print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans('SendMail') . '</a></div>';
2464
+                    }
2430 2465
                 }
2431 2466
 
2432 2467
                 // Create an order
@@ -2496,8 +2531,9 @@  discard block
 block discarded – undo
2496 2531
     }
2497 2532
 
2498 2533
     //Select mail models is same action as presend
2499
-    if (GETPOST('modelselected'))
2500
-        $action = 'presend';
2534
+    if (GETPOST('modelselected')) {
2535
+            $action = 'presend';
2536
+    }
2501 2537
 
2502 2538
     if ($action != 'presend') {
2503 2539
         print '<div class="fichecenter"><div class="fichehalfleft">';
Please login to merge, or discard this patch.
dolibarr/htdocs/comm/propal/class/propal.class.php 1 patch
Braces   +349 added lines, -240 removed lines patch added patch discarded remove patch
@@ -269,8 +269,9 @@  discard block
 block discarded – undo
269 269
         // phpcs:enable
270 270
         global $conf, $mysoc;
271 271
 
272
-        if (!$qty)
273
-            $qty = 1;
272
+        if (!$qty) {
273
+                    $qty = 1;
274
+        }
274 275
 
275 276
         dol_syslog(get_class($this) . "::add_product $idproduct, $qty, $remise_percent");
276 277
         if ($idproduct > 0) {
@@ -281,8 +282,9 @@  discard block
 block discarded – undo
281 282
 
282 283
             $tva_tx = get_default_tva($mysoc, $this->thirdparty, $prod->id);
283 284
             $tva_npr = get_default_npr($mysoc, $this->thirdparty, $prod->id);
284
-            if (empty($tva_tx))
285
-                $tva_npr = 0;
285
+            if (empty($tva_tx)) {
286
+                            $tva_npr = 0;
287
+            }
286 288
             $vat_src_code = '';     // May be defined into tva_tx
287 289
 
288 290
             $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $this->thirdparty, $tva_npr);
@@ -305,8 +307,9 @@  discard block
 block discarded – undo
305 307
             $line->vat_src_code = $vat_src_code;
306 308
             $line->tva_tx = $tva_tx;
307 309
             $line->fk_unit = $prod->fk_unit;
308
-            if ($tva_npr)
309
-                $line->info_bits = 1;
310
+            if ($tva_npr) {
311
+                            $line->info_bits = 1;
312
+            }
310 313
 
311 314
             $this->lines[] = $line;
312 315
         }
@@ -429,16 +432,21 @@  discard block
 block discarded – undo
429 432
             include_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php';
430 433
 
431 434
             // Clean parameters
432
-            if (empty($remise_percent))
433
-                $remise_percent = 0;
434
-            if (empty($qty))
435
-                $qty = 0;
436
-            if (empty($info_bits))
437
-                $info_bits = 0;
438
-            if (empty($rang))
439
-                $rang = 0;
440
-            if (empty($fk_parent_line) || $fk_parent_line < 0)
441
-                $fk_parent_line = 0;
435
+            if (empty($remise_percent)) {
436
+                            $remise_percent = 0;
437
+            }
438
+            if (empty($qty)) {
439
+                            $qty = 0;
440
+            }
441
+            if (empty($info_bits)) {
442
+                            $info_bits = 0;
443
+            }
444
+            if (empty($rang)) {
445
+                            $rang = 0;
446
+            }
447
+            if (empty($fk_parent_line) || $fk_parent_line < 0) {
448
+                            $fk_parent_line = 0;
449
+            }
442 450
 
443 451
             $remise_percent = price2num($remise_percent);
444 452
             $qty = price2num($qty);
@@ -458,8 +466,9 @@  discard block
 block discarded – undo
458 466
             }
459 467
 
460 468
             // Check parameters
461
-            if ($type < 0)
462
-                return -1;
469
+            if ($type < 0) {
470
+                            return -1;
471
+            }
463 472
 
464 473
             $this->db->begin();
465 474
 
@@ -574,8 +583,9 @@  discard block
 block discarded – undo
574 583
             $this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
575 584
 
576 585
             // Mise en option de la ligne
577
-            if (empty($qty) && empty($special_code))
578
-                $this->line->special_code = 3;
586
+            if (empty($qty) && empty($special_code)) {
587
+                            $this->line->special_code = 3;
588
+            }
579 589
 
580 590
             // TODO deprecated
581 591
             $this->line->price = $price;
@@ -588,8 +598,9 @@  discard block
 block discarded – undo
588 598
             $result = $this->line->insert();
589 599
             if ($result > 0) {
590 600
                 // Reorder if child line
591
-                if (!empty($fk_parent_line))
592
-                    $this->line_order(true, 'DESC');
601
+                if (!empty($fk_parent_line)) {
602
+                                    $this->line_order(true, 'DESC');
603
+                }
593 604
 
594 605
                 // Mise a jour informations denormalisees au niveau de la propale meme
595 606
                 $result = $this->update_price(1, 'auto', 0, $mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
@@ -657,12 +668,17 @@  discard block
 block discarded – undo
657 668
         $txlocaltax1 = price2num($txlocaltax1);
658 669
         $txlocaltax2 = price2num($txlocaltax2);
659 670
         $pa_ht = price2num($pa_ht);
660
-        if (empty($qty) && empty($special_code))
661
-            $special_code = 3;    // Set option tag
662
-        if (!empty($qty) && $special_code == 3)
663
-            $special_code = 0;    // Remove option tag
664
-        if (empty($type))
665
-            $type = 0;
671
+        if (empty($qty) && empty($special_code)) {
672
+                    $special_code = 3;
673
+        }
674
+        // Set option tag
675
+        if (!empty($qty) && $special_code == 3) {
676
+                    $special_code = 0;
677
+        }
678
+        // Remove option tag
679
+        if (empty($type)) {
680
+                    $type = 0;
681
+        }
666 682
 
667 683
         if ($this->statut == self::STATUS_DRAFT) {
668 684
             $this->db->begin();
@@ -770,8 +786,9 @@  discard block
 block discarded – undo
770 786
             $result = $this->line->update($notrigger);
771 787
             if ($result > 0) {
772 788
                 // Reorder if child line
773
-                if (!empty($fk_parent_line))
774
-                    $this->line_order(true, 'DESC');
789
+                if (!empty($fk_parent_line)) {
790
+                                    $this->line_order(true, 'DESC');
791
+                }
775 792
 
776 793
                 $this->update_price(1);
777 794
 
@@ -780,8 +797,7 @@  discard block
 block discarded – undo
780 797
 
781 798
                 $this->db->commit();
782 799
                 return $result;
783
-            }
784
-            else {
800
+            } else {
785 801
                 $this->error = $this->line->error;
786 802
 
787 803
                 $this->db->rollback();
@@ -842,21 +858,26 @@  discard block
 block discarded – undo
842 858
         $now = dol_now();
843 859
 
844 860
         // Clean parameters
845
-        if (empty($this->entity))
846
-            $this->entity = $conf->entity;
847
-        if (empty($this->date))
848
-            $this->date = $this->datep;
861
+        if (empty($this->entity)) {
862
+                    $this->entity = $conf->entity;
863
+        }
864
+        if (empty($this->date)) {
865
+                    $this->date = $this->datep;
866
+        }
849 867
         $this->fin_validite = $this->date + ($this->duree_validite * 24 * 3600);
850
-        if (empty($this->availability_id))
851
-            $this->availability_id = 0;
852
-        if (empty($this->demand_reason_id))
853
-            $this->demand_reason_id = 0;
868
+        if (empty($this->availability_id)) {
869
+                    $this->availability_id = 0;
870
+        }
871
+        if (empty($this->demand_reason_id)) {
872
+                    $this->demand_reason_id = 0;
873
+        }
854 874
 
855 875
         // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
856
-        if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx))
857
-            list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date);
858
-        else
859
-            $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
876
+        if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) {
877
+                    list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date);
878
+        } else {
879
+                    $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
880
+        }
860 881
         if (empty($this->fk_multicurrency)) {
861 882
             $this->multicurrency_code = $conf->currency;
862 883
             $this->fk_multicurrency = 0;
@@ -970,8 +991,9 @@  discard block
 block discarded – undo
970 991
 
971 992
                 dol_syslog(get_class($this) . "::create", LOG_DEBUG);
972 993
                 $resql = $this->db->query($sql);
973
-                if (!$resql)
974
-                    $error++;
994
+                if (!$resql) {
995
+                                    $error++;
996
+                }
975 997
 
976 998
                 if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) { // To use new linkedObjectsIds instead of old linked_objects
977 999
                     $this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
@@ -1003,8 +1025,9 @@  discard block
 block discarded – undo
1003 1025
                 if (!$error && $this->origin && $this->origin_id) {
1004 1026
                     dol_syslog('Deprecated use of linked object, use ->linkedObjectsIds instead', LOG_WARNING);
1005 1027
                     $ret = $this->add_object_linked();
1006
-                    if (!$ret)
1007
-                        dol_print_error($this->db);
1028
+                    if (!$ret) {
1029
+                                            dol_print_error($this->db);
1030
+                    }
1008 1031
                 }
1009 1032
 
1010 1033
                 /*
@@ -1027,8 +1050,9 @@  discard block
 block discarded – undo
1027 1050
                         }
1028 1051
                         // Complete vat rate with code
1029 1052
                         $vatrate = $line->tva_tx;
1030
-                        if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate))
1031
-                            $vatrate .= ' (' . $line->vat_src_code . ')';
1053
+                        if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) {
1054
+                                                    $vatrate .= ' (' . $line->vat_src_code . ')';
1055
+                        }
1032 1056
 
1033 1057
                         $result = $this->addline(
1034 1058
                             $line->desc, $line->subprice, $line->qty, $vatrate, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, $line->remise_percent, 'HT', 0, $line->info_bits, $line->product_type, $line->rang, $line->special_code, $fk_parent_line, $line->fk_fournprice, $line->pa_ht, $line->label, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $this->element, $line->id
@@ -1143,8 +1167,9 @@  discard block
 block discarded – undo
1143 1167
         $this->db->begin();
1144 1168
 
1145 1169
         // get extrafields so they will be clone
1146
-        foreach ($this->lines as $line)
1147
-            $line->fetch_optionals();
1170
+        foreach ($this->lines as $line) {
1171
+                    $line->fetch_optionals();
1172
+        }
1148 1173
 
1149 1174
         // Load dest object
1150 1175
         $clonedObj = clone $this;
@@ -1190,22 +1215,25 @@  discard block
 block discarded – undo
1190 1215
         $clonedObj->date = $now;
1191 1216
         $clonedObj->datep = $now;    // deprecated
1192 1217
         $clonedObj->fin_validite = $clonedObj->date + ($clonedObj->duree_validite * 24 * 3600);
1193
-        if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING))
1194
-            $clonedObj->ref_client = '';
1218
+        if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) {
1219
+                    $clonedObj->ref_client = '';
1220
+        }
1195 1221
 
1196 1222
         // Create clone
1197 1223
         $result = $clonedObj->create($user);
1198
-        if ($result < 0)
1199
-            $error++;
1200
-        else {
1224
+        if ($result < 0) {
1225
+                    $error++;
1226
+        } else {
1201 1227
             // copy internal contacts
1202
-            if ($clonedObj->copy_linked_contact($this, 'internal') < 0)
1203
-                $error++;
1228
+            if ($clonedObj->copy_linked_contact($this, 'internal') < 0) {
1229
+                            $error++;
1230
+            }
1204 1231
 
1205 1232
             // copy external contacts if same company
1206 1233
             elseif ($this->socid == $clonedObj->socid) {
1207
-                if ($clonedObj->copy_linked_contact($this, 'external') < 0)
1208
-                    $error++;
1234
+                if ($clonedObj->copy_linked_contact($this, 'external') < 0) {
1235
+                                    $error++;
1236
+                }
1209 1237
             }
1210 1238
         }
1211 1239
 
@@ -1215,8 +1243,9 @@  discard block
 block discarded – undo
1215 1243
                 $parameters = array('objFrom' => $this, 'clonedObj' => $clonedObj);
1216 1244
                 $action = '';
1217 1245
                 $reshook = $hookmanager->executeHooks('createFrom', $parameters, $clonedObj, $action);    // Note that $action and $object may have been modified by some hooks
1218
-                if ($reshook < 0)
1219
-                    $error++;
1246
+                if ($reshook < 0) {
1247
+                                    $error++;
1248
+                }
1220 1249
             }
1221 1250
         }
1222 1251
 
@@ -1280,8 +1309,9 @@  discard block
 block discarded – undo
1280 1309
         if ($ref) {
1281 1310
             $sql .= " WHERE p.entity IN (" . getEntity('propal') . ")"; // Dont't use entity if you use rowid
1282 1311
             $sql .= " AND p.ref='" . $this->db->escape($ref) . "'";
1283
-        } else
1284
-            $sql .= " WHERE p.rowid=" . $rowid;
1312
+        } else {
1313
+                    $sql .= " WHERE p.rowid=" . $rowid;
1314
+        }
1285 1315
 
1286 1316
         dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
1287 1317
         $resql = $this->db->query($sql);
@@ -1404,18 +1434,24 @@  discard block
 block discarded – undo
1404 1434
         $error = 0;
1405 1435
 
1406 1436
         // Clean parameters
1407
-        if (isset($this->ref))
1408
-            $this->ref = trim($this->ref);
1409
-        if (isset($this->ref_client))
1410
-            $this->ref_client = trim($this->ref_client);
1411
-        if (isset($this->note) || isset($this->note_private))
1412
-            $this->note_private = (isset($this->note_private) ? trim($this->note_private) : trim($this->note));
1413
-        if (isset($this->note_public))
1414
-            $this->note_public = trim($this->note_public);
1415
-        if (isset($this->modelpdf))
1416
-            $this->modelpdf = trim($this->modelpdf);
1417
-        if (isset($this->import_key))
1418
-            $this->import_key = trim($this->import_key);
1437
+        if (isset($this->ref)) {
1438
+                    $this->ref = trim($this->ref);
1439
+        }
1440
+        if (isset($this->ref_client)) {
1441
+                    $this->ref_client = trim($this->ref_client);
1442
+        }
1443
+        if (isset($this->note) || isset($this->note_private)) {
1444
+                    $this->note_private = (isset($this->note_private) ? trim($this->note_private) : trim($this->note));
1445
+        }
1446
+        if (isset($this->note_public)) {
1447
+                    $this->note_public = trim($this->note_public);
1448
+        }
1449
+        if (isset($this->modelpdf)) {
1450
+                    $this->modelpdf = trim($this->modelpdf);
1451
+        }
1452
+        if (isset($this->import_key)) {
1453
+                    $this->import_key = trim($this->import_key);
1454
+        }
1419 1455
 
1420 1456
         // Check parameters
1421 1457
         // Put here code to add control on parameters values
@@ -1465,8 +1501,9 @@  discard block
 block discarded – undo
1465 1501
         if (!$error && !$notrigger) {
1466 1502
             // Call trigger
1467 1503
             $result = $this->call_trigger('PROPAL_MODIFY', $user);
1468
-            if ($result < 0)
1469
-                $error++;
1504
+            if ($result < 0) {
1505
+                            $error++;
1506
+            }
1470 1507
             // End call triggers
1471 1508
         }
1472 1509
 
@@ -1506,8 +1543,9 @@  discard block
 block discarded – undo
1506 1543
         $sql .= ' FROM ' . MAIN_DB_PREFIX . 'propaldet as d';
1507 1544
         $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product as p ON (d.fk_product = p.rowid)';
1508 1545
         $sql .= ' WHERE d.fk_propal = ' . $this->id;
1509
-        if ($only_product)
1510
-            $sql .= ' AND p.fk_product_type = 0';
1546
+        if ($only_product) {
1547
+                    $sql .= ' AND p.fk_product_type = 0';
1548
+        }
1511 1549
         $sql .= ' ORDER by d.rang';
1512 1550
 
1513 1551
         dol_syslog(get_class($this) . "::fetch_lines", LOG_DEBUG);
@@ -1750,8 +1788,9 @@  discard block
 block discarded – undo
1750 1788
             if (!$notrigger && empty($error)) {
1751 1789
                 // Call trigger
1752 1790
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
1753
-                if ($result < 0)
1754
-                    $error++;
1791
+                if ($result < 0) {
1792
+                                    $error++;
1793
+                }
1755 1794
                 // End call triggers
1756 1795
             }
1757 1796
 
@@ -1805,8 +1844,9 @@  discard block
 block discarded – undo
1805 1844
             if (!$notrigger && empty($error)) {
1806 1845
                 // Call trigger
1807 1846
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
1808
-                if ($result < 0)
1809
-                    $error++;
1847
+                if ($result < 0) {
1848
+                                    $error++;
1849
+                }
1810 1850
                 // End call triggers
1811 1851
             }
1812 1852
 
@@ -1860,8 +1900,9 @@  discard block
 block discarded – undo
1860 1900
             if (!$notrigger && empty($error)) {
1861 1901
                 // Call trigger
1862 1902
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
1863
-                if ($result < 0)
1864
-                    $error++;
1903
+                if ($result < 0) {
1904
+                                    $error++;
1905
+                }
1865 1906
                 // End call triggers
1866 1907
             }
1867 1908
 
@@ -1916,8 +1957,9 @@  discard block
 block discarded – undo
1916 1957
             if (!$notrigger && empty($error)) {
1917 1958
                 // Call trigger
1918 1959
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
1919
-                if ($result < 0)
1920
-                    $error++;
1960
+                if ($result < 0) {
1961
+                                    $error++;
1962
+                }
1921 1963
                 // End call triggers
1922 1964
             }
1923 1965
 
@@ -1980,8 +2022,9 @@  discard block
 block discarded – undo
1980 2022
             if (!$notrigger && empty($error)) {
1981 2023
                 // Call trigger
1982 2024
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
1983
-                if ($result < 0)
1984
-                    $error++;
2025
+                if ($result < 0) {
2026
+                                    $error++;
2027
+                }
1985 2028
                 // End call triggers
1986 2029
             }
1987 2030
 
@@ -2040,8 +2083,9 @@  discard block
 block discarded – undo
2040 2083
             if (!$notrigger && empty($error)) {
2041 2084
                 // Call trigger
2042 2085
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
2043
-                if ($result < 0)
2044
-                    $error++;
2086
+                if ($result < 0) {
2087
+                                    $error++;
2088
+                }
2045 2089
                 // End call triggers
2046 2090
             }
2047 2091
 
@@ -2101,8 +2145,9 @@  discard block
 block discarded – undo
2101 2145
             if (!$notrigger && empty($error)) {
2102 2146
                 // Call trigger
2103 2147
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
2104
-                if ($result < 0)
2105
-                    $error++;
2148
+                if ($result < 0) {
2149
+                                    $error++;
2150
+                }
2106 2151
                 // End call triggers
2107 2152
             }
2108 2153
 
@@ -2161,8 +2206,9 @@  discard block
 block discarded – undo
2161 2206
             if (!$notrigger && empty($error)) {
2162 2207
                 // Call trigger
2163 2208
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
2164
-                if ($result < 0)
2165
-                    $error++;
2209
+                if ($result < 0) {
2210
+                                    $error++;
2211
+                }
2166 2212
                 // End call triggers
2167 2213
             }
2168 2214
 
@@ -2197,8 +2243,9 @@  discard block
 block discarded – undo
2197 2243
 
2198 2244
         $sql = "UPDATE " . MAIN_DB_PREFIX . "propal";
2199 2245
         $sql .= " SET fk_statut = " . $this->statut . ",";
2200
-        if (!empty($note))
2201
-            $sql .= " note_private = '" . $this->db->escape($note) . "',";
2246
+        if (!empty($note)) {
2247
+                    $sql .= " note_private = '" . $this->db->escape($note) . "',";
2248
+        }
2202 2249
         $sql .= " date_cloture=NULL, fk_user_cloture=NULL";
2203 2250
         $sql .= " WHERE rowid = " . $this->id;
2204 2251
 
@@ -2362,8 +2409,9 @@  discard block
 block discarded – undo
2362 2409
         if (!$notrigger && empty($error)) {
2363 2410
             // Call trigger
2364 2411
             $result = $this->call_trigger('PROPAL_MODIFY', $user);
2365
-            if ($result < 0)
2366
-                $error++;
2412
+            if ($result < 0) {
2413
+                            $error++;
2414
+            }
2367 2415
             // End call triggers
2368 2416
         }
2369 2417
 
@@ -2414,8 +2462,9 @@  discard block
 block discarded – undo
2414 2462
         if (!$notrigger && empty($error)) {
2415 2463
             // Call trigger
2416 2464
             $result = $this->call_trigger('PROPAL_MODIFY', $user);
2417
-            if ($result < 0)
2418
-                $error++;
2465
+            if ($result < 0) {
2466
+                            $error++;
2467
+            }
2419 2468
             // End call triggers
2420 2469
         }
2421 2470
 
@@ -2456,23 +2505,28 @@  discard block
 block discarded – undo
2456 2505
         $sql = "SELECT s.rowid, s.nom as name, s.client,";
2457 2506
         $sql .= " p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.remise, ";
2458 2507
         $sql .= " p.datep as dp, p.fin_validite as datelimite";
2459
-        if (!$user->rights->societe->client->voir && !$socid)
2460
-            $sql .= ", sc.fk_soc, sc.fk_user";
2508
+        if (!$user->rights->societe->client->voir && !$socid) {
2509
+                    $sql .= ", sc.fk_soc, sc.fk_user";
2510
+        }
2461 2511
         $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "propal as p, " . MAIN_DB_PREFIX . "c_propalst as c";
2462
-        if (!$user->rights->societe->client->voir && !$socid)
2463
-            $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
2512
+        if (!$user->rights->societe->client->voir && !$socid) {
2513
+                    $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
2514
+        }
2464 2515
         $sql .= " WHERE p.entity IN (" . getEntity('propal') . ")";
2465 2516
         $sql .= " AND p.fk_soc = s.rowid";
2466 2517
         $sql .= " AND p.fk_statut = c.id";
2467 2518
         if (!$user->rights->societe->client->voir && !$socid) { //restriction
2468 2519
             $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
2469 2520
         }
2470
-        if ($socid)
2471
-            $sql .= " AND s.rowid = " . $socid;
2472
-        if ($draft)
2473
-            $sql .= " AND p.fk_statut = " . self::STATUS_DRAFT;
2474
-        if ($notcurrentuser > 0)
2475
-            $sql .= " AND p.fk_user_author <> " . $user->id;
2521
+        if ($socid) {
2522
+                    $sql .= " AND s.rowid = " . $socid;
2523
+        }
2524
+        if ($draft) {
2525
+                    $sql .= " AND p.fk_statut = " . self::STATUS_DRAFT;
2526
+        }
2527
+        if ($notcurrentuser > 0) {
2528
+                    $sql .= " AND p.fk_user_author <> " . $user->id;
2529
+        }
2476 2530
         $sql .= $this->db->order($sortfield, $sortorder);
2477 2531
         $sql .= $this->db->plimit($limit, $offset);
2478 2532
 
@@ -2583,8 +2637,9 @@  discard block
 block discarded – undo
2583 2637
             } else {
2584 2638
                 return -1;
2585 2639
             }
2586
-        } else
2587
-            return $ga;
2640
+        } else {
2641
+                    return $ga;
2642
+        }
2588 2643
     }
2589 2644
 
2590 2645
     /**
@@ -2619,13 +2674,15 @@  discard block
 block discarded – undo
2619 2674
                 if ($this->db->query($sql)) {
2620 2675
                     // Delete linked object
2621 2676
                     $res = $this->deleteObjectLinked();
2622
-                    if ($res < 0)
2623
-                        $error++;
2677
+                    if ($res < 0) {
2678
+                                            $error++;
2679
+                    }
2624 2680
 
2625 2681
                     // Delete linked contacts
2626 2682
                     $res = $this->delete_linked_contact();
2627
-                    if ($res < 0)
2628
-                        $error++;
2683
+                    if ($res < 0) {
2684
+                                            $error++;
2685
+                    }
2629 2686
 
2630 2687
                     if (!$error) {
2631 2688
                         // We remove directory
@@ -2728,8 +2785,9 @@  discard block
 block discarded – undo
2728 2785
             if (!$notrigger && empty($error)) {
2729 2786
                 // Call trigger
2730 2787
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
2731
-                if ($result < 0)
2732
-                    $error++;
2788
+                if ($result < 0) {
2789
+                                    $error++;
2790
+                }
2733 2791
                 // End call triggers
2734 2792
             }
2735 2793
 
@@ -2791,8 +2849,9 @@  discard block
 block discarded – undo
2791 2849
             if (!$notrigger && empty($error)) {
2792 2850
                 // Call trigger
2793 2851
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
2794
-                if ($result < 0)
2795
-                    $error++;
2852
+                if ($result < 0) {
2853
+                                    $error++;
2854
+                }
2796 2855
                 // End call triggers
2797 2856
             }
2798 2857
 
@@ -2905,31 +2964,33 @@  discard block
 block discarded – undo
2905 2964
         }
2906 2965
 
2907 2966
         $statuttrans = '';
2908
-        if ($statut == self::STATUS_DRAFT)
2909
-            $statuttrans = 'statut0';
2910
-        elseif ($statut == self::STATUS_VALIDATED)
2911
-            $statuttrans = 'statut1';
2912
-        elseif ($statut == self::STATUS_SIGNED)
2913
-            $statuttrans = 'statut3';
2914
-        elseif ($statut == self::STATUS_NOTSIGNED)
2915
-            $statuttrans = 'statut5';
2916
-        elseif ($statut == self::STATUS_BILLED)
2917
-            $statuttrans = 'statut6';
2918
-
2919
-        if ($mode == 0)
2920
-            return $this->labelstatut[$statut];
2921
-        elseif ($mode == 1)
2922
-            return $this->labelstatut_short[$statut];
2923
-        elseif ($mode == 2)
2924
-            return img_picto($this->labelstatut_short[$statut], $statuttrans) . ' ' . $this->labelstatut_short[$statut];
2925
-        elseif ($mode == 3)
2926
-            return img_picto($this->labelstatut[$statut], $statuttrans);
2927
-        elseif ($mode == 4)
2928
-            return img_picto($this->labelstatut[$statut], $statuttrans) . ' ' . $this->labelstatut[$statut];
2929
-        elseif ($mode == 5)
2930
-            return '<span class="hideonsmartphone">' . $this->labelstatut_short[$statut] . ' </span>' . img_picto($this->labelstatut[$statut], $statuttrans);
2931
-        elseif ($mode == 6)
2932
-            return '<span class="hideonsmartphone">' . $this->labelstatut[$statut] . ' </span>' . img_picto($this->labelstatut[$statut], $statuttrans);
2967
+        if ($statut == self::STATUS_DRAFT) {
2968
+                    $statuttrans = 'statut0';
2969
+        } elseif ($statut == self::STATUS_VALIDATED) {
2970
+                    $statuttrans = 'statut1';
2971
+        } elseif ($statut == self::STATUS_SIGNED) {
2972
+                    $statuttrans = 'statut3';
2973
+        } elseif ($statut == self::STATUS_NOTSIGNED) {
2974
+                    $statuttrans = 'statut5';
2975
+        } elseif ($statut == self::STATUS_BILLED) {
2976
+                    $statuttrans = 'statut6';
2977
+        }
2978
+
2979
+        if ($mode == 0) {
2980
+                    return $this->labelstatut[$statut];
2981
+        } elseif ($mode == 1) {
2982
+                    return $this->labelstatut_short[$statut];
2983
+        } elseif ($mode == 2) {
2984
+                    return img_picto($this->labelstatut_short[$statut], $statuttrans) . ' ' . $this->labelstatut_short[$statut];
2985
+        } elseif ($mode == 3) {
2986
+                    return img_picto($this->labelstatut[$statut], $statuttrans);
2987
+        } elseif ($mode == 4) {
2988
+                    return img_picto($this->labelstatut[$statut], $statuttrans) . ' ' . $this->labelstatut[$statut];
2989
+        } elseif ($mode == 5) {
2990
+                    return '<span class="hideonsmartphone">' . $this->labelstatut_short[$statut] . ' </span>' . img_picto($this->labelstatut[$statut], $statuttrans);
2991
+        } elseif ($mode == 6) {
2992
+                    return '<span class="hideonsmartphone">' . $this->labelstatut[$statut] . ' </span>' . img_picto($this->labelstatut[$statut], $statuttrans);
2993
+        }
2933 2994
     }
2934 2995
 
2935 2996
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -2955,12 +3016,15 @@  discard block
 block discarded – undo
2955 3016
             $clause = " AND";
2956 3017
         }
2957 3018
         $sql .= $clause . " p.entity IN (" . getEntity('propal') . ")";
2958
-        if ($mode == 'opened')
2959
-            $sql .= " AND p.fk_statut = " . self::STATUS_VALIDATED;
2960
-        if ($mode == 'signed')
2961
-            $sql .= " AND p.fk_statut = " . self::STATUS_SIGNED;
2962
-        if ($user->societe_id)
2963
-            $sql .= " AND p.fk_soc = " . $user->societe_id;
3019
+        if ($mode == 'opened') {
3020
+                    $sql .= " AND p.fk_statut = " . self::STATUS_VALIDATED;
3021
+        }
3022
+        if ($mode == 'signed') {
3023
+                    $sql .= " AND p.fk_statut = " . self::STATUS_SIGNED;
3024
+        }
3025
+        if ($user->societe_id) {
3026
+                    $sql .= " AND p.fk_soc = " . $user->societe_id;
3027
+        }
2964 3028
 
2965 3029
         $resql = $this->db->query($sql);
2966 3030
         if ($resql) {
@@ -3270,10 +3334,12 @@  discard block
 block discarded – undo
3270 3334
         $linkend = '</a>';
3271 3335
 
3272 3336
         $result .= $linkstart;
3273
-        if ($withpicto)
3274
-            $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
3275
-        if ($withpicto != 2)
3276
-            $result .= $this->ref;
3337
+        if ($withpicto) {
3338
+                    $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
3339
+        }
3340
+        if ($withpicto != 2) {
3341
+                    $result .= $this->ref;
3342
+        }
3277 3343
         $result .= $linkend;
3278 3344
 
3279 3345
         return $result;
@@ -3566,46 +3632,66 @@  discard block
 block discarded – undo
3566 3632
 
3567 3633
         $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'.
3568 3634
         // Clean parameters
3569
-        if (empty($this->tva_tx))
3570
-            $this->tva_tx = 0;
3571
-        if (empty($this->localtax1_tx))
3572
-            $this->localtax1_tx = 0;
3573
-        if (empty($this->localtax2_tx))
3574
-            $this->localtax2_tx = 0;
3575
-        if (empty($this->localtax1_type))
3576
-            $this->localtax1_type = 0;
3577
-        if (empty($this->localtax2_type))
3578
-            $this->localtax2_type = 0;
3579
-        if (empty($this->total_localtax1))
3580
-            $this->total_localtax1 = 0;
3581
-        if (empty($this->total_localtax2))
3582
-            $this->total_localtax2 = 0;
3583
-        if (empty($this->rang))
3584
-            $this->rang = 0;
3585
-        if (empty($this->remise))
3586
-            $this->remise = 0;
3587
-        if (empty($this->remise_percent) || !is_numeric($this->remise_percent))
3588
-            $this->remise_percent = 0;
3589
-        if (empty($this->info_bits))
3590
-            $this->info_bits = 0;
3591
-        if (empty($this->special_code))
3592
-            $this->special_code = 0;
3593
-        if (empty($this->fk_parent_line))
3594
-            $this->fk_parent_line = 0;
3595
-        if (empty($this->fk_fournprice))
3596
-            $this->fk_fournprice = 0;
3597
-        if (!is_numeric($this->qty))
3598
-            $this->qty = 0;
3599
-        if (empty($this->pa_ht))
3600
-            $this->pa_ht = 0;
3601
-        if (empty($this->multicurrency_subprice))
3602
-            $this->multicurrency_subprice = 0;
3603
-        if (empty($this->multicurrency_total_ht))
3604
-            $this->multicurrency_total_ht = 0;
3605
-        if (empty($this->multicurrency_total_tva))
3606
-            $this->multicurrency_total_tva = 0;
3607
-        if (empty($this->multicurrency_total_ttc))
3608
-            $this->multicurrency_total_ttc = 0;
3635
+        if (empty($this->tva_tx)) {
3636
+                    $this->tva_tx = 0;
3637
+        }
3638
+        if (empty($this->localtax1_tx)) {
3639
+                    $this->localtax1_tx = 0;
3640
+        }
3641
+        if (empty($this->localtax2_tx)) {
3642
+                    $this->localtax2_tx = 0;
3643
+        }
3644
+        if (empty($this->localtax1_type)) {
3645
+                    $this->localtax1_type = 0;
3646
+        }
3647
+        if (empty($this->localtax2_type)) {
3648
+                    $this->localtax2_type = 0;
3649
+        }
3650
+        if (empty($this->total_localtax1)) {
3651
+                    $this->total_localtax1 = 0;
3652
+        }
3653
+        if (empty($this->total_localtax2)) {
3654
+                    $this->total_localtax2 = 0;
3655
+        }
3656
+        if (empty($this->rang)) {
3657
+                    $this->rang = 0;
3658
+        }
3659
+        if (empty($this->remise)) {
3660
+                    $this->remise = 0;
3661
+        }
3662
+        if (empty($this->remise_percent) || !is_numeric($this->remise_percent)) {
3663
+                    $this->remise_percent = 0;
3664
+        }
3665
+        if (empty($this->info_bits)) {
3666
+                    $this->info_bits = 0;
3667
+        }
3668
+        if (empty($this->special_code)) {
3669
+                    $this->special_code = 0;
3670
+        }
3671
+        if (empty($this->fk_parent_line)) {
3672
+                    $this->fk_parent_line = 0;
3673
+        }
3674
+        if (empty($this->fk_fournprice)) {
3675
+                    $this->fk_fournprice = 0;
3676
+        }
3677
+        if (!is_numeric($this->qty)) {
3678
+                    $this->qty = 0;
3679
+        }
3680
+        if (empty($this->pa_ht)) {
3681
+                    $this->pa_ht = 0;
3682
+        }
3683
+        if (empty($this->multicurrency_subprice)) {
3684
+                    $this->multicurrency_subprice = 0;
3685
+        }
3686
+        if (empty($this->multicurrency_total_ht)) {
3687
+                    $this->multicurrency_total_ht = 0;
3688
+        }
3689
+        if (empty($this->multicurrency_total_tva)) {
3690
+                    $this->multicurrency_total_tva = 0;
3691
+        }
3692
+        if (empty($this->multicurrency_total_ttc)) {
3693
+                    $this->multicurrency_total_ttc = 0;
3694
+        }
3609 3695
 
3610 3696
         // if buy price not defined, define buyprice as configured in margin admin
3611 3697
         if ($this->pa_ht == 0 && $pa_ht_isemptystring) {
@@ -3617,8 +3703,9 @@  discard block
 block discarded – undo
3617 3703
         }
3618 3704
 
3619 3705
         // Check parameters
3620
-        if ($this->product_type < 0)
3621
-            return -1;
3706
+        if ($this->product_type < 0) {
3707
+                    return -1;
3708
+        }
3622 3709
 
3623 3710
         $this->db->begin();
3624 3711
 
@@ -3763,42 +3850,62 @@  discard block
 block discarded – undo
3763 3850
 
3764 3851
         $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'.
3765 3852
         // Clean parameters
3766
-        if (empty($this->tva_tx))
3767
-            $this->tva_tx = 0;
3768
-        if (empty($this->localtax1_tx))
3769
-            $this->localtax1_tx = 0;
3770
-        if (empty($this->localtax2_tx))
3771
-            $this->localtax2_tx = 0;
3772
-        if (empty($this->total_localtax1))
3773
-            $this->total_localtax1 = 0;
3774
-        if (empty($this->total_localtax2))
3775
-            $this->total_localtax2 = 0;
3776
-        if (empty($this->localtax1_type))
3777
-            $this->localtax1_type = 0;
3778
-        if (empty($this->localtax2_type))
3779
-            $this->localtax2_type = 0;
3780
-        if (empty($this->marque_tx))
3781
-            $this->marque_tx = 0;
3782
-        if (empty($this->marge_tx))
3783
-            $this->marge_tx = 0;
3784
-        if (empty($this->price))
3785
-            $this->price = 0; // TODO A virer
3786
-        if (empty($this->remise))
3787
-            $this->remise = 0; // TODO A virer
3788
-        if (empty($this->remise_percent))
3789
-            $this->remise_percent = 0;
3790
-        if (empty($this->info_bits))
3791
-            $this->info_bits = 0;
3792
-        if (empty($this->special_code))
3793
-            $this->special_code = 0;
3794
-        if (empty($this->fk_parent_line))
3795
-            $this->fk_parent_line = 0;
3796
-        if (empty($this->fk_fournprice))
3797
-            $this->fk_fournprice = 0;
3798
-        if (empty($this->subprice))
3799
-            $this->subprice = 0;
3800
-        if (empty($this->pa_ht))
3801
-            $this->pa_ht = 0;
3853
+        if (empty($this->tva_tx)) {
3854
+                    $this->tva_tx = 0;
3855
+        }
3856
+        if (empty($this->localtax1_tx)) {
3857
+                    $this->localtax1_tx = 0;
3858
+        }
3859
+        if (empty($this->localtax2_tx)) {
3860
+                    $this->localtax2_tx = 0;
3861
+        }
3862
+        if (empty($this->total_localtax1)) {
3863
+                    $this->total_localtax1 = 0;
3864
+        }
3865
+        if (empty($this->total_localtax2)) {
3866
+                    $this->total_localtax2 = 0;
3867
+        }
3868
+        if (empty($this->localtax1_type)) {
3869
+                    $this->localtax1_type = 0;
3870
+        }
3871
+        if (empty($this->localtax2_type)) {
3872
+                    $this->localtax2_type = 0;
3873
+        }
3874
+        if (empty($this->marque_tx)) {
3875
+                    $this->marque_tx = 0;
3876
+        }
3877
+        if (empty($this->marge_tx)) {
3878
+                    $this->marge_tx = 0;
3879
+        }
3880
+        if (empty($this->price)) {
3881
+                    $this->price = 0;
3882
+        }
3883
+        // TODO A virer
3884
+        if (empty($this->remise)) {
3885
+                    $this->remise = 0;
3886
+        }
3887
+        // TODO A virer
3888
+        if (empty($this->remise_percent)) {
3889
+                    $this->remise_percent = 0;
3890
+        }
3891
+        if (empty($this->info_bits)) {
3892
+                    $this->info_bits = 0;
3893
+        }
3894
+        if (empty($this->special_code)) {
3895
+                    $this->special_code = 0;
3896
+        }
3897
+        if (empty($this->fk_parent_line)) {
3898
+                    $this->fk_parent_line = 0;
3899
+        }
3900
+        if (empty($this->fk_fournprice)) {
3901
+                    $this->fk_fournprice = 0;
3902
+        }
3903
+        if (empty($this->subprice)) {
3904
+                    $this->subprice = 0;
3905
+        }
3906
+        if (empty($this->pa_ht)) {
3907
+                    $this->pa_ht = 0;
3908
+        }
3802 3909
 
3803 3910
         // if buy price not defined, define buyprice as configured in margin admin
3804 3911
         if ($this->pa_ht == 0 && $pa_ht_isemptystring) {
@@ -3837,11 +3944,13 @@  discard block
 block discarded – undo
3837 3944
         }
3838 3945
         $sql .= ", fk_product_fournisseur_price=" . (!empty($this->fk_fournprice) ? "'" . $this->db->escape($this->fk_fournprice) . "'" : "null");
3839 3946
         $sql .= ", buy_price_ht=" . price2num($this->pa_ht);
3840
-        if (strlen($this->special_code))
3841
-            $sql .= ", special_code=" . $this->special_code;
3947
+        if (strlen($this->special_code)) {
3948
+                    $sql .= ", special_code=" . $this->special_code;
3949
+        }
3842 3950
         $sql .= ", fk_parent_line=" . ($this->fk_parent_line > 0 ? $this->fk_parent_line : "null");
3843
-        if (!empty($this->rang))
3844
-            $sql .= ", rang=" . $this->rang;
3951
+        if (!empty($this->rang)) {
3952
+                    $sql .= ", rang=" . $this->rang;
3953
+        }
3845 3954
         $sql .= ", date_start=" . (!empty($this->date_start) ? "'" . $this->db->idate($this->date_start) . "'" : "null");
3846 3955
         $sql .= ", date_end=" . (!empty($this->date_end) ? "'" . $this->db->idate($this->date_end) . "'" : "null");
3847 3956
         $sql .= ", fk_unit=" . (!$this->fk_unit ? 'NULL' : $this->fk_unit);
Please login to merge, or discard this patch.
dolibarr/htdocs/comm/propal/list.php 1 patch
Braces   +49 added lines, -39 removed lines patch added patch discarded remove patch
@@ -243,8 +243,9 @@  discard block
 block discarded – undo
243 243
     $search_array_options = array();
244 244
     $search_categ_cus = 0;
245 245
 }
246
-if ($object_statut != '')
246
+if ($object_statut != '') {
247 247
     $viewstatut = $object_statut;
248
+}
248 249
 
249 250
 if (empty($reshook)) {
250 251
     $objectclass = 'Propal';
@@ -442,10 +443,10 @@  discard block
 block discarded – undo
442 443
         $soc = new Societe($db);
443 444
         $soc->fetch($socid);
444 445
         $title = $langs->trans('ListOfProposals') . ' - ' . $soc->name;
445
-        if (empty($search_societe))
446
-            $search_societe = $soc->name;
447
-    }
448
-    else {
446
+        if (empty($search_societe)) {
447
+                    $search_societe = $soc->name;
448
+        }
449
+    } else {
449 450
         $title = $langs->trans('ListOfProposals');
450 451
     }
451 452
 
@@ -660,10 +661,12 @@  discard block
 block discarded – undo
660 661
         print '<input class="flat" type="text" size="10" name="search_societe" value="' . dol_escape_htmltag($search_societe) . '">';
661 662
         print '</td>';
662 663
     }
663
-    if (!empty($arrayfields['s.town']['checked']))
664
-        print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="' . $search_town . '"></td>';
665
-    if (!empty($arrayfields['s.zip']['checked']))
666
-        print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="' . $search_zip . '"></td>';
664
+    if (!empty($arrayfields['s.town']['checked'])) {
665
+            print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="' . $search_town . '"></td>';
666
+    }
667
+    if (!empty($arrayfields['s.zip']['checked'])) {
668
+            print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="' . $search_zip . '"></td>';
669
+    }
667 670
     // State
668 671
     if (!empty($arrayfields['state.nom']['checked'])) {
669 672
         print '<td class="liste_titre">';
@@ -687,8 +690,9 @@  discard block
 block discarded – undo
687 690
     if (!empty($arrayfields['p.date']['checked'])) {
688 691
         print '<td class="liste_titre nowraponall" align="center">';
689 692
         //print $langs->trans('Month').': ';
690
-        if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY))
691
-            print '<input class="flat width25" type="text" maxlength="2" name="search_day" value="' . dol_escape_htmltag($search_day) . '">';
693
+        if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
694
+                    print '<input class="flat width25" type="text" maxlength="2" name="search_day" value="' . dol_escape_htmltag($search_day) . '">';
695
+        }
692 696
         print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_month" value="' . dol_escape_htmltag($search_month) . '">';
693 697
         //print '&nbsp;'.$langs->trans('Year').': ';
694 698
         $formother->select_year($search_year, 'search_year', 1, 20, 5);
@@ -698,8 +702,9 @@  discard block
 block discarded – undo
698 702
     if (!empty($arrayfields['p.fin_validite']['checked'])) {
699 703
         print '<td class="liste_titre nowraponall" align="center">';
700 704
         //print $langs->trans('Month').': ';
701
-        if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY))
702
-            print '<input class="flat width25" type="text" maxlength="2" name="search_dayfin" value="' . dol_escape_htmltag($search_dayfin) . '">';
705
+        if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
706
+                    print '<input class="flat width25" type="text" maxlength="2" name="search_dayfin" value="' . dol_escape_htmltag($search_dayfin) . '">';
707
+        }
703 708
         print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_month_end" value="' . dol_escape_htmltag($search_month_end) . '">';
704 709
         //print '&nbsp;'.$langs->trans('Year').': ';
705 710
         $formother->select_year($search_yearfin, 'search_yearfin', 1, 20, 5);
@@ -709,8 +714,9 @@  discard block
 block discarded – undo
709 714
     if (!empty($arrayfields['p.date_livraison']['checked'])) {
710 715
         print '<td class="liste_titre nowraponall" align="center">';
711 716
         //print $langs->trans('Month').': ';
712
-        if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY))
713
-            print '<input class="flat width25" type="text" size="1" maxlength="2" name="search_daydelivery" value="' . dol_escape_htmltag($search_daydelivery) . '">';
717
+        if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
718
+                    print '<input class="flat width25" type="text" size="1" maxlength="2" name="search_daydelivery" value="' . dol_escape_htmltag($search_daydelivery) . '">';
719
+        }
714 720
         print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_monthdelivery" value="' . dol_escape_htmltag($search_monthdelivery) . '">';
715 721
         //print '&nbsp;'.$langs->trans('Year').': ';
716 722
         $formother->select_year($search_yeardelivery, 'search_yeardelivery', 1, 20, 5);
@@ -877,8 +883,9 @@  discard block
 block discarded – undo
877 883
             print '</td>';
878 884
             // Warning
879 885
             $warnornote = '';
880
-            if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay))
881
-                $warnornote .= img_warning($langs->trans("Late"));
886
+            if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) {
887
+                            $warnornote .= img_warning($langs->trans("Late"));
888
+            }
882 889
             if (!empty($obj->note_private)) {
883 890
                 $warnornote .= ($warnornote ? ' ' : '');
884 891
                 $warnornote .= '<span class="note">';
@@ -900,8 +907,9 @@  discard block
 block discarded – undo
900 907
             print '</td></tr></table>';
901 908
 
902 909
             print "</td>\n";
903
-            if (!$i)
904
-                $totalarray['nbfield'] ++;
910
+            if (!$i) {
911
+                            $totalarray['nbfield'] ++;
912
+            }
905 913
         }
906 914
 
907 915
         if (!empty($arrayfields['p.ref_client']['checked'])) {
@@ -1009,8 +1017,9 @@  discard block
 block discarded – undo
1009 1017
             } else {
1010 1018
                 print '<td>&nbsp;</td>';
1011 1019
             }
1012
-            if (!$i)
1013
-                $totalarray['nbfield'] ++;
1020
+            if (!$i) {
1021
+                            $totalarray['nbfield'] ++;
1022
+            }
1014 1023
         }
1015 1024
         // Date delivery
1016 1025
         if (!empty($arrayfields['p.date_livraison']['checked'])) {
@@ -1185,18 +1194,18 @@  discard block
 block discarded – undo
1185 1194
         while ($i < $totalarray['nbfield']) {
1186 1195
             $i++;
1187 1196
             if ($i == 1) {
1188
-                if ($num < $limit && empty($offset))
1189
-                    print '<td align="left">' . $langs->trans("Total") . '</td>';
1190
-                else
1191
-                    print '<td align="left">' . $langs->trans("Totalforthispage") . '</td>';
1192
-            }
1193
-            elseif ($totalarray['totalhtfield'] == $i)
1194
-                print '<td align="right">' . price($totalarray['totalht']) . '</td>';
1195
-            elseif ($totalarray['totalvatfield'] == $i)
1196
-                print '<td align="right">' . price($totalarray['totalvat']) . '</td>';
1197
-            elseif ($totalarray['totalttcfield'] == $i)
1198
-                print '<td align="right">' . price($totalarray['totalttc']) . '</td>';
1199
-            elseif ($totalarray['totalizable']) {
1197
+                if ($num < $limit && empty($offset)) {
1198
+                                    print '<td align="left">' . $langs->trans("Total") . '</td>';
1199
+                } else {
1200
+                                    print '<td align="left">' . $langs->trans("Totalforthispage") . '</td>';
1201
+                }
1202
+            } elseif ($totalarray['totalhtfield'] == $i) {
1203
+                            print '<td align="right">' . price($totalarray['totalht']) . '</td>';
1204
+            } elseif ($totalarray['totalvatfield'] == $i) {
1205
+                            print '<td align="right">' . price($totalarray['totalvat']) . '</td>';
1206
+            } elseif ($totalarray['totalttcfield'] == $i) {
1207
+                            print '<td align="right">' . price($totalarray['totalttc']) . '</td>';
1208
+            } elseif ($totalarray['totalizable']) {
1200 1209
                 $printed = false;
1201 1210
                 foreach ($totalarray['totalizable'] as $totalizable) {
1202 1211
                     if ($totalizable['pos'] == $i && !$printed) {
@@ -1207,8 +1216,9 @@  discard block
 block discarded – undo
1207 1216
                 if (!$printed) {
1208 1217
                     print '<td></td>';
1209 1218
                 }
1210
-            } else
1211
-                print '<td></td>';
1219
+            } else {
1220
+                            print '<td></td>';
1221
+            }
1212 1222
         }
1213 1223
         print '</tr>';
1214 1224
     }
@@ -1225,8 +1235,9 @@  discard block
 block discarded – undo
1225 1235
     print '</form>' . "\n";
1226 1236
 
1227 1237
     $hidegeneratedfilelistifempty = 1;
1228
-    if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
1229
-        $hidegeneratedfilelistifempty = 0;
1238
+    if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1239
+            $hidegeneratedfilelistifempty = 0;
1240
+    }
1230 1241
 
1231 1242
     // Show list of available documents
1232 1243
     $urlsource = $_SERVER['PHP_SELF'] . '?sortfield=' . $sortfield . '&sortorder=' . $sortorder;
@@ -1237,8 +1248,7 @@  discard block
 block discarded – undo
1237 1248
     $delallowed = $user->rights->propal->creer;
1238 1249
 
1239 1250
     print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1240
-}
1241
-else {
1251
+} else {
1242 1252
     dol_print_error($db);
1243 1253
 }
1244 1254
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/propal.lib.php 1 patch
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -50,10 +50,12 @@  discard block
 block discarded – undo
50 50
         $text = '';
51 51
         // $head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?id='.$object->id;
52 52
         $head[$h][0] = BASE_URI . '?controller=expedition&method=propal&id=' . $object->id;
53
-        if ($conf->expedition_bon->enabled)
54
-            $text = $langs->trans("Shipment");
55
-        if ($conf->livraison_bon->enabled)
56
-            $text .= '/' . $langs->trans("Receivings");
53
+        if ($conf->expedition_bon->enabled) {
54
+                    $text = $langs->trans("Shipment");
55
+        }
56
+        if ($conf->livraison_bon->enabled) {
57
+                    $text .= '/' . $langs->trans("Receivings");
58
+        }
57 59
         $head[$h][1] = $text;
58 60
         $head[$h][2] = 'shipping';
59 61
         $h++;
@@ -64,8 +66,9 @@  discard block
 block discarded – undo
64 66
         // $head[$h][0] = DOL_URL_ROOT.'/comm/propal/contact.php?id='.$object->id;
65 67
         $head[$h][0] = BASE_URI . '?controller=comm/propal&method=contact&id=' . $object->id;
66 68
         $head[$h][1] = $langs->trans('ContactsAddresses');
67
-        if ($nbContact > 0)
68
-            $head[$h][1] .= ' <span class="badge">' . $nbContact . '</span>';
69
+        if ($nbContact > 0) {
70
+                    $head[$h][1] .= ' <span class="badge">' . $nbContact . '</span>';
71
+        }
69 72
         $head[$h][2] = 'contact';
70 73
         $h++;
71 74
     }
@@ -78,15 +81,18 @@  discard block
 block discarded – undo
78 81
 
79 82
     if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
80 83
         $nbNote = 0;
81
-        if (!empty($object->note_private))
82
-            $nbNote++;
83
-        if (!empty($object->note_public))
84
-            $nbNote++;
84
+        if (!empty($object->note_private)) {
85
+                    $nbNote++;
86
+        }
87
+        if (!empty($object->note_public)) {
88
+                    $nbNote++;
89
+        }
85 90
         // $head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?id='.$object->id;
86 91
         $head[$h][0] = BASE_URI . '?controller=comm/propal&method=note&id=' . $object->id;
87 92
         $head[$h][1] = $langs->trans('Notes');
88
-        if ($nbNote > 0)
89
-            $head[$h][1] .= ' <span class="badge">' . $nbNote . '</span>';
93
+        if ($nbNote > 0) {
94
+                    $head[$h][1] .= ' <span class="badge">' . $nbNote . '</span>';
95
+        }
90 96
         $head[$h][2] = 'note';
91 97
         $h++;
92 98
     }
@@ -99,8 +105,9 @@  discard block
 block discarded – undo
99 105
     // $head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id;
100 106
     $head[$h][0] = BASE_URI . '?controller=comm/propal&method=document&id=' . $object->id;
101 107
     $head[$h][1] = $langs->trans('Documents');
102
-    if (($nbFiles + $nbLinks) > 0)
103
-        $head[$h][1] .= ' <span class="badge">' . ($nbFiles + $nbLinks) . '</span>';
108
+    if (($nbFiles + $nbLinks) > 0) {
109
+            $head[$h][1] .= ' <span class="badge">' . ($nbFiles + $nbLinks) . '</span>';
110
+    }
104 111
     $head[$h][2] = 'document';
105 112
     $h++;
106 113
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/doleditor.lib.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@  discard block
 block discarded – undo
54 54
         // $selected_theme = 'moono-lisa';
55 55
 
56 56
         $selected_theme = CKEDITOR_SKIN;
57
-    } else
58
-        $selected_theme = $conf->global->FCKEDITOR_SKIN;
57
+    } else {
58
+            $selected_theme = $conf->global->FCKEDITOR_SKIN;
59
+    }
59 60
 
60 61
     $colspan = 2;
61 62
 
@@ -99,10 +100,12 @@  discard block
 block discarded – undo
99 100
                 while (($subdir = readdir($handle)) !== false) {
100 101
                     if (is_dir($dirskin . "/" . $subdir) && substr($subdir, 0, 1) <> '.' && substr($subdir, 0, 3) <> 'CVS' && !preg_match('/common|phones/i', $subdir)) {
101 102
                         // Disable not stable themes (dir ends with _exp or _dev)
102
-                        if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i', $subdir))
103
-                            continue;
104
-                        if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i', $subdir))
105
-                            continue;
103
+                        if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i', $subdir)) {
104
+                                                    continue;
105
+                        }
106
+                        if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i', $subdir)) {
107
+                                                    continue;
108
+                        }
106 109
 
107 110
                         print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
108 111
                         if ($subdir == $selected_theme) {
Please login to merge, or discard this patch.
dolibarr/htdocs/core/class/doleditor.class.php 1 patch
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -30,19 +30,19 @@  discard block
 block discarded – undo
30 30
 {
31 31
     var $tool;      // Store the selected tool
32 32
 
33
-	// If using fckeditor
34
-	var $editor;
33
+    // If using fckeditor
34
+    var $editor;
35 35
 
36
-	// If not using fckeditor
37
-	var $content;
38
-	var $htmlname;
39
-	var $toolbarname;
40
-	var $toolbarstartexpanded;
41
-	var $rows;
42
-	var $cols;
43
-	var $height;
44
-	var $width;
45
-	var $readonly;
36
+    // If not using fckeditor
37
+    var $content;
38
+    var $htmlname;
39
+    var $toolbarname;
40
+    var $toolbarstartexpanded;
41
+    var $rows;
42
+    var $cols;
43
+    var $height;
44
+    var $width;
45
+    var $readonly;
46 46
 
47 47
 
48 48
     /**
@@ -57,22 +57,22 @@  discard block
 block discarded – undo
57 57
      *                       		             			'In' each window has its own toolbar
58 58
      *                              		      			'Out:name' share toolbar into the div called 'name'
59 59
      *      @param  boolean	$toolbarstartexpanded  			Bar is visible or not at start
60
-	 *		@param	int		$uselocalbrowser				Enabled to add links to local object with local browser. If false, only external images can be added in content.
61
-	 *      @param  boolean|string	$okforextendededitor    True=Allow usage of extended editor tool if qualified (like ckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace.
62
-	 *      												Warning: If you use 'ace', don't forget to also include ace.js in page header. Also, the button "save" must have class="buttonforacesave".
60
+     *		@param	int		$uselocalbrowser				Enabled to add links to local object with local browser. If false, only external images can be added in content.
61
+     *      @param  boolean|string	$okforextendededitor    True=Allow usage of extended editor tool if qualified (like ckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace.
62
+     *      												Warning: If you use 'ace', don't forget to also include ace.js in page header. Also, the button "save" must have class="buttonforacesave".
63 63
      *      @param  int		$rows                   		Size of rows for textarea tool
64
-	 *      @param  string	$cols                   		Size of cols for textarea tool (textarea number of cols '70' or percent 'x%')
65
-	 *      @param	int		$readonly						0=Read/Edit, 1=Read only
66
-	 */
64
+     *      @param  string	$cols                   		Size of cols for textarea tool (textarea number of cols '70' or percent 'x%')
65
+     *      @param	int		$readonly						0=Read/Edit, 1=Read only
66
+     */
67 67
     function __construct($htmlname, $content, $width='', $height=200, $toolbarname='Basic', $toolbarlocation='In', $toolbarstartexpanded=false, $uselocalbrowser=true, $okforextendededitor=true, $rows=0, $cols=0, $readonly=0)
68 68
     {
69
-    	global $conf,$langs;
69
+        global $conf,$langs;
70 70
 
71
-    	dol_syslog(get_class($this)."::DolEditor htmlname=".$htmlname." width=".$width." height=".$height." toolbarname=".$toolbarname);
71
+        dol_syslog(get_class($this)."::DolEditor htmlname=".$htmlname." width=".$width." height=".$height." toolbarname=".$toolbarname);
72 72
 
73
-    	if (! $rows) $rows=round($height/20);
74
-    	if (! $cols) $cols=($width?round($width/6):80);
75
-		$shorttoolbarname=preg_replace('/_encoded$/','',$toolbarname);
73
+        if (! $rows) $rows=round($height/20);
74
+        if (! $cols) $cols=($width?round($width/6):80);
75
+        $shorttoolbarname=preg_replace('/_encoded$/','',$toolbarname);
76 76
 
77 77
         // Name of extended editor to use (FCKEDITOR_EDITORNAME can be 'ckeditor' or 'fckeditor')
78 78
         $defaulteditor='ckeditor';
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
         // Check if extended editor is ok. If not we force textarea
84 84
         if ((empty($conf->fckeditor->enabled) && $okforextendededitor != 'ace') || empty($okforextendededitor)) $this->tool = 'textarea';
85
-		if ($okforextendededitor === 'ace') $this->tool='ace';
85
+        if ($okforextendededitor === 'ace') $this->tool='ace';
86 86
         //if ($conf->dol_use_jmobile) $this->tool = 'textarea';       // ckeditor and ace seems ok with mobile
87 87
 
88 88
         // Define content and some properties
@@ -91,50 +91,50 @@  discard block
 block discarded – undo
91 91
             $content=dol_htmlentitiesbr($content);  // If content is not HTML, we convert to HTML.
92 92
         }
93 93
         if ($this->tool == 'fckeditor')
94
-    	{
95
-        	require_once DOL_DOCUMENT_ROOT.'/includes/fckeditor/fckeditor.php';
96
-
97
-    		$content=dol_htmlentitiesbr($content);	// If content is not HTML, we convert to HTML.
98
-
99
-        	$this->editor = new FCKeditor($htmlname);
100
-        	$this->editor->BasePath = DOL_URL_ROOT.'/includes/fckeditor/' ;
101
-        	$this->editor->Value	= $content;
102
-        	$this->editor->Height   = $height;
103
-        	if (! empty($width)) $this->editor->Width = $width;
104
-        	$this->editor->ToolbarSet = $shorttoolbarname;         // Profile of this toolbar set is deinfed into theme/mytheme/ckeditor/config.js
105
-        	$this->editor->Config['AutoDetectLanguage'] = 'true';  // Language of user (browser)
106
-        	$this->editor->Config['ToolbarLocation'] = $toolbarlocation ? $toolbarlocation : 'In';
107
-        	$this->editor->Config['ToolbarStartExpanded'] = $toolbarstartexpanded;
108
-
109
-    		// Rem: Le forcage de ces 2 parametres ne semble pas fonctionner.
110
-    		// Dolibarr utilise toujours liens avec modulepart='fckeditor' quelque soit modulepart.
111
-    		// Ou se trouve donc cette valeur /viewimage.php?modulepart=fckeditor&file=' ?
112
-        	$modulepart='fckeditor';
113
-    		$this->editor->Config['UserFilesPath'] = '/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&file=';
114
-    		$this->editor->Config['UserFilesAbsolutePath'] = DOL_DATA_ROOT.'/'.$modulepart.'/' ;
115
-
116
-        	$this->editor->Config['LinkBrowser']=($uselocalbrowser?'true':'false');
117
-        	$this->editor->Config['ImageBrowser']=($uselocalbrowser?'true':'false');
118
-
119
-        	if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/fckeditor/fckconfig.js'))
120
-        	{
121
-        		$this->editor->Config['CustomConfigurationsPath'] = DOL_URL_ROOT.'/theme/'.$conf->theme.'/fckeditor/fckconfig.js';
122
-        		$this->editor->Config['SkinPath'] = DOL_URL_ROOT.'/theme/'.$conf->theme.'/fckeditor/';
123
-    		}
124
-    	}
125
-
126
-    	// Define some properties
94
+        {
95
+            require_once DOL_DOCUMENT_ROOT.'/includes/fckeditor/fckeditor.php';
96
+
97
+            $content=dol_htmlentitiesbr($content);	// If content is not HTML, we convert to HTML.
98
+
99
+            $this->editor = new FCKeditor($htmlname);
100
+            $this->editor->BasePath = DOL_URL_ROOT.'/includes/fckeditor/' ;
101
+            $this->editor->Value	= $content;
102
+            $this->editor->Height   = $height;
103
+            if (! empty($width)) $this->editor->Width = $width;
104
+            $this->editor->ToolbarSet = $shorttoolbarname;         // Profile of this toolbar set is deinfed into theme/mytheme/ckeditor/config.js
105
+            $this->editor->Config['AutoDetectLanguage'] = 'true';  // Language of user (browser)
106
+            $this->editor->Config['ToolbarLocation'] = $toolbarlocation ? $toolbarlocation : 'In';
107
+            $this->editor->Config['ToolbarStartExpanded'] = $toolbarstartexpanded;
108
+
109
+            // Rem: Le forcage de ces 2 parametres ne semble pas fonctionner.
110
+            // Dolibarr utilise toujours liens avec modulepart='fckeditor' quelque soit modulepart.
111
+            // Ou se trouve donc cette valeur /viewimage.php?modulepart=fckeditor&file=' ?
112
+            $modulepart='fckeditor';
113
+            $this->editor->Config['UserFilesPath'] = '/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&file=';
114
+            $this->editor->Config['UserFilesAbsolutePath'] = DOL_DATA_ROOT.'/'.$modulepart.'/' ;
115
+
116
+            $this->editor->Config['LinkBrowser']=($uselocalbrowser?'true':'false');
117
+            $this->editor->Config['ImageBrowser']=($uselocalbrowser?'true':'false');
118
+
119
+            if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/fckeditor/fckconfig.js'))
120
+            {
121
+                $this->editor->Config['CustomConfigurationsPath'] = DOL_URL_ROOT.'/theme/'.$conf->theme.'/fckeditor/fckconfig.js';
122
+                $this->editor->Config['SkinPath'] = DOL_URL_ROOT.'/theme/'.$conf->theme.'/fckeditor/';
123
+            }
124
+        }
125
+
126
+        // Define some properties
127 127
         if (in_array($this->tool,array('textarea','ckeditor','ace')))
128 128
         {
129
-    	    $this->content				= $content;
130
-    	    $this->htmlname 			= $htmlname;
131
-    	    $this->toolbarname			= $shorttoolbarname;
132
-    	    $this->toolbarstartexpanded = $toolbarstartexpanded;
129
+            $this->content				= $content;
130
+            $this->htmlname 			= $htmlname;
131
+            $this->toolbarname			= $shorttoolbarname;
132
+            $this->toolbarstartexpanded = $toolbarstartexpanded;
133 133
             $this->rows					= max(ROWS_3,$rows);
134 134
             $this->cols					= (preg_match('/%/',$cols)?$cols:max(40,$cols));	// If $cols is a percent, we keep it, otherwise, we take max
135 135
             $this->height				= $height;
136 136
             $this->width				= $width;
137
-    	}
137
+        }
138 138
     }
139 139
 
140 140
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -152,20 +152,20 @@  discard block
 block discarded – undo
152 152
     function Create($noprint=0, $morejs='', $disallowAnyContent=true, $titlecontent='', $option='')
153 153
     {
154 154
         // phpcs:enable
155
-    	global $conf,$langs;
155
+        global $conf,$langs;
156 156
 
157
-    	$fullpage=false;
158
-    	if (isset($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT))
159
-    	{
160
-    	   $disallowAnyContent=empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT);      // Only predefined list of html tags are allowed or all
161
-    	}
157
+        $fullpage=false;
158
+        if (isset($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT))
159
+        {
160
+            $disallowAnyContent=empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT);      // Only predefined list of html tags are allowed or all
161
+        }
162 162
 
163
-    	$found=0;
164
-		$out='';
163
+        $found=0;
164
+        $out='';
165 165
 
166 166
         if ($this->tool == 'fckeditor') // not used anymore
167 167
         {
168
-			$found=1;
168
+            $found=1;
169 169
             $this->editor->Create();
170 170
         }
171 171
         if (in_array($this->tool,array('textarea','ckeditor')))
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
 
180 180
             if ($this->tool == 'ckeditor' && ! empty($conf->use_javascript_ajax))
181 181
             {
182
-            	if (! defined('REQUIRE_CKEDITOR')) define('REQUIRE_CKEDITOR','1');
182
+                if (! defined('REQUIRE_CKEDITOR')) define('REQUIRE_CKEDITOR','1');
183 183
 
184
-            	if (! empty($conf->global->FCKEDITOR_SKIN)) {
185
-					$skin = $conf->global->FCKEDITOR_SKIN;
186
-				} else {
187
-					// $skin = 'moono-lisa'; // default with ckeditor 4.6 : moono-lisa
184
+                if (! empty($conf->global->FCKEDITOR_SKIN)) {
185
+                    $skin = $conf->global->FCKEDITOR_SKIN;
186
+                } else {
187
+                    // $skin = 'moono-lisa'; // default with ckeditor 4.6 : moono-lisa
188 188
 
189 189
                     /**
190 190
                      * Alixar:
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
                     $skin = CKEDITOR_SKIN;  // In AlixarDispatcher defineConstants()
196 196
                 }
197 197
 
198
-            	$htmlencode_force=preg_match('/_encoded$/',$this->toolbarname)?'true':'false';
198
+                $htmlencode_force=preg_match('/_encoded$/',$this->toolbarname)?'true':'false';
199 199
 
200
-            	$out.= '<!-- Output ckeditor $disallowAnyContent='.$disallowAnyContent.' toolbarname='.$this->toolbarname.' -->'."\n";
201
-            	$out.= '<script type="text/javascript">
200
+                $out.= '<!-- Output ckeditor $disallowAnyContent='.$disallowAnyContent.' toolbarname='.$this->toolbarname.' -->'."\n";
201
+                $out.= '<script type="text/javascript">
202 202
             			$(document).ready(function () {
203 203
                             /* if (CKEDITOR.loadFullCore) CKEDITOR.loadFullCore(); */
204 204
                             /* should be editor=CKEDITOR.replace but what if serveral editors ? */
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
                                                         });
234 234
                                                 }
235 235
                                             }';
236
-            	if ($this->uselocalbrowser)
237
-            	{
236
+                if ($this->uselocalbrowser)
237
+                {
238 238
                     $out.= ','."\n";
239 239
                     // To use filemanager with old fckeditor (GPL)
240 240
                     $out.= '    filebrowserBrowseUrl : ckeditorFilebrowserBrowseUrl,';
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
                     //$out.= '    filebrowserImageUploadUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/connectors/php/upload.php?Type=Image\',';
244 244
                     $out.= "\n";
245 245
                     // To use filemanager with ckfinder (Non free) and ckfinder directory is inside htdocs/includes
246
-					/* $out.= '    filebrowserBrowseUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/ckfinder.html\',
246
+                    /* $out.= '    filebrowserBrowseUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/ckfinder.html\',
247 247
                                filebrowserImageBrowseUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/ckfinder.html?Type=Images\',
248 248
                                filebrowserFlashBrowseUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/ckfinder.html?Type=Flash\',
249 249
                                filebrowserUploadUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files\',
@@ -254,10 +254,10 @@  discard block
 block discarded – undo
254 254
                                filebrowserWindowHeight : \'500\',
255 255
                                filebrowserImageWindowWidth : \'900\',
256 256
                                filebrowserImageWindowHeight : \'500\'';
257
-            	}
258
-            	$out.= '	})'.$morejs;
259
-            	$out.= '});'."\n";
260
-            	$out.= '</script>'."\n";
257
+                }
258
+                $out.= '	})'.$morejs;
259
+                $out.= '});'."\n";
260
+                $out.= '</script>'."\n";
261 261
             }
262 262
         }
263 263
 
@@ -265,19 +265,19 @@  discard block
 block discarded – undo
265 265
         // Warning: ace.js and ext-statusbar.js must be loaded by the parent page.
266 266
         if (preg_match('/^ace/', $this->tool))
267 267
         {
268
-        	$found=1;
269
-			$format=$option;
268
+            $found=1;
269
+            $format=$option;
270 270
 
271 271
             $out.= "\n".'<!-- Output Ace editor -->'."\n";
272 272
 
273
-			if ($titlecontent)
274
-			{
275
-	            $out.= '<div class="aceeditorstatusbar" id="statusBar'.$this->htmlname.'">'.$titlecontent;
276
-	            $out.= ' &nbsp; - &nbsp; <a id="morelines" href="#" class="right morelines'.$this->htmlname.'">'.dol_escape_htmltag($langs->trans("ShowMoreLines")).'</a> &nbsp; &nbsp; ';
277
-	            $out.= '</div>';
278
-	            $out.= '<script type="text/javascript" language="javascript">'."\n";
279
-	            $out.= 'jQuery(document).ready(function() {'."\n";
280
-	            $out.= '	var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
273
+            if ($titlecontent)
274
+            {
275
+                $out.= '<div class="aceeditorstatusbar" id="statusBar'.$this->htmlname.'">'.$titlecontent;
276
+                $out.= ' &nbsp; - &nbsp; <a id="morelines" href="#" class="right morelines'.$this->htmlname.'">'.dol_escape_htmltag($langs->trans("ShowMoreLines")).'</a> &nbsp; &nbsp; ';
277
+                $out.= '</div>';
278
+                $out.= '<script type="text/javascript" language="javascript">'."\n";
279
+                $out.= 'jQuery(document).ready(function() {'."\n";
280
+                $out.= '	var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
281 281
 	    	    		   	var StatusBar = window.ace.require("ace/ext/statusbar").StatusBar;									// Init status bar. Need lib ext-statusbar
282 282
 	        			   	var statusBar = new StatusBar(aceEditor, document.getElementById("statusBar'.$this->htmlname.'"));	// Init status bar. Need lib ext-statusbar
283 283
 	            			var oldNbOfLines = 0
@@ -299,21 +299,21 @@  discard block
 block discarded – undo
299 299
 									}
300 300
 							});
301 301
 						})';
302
-	            $out.= '</script>'."\n";
303
-			}
302
+                $out.= '</script>'."\n";
303
+            }
304 304
 
305 305
             $out.= '<pre id="'.$this->htmlname.'aceeditorid" style="'.($this->width?'width: '.$this->width.'px; ':'');
306 306
             $out.= ($this->height?' height: '.$this->height.'px; ':'');
307 307
             //$out.=" min-height: 100px;";
308 308
             $out.= '">';
309
-        	$out.= htmlspecialchars($this->content);
310
-        	$out.= '</pre>';
311
-        	$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" style="width:0px; height: 0px; display: none;">';
312
-        	$out.= htmlspecialchars($this->content);
313
-        	$out.= '</textarea>';
309
+            $out.= htmlspecialchars($this->content);
310
+            $out.= '</pre>';
311
+            $out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" style="width:0px; height: 0px; display: none;">';
312
+            $out.= htmlspecialchars($this->content);
313
+            $out.= '</textarea>';
314 314
 
315
-        	$out.= '<script type="text/javascript" language="javascript">'."\n";
316
-        	$out.= 'var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
315
+            $out.= '<script type="text/javascript" language="javascript">'."\n";
316
+            $out.= 'var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
317 317
 
318 318
 				    aceEditor.session.setMode("ace/mode/'.$format.'");
319 319
 					aceEditor.setOptions({
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 					//aceEditor.getSession().setMode("ace/mode/javascript_expression");
334 334
 					'."\n";
335 335
 
336
-        	$out.= 'jQuery(document).ready(function() {
336
+            $out.= 'jQuery(document).ready(function() {
337 337
 						jQuery(".buttonforacesave").click(function() {
338 338
         					console.log("We click on savefile button for component '.$this->htmlname.'");
339 339
         					var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid")
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 							else return false;*/
344 344
 	        			});
345 345
 					})';
346
-        	$out.= '</script>'."\n";
346
+            $out.= '</script>'."\n";
347 347
         }
348 348
 
349 349
         if (empty($found))
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modFckeditor.class.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -34,55 +34,55 @@
 block discarded – undo
34 34
 
35 35
 class modFckeditor extends DolibarrModules
36 36
 {
37
-	/**
38
-	 *   Constructor. Define names, constants, directories, boxes, permissions
39
-	 *
40
-	 *   @param      DoliDB		$db      Database handler
41
-	 */
42
-	function __construct($db)
43
-	{
44
-		$this->db = $db;
45
-		$this->numero = 2000;
37
+    /**
38
+     *   Constructor. Define names, constants, directories, boxes, permissions
39
+     *
40
+     *   @param      DoliDB		$db      Database handler
41
+     */
42
+    function __construct($db)
43
+    {
44
+        $this->db = $db;
45
+        $this->numero = 2000;
46 46
 
47
-		$this->family = "technic";
48
-		$this->module_position = '20';
49
-		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
50
-		$this->name = preg_replace('/^mod/i','',get_class($this));
51
-		$this->description = "Editeur WYSIWYG";
52
-		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
53
-		$this->version = 'dolibarr';
54
-		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
55
-		// Name of png file (without png) used for this module.
56
-		// Png file must be in theme/yourtheme/img directory under name object_pictovalue.png.
57
-		$this->picto='list';
47
+        $this->family = "technic";
48
+        $this->module_position = '20';
49
+        // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
50
+        $this->name = preg_replace('/^mod/i','',get_class($this));
51
+        $this->description = "Editeur WYSIWYG";
52
+        // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
53
+        $this->version = 'dolibarr';
54
+        $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
55
+        // Name of png file (without png) used for this module.
56
+        // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png.
57
+        $this->picto='list';
58 58
 
59
-		// Data directories to create when module is enabled
60
-		$this->dirs = array("/medias/temp","/medias/image");
59
+        // Data directories to create when module is enabled
60
+        $this->dirs = array("/medias/temp","/medias/image");
61 61
 
62
-		// Config pages
63
-		$this->config_page_url = array("fckeditor.php");
62
+        // Config pages
63
+        $this->config_page_url = array("fckeditor.php");
64 64
 
65
-		// Dependencies
66
-		$this->disabled = (in_array(constant('JS_CKEDITOR'),array('disabled','disabled/'))?1:0);	// A condition to disable module (used for native debian packages)
67
-		$this->depends = array();
68
-		$this->requiredby = array('modWebsites');
65
+        // Dependencies
66
+        $this->disabled = (in_array(constant('JS_CKEDITOR'),array('disabled','disabled/'))?1:0);	// A condition to disable module (used for native debian packages)
67
+        $this->depends = array();
68
+        $this->requiredby = array('modWebsites');
69 69
 
70
-		// Constants
71
-		$this->const = array();
70
+        // Constants
71
+        $this->const = array();
72 72
         $this->const[0]  = array("FCKEDITOR_ENABLE_SOCIETE","yesno","1","WYSIWIG for description and note (except products/services)");
73 73
         $this->const[1]  = array("FCKEDITOR_ENABLE_PRODUCTDESC","yesno","1","WYSIWIG for products/services description and note");
74 74
         $this->const[2]  = array("FCKEDITOR_ENABLE_MAILING","yesno","1","WYSIWIG for mass emailings");
75 75
         $this->const[3]  = array("FCKEDITOR_ENABLE_DETAILS","yesno","1","WYSIWIG for products details lines for all entities");
76 76
         $this->const[4]  = array("FCKEDITOR_ENABLE_USERSIGN","yesno","1","WYSIWIG for user signature");
77 77
         $this->const[5]  = array("FCKEDITOR_ENABLE_MAIL","yesno","1","WYSIWIG for products details lines for all entities");
78
-		//$this->const[6]  = array("FCKEDITOR_SKIN","string","moono-lisa","Skin by default for fckeditor");
78
+        //$this->const[6]  = array("FCKEDITOR_SKIN","string","moono-lisa","Skin by default for fckeditor");
79 79
         $this->const[6] = array("FCKEDITOR_SKIN", "string", CKEDITOR_SKIN, "Skin by default for fckeditor");
80 80
 
81 81
         // Boxes
82
-		$this->boxes = array();
82
+        $this->boxes = array();
83 83
 
84
-		// Permissions
85
-		$this->rights = array();
86
-		$this->rights_class = 'fckeditor';
87
-	}
84
+        // Permissions
85
+        $this->rights = array();
86
+        $this->rights_class = 'fckeditor';
87
+    }
88 88
 }
Please login to merge, or discard this patch.