@@ -46,7 +46,7 @@ |
||
| 46 | 46 | |
| 47 | 47 | $action = GETPOST('action', 'aZ09'); |
| 48 | 48 | $value = GETPOST('value', 'alpha'); |
| 49 | -$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php |
|
| 49 | +$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php |
|
| 50 | 50 | |
| 51 | 51 | $label = GETPOST('label', 'alpha'); |
| 52 | 52 | $scandir = GETPOST('scan_dir', 'alpha'); |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | |
| 43 | 43 | $action = GETPOST('action', 'aZ09'); |
| 44 | 44 | $value = GETPOST('value', 'alpha'); |
| 45 | -$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php |
|
| 45 | +$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php |
|
| 46 | 46 | |
| 47 | 47 | $type = 'group'; |
| 48 | 48 | |
@@ -411,7 +411,9 @@ |
||
| 411 | 411 | $this->db->begin(); |
| 412 | 412 | |
| 413 | 413 | foreach ($request_data as $TData) { |
| 414 | - if (empty($TData[0])) $TData = array($TData); |
|
| 414 | + if (empty($TData[0])) { |
|
| 415 | + $TData = array($TData); |
|
| 416 | + } |
|
| 415 | 417 | |
| 416 | 418 | foreach ($TData as $lineData) { |
| 417 | 419 | $line = (object) $lineData; |
@@ -66,13 +66,13 @@ |
||
| 66 | 66 | |
| 67 | 67 | print "*** TEST READ OF /tmp/test.txt FILE<br>\n"; |
| 68 | 68 | |
| 69 | -$out=''; |
|
| 70 | -$ret=0; |
|
| 69 | +$out = ''; |
|
| 70 | +$ret = 0; |
|
| 71 | 71 | |
| 72 | 72 | $file = '/tmp/test.txt'; |
| 73 | -$f=fopen($file, 'r'); |
|
| 73 | +$f = fopen($file, 'r'); |
|
| 74 | 74 | if ($f) { |
| 75 | - $s=fread($f, 4096); |
|
| 75 | + $s = fread($f, 4096); |
|
| 76 | 76 | print $s; |
| 77 | 77 | fclose($f); |
| 78 | 78 | } else { |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | |
| 37 | 37 | $action = GETPOST('action', 'aZ09'); |
| 38 | 38 | $value = GETPOST('value', 'alpha'); |
| 39 | -$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php |
|
| 39 | +$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php |
|
| 40 | 40 | |
| 41 | 41 | $param = GETPOST('param', 'alpha'); |
| 42 | 42 | $cancel = GETPOST('cancel', 'alpha'); |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | while ($assoc = $db->fetch_array($resql)) { |
| 802 | 802 | $rate_key = $assoc['rate']; |
| 803 | 803 | if ($f_rate == 'tva_tx' && !empty($assoc['vat_src_code']) && !preg_match('/\(/', $rate_key)) { |
| 804 | - $rate_key .= ' (' . $assoc['vat_src_code'] . ')'; |
|
| 804 | + $rate_key .= ' ('.$assoc['vat_src_code'].')'; |
|
| 805 | 805 | } |
| 806 | 806 | |
| 807 | 807 | // Code to avoid warnings when array entry not defined |
@@ -986,7 +986,7 @@ discard block |
||
| 986 | 986 | while ($assoc = $db->fetch_array($resql)) { |
| 987 | 987 | $rate_key = $assoc['rate']; |
| 988 | 988 | if ($f_rate == 'tva_tx' && !empty($assoc['vat_src_code']) && !preg_match('/\(/', $rate_key)) { |
| 989 | - $rate_key .= ' (' . $assoc['vat_src_code'] . ')'; |
|
| 989 | + $rate_key .= ' ('.$assoc['vat_src_code'].')'; |
|
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | // Code to avoid warnings when array entry not defined |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | while ($assoc = $db->fetch_array($resql)) { |
| 1114 | 1114 | $rate_key = $assoc['rate']; |
| 1115 | 1115 | if ($f_rate == 'tva_tx' && !empty($assoc['vat_src_code']) && !preg_match('/\(/', $rate_key)) { |
| 1116 | - $rate_key .= ' (' . $assoc['vat_src_code'] . ')'; |
|
| 1116 | + $rate_key .= ' ('.$assoc['vat_src_code'].')'; |
|
| 1117 | 1117 | } |
| 1118 | 1118 | |
| 1119 | 1119 | // Code to avoid warnings when array entry not defined |
@@ -29,16 +29,28 @@ discard block |
||
| 29 | 29 | // Load Dolibarr environment |
| 30 | 30 | $res = 0; |
| 31 | 31 | // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) |
| 32 | -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; |
|
| 32 | +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { |
|
| 33 | + $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; |
|
| 34 | +} |
|
| 33 | 35 | // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME |
| 34 | 36 | $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; |
| 35 | 37 | while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } |
| 36 | -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; |
|
| 37 | -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; |
|
| 38 | +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { |
|
| 39 | + $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; |
|
| 40 | +} |
|
| 41 | +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { |
|
| 42 | + $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; |
|
| 43 | +} |
|
| 38 | 44 | // Try main.inc.php using relative path |
| 39 | -if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; |
|
| 40 | -if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; |
|
| 41 | -if (!$res) die("Include of main fails"); |
|
| 45 | +if (!$res && file_exists("../../main.inc.php")) { |
|
| 46 | + $res = @include "../../main.inc.php"; |
|
| 47 | +} |
|
| 48 | +if (!$res && file_exists("../../../main.inc.php")) { |
|
| 49 | + $res = @include "../../../main.inc.php"; |
|
| 50 | +} |
|
| 51 | +if (!$res) { |
|
| 52 | + die("Include of main fails"); |
|
| 53 | +} |
|
| 42 | 54 | |
| 43 | 55 | require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
| 44 | 56 | require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php'; |
@@ -52,13 +64,17 @@ discard block |
||
| 52 | 64 | // List of supported format |
| 53 | 65 | $tmptype2label = ExtraFields::$type2label; |
| 54 | 66 | $type2label = array(''); |
| 55 | -foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val); |
|
| 67 | +foreach ($tmptype2label as $key => $val) { |
|
| 68 | + $type2label[$key] = $langs->transnoentitiesnoconv($val); |
|
| 69 | +} |
|
| 56 | 70 | |
| 57 | 71 | $action = GETPOST('action', 'aZ09'); |
| 58 | 72 | $attrname = GETPOST('attrname', 'alpha'); |
| 59 | 73 | $elementtype = 'stock_mouvement'; //Must be the $table_element of the class that manage extrafield |
| 60 | 74 | |
| 61 | -if (!$user->admin) accessforbidden(); |
|
| 75 | +if (!$user->admin) { |
|
| 76 | + accessforbidden(); |
|
| 77 | +} |
|
| 62 | 78 | |
| 63 | 79 | |
| 64 | 80 | /* |
@@ -159,10 +159,10 @@ discard block |
||
| 159 | 159 | } |
| 160 | 160 | $sql .= "("; |
| 161 | 161 | $sql .= " SELECT cp.fk_categorie, cp.fk_product"; |
| 162 | - $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_product as cp"; |
|
| 162 | + $sql .= " FROM ".MAIN_DB_PREFIX."categorie_product as cp"; |
|
| 163 | 163 | $sql .= " WHERE cp.fk_product = p.rowid"; // Join for the needed table to filter by categ |
| 164 | 164 | if ($search_categ > 0) { |
| 165 | - $sql .= " AND cp.fk_categorie = " . ((int) $search_categ); |
|
| 165 | + $sql .= " AND cp.fk_categorie = ".((int) $search_categ); |
|
| 166 | 166 | } |
| 167 | 167 | $sql .= ")"; |
| 168 | 168 | } |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | } |
| 211 | 211 | if ($search_stock_physique != '') { |
| 212 | 212 | //$natural_search_physique = natural_search('HAVING SUM(' . $db->ifsql('s.reel IS NULL', '0', 's.reel') . ')', $search_stock_physique, 1, 1); |
| 213 | - $natural_search_physique = natural_search('SUM(' . $db->ifsql('s.reel IS NULL', '0', 's.reel') . ')', $search_stock_physique, 1, 1); |
|
| 214 | - $natural_search_physique = " " . substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters |
|
| 213 | + $natural_search_physique = natural_search('SUM('.$db->ifsql('s.reel IS NULL', '0', 's.reel').')', $search_stock_physique, 1, 1); |
|
| 214 | + $natural_search_physique = " ".substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters |
|
| 215 | 215 | if (!empty($sql_having)) { |
| 216 | 216 | $sql_having .= " AND"; |
| 217 | 217 | } else { |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | $param .= "&sbarcode=".urlencode($sbarcode); |
| 299 | 299 | } |
| 300 | 300 | if ($search_stock_physique) { |
| 301 | - $param .= '&search_stock_physique=' . urlencode($search_stock_physique); |
|
| 301 | + $param .= '&search_stock_physique='.urlencode($search_stock_physique); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | llxHeader("", $texte, $helpurl); |
@@ -156,7 +156,7 @@ |
||
| 156 | 156 | * $price Can be set to update AWP (Average Weighted Price) when you make a stock increase |
| 157 | 157 | * $dlc Eat-by date. Will be used if lot does not exists yet and will be created. |
| 158 | 158 | * $dluo Sell-by date. Will be used if lot does not exists yet and will be created. |
| 159 | - * |
|
| 159 | + * |
|
| 160 | 160 | * @param int $product_id Id product id {@min 1} {@from body} {@required true} |
| 161 | 161 | * @param int $warehouse_id Id warehouse {@min 1} {@from body} {@required true} |
| 162 | 162 | * @param float $qty Qty to add (Use negative value for a stock decrease) {@from body} {@required true} |