瀏覽代碼

unprinted factures fixes

szollosil 9 月之前
父節點
當前提交
864410fdd6
共有 1 個文件被更改,包括 8 次插入8 次删除
  1. 8 8
      custom/settlements/class/daily_closing.class.php

+ 8 - 8
custom/settlements/class/daily_closing.class.php

@@ -263,17 +263,17 @@ class DailyClosing
         //print $sql;
         $data = $db->query($sql);
         $result = pg_fetch_all($data);
-        $refs = "";
+        $refs = [];
         while($row = $db->fetch_object($result)){
-            if ($refs == "") {
-                $refs .= "'" . $row->ref . "'";
-            } else {
-                $refs .= ",'" . $row->ref . "'";
-            }
+            $refs[] = "'".$row->ref . "'";
         }
-        $params = ["from" => $from, "to" => $to, "factures" => $refs];
+        $refs = array_unique($refs);
+        $refs = array_values($refs);
+        $refsString = implode(",", $refs);
+        $params = ["from" => $from, "to" => $to, "factures" => $refsString];
         $postFields = json_encode($params);
-        $crossShoppingFactures = $this->curlRunner('bookingapi/getPrintedFacturesRefsArray', $postFields, 'POST', true);
+        $crossShoppingFacturesResult = $this->curlRunner('bookingapi/getPrintedFacturesRefsArray', $postFields, 'POST', true);
+        $crossShoppingFactures = is_null($crossShoppingFacturesResult) ? [] : $crossShoppingFacturesResult;
         //print_r($crossShoppingFactures);
         print '<table id="unprintedfactureslist" style="display:none; width:100%;">';
         print '<tr class="center unprintedfacturetr">