@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | if (getDolGlobalString('EXPEDITION_ADDON_NUMBER')) { |
| 371 | 371 | $mybool = false; |
| 372 | 372 | |
| 373 | - $file = getDolGlobalString('EXPEDITION_ADDON_NUMBER') . ".php"; |
|
| 373 | + $file = getDolGlobalString('EXPEDITION_ADDON_NUMBER').".php"; |
|
| 374 | 374 | $classname = getDolGlobalString('EXPEDITION_ADDON_NUMBER'); |
| 375 | 375 | |
| 376 | 376 | // Include file with class |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | $line_id = $this->create_line($warehouse_id, 0, $product_child_qty, $line->rang, $line->array_options, $parent_line_id, $product_child_id); |
| 643 | 643 | if ($line_id <= 0) { |
| 644 | 644 | $error++; |
| 645 | - dol_syslog(__METHOD__ . ' : ' . $this->errorsToString(), LOG_ERR); |
|
| 645 | + dol_syslog(__METHOD__.' : '.$this->errorsToString(), LOG_ERR); |
|
| 646 | 646 | break; |
| 647 | 647 | } |
| 648 | 648 | |
@@ -869,20 +869,20 @@ discard block |
||
| 869 | 869 | if ($this->db->num_rows($result)) { |
| 870 | 870 | $obj = $this->db->fetch_object($result); |
| 871 | 871 | |
| 872 | - $this->id = (int) $obj->rowid; |
|
| 873 | - $this->entity = $obj->entity; |
|
| 874 | - $this->ref = $obj->ref; |
|
| 875 | - $this->socid = $obj->socid; |
|
| 876 | - $this->ref_customer = $obj->ref_customer; |
|
| 877 | - $this->ref_ext = $obj->ref_ext; |
|
| 872 | + $this->id = (int) $obj->rowid; |
|
| 873 | + $this->entity = $obj->entity; |
|
| 874 | + $this->ref = $obj->ref; |
|
| 875 | + $this->socid = $obj->socid; |
|
| 876 | + $this->ref_customer = $obj->ref_customer; |
|
| 877 | + $this->ref_ext = $obj->ref_ext; |
|
| 878 | 878 | $this->status = $obj->fk_statut; |
| 879 | 879 | $this->statut = $this->status; // Deprecated |
| 880 | - $this->signed_status = $obj->signed_status; |
|
| 880 | + $this->signed_status = $obj->signed_status; |
|
| 881 | 881 | $this->user_author_id = $obj->fk_user_author; |
| 882 | 882 | $this->fk_user_author = $obj->fk_user_author; |
| 883 | - $this->user_creation_id = $obj->fk_user_author; |
|
| 883 | + $this->user_creation_id = $obj->fk_user_author; |
|
| 884 | 884 | $this->date_creation = $this->db->jdate($obj->date_creation); |
| 885 | - $this->date_valid = $this->db->jdate($obj->date_valid); |
|
| 885 | + $this->date_valid = $this->db->jdate($obj->date_valid); |
|
| 886 | 886 | $this->date = $this->db->jdate($obj->date_expedition); // TODO deprecated |
| 887 | 887 | $this->date_expedition = $this->db->jdate($obj->date_expedition); // TODO deprecated |
| 888 | 888 | $this->date_shipping = $this->db->jdate($obj->date_expedition); // Date real |
@@ -890,13 +890,13 @@ discard block |
||
| 890 | 890 | $this->fk_delivery_address = $obj->fk_address; |
| 891 | 891 | $this->model_pdf = $obj->model_pdf; |
| 892 | 892 | $this->shipping_method_id = $obj->fk_shipping_method; |
| 893 | - $this->shipping_method = $obj->shipping_method; |
|
| 893 | + $this->shipping_method = $obj->shipping_method; |
|
| 894 | 894 | $this->tracking_number = $obj->tracking_number; |
| 895 | 895 | $this->origin = ($obj->origin_type ? $obj->origin_type : 'commande'); // For compatibility |
| 896 | 896 | $this->origin_type = ($obj->origin_type ? $obj->origin_type : 'commande'); |
| 897 | 897 | $this->origin_id = $obj->origin_id; |
| 898 | 898 | $this->billed = $obj->billed; |
| 899 | - $this->fk_project = $obj->fk_project; |
|
| 899 | + $this->fk_project = $obj->fk_project; |
|
| 900 | 900 | $this->signed_status = $obj->signed_status; |
| 901 | 901 | $this->trueWeight = $obj->weight; |
| 902 | 902 | $this->weight_units = $obj->weight_units; |
@@ -1263,7 +1263,7 @@ discard block |
||
| 1263 | 1263 | // If product need a batch number, we should not have called this function but addline_batch instead. |
| 1264 | 1264 | // If this happen, we may have a bug in card.php page |
| 1265 | 1265 | if (isModEnabled('productbatch') && !empty($line->fk_product) && !empty($orderline->product_tobatch)) { |
| 1266 | - $this->error = 'ADDLINE_WAS_CALLED_INSTEAD_OF_ADDLINEBATCH '.$orderline->id.' '.$line->fk_product; // |
|
| 1266 | + $this->error = 'ADDLINE_WAS_CALLED_INSTEAD_OF_ADDLINEBATCH '.$orderline->id.' '.$line->fk_product; // |
|
| 1267 | 1267 | return -4; |
| 1268 | 1268 | } |
| 1269 | 1269 | |
@@ -2048,14 +2048,14 @@ discard block |
||
| 2048 | 2048 | $this->db->commit(); |
| 2049 | 2049 | |
| 2050 | 2050 | // Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive |
| 2051 | - $this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive |
|
| 2052 | - $this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive |
|
| 2051 | + $this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive |
|
| 2052 | + $this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive |
|
| 2053 | 2053 | |
| 2054 | 2054 | // We delete PDFs |
| 2055 | 2055 | $ref = dol_sanitizeFileName($this->ref); |
| 2056 | 2056 | if (!empty($conf->expedition->dir_output)) { |
| 2057 | - $dir = $conf->expedition->dir_output . '/sending/' . $ref; |
|
| 2058 | - $file = $dir . '/' . $ref . '.pdf'; |
|
| 2057 | + $dir = $conf->expedition->dir_output.'/sending/'.$ref; |
|
| 2058 | + $file = $dir.'/'.$ref.'.pdf'; |
|
| 2059 | 2059 | if (file_exists($file)) { |
| 2060 | 2060 | if (!dol_delete_file($file)) { |
| 2061 | 2061 | return 0; |
@@ -2115,7 +2115,7 @@ discard block |
||
| 2115 | 2115 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product"; |
| 2116 | 2116 | $sql .= " WHERE ed.fk_expedition = ".((int) $this->id); |
| 2117 | 2117 | $sql .= " AND ed.fk_elementdet = cd.rowid"; |
| 2118 | - $sql .= " ORDER BY cd.rang, ed.fk_elementdet"; // We need after a break on fk_elementdet but when there is no break on fk_elementdet, cd.rang is same so we can add it as first order criteria. |
|
| 2118 | + $sql .= " ORDER BY cd.rang, ed.fk_elementdet"; // We need after a break on fk_elementdet but when there is no break on fk_elementdet, cd.rang is same so we can add it as first order criteria. |
|
| 2119 | 2119 | |
| 2120 | 2120 | dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); |
| 2121 | 2121 | $resql = $this->db->query($sql); |
@@ -2149,9 +2149,9 @@ discard block |
||
| 2149 | 2149 | $line->entrepot_id = 0; // entrepod_id in details_entrepot |
| 2150 | 2150 | $line->qty_shipped += $obj->qty_shipped; |
| 2151 | 2151 | } else { |
| 2152 | - $line = new ExpeditionLigne($this->db); // new group to start |
|
| 2153 | - $line->entrepot_id = $obj->fk_entrepot; // this is a property of a shipment line |
|
| 2154 | - $line->qty_shipped = $obj->qty_shipped; // this is a property of a shipment line |
|
| 2152 | + $line = new ExpeditionLigne($this->db); // new group to start |
|
| 2153 | + $line->entrepot_id = $obj->fk_entrepot; // this is a property of a shipment line |
|
| 2154 | + $line->qty_shipped = $obj->qty_shipped; // this is a property of a shipment line |
|
| 2155 | 2155 | } |
| 2156 | 2156 | |
| 2157 | 2157 | $detail_entrepot = new stdClass(); |
@@ -2164,13 +2164,13 @@ discard block |
||
| 2164 | 2164 | $line->rowid = $obj->line_id; // TODO deprecated |
| 2165 | 2165 | $line->id = $obj->line_id; |
| 2166 | 2166 | |
| 2167 | - $line->fk_origin = 'orderline'; // TODO deprecated, we already have element_type that can be use to guess type of line |
|
| 2167 | + $line->fk_origin = 'orderline'; // TODO deprecated, we already have element_type that can be use to guess type of line |
|
| 2168 | 2168 | |
| 2169 | - $line->fk_element = $obj->fk_element; |
|
| 2170 | - $line->origin_id = $obj->fk_element; |
|
| 2171 | - $line->fk_elementdet = $obj->fk_elementdet; |
|
| 2172 | - $line->origin_line_id = $obj->fk_elementdet; |
|
| 2173 | - $line->element_type = $obj->element_type; |
|
| 2169 | + $line->fk_element = $obj->fk_element; |
|
| 2170 | + $line->origin_id = $obj->fk_element; |
|
| 2171 | + $line->fk_elementdet = $obj->fk_elementdet; |
|
| 2172 | + $line->origin_line_id = $obj->fk_elementdet; |
|
| 2173 | + $line->element_type = $obj->element_type; |
|
| 2174 | 2174 | |
| 2175 | 2175 | $line->fk_expedition = $this->id; // id of parent |
| 2176 | 2176 | |
@@ -2357,16 +2357,16 @@ discard block |
||
| 2357 | 2357 | $line = new ExpeditionLigne($this->db); |
| 2358 | 2358 | |
| 2359 | 2359 | $line->rowid = $objp->rowid; |
| 2360 | - $line->id = $objp->rowid; |
|
| 2361 | - $line->fk_expedition = $this->id; |
|
| 2360 | + $line->id = $objp->rowid; |
|
| 2361 | + $line->fk_expedition = $this->id; |
|
| 2362 | 2362 | $line->description = $objp->description; |
| 2363 | 2363 | $line->qty = $objp->qty; |
| 2364 | 2364 | $line->fk_entrepot = $objp->fk_entrepot; |
| 2365 | 2365 | $line->fk_product = $objp->fk_product; |
| 2366 | 2366 | $line->rang = $objp->rang; |
| 2367 | - $line->fk_element = $objp->fk_element; |
|
| 2367 | + $line->fk_element = $objp->fk_element; |
|
| 2368 | 2368 | $line->fk_unit = $objp->fk_unit; |
| 2369 | - $line->fk_elementdet = $objp->fk_elementdet; |
|
| 2369 | + $line->fk_elementdet = $objp->fk_elementdet; |
|
| 2370 | 2370 | $line->fk_element_type = $objp->element_type; |
| 2371 | 2371 | $line->fetch_optionals(); |
| 2372 | 2372 | |
@@ -2533,7 +2533,7 @@ discard block |
||
| 2533 | 2533 | } |
| 2534 | 2534 | $result .= $linkend; |
| 2535 | 2535 | global $action; |
| 2536 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 2536 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 2537 | 2537 | $parameters = array('id' => $this->id, 'getnomurl' => &$result); |
| 2538 | 2538 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 2539 | 2539 | if ($reshook > 0) { |
@@ -2582,9 +2582,9 @@ discard block |
||
| 2582 | 2582 | $statusType = 'status9'; |
| 2583 | 2583 | } |
| 2584 | 2584 | |
| 2585 | - $signed_label = ' (' . $this->getLibSignedStatus() . ')'; |
|
| 2586 | - $status_label = $this->signed_status ? $labelStatus . $signed_label : $labelStatus; |
|
| 2587 | - $status_label_short = $this->signed_status ? $labelStatusShort . $signed_label : $labelStatusShort; |
|
| 2585 | + $signed_label = ' ('.$this->getLibSignedStatus().')'; |
|
| 2586 | + $status_label = $this->signed_status ? $labelStatus.$signed_label : $labelStatus; |
|
| 2587 | + $status_label_short = $this->signed_status ? $labelStatusShort.$signed_label : $labelStatusShort; |
|
| 2588 | 2588 | |
| 2589 | 2589 | return dolGetStatus($status_label, $status_label_short, '', $statusType, $mode); |
| 2590 | 2590 | } |
@@ -2608,7 +2608,7 @@ discard block |
||
| 2608 | 2608 | $return .= img_picto('', 'order'); |
| 2609 | 2609 | $return .= '</div>'; |
| 2610 | 2610 | $return .= '<div class="info-box-content">'; |
| 2611 | - $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . $this->getNomUrl() . '</span>'; |
|
| 2611 | + $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.$this->getNomUrl().'</span>'; |
|
| 2612 | 2612 | if ($selected >= 0) { |
| 2613 | 2613 | $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>'; |
| 2614 | 2614 | } |
@@ -2665,7 +2665,7 @@ discard block |
||
| 2665 | 2665 | $this->note_private = 'Private note'; |
| 2666 | 2666 | $this->note_public = 'Public note'; |
| 2667 | 2667 | |
| 2668 | - $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) |
|
| 2668 | + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) |
|
| 2669 | 2669 | $xnbp = 0; |
| 2670 | 2670 | while ($xnbp < $nbp) { |
| 2671 | 2671 | $line = new ExpeditionLigne($this->db); |
@@ -2677,7 +2677,7 @@ discard block |
||
| 2677 | 2677 | $line->fk_product = $this->commande->lines[$xnbp]->fk_product; |
| 2678 | 2678 | |
| 2679 | 2679 | $line->weight = 1.123456; |
| 2680 | - $line->weight_units = 0; // kg |
|
| 2680 | + $line->weight_units = 0; // kg |
|
| 2681 | 2681 | |
| 2682 | 2682 | $line->volume = 2.34567; |
| 2683 | 2683 | $line->volume_unit = 0; |
@@ -2901,12 +2901,12 @@ discard block |
||
| 2901 | 2901 | if ($shipments_match_order) { |
| 2902 | 2902 | dol_syslog("Qty for the ".count($order->lines)." lines of the origin order is same than qty for lines in the shipment we close (shipments_match_order is true), with new status Expedition::STATUS_CLOSED=".self::STATUS_CLOSED.', so we close order'); |
| 2903 | 2903 | // We close the order |
| 2904 | - $order->cloture($user); // Note this may also create an invoice if module workflow ask it |
|
| 2904 | + $order->cloture($user); // Note this may also create an invoice if module workflow ask it |
|
| 2905 | 2905 | } |
| 2906 | 2906 | } |
| 2907 | 2907 | |
| 2908 | - $this->statut = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback |
|
| 2909 | - $this->status = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback |
|
| 2908 | + $this->statut = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback |
|
| 2909 | + $this->status = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback |
|
| 2910 | 2910 | |
| 2911 | 2911 | // If stock increment is done on closing |
| 2912 | 2912 | if (isModEnabled('stock') && getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT_CLOSE')) { |
@@ -2954,7 +2954,7 @@ discard block |
||
| 2954 | 2954 | |
| 2955 | 2955 | $error = 0; |
| 2956 | 2956 | |
| 2957 | - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/mouvementstock.class.php'; |
|
| 2957 | + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; |
|
| 2958 | 2958 | |
| 2959 | 2959 | $langs->load("agenda"); |
| 2960 | 2960 | |
@@ -2965,14 +2965,14 @@ discard block |
||
| 2965 | 2965 | $sql .= ", cd.subprice"; |
| 2966 | 2966 | $sql .= ", edb.rowid as edbrowid, edb.eatby, edb.sellby, edb.batch, edb.qty as edbqty, edb.fk_origin_stock"; |
| 2967 | 2967 | $sql .= ", e.ref"; |
| 2968 | - $sql .= " FROM " . $this->db->prefix() . "expeditiondet as ed"; |
|
| 2969 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "commandedet as cd ON cd.rowid = ed.fk_elementdet"; |
|
| 2970 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "expeditiondet_batch as edb on edb.fk_expeditiondet = ed.rowid"; |
|
| 2971 | - $sql .= " INNER JOIN " . $this->db->prefix() . "expedition as e ON ed.fk_expedition = e.rowid"; |
|
| 2972 | - $sql .= " WHERE ed.fk_expedition = " . ((int) $this->id); |
|
| 2968 | + $sql .= " FROM ".$this->db->prefix()."expeditiondet as ed"; |
|
| 2969 | + $sql .= " LEFT JOIN ".$this->db->prefix()."commandedet as cd ON cd.rowid = ed.fk_elementdet"; |
|
| 2970 | + $sql .= " LEFT JOIN ".$this->db->prefix()."expeditiondet_batch as edb on edb.fk_expeditiondet = ed.rowid"; |
|
| 2971 | + $sql .= " INNER JOIN ".$this->db->prefix()."expedition as e ON ed.fk_expedition = e.rowid"; |
|
| 2972 | + $sql .= " WHERE ed.fk_expedition = ".((int) $this->id); |
|
| 2973 | 2973 | //$sql .= " AND cd.rowid = ed.fk_elementdet"; |
| 2974 | 2974 | |
| 2975 | - dol_syslog(get_class($this) . "::valid select details", LOG_DEBUG); |
|
| 2975 | + dol_syslog(get_class($this)."::valid select details", LOG_DEBUG); |
|
| 2976 | 2976 | $resql = $this->db->query($sql); |
| 2977 | 2977 | if ($resql) { |
| 2978 | 2978 | $cpt = $this->db->num_rows($resql); |
@@ -2986,7 +2986,7 @@ discard block |
||
| 2986 | 2986 | if ($qty <= 0 || ($qty < 0 && !getDolGlobalInt('SHIPMENT_ALLOW_NEGATIVE_QTY'))) { |
| 2987 | 2987 | continue; |
| 2988 | 2988 | } |
| 2989 | - dol_syslog(get_class($this) . "::valid movement index " . $i . " ed.rowid=" . $obj->edid . " edb.rowid=" . $obj->edbrowid); |
|
| 2989 | + dol_syslog(get_class($this)."::valid movement index ".$i." ed.rowid=".$obj->edid." edb.rowid=".$obj->edbrowid); |
|
| 2990 | 2990 | |
| 2991 | 2991 | $mouvS = new MouvementStock($this->db); |
| 2992 | 2992 | $mouvS->origin = &$this; |
@@ -177,25 +177,25 @@ discard block |
||
| 177 | 177 | global $langs; |
| 178 | 178 | |
| 179 | 179 | $sql = "SELECT COUNT(*) AS nb"; |
| 180 | - $sql .= " FROM " . $this->db->prefix() . "product_customer_price as t"; |
|
| 181 | - $sql .= " WHERE (t.date_begin = '" . $this->db->idate($this->date_begin) . "' OR t.date_end = '" . $this->db->idate($this->date_begin) . "'"; |
|
| 182 | - $sql .= " OR t.date_begin = '" . $this->db->idate($this->date_end) . "' OR t.date_end = '" . $this->db->idate($this->date_end) . "'"; |
|
| 183 | - $sql .= " OR (t.date_begin <= '" . $this->db->idate($this->date_begin) . "' AND '" . $this->db->idate($this->date_begin) . "' <= t.date_end)"; |
|
| 184 | - $sql .= " OR (t.date_begin <= '" . $this->db->idate($this->date_end) . "' AND '" . $this->db->idate($this->date_end) . "' <= t.date_end))"; |
|
| 180 | + $sql .= " FROM ".$this->db->prefix()."product_customer_price as t"; |
|
| 181 | + $sql .= " WHERE (t.date_begin = '".$this->db->idate($this->date_begin)."' OR t.date_end = '".$this->db->idate($this->date_begin)."'"; |
|
| 182 | + $sql .= " OR t.date_begin = '".$this->db->idate($this->date_end)."' OR t.date_end = '".$this->db->idate($this->date_end)."'"; |
|
| 183 | + $sql .= " OR (t.date_begin <= '".$this->db->idate($this->date_begin)."' AND '".$this->db->idate($this->date_begin)."' <= t.date_end)"; |
|
| 184 | + $sql .= " OR (t.date_begin <= '".$this->db->idate($this->date_end)."' AND '".$this->db->idate($this->date_end)."' <= t.date_end))"; |
|
| 185 | 185 | if ($this->fk_product > 0) { |
| 186 | - $sql .= " AND t.fk_product = " . ((int) $this->fk_product); |
|
| 186 | + $sql .= " AND t.fk_product = ".((int) $this->fk_product); |
|
| 187 | 187 | } |
| 188 | 188 | if ($this->fk_soc > 0) { |
| 189 | - $sql .= " AND t.fk_soc = " . ((int) $this->fk_soc); |
|
| 189 | + $sql .= " AND t.fk_soc = ".((int) $this->fk_soc); |
|
| 190 | 190 | } |
| 191 | 191 | if ($this->id > 0) { |
| 192 | - $sql .= " AND t.rowid != " . ((int) $this->id); |
|
| 192 | + $sql .= " AND t.rowid != ".((int) $this->id); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - dol_syslog(get_class($this) . "::fetch", LOG_DEBUG); |
|
| 195 | + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); |
|
| 196 | 196 | $resql = $this->db->query($sql); |
| 197 | 197 | if (!$resql) { |
| 198 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 198 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 199 | 199 | return -1; |
| 200 | 200 | } |
| 201 | 201 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | $sql .= " '".$this->db->idate($this->date_begin)."',"; |
| 371 | 371 | $sql .= " ".(empty($this->date_end) ? 'NULL' : "'".$this->db->idate($this->date_end)."'").","; |
| 372 | 372 | $sql .= " ".((int) $user->id).","; |
| 373 | - $sql .= " ".(!isset($this->price_label) ? 'NULL' : "'".$this->db->escape($this->price_label)."'").","; |
|
| 373 | + $sql .= " ".(!isset($this->price_label) ? 'NULL' : "'".$this->db->escape($this->price_label)."'").","; |
|
| 374 | 374 | $sql .= " ".(!isset($this->import_key) ? 'NULL' : "'".$this->db->escape($this->import_key)."'"); |
| 375 | 375 | $sql .= ")"; |
| 376 | 376 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | if ($fiscal_period_id == $fiscal_period['id'] || (empty($fiscal_period_id) && $fiscal_period['date_start'] <= $now && $now <= $fiscal_period['date_end'])) { |
| 98 | 98 | $current_fiscal_period = $fiscal_period; |
| 99 | 99 | } else { |
| 100 | - $last_fiscal_period = $fiscal_period; // $last_fiscal_period is in fact $previous_fiscal_period |
|
| 100 | + $last_fiscal_period = $fiscal_period; // $last_fiscal_period is in fact $previous_fiscal_period |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | if ($result > 0) { |
| 147 | 147 | setEventMessages($langs->trans("AllMovementsWereRecordedAsValidated"), null, 'mesgs'); |
| 148 | 148 | |
| 149 | - header("Location: " . $_SERVER['PHP_SELF'] . '?fiscal_period_id=' . $current_fiscal_period['id']); |
|
| 149 | + header("Location: ".$_SERVER['PHP_SELF'].'?fiscal_period_id='.$current_fiscal_period['id']); |
|
| 150 | 150 | exit; |
| 151 | 151 | } else { |
| 152 | 152 | setEventMessages($langs->trans("NotAllMovementsCouldBeRecordedAsValidated"), null, 'errors'); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | } else { |
| 177 | 177 | setEventMessages($langs->trans("AccountancyClosureCloseSuccessfully"), null, 'mesgs'); |
| 178 | 178 | |
| 179 | - header("Location: " . $_SERVER['PHP_SELF'] . '?fiscal_period_id=' . $current_fiscal_period['id']); |
|
| 179 | + header("Location: ".$_SERVER['PHP_SELF'].'?fiscal_period_id='.$current_fiscal_period['id']); |
|
| 180 | 180 | exit; |
| 181 | 181 | } |
| 182 | 182 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | } else { |
| 193 | 193 | setEventMessages($langs->trans("AccountancyClosureInsertAccountingReversalSuccessfully"), null, 'mesgs'); |
| 194 | 194 | |
| 195 | - header("Location: " . $_SERVER['PHP_SELF'] . '?fiscal_period_id=' . $current_fiscal_period['id']); |
|
| 195 | + header("Location: ".$_SERVER['PHP_SELF'].'?fiscal_period_id='.$current_fiscal_period['id']); |
|
| 196 | 196 | exit; |
| 197 | 197 | } |
| 198 | 198 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | ); |
| 234 | 234 | |
| 235 | 235 | $formconfirm = $form->formconfirm( |
| 236 | - $_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'], |
|
| 236 | + $_SERVER["PHP_SELF"].'?fiscal_period_id='.$current_fiscal_period['id'], |
|
| 237 | 237 | $langs->trans('ValidateMovements'), |
| 238 | 238 | $langs->trans('DescValidateMovements', $langs->transnoentitiesnoconv("RegistrationInAccounting")), |
| 239 | 239 | 'confirm_step_1', |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | ); |
| 272 | 272 | |
| 273 | 273 | $formconfirm = $form->formconfirm( |
| 274 | - $_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'], |
|
| 274 | + $_SERVER["PHP_SELF"].'?fiscal_period_id='.$current_fiscal_period['id'], |
|
| 275 | 275 | $langs->trans('AccountancyClosureClose'), |
| 276 | 276 | $langs->trans('AccountancyClosureConfirmClose'), |
| 277 | 277 | 'confirm_step_2', |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | ); |
| 316 | 316 | |
| 317 | 317 | $formconfirm = $form->formconfirm( |
| 318 | - $_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'], |
|
| 318 | + $_SERVER["PHP_SELF"].'?fiscal_period_id='.$current_fiscal_period['id'], |
|
| 319 | 319 | $langs->trans('AccountancyClosureAccountingReversal'), |
| 320 | 320 | $langs->trans('AccountancyClosureConfirmAccountingReversal'), |
| 321 | 321 | 'confirm_step_3', |
@@ -342,13 +342,13 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | $fiscal_period_nav_text = $langs->trans("FiscalPeriod"); |
| 344 | 344 | |
| 345 | -$fiscal_period_nav_text .= ' <a href="' . (isset($last_fiscal_period) ? $_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $last_fiscal_period['id'] : '#" class="disabled') . '">' . img_previous() . '</a>'; |
|
| 346 | -$fiscal_period_nav_text .= ' <a href="' . (isset($next_fiscal_period) ? $_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $next_fiscal_period['id'] : '#" class="disabled') . '">' . img_next() . '</a>'; |
|
| 345 | +$fiscal_period_nav_text .= ' <a href="'.(isset($last_fiscal_period) ? $_SERVER["PHP_SELF"].'?fiscal_period_id='.$last_fiscal_period['id'] : '#" class="disabled').'">'.img_previous().'</a>'; |
|
| 346 | +$fiscal_period_nav_text .= ' <a href="'.(isset($next_fiscal_period) ? $_SERVER["PHP_SELF"].'?fiscal_period_id='.$next_fiscal_period['id'] : '#" class="disabled').'">'.img_next().'</a>'; |
|
| 347 | 347 | if (!empty($current_fiscal_period)) { |
| 348 | - $fiscal_period_nav_text .= $current_fiscal_period['label'].' (' . dol_print_date($current_fiscal_period['date_start'], 'day') . ' - ' . dol_print_date($current_fiscal_period['date_end'], 'day') . ')'; |
|
| 348 | + $fiscal_period_nav_text .= $current_fiscal_period['label'].' ('.dol_print_date($current_fiscal_period['date_start'], 'day').' - '.dol_print_date($current_fiscal_period['date_end'], 'day').')'; |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | -print load_fiche_titre($langs->trans("Closure") . " - " . $fiscal_period_nav_text, '', 'title_accountancy'); |
|
| 351 | +print load_fiche_titre($langs->trans("Closure")." - ".$fiscal_period_nav_text, '', 'title_accountancy'); |
|
| 352 | 352 | |
| 353 | 353 | if (empty($current_fiscal_period)) { |
| 354 | 354 | print $langs->trans('ErrorNoFiscalPeriodActiveFound', $langs->transnoentitiesnoconv("Accounting"), $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("FiscalPeriod")); |
@@ -356,12 +356,12 @@ discard block |
||
| 356 | 356 | if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) { |
| 357 | 357 | // Step 1 |
| 358 | 358 | $head = array(); |
| 359 | - $head[0][0] = DOL_URL_ROOT . '/accountancy/closure/index.php?fiscal_period_id=' . $current_fiscal_period['id']; |
|
| 359 | + $head[0][0] = DOL_URL_ROOT.'/accountancy/closure/index.php?fiscal_period_id='.$current_fiscal_period['id']; |
|
| 360 | 360 | $head[0][1] = $langs->trans("Step").' 1 - '.$langs->trans("AccountancyClosureStep1"); |
| 361 | 361 | $head[0][2] = 'step1'; |
| 362 | 362 | print dol_get_fiche_head($head, 'step1', '', -1, ''); |
| 363 | 363 | |
| 364 | - print '<span class="opacitymedium">' . $langs->trans("AccountancyClosureStep1Desc") . '</span><br>'; |
|
| 364 | + print '<span class="opacitymedium">'.$langs->trans("AccountancyClosureStep1Desc").'</span><br>'; |
|
| 365 | 365 | |
| 366 | 366 | $count_by_month = $object->getCountByMonthForFiscalPeriod((int) $current_fiscal_period['date_start'], (int) $current_fiscal_period['date_end']); |
| 367 | 367 | |
@@ -370,9 +370,9 @@ discard block |
||
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | if (empty($count_by_month['total'])) { |
| 373 | - $buttonvalidate = '<a class="butActionRefused classfortooltip" href="#">' . $langs->trans("ValidateMovements") . '</a>'; |
|
| 373 | + $buttonvalidate = '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("ValidateMovements").'</a>'; |
|
| 374 | 374 | } else { |
| 375 | - $buttonvalidate = '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=step_1&token='.newToken().'&fiscal_period_id=' . $current_fiscal_period['id'] . '">' . $langs->trans("ValidateMovements") . '</a>'; |
|
| 375 | + $buttonvalidate = '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=step_1&token='.newToken().'&fiscal_period_id='.$current_fiscal_period['id'].'">'.$langs->trans("ValidateMovements").'</a>'; |
|
| 376 | 376 | } |
| 377 | 377 | print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), 0, '', '', '', '', '', -1, '', '', 0, $buttonvalidate, '', 0, 1, 0); |
| 378 | 378 | |
@@ -382,24 +382,24 @@ discard block |
||
| 382 | 382 | print '<tr class="liste_titre">'; |
| 383 | 383 | $nb_years = is_array($count_by_month['list']) ? count($count_by_month['list']) : 0; |
| 384 | 384 | if ($nb_years > 1) { |
| 385 | - print '<td class="right">' . $langs->trans("Year") . '</td>'; |
|
| 385 | + print '<td class="right">'.$langs->trans("Year").'</td>'; |
|
| 386 | 386 | } |
| 387 | 387 | for ($i = 1; $i <= 12; $i++) { |
| 388 | - print '<td class="right">' . $langs->trans('MonthShort' . str_pad((string) $i, 2, '0', STR_PAD_LEFT)) . '</td>'; |
|
| 388 | + print '<td class="right">'.$langs->trans('MonthShort'.str_pad((string) $i, 2, '0', STR_PAD_LEFT)).'</td>'; |
|
| 389 | 389 | } |
| 390 | - print '<td class="right"><b>' . $langs->trans("Total") . '</b></td>'; |
|
| 390 | + print '<td class="right"><b>'.$langs->trans("Total").'</b></td>'; |
|
| 391 | 391 | print '</tr>'; |
| 392 | 392 | |
| 393 | 393 | if (is_array($count_by_month['list'])) { |
| 394 | 394 | foreach ($count_by_month['list'] as $info) { |
| 395 | 395 | print '<tr class="oddeven">'; |
| 396 | 396 | if ($nb_years > 1) { |
| 397 | - print '<td class="right">' . $info['year'] . '</td>'; |
|
| 397 | + print '<td class="right">'.$info['year'].'</td>'; |
|
| 398 | 398 | } |
| 399 | 399 | for ($i = 1; $i <= 12; $i++) { |
| 400 | - print '<td class="right">' . ((int) $info['count'][$i]) . '</td>'; |
|
| 400 | + print '<td class="right">'.((int) $info['count'][$i]).'</td>'; |
|
| 401 | 401 | } |
| 402 | - print '<td class="right"><b>' . $info['total'] . '</b></td></tr>'; |
|
| 402 | + print '<td class="right"><b>'.$info['total'].'</b></td></tr>'; |
|
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | |
@@ -411,8 +411,8 @@ discard block |
||
| 411 | 411 | |
| 412 | 412 | // Step 2 |
| 413 | 413 | $head = array(); |
| 414 | - $head[0][0] = DOL_URL_ROOT . '/accountancy/closure/index.php?fiscal_period_id=' . $current_fiscal_period['id']; |
|
| 415 | - $head[0][1] = $langs->trans("Step"). ' ' . (getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE") ? '1' : '2').' - '.$langs->trans("AccountancyClosureStep2"); |
|
| 414 | + $head[0][0] = DOL_URL_ROOT.'/accountancy/closure/index.php?fiscal_period_id='.$current_fiscal_period['id']; |
|
| 415 | + $head[0][1] = $langs->trans("Step").' '.(getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE") ? '1' : '2').' - '.$langs->trans("AccountancyClosureStep2"); |
|
| 416 | 416 | $head[0][2] = 'step2'; |
| 417 | 417 | print dol_get_fiche_head($head, 'step2', '', -1, ''); |
| 418 | 418 | |
@@ -420,12 +420,12 @@ discard block |
||
| 420 | 420 | // print '<span class="opacitymedium">' . $langs->trans("AccountancyClosureStep2Desc") . '</span><br>'; |
| 421 | 421 | if ((empty($count_by_month['total']) || getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) && empty($current_fiscal_period['status'])) { |
| 422 | 422 | // If no unlocked record and period still open |
| 423 | - $button = '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=step_2&token='.newToken().'&fiscal_period_id=' . $current_fiscal_period['id'] . '">' . $langs->trans("AccountancyClosureClose") . '</a>'; |
|
| 423 | + $button = '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=step_2&token='.newToken().'&fiscal_period_id='.$current_fiscal_period['id'].'">'.$langs->trans("AccountancyClosureClose").'</a>'; |
|
| 424 | 424 | } else { |
| 425 | 425 | if (!empty($current_fiscal_period['status'])) { |
| 426 | - $button = '<a class="butActionRefused classfortooltip" href="#" title="The period is already closed. Feature disabled.">' . $langs->trans("AccountancyClosureClose") . '</a>'; |
|
| 426 | + $button = '<a class="butActionRefused classfortooltip" href="#" title="The period is already closed. Feature disabled.">'.$langs->trans("AccountancyClosureClose").'</a>'; |
|
| 427 | 427 | } elseif (!empty($count_by_month['total'])) { |
| 428 | - $button = '<a class="butActionRefused classfortooltip" href="#" title="There is some lines not yet locked. Feature disabled.">' . $langs->trans("AccountancyClosureClose") . '</a>'; |
|
| 428 | + $button = '<a class="butActionRefused classfortooltip" href="#" title="There is some lines not yet locked. Feature disabled.">'.$langs->trans("AccountancyClosureClose").'</a>'; |
|
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | print_barre_liste('', 0, '', '', '', '', '', -1, '', '', 0, $button, '', 0, 1, 0); |
@@ -434,17 +434,17 @@ discard block |
||
| 434 | 434 | |
| 435 | 435 | // Step 3 |
| 436 | 436 | $head = array(); |
| 437 | - $head[0][0] = DOL_URL_ROOT . '/accountancy/closure/index.php?fiscal_period_id=' . $current_fiscal_period['id']; |
|
| 438 | - $head[0][1] = $langs->trans("Step"). ' ' . (getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE") ? '2' : '3').' - '.$langs->trans("AccountancyClosureStep3"); |
|
| 437 | + $head[0][0] = DOL_URL_ROOT.'/accountancy/closure/index.php?fiscal_period_id='.$current_fiscal_period['id']; |
|
| 438 | + $head[0][1] = $langs->trans("Step").' '.(getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE") ? '2' : '3').' - '.$langs->trans("AccountancyClosureStep3"); |
|
| 439 | 439 | $head[0][2] = 'step3'; |
| 440 | 440 | print dol_get_fiche_head($head, 'step3', '', -1, ''); |
| 441 | 441 | |
| 442 | 442 | // print '<span class="opacitymedium">' . $langs->trans("AccountancyClosureStep3Desc") . '</span><br>'; |
| 443 | 443 | |
| 444 | 444 | if (empty($current_fiscal_period['status'])) { |
| 445 | - $button = '<a class="butActionRefused classfortooltip" href="#">' . $langs->trans("AccountancyClosureAccountingReversal") . '</a>'; |
|
| 445 | + $button = '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("AccountancyClosureAccountingReversal").'</a>'; |
|
| 446 | 446 | } else { |
| 447 | - $button = '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=step_3&token='.newToken().'&fiscal_period_id=' . $current_fiscal_period['id'] . '">' . $langs->trans("AccountancyClosureAccountingReversal") . '</a>'; |
|
| 447 | + $button = '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=step_3&token='.newToken().'&fiscal_period_id='.$current_fiscal_period['id'].'">'.$langs->trans("AccountancyClosureAccountingReversal").'</a>'; |
|
| 448 | 448 | } |
| 449 | 449 | print_barre_liste('', 0, '', '', '', '', '', -1, '', '', 0, $button, '', 0, 1, 0); |
| 450 | 450 | } |
@@ -382,8 +382,8 @@ discard block |
||
| 382 | 382 | */ |
| 383 | 383 | public function export(&$TData, $formatexportset, $withAttachment = 0, $downloadMode = 1, $outputMode = 1, $noouput = 1) |
| 384 | 384 | { |
| 385 | - global $db, $conf, $langs; // The tpl file use $db |
|
| 386 | - global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php |
|
| 385 | + global $db, $conf, $langs; // The tpl file use $db |
|
| 386 | + global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php |
|
| 387 | 387 | |
| 388 | 388 | // Define name of file to save |
| 389 | 389 | $filename = 'general_ledger-'.$this->getFormatCode($formatexportset); |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | $exportFileFullName = $completefilename; |
| 465 | 465 | $exportFileBaseName = basename($exportFileFullName); |
| 466 | 466 | $exportFileName = pathinfo($exportFileBaseName, PATHINFO_FILENAME); |
| 467 | - $exportFilePath = $outputDir . '/' . $exportFileFullName; |
|
| 467 | + $exportFilePath = $outputDir.'/'.$exportFileFullName; |
|
| 468 | 468 | $exportFile = fopen($exportFilePath, 'w'); |
| 469 | 469 | if (!$exportFile) { |
| 470 | 470 | $this->errors[] = $langs->trans('ErrorFileNotFound', $exportFilePath); |
@@ -478,8 +478,8 @@ discard block |
||
| 478 | 478 | ); |
| 479 | 479 | |
| 480 | 480 | // archive name and path |
| 481 | - $archiveFullName = $exportFileName . '.zip'; |
|
| 482 | - $archivePath = $outputDir . '/' . $archiveFullName; |
|
| 481 | + $archiveFullName = $exportFileName.'.zip'; |
|
| 482 | + $archivePath = $outputDir.'/'.$archiveFullName; |
|
| 483 | 483 | } |
| 484 | 484 | } |
| 485 | 485 | } |
@@ -620,11 +620,11 @@ discard block |
||
| 620 | 620 | if (!empty($downloadFileMimeType) && !empty($downloadFileFullName) && !empty($downloadFilePath) && empty($noouput)) { |
| 621 | 621 | // deprecated. We must not use this anymore, but have $noouput = 1 because HTTP header must be sent |
| 622 | 622 | // into main page not into a method. |
| 623 | - header('Content-Type: ' . $downloadFileMimeType); |
|
| 624 | - header('Content-Disposition: attachment; filename=' . $downloadFileFullName); |
|
| 623 | + header('Content-Type: '.$downloadFileMimeType); |
|
| 624 | + header('Content-Disposition: attachment; filename='.$downloadFileFullName); |
|
| 625 | 625 | header('Cache-Control: Public, must-revalidate'); |
| 626 | 626 | header('Pragma: public'); |
| 627 | - header('Content-Length: ' . dol_filesize($downloadFilePath)); |
|
| 627 | + header('Content-Length: '.dol_filesize($downloadFilePath)); |
|
| 628 | 628 | |
| 629 | 629 | readfileLowMemory($downloadFilePath); |
| 630 | 630 | } |
@@ -696,14 +696,14 @@ discard block |
||
| 696 | 696 | $refInvoice = ''; |
| 697 | 697 | if ($line->doc_type == 'customer_invoice') { |
| 698 | 698 | // Customer invoice |
| 699 | - require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; |
|
| 699 | + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
|
| 700 | 700 | $invoice = new Facture($this->db); |
| 701 | 701 | $invoice->fetch($line->fk_doc); |
| 702 | 702 | |
| 703 | 703 | $refInvoice = $invoice->ref; |
| 704 | 704 | } elseif ($line->doc_type == 'supplier_invoice') { |
| 705 | 705 | // Supplier invoice |
| 706 | - require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; |
|
| 706 | + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; |
|
| 707 | 707 | $invoice = new FactureFournisseur($this->db); |
| 708 | 708 | $invoice->fetch($line->fk_doc); |
| 709 | 709 | |
@@ -1384,25 +1384,25 @@ discard block |
||
| 1384 | 1384 | /*** preparation du champ label operation pour istea ***/ |
| 1385 | 1385 | // retrecissement du champs car ISTEA n'affiche pas bcp de caract�re. |
| 1386 | 1386 | $search = array('Paiement fournisseur ', 'Virement ', 'Paiement '); |
| 1387 | - $replace = array('Paiemt fourn ','Virt ','Paiemt '); |
|
| 1387 | + $replace = array('Paiemt fourn ', 'Virt ', 'Paiemt '); |
|
| 1388 | 1388 | $label_operation = str_replace($search, $replace, $line->label_operation); |
| 1389 | 1389 | // encadrement par des ' si le champs contient le separateur |
| 1390 | 1390 | $label_operation = preg_match('/'.$separator.'/', $label_operation) ? "'".$label_operation."'" : $label_operation; |
| 1391 | 1391 | |
| 1392 | 1392 | $tab = array(); |
| 1393 | 1393 | // export configurable |
| 1394 | - $tab[] = $line->piece_num; // colonne 1 : numero de piece ISTEA |
|
| 1395 | - $tab[] = $date_document; // colonne 2 : date ISTEA |
|
| 1396 | - $tab[] = $line->doc_ref; // colonne 3 : reference piece ISTEA |
|
| 1397 | - $tab[] = array_key_exists($line->piece_num, $tiers) ? $tiers[$line->piece_num] : ''; // colonne 4 : nom tiers ISTEA |
|
| 1398 | - $tab[] = length_accountg(($line->subledger_account && (substr($line->subledger_account, 0, 2) == substr($line->numero_compte, 0, 2))) ? $line->subledger_account : $line->numero_compte); // colonne 5 : numero de compte ISTEA |
|
| 1399 | - $tab[] = length_accountg($line->subledger_account ? $line->subledger_account : $line->numero_compte); // colonne 6 : numero de compte |
|
| 1400 | - $tab[] = length_accountg($line->subledger_account ? $line->numero_compte : ''); // G // colonne 7 : numero de compte principal (divers paiement ou 40100000 ou 41100000) |
|
| 1401 | - $tab[] = ($line->doc_type == 'bank') ? $label_operation : ($line->subledger_account ? $line->subledger_label : $line->label_compte); // colonne 8 : label de l'operation ISTEA |
|
| 1402 | - $tab[] = $label_operation; // colonne 9 : label de l'operation (semble non prise en compte par ISTEA) |
|
| 1403 | - $tab[] = price2num($line->debit); // colonne 10 : debit ISTEA |
|
| 1404 | - $tab[] = price2num($line->credit); // colonne 11 : credit ISTEA |
|
| 1405 | - $tab[] = $line->code_journal; // colonne 12 : journal ISTEA |
|
| 1394 | + $tab[] = $line->piece_num; // colonne 1 : numero de piece ISTEA |
|
| 1395 | + $tab[] = $date_document; // colonne 2 : date ISTEA |
|
| 1396 | + $tab[] = $line->doc_ref; // colonne 3 : reference piece ISTEA |
|
| 1397 | + $tab[] = array_key_exists($line->piece_num, $tiers) ? $tiers[$line->piece_num] : ''; // colonne 4 : nom tiers ISTEA |
|
| 1398 | + $tab[] = length_accountg(($line->subledger_account && (substr($line->subledger_account, 0, 2) == substr($line->numero_compte, 0, 2))) ? $line->subledger_account : $line->numero_compte); // colonne 5 : numero de compte ISTEA |
|
| 1399 | + $tab[] = length_accountg($line->subledger_account ? $line->subledger_account : $line->numero_compte); // colonne 6 : numero de compte |
|
| 1400 | + $tab[] = length_accountg($line->subledger_account ? $line->numero_compte : ''); // G // colonne 7 : numero de compte principal (divers paiement ou 40100000 ou 41100000) |
|
| 1401 | + $tab[] = ($line->doc_type == 'bank') ? $label_operation : ($line->subledger_account ? $line->subledger_label : $line->label_compte); // colonne 8 : label de l'operation ISTEA |
|
| 1402 | + $tab[] = $label_operation; // colonne 9 : label de l'operation (semble non prise en compte par ISTEA) |
|
| 1403 | + $tab[] = price2num($line->debit); // colonne 10 : debit ISTEA |
|
| 1404 | + $tab[] = price2num($line->credit); // colonne 11 : credit ISTEA |
|
| 1405 | + $tab[] = $line->code_journal; // colonne 12 : journal ISTEA |
|
| 1406 | 1406 | |
| 1407 | 1407 | $output = mb_convert_encoding('"'.implode('"'.$separator.'"', $tab).'"'.$this->end_line, 'ISO-8859-1'); |
| 1408 | 1408 | if ($exportFile) { |
@@ -1581,7 +1581,7 @@ discard block |
||
| 1581 | 1581 | if (!getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_SUPPLIERINVOICE_SOURCE_FILE')) { |
| 1582 | 1582 | '@phan-var-force FactureFournisseur $invoice'; |
| 1583 | 1583 | $objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output; |
| 1584 | - $objectDirPath .= '/' . rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/'); |
|
| 1584 | + $objectDirPath .= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/'); |
|
| 1585 | 1585 | } |
| 1586 | 1586 | } |
| 1587 | 1587 | $arrayofinclusion = array(); |
@@ -1801,7 +1801,7 @@ discard block |
||
| 1801 | 1801 | if (!getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_SUPPLIERINVOICE_SOURCE_FILE')) { |
| 1802 | 1802 | '@phan-var-force FactureFournisseur $invoice'; |
| 1803 | 1803 | $objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output; |
| 1804 | - $objectDirPath .= '/' . rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/'); |
|
| 1804 | + $objectDirPath .= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/'); |
|
| 1805 | 1805 | } |
| 1806 | 1806 | } |
| 1807 | 1807 | $arrayofinclusion = array(); |
@@ -2124,7 +2124,7 @@ discard block |
||
| 2124 | 2124 | // MOPM |
| 2125 | 2125 | $tab[] = ""; |
| 2126 | 2126 | // BONP |
| 2127 | - $tab[] = ""; |
|
| 2127 | + $tab[] = ""; |
|
| 2128 | 2128 | // BQAF |
| 2129 | 2129 | $tab[] = ""; |
| 2130 | 2130 | // ECES |
@@ -2330,7 +2330,7 @@ discard block |
||
| 2330 | 2330 | } |
| 2331 | 2331 | } elseif ($line->doc_type == 'customer_invoice') { |
| 2332 | 2332 | if (($line->amount) < 0) { |
| 2333 | - $nature_piece = 'AC'; // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long or make amount mandatory with rule on sign. |
|
| 2333 | + $nature_piece = 'AC'; // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long or make amount mandatory with rule on sign. |
|
| 2334 | 2334 | } else { |
| 2335 | 2335 | $nature_piece = 'FC'; |
| 2336 | 2336 | } |
@@ -2539,8 +2539,8 @@ discard block |
||
| 2539 | 2539 | ($line->doc_type == 'supplier_invoice' && !isset($supplier_invoices_infos[$line->fk_doc]))) { |
| 2540 | 2540 | if ($line->doc_type == 'customer_invoice') { |
| 2541 | 2541 | // Get new customer invoice ref and company name |
| 2542 | - $sql = 'SELECT f.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture as f'; |
|
| 2543 | - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON f.fk_soc = s.rowid'; |
|
| 2542 | + $sql = 'SELECT f.ref, s.nom FROM '.MAIN_DB_PREFIX.'facture as f'; |
|
| 2543 | + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON f.fk_soc = s.rowid'; |
|
| 2544 | 2544 | $sql .= ' WHERE f.rowid = '.((int) $line->fk_doc); |
| 2545 | 2545 | $resql = $this->db->query($sql); |
| 2546 | 2546 | if ($resql) { |
@@ -2553,8 +2553,8 @@ discard block |
||
| 2553 | 2553 | } |
| 2554 | 2554 | } else { |
| 2555 | 2555 | // Get new supplier invoice ref and company name |
| 2556 | - $sql = 'SELECT ff.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture_fourn as ff'; |
|
| 2557 | - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON ff.fk_soc = s.rowid'; |
|
| 2556 | + $sql = 'SELECT ff.ref, s.nom FROM '.MAIN_DB_PREFIX.'facture_fourn as ff'; |
|
| 2557 | + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON ff.fk_soc = s.rowid'; |
|
| 2558 | 2558 | $sql .= ' WHERE ff.rowid = '.((int) $line->fk_doc); |
| 2559 | 2559 | $resql = $this->db->query($sql); |
| 2560 | 2560 | if ($resql) { |
@@ -2592,7 +2592,7 @@ discard block |
||
| 2592 | 2592 | $tab[] = ""; |
| 2593 | 2593 | //print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"'; |
| 2594 | 2594 | //Libellé manual |
| 2595 | - $tab[] = dol_trunc(str_replace('"', '', $invoice_ref . (!empty($company_name) ? ' - ' : '') . $company_name), 40, 'right', 'UTF-8', 1); |
|
| 2595 | + $tab[] = dol_trunc(str_replace('"', '', $invoice_ref.(!empty($company_name) ? ' - ' : '').$company_name), 40, 'right', 'UTF-8', 1); |
|
| 2596 | 2596 | //Numéro de pièce |
| 2597 | 2597 | $tab[] = dol_trunc(str_replace('"', '', (string) $line->piece_num), 10, 'right', 'UTF-8', 1); |
| 2598 | 2598 | //Devise |
@@ -2646,8 +2646,8 @@ discard block |
||
| 2646 | 2646 | } |
| 2647 | 2647 | $tab[] = ""; |
| 2648 | 2648 | $tab[] = '"'.dol_trunc(str_replace('"', '', $line->label_operation), 40, 'right', 'UTF-8', 1).'"'; |
| 2649 | - $tab[] = '"' . dol_trunc(str_replace('"', '', $line->doc_ref), 40, 'right', 'UTF-8', 1) . '"'; |
|
| 2650 | - $tab[] = '"' . dol_trunc(str_replace('"', '', (string) $line->piece_num), 10, 'right', 'UTF-8', 1) . '"'; |
|
| 2649 | + $tab[] = '"'.dol_trunc(str_replace('"', '', $line->doc_ref), 40, 'right', 'UTF-8', 1).'"'; |
|
| 2650 | + $tab[] = '"'.dol_trunc(str_replace('"', '', (string) $line->piece_num), 10, 'right', 'UTF-8', 1).'"'; |
|
| 2651 | 2651 | $tab[] = price2num(abs($line->debit - $line->credit)); |
| 2652 | 2652 | $tab[] = $line->sens; |
| 2653 | 2653 | $tab[] = $date_document; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | { |
| 116 | 116 | $valid_nature = array(1, 2, 3, 4, 5, 8, 9); |
| 117 | 117 | if (!in_array((int) $this->nature, $valid_nature)) { |
| 118 | - $this->error = get_class($this)."::Create Error invalid field nature '" . strval($this->nature) . "'"; |
|
| 118 | + $this->error = get_class($this)."::Create Error invalid field nature '".strval($this->nature)."'"; |
|
| 119 | 119 | dol_syslog($this->error, LOG_ERR); |
| 120 | 120 | return -1; |
| 121 | 121 | } |
@@ -123,23 +123,23 @@ discard block |
||
| 123 | 123 | $sql = "INSERT INTO ".MAIN_DB_PREFIX."accounting_journal"; |
| 124 | 124 | $sql .= " (entity, code, label, nature, active)"; |
| 125 | 125 | $sql .= " VALUES (" |
| 126 | - . ((int) $this->entity) .",'" |
|
| 127 | - . $this->db->escape($this->code) ."','" |
|
| 128 | - . $this->db->escape($this->label) ."'," |
|
| 129 | - . ((int) $this->nature) ."," |
|
| 130 | - . ((int) $this->active) .")"; |
|
| 126 | + . ((int) $this->entity).",'" |
|
| 127 | + . $this->db->escape($this->code)."','" |
|
| 128 | + . $this->db->escape($this->label)."'," |
|
| 129 | + . ((int) $this->nature)."," |
|
| 130 | + . ((int) $this->active).")"; |
|
| 131 | 131 | |
| 132 | 132 | dol_syslog(get_class($this)."::create", LOG_DEBUG); |
| 133 | 133 | $resql = $this->db->query($sql); |
| 134 | 134 | if (!$resql) { |
| 135 | - $this->error = get_class($this)."::Create Error: " . $this->db->lasterror(); |
|
| 135 | + $this->error = get_class($this)."::Create Error: ".$this->db->lasterror(); |
|
| 136 | 136 | dol_syslog($this->error, LOG_ERR); |
| 137 | 137 | return -1; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | $id = $this->db->last_insert_id(MAIN_DB_PREFIX."accounting_journal"); |
| 141 | 141 | if ($id <= 0) { |
| 142 | - $this->error = get_class($this)."::Create Error " . $id . ": " . $this->db->lasterror(); |
|
| 142 | + $this->error = get_class($this)."::Create Error ".$id.": ".$this->db->lasterror(); |
|
| 143 | 143 | dol_syslog($this->error, LOG_ERR); |
| 144 | 144 | return -2; |
| 145 | 145 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $this->rowid = $obj->rowid; |
| 182 | 182 | |
| 183 | 183 | $this->code = $obj->code; |
| 184 | - $this->ref = $obj->code; |
|
| 184 | + $this->ref = $obj->code; |
|
| 185 | 185 | $this->label = $obj->label; |
| 186 | 186 | $this->nature = $obj->nature; |
| 187 | 187 | $this->active = $obj->active; |
@@ -425,10 +425,10 @@ discard block |
||
| 425 | 425 | return array(); |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; |
|
| 429 | - require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php'; |
|
| 430 | - require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php'; |
|
| 431 | - require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php'; |
|
| 428 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; |
|
| 429 | + require_once DOL_DOCUMENT_ROOT.'/asset/class/asset.class.php'; |
|
| 430 | + require_once DOL_DOCUMENT_ROOT.'/asset/class/assetaccountancycodes.class.php'; |
|
| 431 | + require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php'; |
|
| 432 | 432 | |
| 433 | 433 | $langs->loadLangs(array("assets")); |
| 434 | 434 | |
@@ -444,22 +444,22 @@ discard block |
||
| 444 | 444 | $sql .= "SELECT ad.fk_asset AS rowid, a.ref AS asset_ref, a.label AS asset_label, a.acquisition_value_ht AS asset_acquisition_value_ht"; |
| 445 | 445 | $sql .= ", a.disposal_date AS asset_disposal_date, a.disposal_amount_ht AS asset_disposal_amount_ht, a.disposal_subject_to_vat AS asset_disposal_subject_to_vat"; |
| 446 | 446 | $sql .= ", ad.rowid AS depreciation_id, ad.depreciation_mode, ad.ref AS depreciation_ref, ad.depreciation_date, ad.depreciation_ht, ad.accountancy_code_debit, ad.accountancy_code_credit"; |
| 447 | - $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation as ad"; |
|
| 448 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "asset as a ON a.rowid = ad.fk_asset"; |
|
| 449 | - $sql .= " WHERE a.entity IN (" . getEntity('asset', 0) . ')'; // We don't share object for accountancy, we use source object sharing |
|
| 447 | + $sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation as ad"; |
|
| 448 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."asset as a ON a.rowid = ad.fk_asset"; |
|
| 449 | + $sql .= " WHERE a.entity IN (".getEntity('asset', 0).')'; // We don't share object for accountancy, we use source object sharing |
|
| 450 | 450 | $sql .= " AND a.status > 0"; |
| 451 | 451 | if ($in_bookkeeping == 'already') { |
| 452 | - $sql .= " AND EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')"; |
|
| 452 | + $sql .= " AND EXISTS (SELECT iab.fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')"; |
|
| 453 | 453 | } elseif ($in_bookkeeping == 'notyet') { |
| 454 | - $sql .= " AND NOT EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')"; |
|
| 454 | + $sql .= " AND NOT EXISTS (SELECT iab.fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')"; |
|
| 455 | 455 | } |
| 456 | 456 | $sql .= " AND ad.ref != ''"; // not reversal lines |
| 457 | 457 | if ($date_start && $date_end) { |
| 458 | - $sql .= " AND ad.depreciation_date >= '" . $this->db->idate($date_start) . "' AND ad.depreciation_date <= '" . $this->db->idate($date_end) . "'"; |
|
| 458 | + $sql .= " AND ad.depreciation_date >= '".$this->db->idate($date_start)."' AND ad.depreciation_date <= '".$this->db->idate($date_end)."'"; |
|
| 459 | 459 | } |
| 460 | 460 | // Define begin binding date |
| 461 | 461 | if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { |
| 462 | - $sql .= " AND ad.depreciation_date >= '" . $this->db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) . "'"; |
|
| 462 | + $sql .= " AND ad.depreciation_date >= '".$this->db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'"; |
|
| 463 | 463 | } |
| 464 | 464 | $sql .= " ORDER BY ad.depreciation_date"; |
| 465 | 465 | |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | |
| 527 | 527 | $element = array( |
| 528 | 528 | 'ref' => dol_trunc($element_static->ref, 16, 'right', 'UTF-8', 1), |
| 529 | - 'error' => array_key_exists('error', $pre_data_info) ? $pre_data_info['error'] : '', // @phpstan-ignore-line |
|
| 529 | + 'error' => array_key_exists('error', $pre_data_info) ? $pre_data_info['error'] : '', // @phpstan-ignore-line |
|
| 530 | 530 | 'blocks' => array(), |
| 531 | 531 | ); |
| 532 | 532 | |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | if ($type == 'view') { |
| 546 | 546 | $account_to_show = length_accountg($account); |
| 547 | 547 | if (($account_to_show == "") || $account_to_show == 'NotDefined') { |
| 548 | - $account_to_show = '<span class="error">' . $langs->trans("AssetInAccountNotDefined") . '</span>'; |
|
| 548 | + $account_to_show = '<span class="error">'.$langs->trans("AssetInAccountNotDefined").'</span>'; |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | $blocks[] = array( |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | 'piece' => $element_link, |
| 554 | 554 | 'account_accounting' => $account_to_show, |
| 555 | 555 | 'subledger_account' => '', |
| 556 | - 'label_operation' => $label_operation . ' - ' . $depreciation_ref, |
|
| 556 | + 'label_operation' => $label_operation.' - '.$depreciation_ref, |
|
| 557 | 557 | 'debit' => $mt < 0 ? price(-$mt) : '', |
| 558 | 558 | 'credit' => $mt >= 0 ? price($mt) : '', |
| 559 | 559 | ); |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | 'subledger_label' => '', |
| 573 | 573 | 'numero_compte' => $account, |
| 574 | 574 | 'label_compte' => $account_infos['label'], |
| 575 | - 'label_operation' => $element_name_formatted_0 . ' - ' . $depreciation_ref, |
|
| 575 | + 'label_operation' => $element_name_formatted_0.' - '.$depreciation_ref, |
|
| 576 | 576 | 'montant' => $mt, |
| 577 | 577 | 'sens' => $mt < 0 ? 'D' : 'C', |
| 578 | 578 | 'debit' => $mt < 0 ? -$mt : 0, |
@@ -587,12 +587,12 @@ discard block |
||
| 587 | 587 | } |
| 588 | 588 | } else { // $type == 'csv' |
| 589 | 589 | $blocks[] = array( |
| 590 | - $depreciation_date, // Date |
|
| 591 | - $element_static->ref, // Piece |
|
| 592 | - $account_infos['code_formatted_1'], // AccountAccounting |
|
| 593 | - $element_name_formatted_0 . ' - ' . $depreciation_ref, // LabelOperation |
|
| 594 | - $mt < 0 ? price(-$mt) : '', // Debit |
|
| 595 | - $mt >= 0 ? price($mt) : '', // Credit |
|
| 590 | + $depreciation_date, // Date |
|
| 591 | + $element_static->ref, // Piece |
|
| 592 | + $account_infos['code_formatted_1'], // AccountAccounting |
|
| 593 | + $element_name_formatted_0.' - '.$depreciation_ref, // LabelOperation |
|
| 594 | + $mt < 0 ? price(-$mt) : '', // Debit |
|
| 595 | + $mt >= 0 ? price($mt) : '', // Credit |
|
| 596 | 596 | ); |
| 597 | 597 | } |
| 598 | 598 | } |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | |
| 615 | 615 | // Get accountancy codes |
| 616 | 616 | //--------------------------- |
| 617 | - require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php'; |
|
| 617 | + require_once DOL_DOCUMENT_ROOT.'/asset/class/assetaccountancycodes.class.php'; |
|
| 618 | 618 | $accountancy_codes = new AssetAccountancyCodes($this->db); |
| 619 | 619 | $result = $accountancy_codes->fetchAccountancyCodes($element_static->id); |
| 620 | 620 | if ($result < 0) { |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | if ($type == 'view') { |
| 666 | 666 | $account_to_show = length_accountg($account); |
| 667 | 667 | if (($account_to_show == "") || $account_to_show == 'NotDefined') { |
| 668 | - $account_to_show = '<span class="error">' . $langs->trans("AssetInAccountNotDefined") . '</span>'; |
|
| 668 | + $account_to_show = '<span class="error">'.$langs->trans("AssetInAccountNotDefined").'</span>'; |
|
| 669 | 669 | } |
| 670 | 670 | |
| 671 | 671 | $blocks[] = array( |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | 'piece' => $element_link, |
| 674 | 674 | 'account_accounting' => $account_to_show, |
| 675 | 675 | 'subledger_account' => '', |
| 676 | - 'label_operation' => $label_operation . ' - ' . $disposal_ref, |
|
| 676 | + 'label_operation' => $label_operation.' - '.$disposal_ref, |
|
| 677 | 677 | 'debit' => $mt < 0 ? price(-$mt) : '', |
| 678 | 678 | 'credit' => $mt >= 0 ? price($mt) : '', |
| 679 | 679 | ); |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | 'subledger_label' => '', |
| 693 | 693 | 'numero_compte' => $account, |
| 694 | 694 | 'label_compte' => $account_infos['label'], |
| 695 | - 'label_operation' => $element_name_formatted_0 . ' - ' . $disposal_ref, |
|
| 695 | + 'label_operation' => $element_name_formatted_0.' - '.$disposal_ref, |
|
| 696 | 696 | 'montant' => $mt, |
| 697 | 697 | 'sens' => $mt < 0 ? 'D' : 'C', |
| 698 | 698 | 'debit' => $mt < 0 ? -$mt : 0, |
@@ -707,12 +707,12 @@ discard block |
||
| 707 | 707 | } |
| 708 | 708 | } else { // $type == 'csv' |
| 709 | 709 | $blocks[] = array( |
| 710 | - $disposal_date, // Date |
|
| 711 | - $element_static->ref, // Piece |
|
| 712 | - $account_infos['code_formatted_1'], // AccountAccounting |
|
| 713 | - $element_name_formatted_0 . ' - ' . $disposal_ref, // LabelOperation |
|
| 714 | - $mt < 0 ? price(-$mt) : '', // Debit |
|
| 715 | - $mt >= 0 ? price($mt) : '', // Credit |
|
| 710 | + $disposal_date, // Date |
|
| 711 | + $element_static->ref, // Piece |
|
| 712 | + $account_infos['code_formatted_1'], // AccountAccounting |
|
| 713 | + $element_name_formatted_0.' - '.$disposal_ref, // LabelOperation |
|
| 714 | + $mt < 0 ? price(-$mt) : '', // Debit |
|
| 715 | + $mt >= 0 ? price($mt) : '', // Credit |
|
| 716 | 716 | ); |
| 717 | 717 | } |
| 718 | 718 | } |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | |
| 802 | 802 | // Accounting accounts |
| 803 | 803 | $acc_disc_granted = getDolGlobalString('ACCOUNTING_ACCOUNT_DISCOUNT_GRANTED'); |
| 804 | - $acc_vat_coll_def = getDolGlobalString('ACCOUNTING_VAT_BUY_ACCOUNT'); // Normal to apply vat default account for buy with customer's discount |
|
| 804 | + $acc_vat_coll_def = getDolGlobalString('ACCOUNTING_VAT_BUY_ACCOUNT'); // Normal to apply vat default account for buy with customer's discount |
|
| 805 | 805 | |
| 806 | 806 | while ($obj = $this->db->fetch_object($resql)) { |
| 807 | 807 | if ($invoice_static->fetch((int) $obj->rowid) <= 0) { |
@@ -894,7 +894,7 @@ discard block |
||
| 894 | 894 | 'piece' => $piece_link, |
| 895 | 895 | 'account_accounting' => length_accountg($acc_disc_granted), |
| 896 | 896 | 'subledger_account' => '', |
| 897 | - 'label_operation' => $label_discount." - " .$langs->transnoentitiesnoconv('HT') . " (".$rateStr."%)", |
|
| 897 | + 'label_operation' => $label_discount." - ".$langs->transnoentitiesnoconv('HT')." (".$rateStr."%)", |
|
| 898 | 898 | 'debit' => price($ht_part), |
| 899 | 899 | 'credit' => '', |
| 900 | 900 | ); |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | 'subledger_label' => '', |
| 913 | 913 | 'numero_compte' => $acc_disc_granted, |
| 914 | 914 | 'label_compte' => $acc_info_discountgranted['label'], |
| 915 | - 'label_operation' => $label_discount." - " .$langs->transnoentitiesnoconv('HT') . " (".$rateStr."%)", |
|
| 915 | + 'label_operation' => $label_discount." - ".$langs->transnoentitiesnoconv('HT')." (".$rateStr."%)", |
|
| 916 | 916 | 'montant' => $ht_part, |
| 917 | 917 | 'sens' => 'D', |
| 918 | 918 | 'debit' => $ht_part, |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | 'piece' => $piece_link, |
| 936 | 936 | 'account_accounting' => length_accountg($acc_vat_coll), |
| 937 | 937 | 'subledger_account' => '', |
| 938 | - 'label_operation' => $label_discount." - " .$langs->transnoentitiesnoconv('VAT') . " (".$rateStr."%)", |
|
| 938 | + 'label_operation' => $label_discount." - ".$langs->transnoentitiesnoconv('VAT')." (".$rateStr."%)", |
|
| 939 | 939 | 'debit' => price($tva_part), |
| 940 | 940 | 'credit' => '', |
| 941 | 941 | ); |
@@ -953,7 +953,7 @@ discard block |
||
| 953 | 953 | 'subledger_label' => '', |
| 954 | 954 | 'numero_compte' => $acc_vat_coll, |
| 955 | 955 | 'label_compte' => $acc_info_vatbuy['label'], |
| 956 | - 'label_operation' => $label_discount." - " .$langs->transnoentitiesnoconv('VAT') . " (".$rateStr."%)", |
|
| 956 | + 'label_operation' => $label_discount." - ".$langs->transnoentitiesnoconv('VAT')." (".$rateStr."%)", |
|
| 957 | 957 | 'montant' => $tva_part, |
| 958 | 958 | 'sens' => 'D', |
| 959 | 959 | 'debit' => $tva_part, |
@@ -1010,16 +1010,16 @@ discard block |
||
| 1010 | 1010 | $element['blocks'][] = $lines_book; |
| 1011 | 1011 | } else { // CSV |
| 1012 | 1012 | $element['blocks'][] = array( |
| 1013 | - $docdate, // Date |
|
| 1014 | - $invoice_static->ref, // Piece |
|
| 1013 | + $docdate, // Date |
|
| 1014 | + $invoice_static->ref, // Piece |
|
| 1015 | 1015 | length_accountg($acc_disc_granted), // Account |
| 1016 | - $label_discount." (".$rateStr."%)", // Label |
|
| 1017 | - price($ht_part), // Debit |
|
| 1018 | - '', // Credit |
|
| 1016 | + $label_discount." (".$rateStr."%)", // Label |
|
| 1017 | + price($ht_part), // Debit |
|
| 1018 | + '', // Credit |
|
| 1019 | 1019 | ); |
| 1020 | 1020 | if ($tva_part > 0) { |
| 1021 | 1021 | $element['blocks'][] = array( |
| 1022 | - $docdate, $invoice_static->ref, length_accountg($acc_vat_coll), $label_discount." ". $langs->transnoentitiesnoconv('VAT') . " (".$rateStr."%)", price($tva_part), '' |
|
| 1022 | + $docdate, $invoice_static->ref, length_accountg($acc_vat_coll), $label_discount." ".$langs->transnoentitiesnoconv('VAT')." (".$rateStr."%)", price($tva_part), '' |
|
| 1023 | 1023 | ); |
| 1024 | 1024 | } |
| 1025 | 1025 | $element['blocks'][] = array( |
@@ -1105,7 +1105,7 @@ discard block |
||
| 1105 | 1105 | |
| 1106 | 1106 | // Accounting accounts |
| 1107 | 1107 | $acc_disc_recv = getDolGlobalString('ACCOUNTING_ACCOUNT_DISCOUNT_RECEIVED'); |
| 1108 | - $acc_vat_ded_def = getDolGlobalString('ACCOUNTING_VAT_SOLD_ACCOUNT'); // Normal to apply vat default account for sold with supplier's discount |
|
| 1108 | + $acc_vat_ded_def = getDolGlobalString('ACCOUNTING_VAT_SOLD_ACCOUNT'); // Normal to apply vat default account for sold with supplier's discount |
|
| 1109 | 1109 | |
| 1110 | 1110 | while ($obj = $this->db->fetch_object($resql)) { |
| 1111 | 1111 | if ($invoicesupplier_static->fetch((int) $obj->rowid) <= 0) { |
@@ -1238,7 +1238,7 @@ discard block |
||
| 1238 | 1238 | 'piece' => $piece_link, |
| 1239 | 1239 | 'account_accounting' => length_accountg($acc_disc_recv), |
| 1240 | 1240 | 'subledger_account' => '', |
| 1241 | - 'label_operation' => $label_discount." - " .$langs->transnoentitiesnoconv('HT') . " (".$rateStr."%)", |
|
| 1241 | + 'label_operation' => $label_discount." - ".$langs->transnoentitiesnoconv('HT')." (".$rateStr."%)", |
|
| 1242 | 1242 | 'debit' => '', |
| 1243 | 1243 | 'credit' => price($ht_part), |
| 1244 | 1244 | ); |
@@ -1256,7 +1256,7 @@ discard block |
||
| 1256 | 1256 | 'subledger_label' => '', |
| 1257 | 1257 | 'numero_compte' => $acc_disc_recv, |
| 1258 | 1258 | 'label_compte' => $acc_info_discountreceived['label'], |
| 1259 | - 'label_operation' => $label_discount." - " .$langs->transnoentitiesnoconv('HT') . " (".$rateStr."%)", |
|
| 1259 | + 'label_operation' => $label_discount." - ".$langs->transnoentitiesnoconv('HT')." (".$rateStr."%)", |
|
| 1260 | 1260 | 'montant' => $ht_part, |
| 1261 | 1261 | 'sens' => 'C', |
| 1262 | 1262 | 'debit' => 0, |
@@ -1279,7 +1279,7 @@ discard block |
||
| 1279 | 1279 | 'piece' => $piece_link, |
| 1280 | 1280 | 'account_accounting' => length_accountg($acc_vat_ded), |
| 1281 | 1281 | 'subledger_account' => '', |
| 1282 | - 'label_operation' => $label_discount." - " .$langs->transnoentitiesnoconv('VAT') . " (".$rateStr."%)", |
|
| 1282 | + 'label_operation' => $label_discount." - ".$langs->transnoentitiesnoconv('VAT')." (".$rateStr."%)", |
|
| 1283 | 1283 | 'debit' => '', |
| 1284 | 1284 | 'credit' => price($tva_part), |
| 1285 | 1285 | ); |
@@ -1298,7 +1298,7 @@ discard block |
||
| 1298 | 1298 | 'subledger_label' => '', |
| 1299 | 1299 | 'numero_compte' => $acc_vat_ded, |
| 1300 | 1300 | 'label_compte' => $acc_info_vatbuy['label'], |
| 1301 | - 'label_operation' => $label_discount." - " .$langs->transnoentitiesnoconv('VAT') . " (".$rateStr."%)", |
|
| 1301 | + 'label_operation' => $label_discount." - ".$langs->transnoentitiesnoconv('VAT')." (".$rateStr."%)", |
|
| 1302 | 1302 | 'montant' => $tva_part, |
| 1303 | 1303 | 'sens' => 'C', |
| 1304 | 1304 | 'debit' => 0, |
@@ -1327,7 +1327,7 @@ discard block |
||
| 1327 | 1327 | // CSV |
| 1328 | 1328 | if ($type == 'csv') { |
| 1329 | 1329 | $element['blocks'][] = array( |
| 1330 | - $docdate, $invoicesupplier_static->ref, length_accountg($acc_vat_ded), $label_discount." ". $langs->transnoentitiesnoconv('VAT') . " (".$rateStr."%)", '', $tva_part > 0 ? price($tva_part) : '' |
|
| 1330 | + $docdate, $invoicesupplier_static->ref, length_accountg($acc_vat_ded), $label_discount." ".$langs->transnoentitiesnoconv('VAT')." (".$rateStr."%)", '', $tva_part > 0 ? price($tva_part) : '' |
|
| 1331 | 1331 | ); |
| 1332 | 1332 | } |
| 1333 | 1333 | } |
@@ -1384,7 +1384,7 @@ discard block |
||
| 1384 | 1384 | public function writeIntoBookkeeping(User $user, &$journal_data = array(), $max_nb_errors = 10) |
| 1385 | 1385 | { |
| 1386 | 1386 | global $conf, $langs, $hookmanager; |
| 1387 | - require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; |
|
| 1387 | + require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; |
|
| 1388 | 1388 | |
| 1389 | 1389 | $error = 0; |
| 1390 | 1390 | |
@@ -1484,7 +1484,7 @@ discard block |
||
| 1484 | 1484 | $error++; |
| 1485 | 1485 | $error_for_line++; |
| 1486 | 1486 | $journal_data[$element_id]['error'] = 'amountsnotbalanced'; |
| 1487 | - $this->errors[] = 'Try to insert a non balanced transaction in book for ' . json_encode($element['blocks']) . '. Canceled. Surely a bug.'; |
|
| 1487 | + $this->errors[] = 'Try to insert a non balanced transaction in book for '.json_encode($element['blocks']).'. Canceled. Surely a bug.'; |
|
| 1488 | 1488 | } |
| 1489 | 1489 | |
| 1490 | 1490 | if (!$error_for_line) { |
@@ -1582,12 +1582,12 @@ discard block |
||
| 1582 | 1582 | } |
| 1583 | 1583 | |
| 1584 | 1584 | if (!empty($header)) { |
| 1585 | - $out .= '"' . implode('"' . $sep . '"', $header) . '"' . "\n"; |
|
| 1585 | + $out .= '"'.implode('"'.$sep.'"', $header).'"'."\n"; |
|
| 1586 | 1586 | } |
| 1587 | 1587 | foreach ($journal_data as $element_id => $element) { |
| 1588 | 1588 | foreach ($element['blocks'] as $lines) { |
| 1589 | 1589 | foreach ($lines as $line) { |
| 1590 | - $out .= '"' . implode('"' . $sep . '"', $line) . '"' . "\n"; |
|
| 1590 | + $out .= '"'.implode('"'.$sep.'"', $line).'"'."\n"; |
|
| 1591 | 1591 | } |
| 1592 | 1592 | } |
| 1593 | 1593 | } |
@@ -1605,8 +1605,8 @@ discard block |
||
| 1605 | 1605 | public function getAccountingAccountInfos($account) |
| 1606 | 1606 | { |
| 1607 | 1607 | if (!isset(self::$accounting_account_cached[$account])) { |
| 1608 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; |
|
| 1609 | - require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; |
|
| 1608 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; |
|
| 1609 | + require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; |
|
| 1610 | 1610 | $accountingaccount = new AccountingAccount($this->db); |
| 1611 | 1611 | $result = $accountingaccount->fetch(0, $account, true); |
| 1612 | 1612 | if ($result > 0) { |