@@ -64,40 +64,40 @@ |
||
| 64 | 64 | // Dolibarr uses a lot of internal deprecated stuff, not reporting |
| 65 | 65 | 'PhanDeprecatedProperty', |
| 66 | 66 | |
| 67 | - 'PhanCompatibleNegativeStringOffset', // return false positive |
|
| 68 | - 'PhanPluginConstantVariableBool', // a lot of false positive, in most cases, we want to keep the code as it is |
|
| 69 | - 'PhanPluginUnknownArrayPropertyType', // this option costs more time to be supported than it solves time |
|
| 70 | - 'PhanTypeArraySuspiciousNullable', // this option costs more time to be supported than it solves time |
|
| 67 | + 'PhanCompatibleNegativeStringOffset', // return false positive |
|
| 68 | + 'PhanPluginConstantVariableBool', // a lot of false positive, in most cases, we want to keep the code as it is |
|
| 69 | + 'PhanPluginUnknownArrayPropertyType', // this option costs more time to be supported than it solves time |
|
| 70 | + 'PhanTypeArraySuspiciousNullable', // this option costs more time to be supported than it solves time |
|
| 71 | 71 | // 'PhanTypeInvalidDimOffset', // Helps identify missing array indexes in types or reference to unset indexes |
| 72 | 72 | 'PhanTypeObjectUnsetDeclaredProperty', |
| 73 | - 'PhanTypePossiblyInvalidDimOffset', // a lot of false positive, in most cases, we want to keep the code as it is |
|
| 74 | - 'PhanPluginUnknownArrayFunctionReturnType', // a lot of false positive, in most cases, we want to keep the code as it is |
|
| 73 | + 'PhanTypePossiblyInvalidDimOffset', // a lot of false positive, in most cases, we want to keep the code as it is |
|
| 74 | + 'PhanPluginUnknownArrayFunctionReturnType', // a lot of false positive, in most cases, we want to keep the code as it is |
|
| 75 | 75 | |
| 76 | - 'PhanPluginWhitespaceTab', // Dolibarr used tabs |
|
| 77 | - 'PhanPluginCanUsePHP71Void', // Dolibarr is maintaining 7.0 compatibility |
|
| 78 | - 'PhanPluginShortArray', // Dolibarr uses array() |
|
| 79 | - 'PhanPluginShortArrayList', // Dolibarr uses array() |
|
| 76 | + 'PhanPluginWhitespaceTab', // Dolibarr used tabs |
|
| 77 | + 'PhanPluginCanUsePHP71Void', // Dolibarr is maintaining 7.0 compatibility |
|
| 78 | + 'PhanPluginShortArray', // Dolibarr uses array() |
|
| 79 | + 'PhanPluginShortArrayList', // Dolibarr uses array() |
|
| 80 | 80 | // Fixers From PHPDocToRealTypesPlugin: |
| 81 | - 'PhanPluginCanUseParamType', // Fixer - Report/Add types in the function definition (function abc(string $var) (adds string) |
|
| 82 | - 'PhanPluginCanUseReturnType', // Fixer - Report/Add return types in the function definition (function abc(string $var) (adds string) |
|
| 83 | - 'PhanPluginCanUseNullableParamType', // Fixer - Report/Add nullable parameter types in the function definition |
|
| 84 | - 'PhanPluginCanUseNullableReturnType', // Fixer - Report/Add nullable return types in the function definition |
|
| 81 | + 'PhanPluginCanUseParamType', // Fixer - Report/Add types in the function definition (function abc(string $var) (adds string) |
|
| 82 | + 'PhanPluginCanUseReturnType', // Fixer - Report/Add return types in the function definition (function abc(string $var) (adds string) |
|
| 83 | + 'PhanPluginCanUseNullableParamType', // Fixer - Report/Add nullable parameter types in the function definition |
|
| 84 | + 'PhanPluginCanUseNullableReturnType', // Fixer - Report/Add nullable return types in the function definition |
|
| 85 | 85 | |
| 86 | - 'PhanPluginNonBoolBranch', // Not essential - 31240+ occurrences |
|
| 87 | - 'PhanPluginNumericalComparison', // Not essential - 19870+ occurrences |
|
| 88 | - 'PhanTypeMismatchArgument', // Not essential - 12300+ occurrences |
|
| 89 | - 'PhanPluginNonBoolInLogicalArith', // Not essential - 11040+ occurrences |
|
| 90 | - 'PhanPluginConstantVariableScalar', // Not essential - 5180+ occurrences |
|
| 86 | + 'PhanPluginNonBoolBranch', // Not essential - 31240+ occurrences |
|
| 87 | + 'PhanPluginNumericalComparison', // Not essential - 19870+ occurrences |
|
| 88 | + 'PhanTypeMismatchArgument', // Not essential - 12300+ occurrences |
|
| 89 | + 'PhanPluginNonBoolInLogicalArith', // Not essential - 11040+ occurrences |
|
| 90 | + 'PhanPluginConstantVariableScalar', // Not essential - 5180+ occurrences |
|
| 91 | 91 | 'PhanPluginDuplicateAdjacentStatement', |
| 92 | - 'PhanPluginDuplicateConditionalTernaryDuplication', // 2750+ occurrences |
|
| 93 | - 'PhanPluginDuplicateConditionalNullCoalescing', // Not essential - 990+ occurrences |
|
| 94 | - 'PhanPluginRedundantAssignmentInGlobalScope', // Not essential, a lot of false warning |
|
| 95 | - 'PhanPluginRedundantAssignment', // Not essential, useless |
|
| 96 | - 'PhanPluginDuplicateCatchStatementBody', // Requires PHP7.1 - 50+ occurrences |
|
| 92 | + 'PhanPluginDuplicateConditionalTernaryDuplication', // 2750+ occurrences |
|
| 93 | + 'PhanPluginDuplicateConditionalNullCoalescing', // Not essential - 990+ occurrences |
|
| 94 | + 'PhanPluginRedundantAssignmentInGlobalScope', // Not essential, a lot of false warning |
|
| 95 | + 'PhanPluginRedundantAssignment', // Not essential, useless |
|
| 96 | + 'PhanPluginDuplicateCatchStatementBody', // Requires PHP7.1 - 50+ occurrences |
|
| 97 | 97 | |
| 98 | - 'PhanPluginUnknownArrayMethodParamType', // this option costs more time to be supported than it solves time |
|
| 99 | - 'PhanPluginUnknownArrayMethodReturnType', // this option costs more time to be supported than it solves time |
|
| 100 | - 'PhanTypeSuspiciousNonTraversableForeach', // Reports on `foreach ($object as $key => $value)` which works without php notices, so we ignore it because this is intentional in the code. |
|
| 98 | + 'PhanPluginUnknownArrayMethodParamType', // this option costs more time to be supported than it solves time |
|
| 99 | + 'PhanPluginUnknownArrayMethodReturnType', // this option costs more time to be supported than it solves time |
|
| 100 | + 'PhanTypeSuspiciousNonTraversableForeach', // Reports on `foreach ($object as $key => $value)` which works without php notices, so we ignore it because this is intentional in the code. |
|
| 101 | 101 | ]; |
| 102 | 102 | |
| 103 | 103 | return $config; |
@@ -246,15 +246,15 @@ |
||
| 246 | 246 | /** |
| 247 | 247 | * @var string |
| 248 | 248 | */ |
| 249 | - public $stripe_card_ref; // External system payment mode ID |
|
| 249 | + public $stripe_card_ref; // External system payment mode ID |
|
| 250 | 250 | /** |
| 251 | 251 | * @var string |
| 252 | 252 | */ |
| 253 | - public $stripe_account; // External system customer ID |
|
| 253 | + public $stripe_account; // External system customer ID |
|
| 254 | 254 | /** |
| 255 | 255 | * @var string |
| 256 | 256 | */ |
| 257 | - public $ext_payment_site; // External system 'StripeLive', 'StripeTest', 'StancerLive', 'StancerTest', ... |
|
| 257 | + public $ext_payment_site; // External system 'StripeLive', 'StripeTest', 'StancerLive', 'StancerTest', ... |
|
| 258 | 258 | |
| 259 | 259 | /** |
| 260 | 260 | * @var int Status |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | //var_dump($modulenamearrays);exit; |
| 302 | 302 | |
| 303 | 303 | // Lop on each packages (can have several if package is a metapackage) |
| 304 | - if (! $error) { |
|
| 304 | + if (!$error) { |
|
| 305 | 305 | foreach ($modulenamearrays as $modulenameval) { |
| 306 | 306 | if (strpos($modulenameval, '#') === 0) { |
| 307 | 307 | continue; // Discard comments |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | 'search_version' => '-1' |
| 347 | 347 | ); |
| 348 | 348 | $queryString = http_build_query($searchParams); |
| 349 | - $redirectUrl = DOL_URL_ROOT . '/admin/modules.php?' . $queryString; |
|
| 349 | + $redirectUrl = DOL_URL_ROOT.'/admin/modules.php?'.$queryString; |
|
| 350 | 350 | |
| 351 | 351 | $message = $langs->trans("SetupIsReadyForUse", $redirectUrl, $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules")); |
| 352 | 352 | |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | } else { |
| 549 | 549 | $familykey = $objMod->family; |
| 550 | 550 | } |
| 551 | - '@phan-var-force string $familykey'; // if not, phan considers $familykey may be null |
|
| 551 | + '@phan-var-force string $familykey'; // if not, phan considers $familykey may be null |
|
| 552 | 552 | |
| 553 | 553 | $moduleposition = ($objMod->module_position ? $objMod->module_position : '50'); |
| 554 | 554 | if ($objMod->isCoreOrExternalModule() == 'external' && $moduleposition < 100000) { |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | print load_fiche_titre($langs->trans("ModulesSetup"), '', 'title_setup'); |
| 655 | 655 | |
| 656 | 656 | // Start to show page |
| 657 | -$deschelp = ''; |
|
| 657 | +$deschelp = ''; |
|
| 658 | 658 | if ($mode == 'common' || $mode == 'commonkanban') { |
| 659 | 659 | $desc = $langs->trans("ModulesDesc", '{picto}'); |
| 660 | 660 | $desc .= ' '.$langs->trans("ModulesDesc2", '{picto2}'); |
@@ -943,7 +943,7 @@ discard block |
||
| 943 | 943 | } |
| 944 | 944 | |
| 945 | 945 | if ($objMod->isCoreOrExternalModule() == 'external' && $action == 'checklastversion' && !getDolGlobalString('DISABLE_CHECK_ON_MALWARE_MODULES')) { |
| 946 | - $checkRes = $objMod->checkForCompliance(); // Check if module is reported as non compliant with Dolibarr rules and law |
|
| 946 | + $checkRes = $objMod->checkForCompliance(); // Check if module is reported as non compliant with Dolibarr rules and law |
|
| 947 | 947 | if (!is_numeric($checkRes) && $checkRes != '') { |
| 948 | 948 | $langs->load("errors"); |
| 949 | 949 | setEventMessages($objMod->getName().' : '.$langs->trans($checkRes), null, 'errors'); |
@@ -1272,7 +1272,7 @@ discard block |
||
| 1272 | 1272 | <div id="category-tree-left"> |
| 1273 | 1273 | <ul class="tree"> |
| 1274 | 1274 | <?php |
| 1275 | - echo $dolistore->get_categories(); // Do not use dol_escape_htmltag here, it is already a structured content?> |
|
| 1275 | + echo $dolistore->get_categories(); // Do not use dol_escape_htmltag here, it is already a structured content?> |
|
| 1276 | 1276 | </ul> |
| 1277 | 1277 | </div> |
| 1278 | 1278 | <div id="listing-content"> |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | 'typent.code' => array('label' => "ThirdPartyType", 'checked' => $checkedtypetiers, 'position' => 55), |
| 205 | 205 | 'c.date_commande' => array('label' => "OrderDateShort", 'checked' => 1, 'position' => 60, 'csslist' => 'nowraponall'), |
| 206 | 206 | 'c.date_delivery' => array('label' => "DateDeliveryPlanned", 'checked' => 1, 'enabled' => !getDolGlobalString('ORDER_DISABLE_DELIVERY_DATE'), 'position' => 65, 'csslist' => 'nowraponall'), |
| 207 | - 'c.fk_shipping_method' => array('label' => "SendingMethod", 'checked' => -1, 'position' => 66 , 'enabled' => isModEnabled("shipping")), |
|
| 207 | + 'c.fk_shipping_method' => array('label' => "SendingMethod", 'checked' => -1, 'position' => 66, 'enabled' => isModEnabled("shipping")), |
|
| 208 | 208 | 'c.fk_cond_reglement' => array('label' => "PaymentConditionsShort", 'checked' => -1, 'position' => 67), |
| 209 | 209 | 'c.fk_mode_reglement' => array('label' => "PaymentMode", 'checked' => -1, 'position' => 68), |
| 210 | 210 | 'c.fk_input_reason' => array('label' => "Origin", 'checked' => -1, 'position' => 69), |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | 'c.date_cloture' => array('label' => "DateClosing", 'checked' => 0, 'position' => 130), |
| 228 | 228 | 'c.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES')), 'position' => 135, 'searchall' => 1), |
| 229 | 229 | 'c.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'position' => 140), |
| 230 | - 'shippable' => array('label' => "Shippable", 'checked' => 1,'enabled' => (isModEnabled("shipping")), 'position' => 990), |
|
| 230 | + 'shippable' => array('label' => "Shippable", 'checked' => 1, 'enabled' => (isModEnabled("shipping")), 'position' => 990), |
|
| 231 | 231 | 'c.facture' => array('label' => "Billed", 'checked' => 1, 'enabled' => (!getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT')), 'position' => 995), |
| 232 | 232 | 'c.import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 999), |
| 233 | 233 | 'c.fk_statut' => array('label' => "Status", 'checked' => 1, 'position' => 1000) |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $object->fields = dol_sort_array($object->fields, 'position'); |
| 248 | 248 | //$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right'); |
| 249 | 249 | $arrayfields = dol_sort_array($arrayfields, 'position'); |
| 250 | -'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan |
|
| 250 | +'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan |
|
| 251 | 251 | |
| 252 | 252 | |
| 253 | 253 | // Security check |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | if (empty($objecttmp->note_public)) { |
| 417 | - $objecttmp->note_public = $langs->transnoentities("Orders"); |
|
| 417 | + $objecttmp->note_public = $langs->transnoentities("Orders"); |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | $datefacture = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | $db->rollback(); |
| 737 | 737 | |
| 738 | 738 | $action = 'create'; |
| 739 | - $_GET["origin"] = $_POST["origin"]; // Keep GET and POST here ? |
|
| 739 | + $_GET["origin"] = $_POST["origin"]; // Keep GET and POST here ? |
|
| 740 | 740 | $_GET["originid"] = $_POST["originid"]; // Keep GET and POST here ? |
| 741 | 741 | if (!empty($errors)) { |
| 742 | 742 | setEventMessages(null, $errors, 'errors'); |
@@ -1102,7 +1102,7 @@ discard block |
||
| 1102 | 1102 | if ($searchCategoryCustomerOperator == 0) { |
| 1103 | 1103 | $searchCategoryCustomerSqlList[] = " EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as cs WHERE s.rowid = cs.fk_soc AND cs.fk_categorie = ".((int) $searchCategoryCustomer).")"; |
| 1104 | 1104 | } else { |
| 1105 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer); |
|
| 1105 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryCustomer); |
|
| 1106 | 1106 | } |
| 1107 | 1107 | } |
| 1108 | 1108 | } |
@@ -1132,7 +1132,7 @@ discard block |
||
| 1132 | 1132 | if ($searchCategoryProductOperator == 0) { |
| 1133 | 1133 | $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."commandedet as cd WHERE cd.fk_commande = c.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")"; |
| 1134 | 1134 | } else { |
| 1135 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct); |
|
| 1135 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryProduct); |
|
| 1136 | 1136 | } |
| 1137 | 1137 | } |
| 1138 | 1138 | } |
@@ -1587,7 +1587,7 @@ discard block |
||
| 1587 | 1587 | } |
| 1588 | 1588 | |
| 1589 | 1589 | $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
| 1590 | -$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup |
|
| 1590 | +$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup |
|
| 1591 | 1591 | $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : ''); |
| 1592 | 1592 | $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); |
| 1593 | 1593 | |
@@ -2727,15 +2727,15 @@ discard block |
||
| 2727 | 2727 | if (!empty($show_shippable_command) && isModEnabled('stock')) { |
| 2728 | 2728 | $text_icon = ''; |
| 2729 | 2729 | if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) { |
| 2730 | - $generic_commande->getLinesArray(); // Load array ->lines |
|
| 2731 | - $generic_commande->loadExpeditions(); // Load array ->expeditions |
|
| 2730 | + $generic_commande->getLinesArray(); // Load array ->lines |
|
| 2731 | + $generic_commande->loadExpeditions(); // Load array ->expeditions |
|
| 2732 | 2732 | |
| 2733 | 2733 | $numlines = count($generic_commande->lines); // Loop on each line of order |
| 2734 | 2734 | for ($lig = 0; $lig < $numlines; $lig++) { |
| 2735 | 2735 | $orderLine = $generic_commande->lines[$lig]; |
| 2736 | 2736 | '@phan-var-force OrderLine $orderLine'; |
| 2737 | 2737 | if (isset($generic_commande->expeditions[$orderLine->id])) { |
| 2738 | - $reliquat = $orderLine->qty - $generic_commande->expeditions[$orderLine->id]; |
|
| 2738 | + $reliquat = $orderLine->qty - $generic_commande->expeditions[$orderLine->id]; |
|
| 2739 | 2739 | } else { |
| 2740 | 2740 | $reliquat = $orderLine->qty; |
| 2741 | 2741 | } |
@@ -99,18 +99,18 @@ discard block |
||
| 99 | 99 | $placeholder = ''; |
| 100 | 100 | |
| 101 | 101 | if ($selected && empty($selected_input_value)) { |
| 102 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
| 102 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
| 103 | 103 | $project = new Project($this->db); |
| 104 | 104 | $project->fetch($selected); |
| 105 | 105 | $selected_input_value = $project->ref; |
| 106 | 106 | } |
| 107 | - $urloption = 'socid=' . ((int) $socid) . '&htmlname=' . urlencode($htmlname) . '&discardclosed=' . ((int) $discard_closed); |
|
| 107 | + $urloption = 'socid='.((int) $socid).'&htmlname='.urlencode($htmlname).'&discardclosed='.((int) $discard_closed); |
|
| 108 | 108 | if ($morefilter == 'usage_organize_event=1') { |
| 109 | 109 | $urloption .= '&usage_organize_event=1'; |
| 110 | 110 | } |
| 111 | - $out .= '<input type="text" class="minwidth200' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' />'; |
|
| 111 | + $out .= '<input type="text" class="minwidth200'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' />'; |
|
| 112 | 112 | |
| 113 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array()); |
|
| 113 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array()); |
|
| 114 | 114 | } else { |
| 115 | 115 | $out .= $this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, abs($discard_closed), $forcefocus, $disabled, 0, $filterkey, 1, $forceaddid, $htmlid, $morecss, $morefilter); |
| 116 | 116 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | // phpcs:enable |
| 157 | 157 | global $user, $conf, $langs; |
| 158 | 158 | |
| 159 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
| 159 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
| 160 | 160 | |
| 161 | 161 | if (empty($htmlid)) { |
| 162 | 162 | $htmlid = $htmlname; |
@@ -181,26 +181,26 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | // Search all projects |
| 183 | 183 | $sql = "SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, s.nom as name, s.name_alias"; |
| 184 | - $sql .= " FROM " . $this->db->prefix() . "projet as p LEFT JOIN " . $this->db->prefix() . "societe as s ON s.rowid = p.fk_soc"; |
|
| 185 | - $sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; |
|
| 184 | + $sql .= " FROM ".$this->db->prefix()."projet as p LEFT JOIN ".$this->db->prefix()."societe as s ON s.rowid = p.fk_soc"; |
|
| 185 | + $sql .= " WHERE p.entity IN (".getEntity('project').")"; |
|
| 186 | 186 | if ($projectsListId !== false) { |
| 187 | - $sql .= " AND p.rowid IN (" . $this->db->sanitize($projectsListId) . ")"; |
|
| 187 | + $sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; |
|
| 188 | 188 | } |
| 189 | 189 | if ($socid == 0) { |
| 190 | 190 | $sql .= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; |
| 191 | 191 | } |
| 192 | 192 | if ($socid > 0) { |
| 193 | 193 | if (!getDolGlobalString('PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY')) { |
| 194 | - $sql .= " AND (p.fk_soc=" . ((int) $socid) . " OR p.fk_soc IS NULL)"; |
|
| 194 | + $sql .= " AND (p.fk_soc=".((int) $socid)." OR p.fk_soc IS NULL)"; |
|
| 195 | 195 | } elseif (getDolGlobalString('PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY') != 'all') { // PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma. |
| 196 | - $sql .= " AND (p.fk_soc IN (" . $this->db->sanitize(((int) $socid) . ", " . getDolGlobalString('PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY')) . ") OR p.fk_soc IS NULL)"; |
|
| 196 | + $sql .= " AND (p.fk_soc IN (".$this->db->sanitize(((int) $socid).", ".getDolGlobalString('PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY')).") OR p.fk_soc IS NULL)"; |
|
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | if (!empty($filterkey)) { |
| 200 | 200 | $sql .= natural_search(array('p.title', 'p.ref'), $filterkey); |
| 201 | 201 | } |
| 202 | 202 | if ($morefilter) { |
| 203 | - $sql .= ' AND (' . $this->db->sanitize($morefilter, 0, 1) . ')'; |
|
| 203 | + $sql .= ' AND ('.$this->db->sanitize($morefilter, 0, 1).')'; |
|
| 204 | 204 | } |
| 205 | 205 | $sql .= " ORDER BY p.ref ASC"; |
| 206 | 206 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | $morecss .= ' minwidth100'; |
| 211 | 211 | } |
| 212 | 212 | if (empty($option_only)) { |
| 213 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlid . '" name="' . $htmlname . '">'; |
|
| 213 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlid.'" name="'.$htmlname.'">'; |
|
| 214 | 214 | } |
| 215 | 215 | if (!empty($show_empty)) { |
| 216 | 216 | if (is_numeric($show_empty)) { |
@@ -236,37 +236,37 @@ discard block |
||
| 236 | 236 | $labeltoshow = dol_trunc($obj->ref, 18); |
| 237 | 237 | //if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')'; |
| 238 | 238 | //else $labeltoshow.=' ('.$langs->trans("Private").')'; |
| 239 | - $labeltoshow .= ', ' . dol_trunc($obj->title, $maxlength); |
|
| 239 | + $labeltoshow .= ', '.dol_trunc($obj->title, $maxlength); |
|
| 240 | 240 | if ($obj->name) { |
| 241 | - $labeltoshow .= ' - ' . $obj->name; |
|
| 241 | + $labeltoshow .= ' - '.$obj->name; |
|
| 242 | 242 | if ($obj->name_alias) { |
| 243 | - $labeltoshow .= ' (' . $obj->name_alias . ')'; |
|
| 243 | + $labeltoshow .= ' ('.$obj->name_alias.')'; |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | $disabled = 0; |
| 248 | 248 | if ($obj->fk_statut == 0) { |
| 249 | 249 | $disabled = 1; |
| 250 | - $labeltoshow .= ' - ' . $langs->trans("Draft"); |
|
| 250 | + $labeltoshow .= ' - '.$langs->trans("Draft"); |
|
| 251 | 251 | } elseif ($obj->fk_statut == 2) { |
| 252 | 252 | if ($discard_closed == 2) { |
| 253 | 253 | $disabled = 1; |
| 254 | 254 | } |
| 255 | - $labeltoshow .= ' - ' . $langs->trans("Closed"); |
|
| 255 | + $labeltoshow .= ' - '.$langs->trans("Closed"); |
|
| 256 | 256 | } elseif (!getDolGlobalString('PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY') && $socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) { |
| 257 | 257 | $disabled = 1; |
| 258 | - $labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany"); |
|
| 258 | + $labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany"); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | if (!empty($selected) && $selected == $obj->rowid) { |
| 262 | - $out .= '<option value="' . $obj->rowid . '" selected'; |
|
| 262 | + $out .= '<option value="'.$obj->rowid.'" selected'; |
|
| 263 | 263 | //if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled |
| 264 | - $out .= '>' . $labeltoshow . '</option>'; |
|
| 264 | + $out .= '>'.$labeltoshow.'</option>'; |
|
| 265 | 265 | } else { |
| 266 | 266 | if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { |
| 267 | 267 | $resultat = ''; |
| 268 | 268 | } else { |
| 269 | - $resultat = '<option value="' . $obj->rowid . '"'; |
|
| 269 | + $resultat = '<option value="'.$obj->rowid.'"'; |
|
| 270 | 270 | if ($disabled) { |
| 271 | 271 | $resultat .= ' disabled'; |
| 272 | 272 | } |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | 'value' => $obj->ref, |
| 284 | 284 | 'ref' => $obj->ref, |
| 285 | 285 | 'labelx' => $labeltoshow, |
| 286 | - 'label' => ($disabled ? '<span class="opacitymedium">' . $labeltoshow . '</span>' : $labeltoshow), |
|
| 286 | + 'label' => ($disabled ? '<span class="opacitymedium">'.$labeltoshow.'</span>' : $labeltoshow), |
|
| 287 | 287 | 'disabled' => (bool) $disabled |
| 288 | 288 | ); |
| 289 | 289 | } |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | |
| 302 | 302 | // Use select2 selector |
| 303 | 303 | if (!empty($conf->use_javascript_ajax)) { |
| 304 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 304 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 305 | 305 | $comboenhancement = ajax_combobox($htmlid, array(), 0, $forcefocus); |
| 306 | 306 | $out .= $comboenhancement; |
| 307 | 307 | $morecss .= ' minwidth100'; |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | { |
| 347 | 347 | global $user, $conf, $langs; |
| 348 | 348 | |
| 349 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
| 349 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
| 350 | 350 | |
| 351 | 351 | if (is_null($usertofilter)) { |
| 352 | 352 | $usertofilter = $user; |
@@ -370,19 +370,19 @@ discard block |
||
| 370 | 370 | $sql = "SELECT t.rowid, t.ref as tref, t.label as tlabel, t.progress,"; |
| 371 | 371 | $sql .= " p.rowid as pid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, p.usage_task,"; |
| 372 | 372 | $sql .= " s.nom as name"; |
| 373 | - $sql .= " FROM " . $this->db->prefix() . "projet as p"; |
|
| 374 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON s.rowid = p.fk_soc,"; |
|
| 375 | - $sql .= " " . $this->db->prefix() . "projet_task as t"; |
|
| 376 | - $sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; |
|
| 373 | + $sql .= " FROM ".$this->db->prefix()."projet as p"; |
|
| 374 | + $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON s.rowid = p.fk_soc,"; |
|
| 375 | + $sql .= " ".$this->db->prefix()."projet_task as t"; |
|
| 376 | + $sql .= " WHERE p.entity IN (".getEntity('project').")"; |
|
| 377 | 377 | $sql .= " AND t.fk_projet = p.rowid"; |
| 378 | 378 | if ($projectsListId) { |
| 379 | - $sql .= " AND p.rowid IN (" . $this->db->sanitize($projectsListId) . ")"; |
|
| 379 | + $sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; |
|
| 380 | 380 | } |
| 381 | 381 | if ($socid == 0) { |
| 382 | 382 | $sql .= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; |
| 383 | 383 | } |
| 384 | 384 | if ($socid > 0) { |
| 385 | - $sql .= " AND (p.fk_soc=" . ((int) $socid) . " OR p.fk_soc IS NULL)"; |
|
| 385 | + $sql .= " AND (p.fk_soc=".((int) $socid)." OR p.fk_soc IS NULL)"; |
|
| 386 | 386 | } |
| 387 | 387 | $sql .= " ORDER BY p.ref, t.ref ASC"; |
| 388 | 388 | |
@@ -390,14 +390,14 @@ discard block |
||
| 390 | 390 | if ($resql) { |
| 391 | 391 | // Use select2 selector |
| 392 | 392 | if (empty($option_only) && !empty($conf->use_javascript_ajax)) { |
| 393 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 393 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 394 | 394 | $comboenhancement = ajax_combobox($htmlname, [], 0, $forcefocus); |
| 395 | 395 | $out .= $comboenhancement; |
| 396 | 396 | $morecss .= ' minwidth150imp'; |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | if (empty($option_only)) { |
| 400 | - $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
| 400 | + $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; |
|
| 401 | 401 | } |
| 402 | 402 | if (!empty($show_empty)) { |
| 403 | 403 | $out .= '<option value="0" class="optiongrey">'; |
@@ -443,58 +443,58 @@ discard block |
||
| 443 | 443 | $labeltoshow .= dol_trunc($obj->ref, 18); // Project ref |
| 444 | 444 | //if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')'; |
| 445 | 445 | //else $labeltoshow.=' ('.$langs->trans("Private").')'; |
| 446 | - $labeltoshow .= ' ' . dol_trunc($obj->title, $maxlength); |
|
| 446 | + $labeltoshow .= ' '.dol_trunc($obj->title, $maxlength); |
|
| 447 | 447 | $labeltoshowhtml = $labeltoshow; |
| 448 | 448 | |
| 449 | 449 | if ($obj->name) { |
| 450 | - $labeltoshow .= ' (' . $obj->name . ')'; |
|
| 451 | - $labeltoshowhtml .= ' <span class="opacitymedium">(' . $obj->name . ')</span>'; |
|
| 450 | + $labeltoshow .= ' ('.$obj->name.')'; |
|
| 451 | + $labeltoshowhtml .= ' <span class="opacitymedium">('.$obj->name.')</span>'; |
|
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | $disabled = 0; |
| 455 | 455 | if ($obj->fk_statut == Project::STATUS_DRAFT) { |
| 456 | 456 | $disabled = 1; |
| 457 | - $labeltoshow .= ' - ' . $langs->trans("Draft"); |
|
| 458 | - $labeltoshowhtml .= ' - <span class="opacitymedium">' . $langs->trans("Draft") . '</span>'; |
|
| 457 | + $labeltoshow .= ' - '.$langs->trans("Draft"); |
|
| 458 | + $labeltoshowhtml .= ' - <span class="opacitymedium">'.$langs->trans("Draft").'</span>'; |
|
| 459 | 459 | } elseif ($obj->fk_statut == Project::STATUS_CLOSED) { |
| 460 | 460 | if ($discard_closed == 2) { |
| 461 | 461 | $disabled = 1; |
| 462 | 462 | } |
| 463 | - $labeltoshow .= ' - ' . $langs->trans("Closed"); |
|
| 464 | - $labeltoshowhtml .= ' - <span class="opacitymedium">' . $langs->trans("Closed") . '</span>'; |
|
| 463 | + $labeltoshow .= ' - '.$langs->trans("Closed"); |
|
| 464 | + $labeltoshowhtml .= ' - <span class="opacitymedium">'.$langs->trans("Closed").'</span>'; |
|
| 465 | 465 | } elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) { |
| 466 | 466 | $disabled = 1; |
| 467 | - $labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany"); |
|
| 468 | - $labeltoshowhtml .= ' - <span class="opacitymedium">' . $langs->trans("LinkedToAnotherCompany") . '</span>'; |
|
| 467 | + $labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany"); |
|
| 468 | + $labeltoshowhtml .= ' - <span class="opacitymedium">'.$langs->trans("LinkedToAnotherCompany").'</span>'; |
|
| 469 | 469 | } |
| 470 | 470 | $labeltoshow .= ' - '; |
| 471 | 471 | $labeltoshowhtml .= ' - '; |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | // Label for task |
| 475 | - $labeltoshow .= $obj->tref . ' ' . dol_trunc($obj->tlabel, $maxlength); |
|
| 476 | - $labeltoshowhtml .= $obj->tref . ' - ' . dol_trunc($obj->tlabel, $maxlength); |
|
| 475 | + $labeltoshow .= $obj->tref.' '.dol_trunc($obj->tlabel, $maxlength); |
|
| 476 | + $labeltoshowhtml .= $obj->tref.' - '.dol_trunc($obj->tlabel, $maxlength); |
|
| 477 | 477 | if ($obj->usage_task && preg_match('/progress/', $showmore)) { |
| 478 | - $labeltoshow .= ' <span class="opacitymedium">(' . $obj->progress . '%)</span>'; |
|
| 479 | - $labeltoshowhtml .= ' <span class="opacitymedium">(' . $obj->progress . '%)</span>'; |
|
| 478 | + $labeltoshow .= ' <span class="opacitymedium">('.$obj->progress.'%)</span>'; |
|
| 479 | + $labeltoshowhtml .= ' <span class="opacitymedium">('.$obj->progress.'%)</span>'; |
|
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | if (!empty($selected) && $selected == $obj->rowid) { |
| 483 | - $out .= '<option value="' . $obj->rowid . '" selected'; |
|
| 484 | - $out .= ' data-html="' . dol_escape_htmltag($labeltoshowhtml) . '"'; |
|
| 483 | + $out .= '<option value="'.$obj->rowid.'" selected'; |
|
| 484 | + $out .= ' data-html="'.dol_escape_htmltag($labeltoshowhtml).'"'; |
|
| 485 | 485 | //if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled |
| 486 | - $out .= '>' . $labeltoshow . '</option>'; |
|
| 486 | + $out .= '>'.$labeltoshow.'</option>'; |
|
| 487 | 487 | } else { |
| 488 | 488 | if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { |
| 489 | 489 | $resultat = ''; |
| 490 | 490 | } else { |
| 491 | - $resultat = '<option value="' . $obj->rowid . '"'; |
|
| 491 | + $resultat = '<option value="'.$obj->rowid.'"'; |
|
| 492 | 492 | if ($disabled) { |
| 493 | 493 | $resultat .= ' disabled'; |
| 494 | 494 | } |
| 495 | 495 | //if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')'; |
| 496 | 496 | //else $labeltoshow.=' ('.$langs->trans("Private").')'; |
| 497 | - $resultat .= ' data-html="' . dol_escape_htmltag($labeltoshowhtml) . '"'; |
|
| 497 | + $resultat .= ' data-html="'.dol_escape_htmltag($labeltoshowhtml).'"'; |
|
| 498 | 498 | $resultat .= '>'; |
| 499 | 499 | $resultat .= $labeltoshow; |
| 500 | 500 | $resultat .= '</option>'; |
@@ -620,30 +620,30 @@ discard block |
||
| 620 | 620 | if ($linkedtothirdparty) { |
| 621 | 621 | $sql .= ", s.nom as name"; |
| 622 | 622 | } |
| 623 | - $sql .= " FROM " . $this->db->prefix() . $table_element . " as t"; |
|
| 623 | + $sql .= " FROM ".$this->db->prefix().$table_element." as t"; |
|
| 624 | 624 | if ($linkedtothirdparty) { |
| 625 | - $sql .= ", " . $this->db->prefix() . "societe as s"; |
|
| 625 | + $sql .= ", ".$this->db->prefix()."societe as s"; |
|
| 626 | 626 | } |
| 627 | - $sql .= " WHERE " . $projectkey . " is null"; |
|
| 627 | + $sql .= " WHERE ".$projectkey." is null"; |
|
| 628 | 628 | if (!empty($socid) && $linkedtothirdparty) { |
| 629 | 629 | if (is_numeric($socid)) { |
| 630 | - $sql .= " AND t.fk_soc = " . ((int) $socid); |
|
| 630 | + $sql .= " AND t.fk_soc = ".((int) $socid); |
|
| 631 | 631 | } else { |
| 632 | - $sql .= " AND t.fk_soc IN (" . $this->db->sanitize($socid) . ")"; |
|
| 632 | + $sql .= " AND t.fk_soc IN (".$this->db->sanitize($socid).")"; |
|
| 633 | 633 | } |
| 634 | 634 | } |
| 635 | 635 | if (!in_array($table_element, array('expensereport_det', 'stock_mouvement'))) { |
| 636 | - $sql .= ' AND t.entity IN (' . getEntity('project') . ')'; |
|
| 636 | + $sql .= ' AND t.entity IN ('.getEntity('project').')'; |
|
| 637 | 637 | } |
| 638 | 638 | if ($linkedtothirdparty) { |
| 639 | 639 | $sql .= " AND s.rowid = t.fk_soc"; |
| 640 | 640 | } |
| 641 | 641 | if ($sqlfilter) { |
| 642 | - $sql .= " AND " . $sqlfilter; |
|
| 642 | + $sql .= " AND ".$sqlfilter; |
|
| 643 | 643 | } |
| 644 | 644 | $sql .= " ORDER BY ref DESC"; |
| 645 | 645 | |
| 646 | - dol_syslog(get_class($this) . '::select_element', LOG_DEBUG); |
|
| 646 | + dol_syslog(get_class($this).'::select_element', LOG_DEBUG); |
|
| 647 | 647 | $resql = $this->db->query($sql); |
| 648 | 648 | if ($resql) { |
| 649 | 649 | $num = $this->db->num_rows($resql); |
@@ -651,18 +651,18 @@ discard block |
||
| 651 | 651 | $sellist = ''; |
| 652 | 652 | |
| 653 | 653 | if ($num > 0) { |
| 654 | - $sellist = '<select class="flat elementselect css' . $table_element . ($morecss ? ' ' . $morecss : '') . '" name="elementselect">'; |
|
| 655 | - $sellist .= '<option value="-1"' . ($placeholder ? ' class="optiongrey"' : '') . '>' . $placeholder . '</option>'; |
|
| 654 | + $sellist = '<select class="flat elementselect css'.$table_element.($morecss ? ' '.$morecss : '').'" name="elementselect">'; |
|
| 655 | + $sellist .= '<option value="-1"'.($placeholder ? ' class="optiongrey"' : '').'>'.$placeholder.'</option>'; |
|
| 656 | 656 | while ($i < $num) { |
| 657 | 657 | $obj = $this->db->fetch_object($resql); |
| 658 | 658 | $ref = $obj->ref ? $obj->ref : $obj->rowid; |
| 659 | 659 | if (!empty($obj->ref_supplier)) { |
| 660 | - $ref .= ' (' . $obj->ref_supplier . ')'; |
|
| 660 | + $ref .= ' ('.$obj->ref_supplier.')'; |
|
| 661 | 661 | } |
| 662 | 662 | if (!empty($obj->name)) { |
| 663 | - $ref .= ' - ' . $obj->name; |
|
| 663 | + $ref .= ' - '.$obj->name; |
|
| 664 | 664 | } |
| 665 | - $sellist .= '<option value="' . $obj->rowid . '">' . $ref . '</option>'; |
|
| 665 | + $sellist .= '<option value="'.$obj->rowid.'">'.$ref.'</option>'; |
|
| 666 | 666 | $i++; |
| 667 | 667 | } |
| 668 | 668 | $sellist .= '</select>'; |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | dol_print_error($this->db); |
| 681 | 681 | $this->error = $this->db->lasterror(); |
| 682 | 682 | $this->errors[] = $this->db->lasterror(); |
| 683 | - dol_syslog(get_class($this) . "::select_element " . $this->error, LOG_ERR); |
|
| 683 | + dol_syslog(get_class($this)."::select_element ".$this->error, LOG_ERR); |
|
| 684 | 684 | return -1; |
| 685 | 685 | } |
| 686 | 686 | } |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | global $conf, $langs, $user; |
| 706 | 706 | |
| 707 | 707 | $sql = "SELECT rowid, code, label, percent"; |
| 708 | - $sql .= " FROM " . $this->db->prefix() . 'c_lead_status'; |
|
| 708 | + $sql .= " FROM ".$this->db->prefix().'c_lead_status'; |
|
| 709 | 709 | $sql .= " WHERE active = 1"; |
| 710 | 710 | $sql .= " ORDER BY position"; |
| 711 | 711 | |
@@ -715,31 +715,31 @@ discard block |
||
| 715 | 715 | $i = 0; |
| 716 | 716 | $sellist = ''; |
| 717 | 717 | if ($num > 0) { |
| 718 | - $sellist = '<select class="flat oppstatus' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
| 718 | + $sellist = '<select class="flat oppstatus'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">'; |
|
| 719 | 719 | if ($showempty) { |
| 720 | 720 | // Without  , strange move of screen when switching value |
| 721 | 721 | $sellist .= '<option value="-1"> </option>'; |
| 722 | 722 | } |
| 723 | 723 | if ($showallnone) { |
| 724 | - $sellist .= '<option value="all"' . ($preselected == 'all' ? ' selected="selected"' : '') . '>-- ' . $langs->trans("OnlyOpportunitiesShort") . '</option>'; |
|
| 725 | - $sellist .= '<option value="openedopp"' . ($preselected == 'openedopp' ? ' selected="selected"' : '') . '>-- ' . $langs->trans("OpenedOpportunitiesShort") . '</option>'; |
|
| 726 | - $sellist .= '<option value="notopenedopp"' . ($preselected == 'notopenedopp' ? ' selected="selected"' : '') . '>-- ' . $langs->trans("NotOpenedOpportunitiesShort") . '</option>'; |
|
| 727 | - $sellist .= '<option value="none"' . ($preselected == 'none' ? ' selected="selected"' : '') . '>-- ' . $langs->trans("NotAnOpportunityShort") . '</option>'; |
|
| 724 | + $sellist .= '<option value="all"'.($preselected == 'all' ? ' selected="selected"' : '').'>-- '.$langs->trans("OnlyOpportunitiesShort").'</option>'; |
|
| 725 | + $sellist .= '<option value="openedopp"'.($preselected == 'openedopp' ? ' selected="selected"' : '').'>-- '.$langs->trans("OpenedOpportunitiesShort").'</option>'; |
|
| 726 | + $sellist .= '<option value="notopenedopp"'.($preselected == 'notopenedopp' ? ' selected="selected"' : '').'>-- '.$langs->trans("NotOpenedOpportunitiesShort").'</option>'; |
|
| 727 | + $sellist .= '<option value="none"'.($preselected == 'none' ? ' selected="selected"' : '').'>-- '.$langs->trans("NotAnOpportunityShort").'</option>'; |
|
| 728 | 728 | } |
| 729 | 729 | while ($i < $num) { |
| 730 | 730 | $obj = $this->db->fetch_object($resql); |
| 731 | 731 | |
| 732 | - $sellist .= '<option value="' . $obj->rowid . '" defaultpercent="' . $obj->percent . '" elemcode="' . $obj->code . '"'; |
|
| 732 | + $sellist .= '<option value="'.$obj->rowid.'" defaultpercent="'.$obj->percent.'" elemcode="'.$obj->code.'"'; |
|
| 733 | 733 | if ($obj->rowid == $preselected) { |
| 734 | 734 | $sellist .= ' selected="selected"'; |
| 735 | 735 | } |
| 736 | 736 | $sellist .= '>'; |
| 737 | 737 | if ($useshortlabel) { |
| 738 | - $finallabel = ($langs->transnoentitiesnoconv("OppStatus" . $obj->code) != "OppStatus" . $obj->code ? $langs->transnoentitiesnoconv("OppStatus" . $obj->code) : $obj->label); |
|
| 738 | + $finallabel = ($langs->transnoentitiesnoconv("OppStatus".$obj->code) != "OppStatus".$obj->code ? $langs->transnoentitiesnoconv("OppStatus".$obj->code) : $obj->label); |
|
| 739 | 739 | } else { |
| 740 | - $finallabel = ($langs->transnoentitiesnoconv("OppStatus" . $obj->code) != "OppStatus" . $obj->code ? $langs->transnoentitiesnoconv("OppStatus" . $obj->code) : $obj->label); |
|
| 740 | + $finallabel = ($langs->transnoentitiesnoconv("OppStatus".$obj->code) != "OppStatus".$obj->code ? $langs->transnoentitiesnoconv("OppStatus".$obj->code) : $obj->label); |
|
| 741 | 741 | if ($showpercent) { |
| 742 | - $finallabel .= ' (' . $obj->percent . '%)'; |
|
| 742 | + $finallabel .= ' ('.$obj->percent.'%)'; |
|
| 743 | 743 | } |
| 744 | 744 | } |
| 745 | 745 | $sellist .= $finallabel; |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | } else { |
| 769 | 769 | $this->error = $this->db->lasterror(); |
| 770 | 770 | $this->errors[] = $this->db->lasterror(); |
| 771 | - dol_syslog(get_class($this) . "::selectOpportunityStatus " . $this->error, LOG_ERR); |
|
| 771 | + dol_syslog(get_class($this)."::selectOpportunityStatus ".$this->error, LOG_ERR); |
|
| 772 | 772 | return -1; |
| 773 | 773 | } |
| 774 | 774 | } |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | if (is_array($selected)) { |
| 803 | 803 | $selectedarray = $selected; |
| 804 | 804 | } elseif ($selected == 99) { |
| 805 | - $selectedarray = array(0,1); |
|
| 805 | + $selectedarray = array(0, 1); |
|
| 806 | 806 | } else { |
| 807 | 807 | $selectedarray = explode(',', $selected); |
| 808 | 808 | } |
@@ -826,24 +826,24 @@ discard block |
||
| 826 | 826 | { |
| 827 | 827 | global $user, $conf, $langs; |
| 828 | 828 | |
| 829 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
| 829 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
| 830 | 830 | |
| 831 | 831 | $out = ''; |
| 832 | 832 | if (empty($lineOnly)) { |
| 833 | 833 | // Search Invoice |
| 834 | 834 | $sql = "SELECT f.rowid, f.ref as fref,"; |
| 835 | 835 | $sql .= ' s.nom as name'; |
| 836 | - $sql .= ' FROM ' . $this->db->prefix() . 'projet as p'; |
|
| 837 | - $sql .= ' INNER JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc'; |
|
| 838 | - $sql .= ' INNER JOIN ' . $this->db->prefix() . 'facture as f ON f.fk_projet = p.rowid'; |
|
| 839 | - $sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; |
|
| 836 | + $sql .= ' FROM '.$this->db->prefix().'projet as p'; |
|
| 837 | + $sql .= ' INNER JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc'; |
|
| 838 | + $sql .= ' INNER JOIN '.$this->db->prefix().'facture as f ON f.fk_projet = p.rowid'; |
|
| 839 | + $sql .= " WHERE p.entity IN (".getEntity('project').")"; |
|
| 840 | 840 | if (!empty($filters)) { |
| 841 | 841 | foreach ($filters as $key => $value) { |
| 842 | 842 | if ($key == 'p.rowid') { |
| 843 | - $sql .= " AND p.rowid=" . (int) $value; |
|
| 843 | + $sql .= " AND p.rowid=".(int) $value; |
|
| 844 | 844 | } |
| 845 | 845 | if ($key == 'f.rowid') { |
| 846 | - $sql .= " AND f.rowid=" . (int) $value; |
|
| 846 | + $sql .= " AND f.rowid=".(int) $value; |
|
| 847 | 847 | } |
| 848 | 848 | } |
| 849 | 849 | } |
@@ -853,26 +853,26 @@ discard block |
||
| 853 | 853 | if ($resql) { |
| 854 | 854 | // Use select2 selector |
| 855 | 855 | if (!empty($conf->use_javascript_ajax)) { |
| 856 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 856 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 857 | 857 | $comboenhancement = ajax_combobox($htmlNameInvoice, array(array('method' => 'getLines', 'url' => dol_buildpath('/core/ajax/ajaxinvoiceline.php', 1), 'htmlname' => $htmlNameInvoiceLine)), 0, 0); |
| 858 | 858 | $out .= $comboenhancement; |
| 859 | 859 | $morecss = 'minwidth200imp maxwidth500'; |
| 860 | 860 | } |
| 861 | 861 | |
| 862 | - $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlNameInvoice . '" name="' . $htmlNameInvoice . '">'; |
|
| 862 | + $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlNameInvoice.'" name="'.$htmlNameInvoice.'">'; |
|
| 863 | 863 | $num = $this->db->num_rows($resql); |
| 864 | 864 | if ($num) { |
| 865 | 865 | while ($obj = $this->db->fetch_object($resql)) { |
| 866 | 866 | $labeltoshow = $obj->fref; // Invoice ref |
| 867 | 867 | if ($obj->name) { |
| 868 | - $labeltoshow .= ' - ' . $obj->name; |
|
| 868 | + $labeltoshow .= ' - '.$obj->name; |
|
| 869 | 869 | } |
| 870 | 870 | |
| 871 | - $out .= '<option value="' . $obj->rowid . '" '; |
|
| 871 | + $out .= '<option value="'.$obj->rowid.'" '; |
|
| 872 | 872 | if (!empty($selectedInvoiceId) && $selectedInvoiceId == $obj->rowid) { |
| 873 | 873 | $out .= ' selected '; |
| 874 | 874 | } |
| 875 | - $out .= '>' . $labeltoshow . '</option>'; |
|
| 875 | + $out .= '>'.$labeltoshow.'</option>'; |
|
| 876 | 876 | } |
| 877 | 877 | } |
| 878 | 878 | $out .= '</select>'; |
@@ -884,20 +884,20 @@ discard block |
||
| 884 | 884 | |
| 885 | 885 | // Search Invoice Line |
| 886 | 886 | $sql = "SELECT fd.rowid, fd.label, fd.description"; |
| 887 | - $sql .= ' FROM ' . $this->db->prefix() . 'projet as p'; |
|
| 888 | - $sql .= ' INNER JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc'; |
|
| 889 | - $sql .= ' INNER JOIN ' . $this->db->prefix() . 'facture as f ON f.fk_projet = p.rowid'; |
|
| 890 | - $sql .= ' INNER JOIN ' . $this->db->prefix() . 'facturedet as fd ON fd.fk_facture = f.rowid'; |
|
| 891 | - $sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; |
|
| 887 | + $sql .= ' FROM '.$this->db->prefix().'projet as p'; |
|
| 888 | + $sql .= ' INNER JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc'; |
|
| 889 | + $sql .= ' INNER JOIN '.$this->db->prefix().'facture as f ON f.fk_projet = p.rowid'; |
|
| 890 | + $sql .= ' INNER JOIN '.$this->db->prefix().'facturedet as fd ON fd.fk_facture = f.rowid'; |
|
| 891 | + $sql .= " WHERE p.entity IN (".getEntity('project').")"; |
|
| 892 | 892 | if (!empty($filters)) { |
| 893 | 893 | foreach ($filters as $key => $value) { |
| 894 | 894 | if ($key == 'p.rowid') { |
| 895 | - $sql .= " AND p.rowid=" . (int) $value; |
|
| 895 | + $sql .= " AND p.rowid=".(int) $value; |
|
| 896 | 896 | } |
| 897 | 897 | } |
| 898 | 898 | } |
| 899 | 899 | if (!empty($selectedInvoiceId)) { |
| 900 | - $sql .= " AND f.rowid=" . (int) $selectedInvoiceId; |
|
| 900 | + $sql .= " AND f.rowid=".(int) $selectedInvoiceId; |
|
| 901 | 901 | } |
| 902 | 902 | $sql .= " ORDER BY p.ref, f.ref ASC"; |
| 903 | 903 | $resql = $this->db->query($sql); |
@@ -905,24 +905,24 @@ discard block |
||
| 905 | 905 | // Use select2 selector |
| 906 | 906 | if (empty($lineOnly)) { |
| 907 | 907 | if (!empty($conf->use_javascript_ajax)) { |
| 908 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 908 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 909 | 909 | $comboenhancement = ajax_combobox($htmlNameInvoiceLine, [], 0, 0); |
| 910 | 910 | $out .= $comboenhancement; |
| 911 | 911 | $morecss = 'minwidth200imp maxwidth500'; |
| 912 | 912 | } |
| 913 | 913 | |
| 914 | - $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlNameInvoiceLine . '" name="' . $htmlNameInvoiceLine . '">'; |
|
| 914 | + $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlNameInvoiceLine.'" name="'.$htmlNameInvoiceLine.'">'; |
|
| 915 | 915 | } |
| 916 | 916 | $num = $this->db->num_rows($resql); |
| 917 | 917 | if ($num) { |
| 918 | 918 | while ($obj = $this->db->fetch_object($resql)) { |
| 919 | 919 | $labeltoshow .= $obj->description; // Invoice ref |
| 920 | 920 | |
| 921 | - $out .= '<option value="' . $obj->rowid . '" '; |
|
| 921 | + $out .= '<option value="'.$obj->rowid.'" '; |
|
| 922 | 922 | if (!empty($selectedLineId) && $selectedLineId == $obj->rowid) { |
| 923 | 923 | $out .= ' selected '; |
| 924 | 924 | } |
| 925 | - $out .= '>' . $labeltoshow . '</option>'; |
|
| 925 | + $out .= '>'.$labeltoshow.'</option>'; |
|
| 926 | 926 | } |
| 927 | 927 | } |
| 928 | 928 | if (empty($lineOnly)) { |
@@ -955,14 +955,14 @@ discard block |
||
| 955 | 955 | |
| 956 | 956 | $out = ''; |
| 957 | 957 | if ($htmlname_status != "none" && $htmlname_percent != 'none') { |
| 958 | - $out .= '<form method="post" action="' . $page . '">'; |
|
| 958 | + $out .= '<form method="post" action="'.$page.'">'; |
|
| 959 | 959 | $out .= '<input type="hidden" name="action" value="set_opp_status">'; |
| 960 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 960 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 961 | 961 | $out .= $this-> selectOpportunityStatus($htmlname_status, $selected, 1, 0, 0, 0, 'minwidth150 inline-block valignmiddle', 1, 1); |
| 962 | 962 | $out .= ' / <span title="'.$langs->trans("OpportunityProbability").'"> '; |
| 963 | 963 | $out .= '<input class="width50 right" type="text" id="'.$htmlname_percent.'" name="'.$htmlname_percent.'" title="'.dol_escape_htmltag($langs->trans("OpportunityProbability")).'" value="'.$percent_value.'"> %'; |
| 964 | 964 | $out .= '</span>'; |
| 965 | - $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
| 965 | + $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 966 | 966 | $out .= '</form>'; |
| 967 | 967 | } else { |
| 968 | 968 | if ($selected > 0) { |