fixed same bug

This commit is contained in:
2026-09-30 14:33:11 +07:00
parent bc95edbc0f
commit 8a758e5875
18 changed files with 162 additions and 433 deletions
+5 -4
View File
@@ -5,7 +5,7 @@
Module : /DB/SQL.php
Created By : Siau Pheng ([email protected]).
Created Date : February 2nd, 2007.
Last Modified : August 21st, 2026.
Last Modified : September 11th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
@@ -15,6 +15,7 @@ declare(strict_types=1);
namespace Webapp\DB;
use ErrorException;
use \flight\Engine;
use \flight\Session;
use \flight\database\SimplePdo;
@@ -68,7 +69,7 @@ final class SQL {
public function add_param_date(string $param = "", string|null $value = null): void {
$this->_afield[] = [
'field' => $param,
'value' => tgl_sql2str(is_null($value) ? Param::Get($param) : $value),
'value' => tgl_sql2str(is_null($value) ? Param::Get($param, '00-00-0000') : $value),
'numbe' => false,
];
}
@@ -185,8 +186,8 @@ final class SQL {
$this->db->runQuery($tsql, $__aexec);
}
public function LastInsertID(): int {
return $this->db->lastInsertId();
public function LastInsertID(?string $name = null): mixed {
return $this->db->lastInsertId($name);
}
}
+1 -2
View File
@@ -136,8 +136,7 @@ final class Cache {
$_ajs = ['system/profile', 'system/chpasswd'];
$amenu = array_values($this->web_user['Merge_Menu'] ?? []);
$_ops = $this->db->fetchColumn("SELECT Link FROM app_menu WHERE Kode IN (?) AND Link<>'' ORDER BY Kode", [$amenu]);
if ($_ops) $_ajs += $_ops;
if ($_ops) $_ajs = array_merge($_ajs, $_ops);
$dirIterator = new \RecursiveDirectoryIterator($this->jsapp, \RecursiveDirectoryIterator::SKIP_DOTS);
$dirFilter = new \RecursiveCallbackFilterIterator($dirIterator, fn($curr, $key, $iter) => !($curr->isDir() && in_array($curr->getFilename(), ['locale'])));
$iterator = new \RecursiveIteratorIterator($dirFilter);
-164
View File
@@ -1,164 +0,0 @@
<?php
/*******************************************************************
Module : /Data/SimpleXLS.php
Desc. : Class pembuatan file Simple XLS
Created By : Siau Pheng ([email protected]).
Created Date : November 18th, 2012.
Last Modified : September 30th, 2025.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
//todo: deprecated
declare(strict_types=1);
namespace Webapp\Data;
final class SimpleXLS {
private $__wbook = null;
private $__atabel = [];
private $__astyle = [];
private $__aheader = [];
private $__amerge = [];
private $__avalue = [];
private $__tsheet = null;
public function __construct($oprop=[]) {
$this->__wbook = new \Shuchkin\SimpleXLSXGen();
$this->__wbook
->setAuthor($_SESSION['WEB_APP']['APP_NAME']." v".$_SESSION['WEB_APP']['APP_VER'])
->setLastModifiedBy($_SESSION['WEB_APP']['APP_NAME']." v".$_SESSION['WEB_APP']['APP_VER'])
->setTitle($oprop['title'] ?? "")
->setSubject($oprop['subject'] ?? $_SESSION['WEB_APP']['REG_NAME'])
->setDescription($oprop['desc'] ?? "")
->setCompany($_SESSION['WEB_APP']['REG_NAME'])
->setDefaultFont("Calibri")
->setDefaultFontSize(11);
}
private function coord2cell($x, $y) {
$c = '';
for ($i = $x; $i >= 0; $i = ((int)($i / 26)) - 1) {
$c = chr(ord('A') + $i % 26) . $c;
}
return $c . ($y + 1);
}
private function create_style($tstyle="L") {
$_astyle = explode(",", $tstyle);
$_s_style = ""; $_e_style = "";
foreach ($_astyle as $_key => $_val) {
if ($_val == "L") {$_s_style .= '<left>'; $_e_style .= '</left>';}
if ($_val == "R") {$_s_style .= '<right>'; $_e_style .= '</right>';}
if ($_val == "C") {$_s_style .= '<center>'; $_e_style .= '</center>';}
if ($_val == "W") {$_s_style .= '<wraptext>'; $_e_style .= '</wraptext>';}
if ($_val == "B") {$_s_style .= '<b>'; $_e_style .= '</b>';}
if ($_val == "I") {$_s_style .= '<i>'; $_e_style .= '</i>';}
if ($_val == "S") {$_s_style .= "\0"; $_e_style .= '';}
if ($_val == "N") {$_s_style .= '<style nf="#,##0.00">'; $_e_style .= '</style>';}
if ($_val == "N0") {$_s_style .= '<style nf="#,##0">'; $_e_style .= '</style>';}
}
return ['s'=>$_s_style, 'e'=>$_e_style];
}
public function clear_field() {
$this->__atabel = [];
}
public function add_header($tjudul="") {
if ($tjudul=="") return;
$this->__aheader[] = $tjudul;
}
public function add_empty_row($nrow=1) {
$_jkolom = count($this->__atabel);
for ($i=0; $i<$nrow; $i++) {
$this->__avalue[] = array_fill(0,$_jkolom,"");
}
}
public function add_field($tnama="", $nlebar=0, $talign="L", $ffunc="") {
$this->__atabel[] = [$tnama, $nlebar, $ffunc];
$this->__astyle[] = $this->create_style($talign);
}
public function add_sheet($tnama_sheet="BARU", $bw_header=true) {
$this->__tsheet = $tnama_sheet;
$_jkolom = count($this->__atabel);
foreach ($this->__aheader as $_key => $_val) {
$a_out = ['<style font-size="12"><center>'.$_val."</center></style>"];
$this->__amerge[] = $this->coord2cell(0, count($this->__avalue)) . ":" . $this->coord2cell($_jkolom-1, count($this->__avalue));
$this->__avalue[] = $a_out;
}
if ($bw_header==true) $this->show_headers();
}
public function add_value() {
$tmp_arr = func_get_args();
if (is_array($tmp_arr[0])) $tmp_arr = $tmp_arr[0];
$a_out = [];
for ($i=0; $i<count($this->__atabel); $i++) {
$tmp_val = $tmp_arr[$i];
if (is_array($this->__atabel[$i][2]) && trim($tmp_val)<>"") {
$tmp_val = $this->__atabel[$i][2][$tmp_val];
} else if (function_exists($this->__atabel[$i][2]) && trim($tmp_val)<>"") {
$tmp_val = call_user_func($this->__atabel[$i][2], $tmp_val);
}
$a_out[] = $this->__astyle[$i]['s'] . $tmp_val . $this->__astyle[$i]['e'];
}
$this->__avalue[] = $a_out;
}
public function add_span() {
$tmp_arr = func_get_args();
$a_out = [];
for ($i=0; $i<count($tmp_arr); $i++) {
$tmp_val = $tmp_arr[$i]; // CONTENT, COLSPAN=1, L, FUNC
if (!isset($tmp_val[1])) $tmp_val[1] = 1;
if (!isset($tmp_val[2])) $tmp_val[2] = "L";
if (isset($tmp_val[3])) {
if (function_exists($tmp_val[3]) && trim("".$tmp_val[0])<>"") {
$tmp_val[0] = call_user_func($tmp_val[3], $tmp_val[0]);
}
}
$tmp_style = $this->create_style($tmp_val[2]);
if ($tmp_val[1]>1) $this->__amerge[] = $this->coord2cell(count($a_out), count($this->__avalue)) . ":" . $this->coord2cell((count($a_out)+$tmp_val[1])-1, count($this->__avalue));
$a_out[] = $tmp_style['s'] . $tmp_val[0] . $tmp_style['e'];
for ($k=1; $k<$tmp_val[1]; $k++) $a_out[] = null;
}
$this->__avalue[] = $a_out;
}
public function add_stamp($ctk_ke=1, $bnama=false) {
$this->__avalue[] = ["<i>".$_SESSION['WEB_APP']['APP_NAME']."v".$_SESSION['WEB_APP']['APP_VER'].date("\@ymd.His")."-".user_id(3).(($bnama==true)?"/".strtoupper(user_user()):"").(($ctk_ke>0)?"#".isi_nol($ctk_ke,2):"")."</i>"];
}
public function get_stamp($ctk_ke=1, $bnama=false) {
return $_SESSION['WEB_APP']['APP_NAME']."v".$_SESSION['WEB_APP']['APP_VER'].date("\@ymd.His")."-".user_id(3).(($bnama==true)?"/".strtoupper(user_user()):"").(($ctk_ke>0)?"#".isi_nol($ctk_ke,2):"");
}
public function show_headers() {
$a_out = [];
for ($i=0; $i<count($this->__atabel); $i++) {
$a_out[] = '<style bgcolor="#D0D0D0"><center>'.$this->__atabel[$i][0].'</center></style>';
}
$this->__avalue[] = $a_out;
}
public function send($tnama_file="File_Excel") {
$this->__wbook->addSheet($this->__avalue, $this->__tsheet);
for ($i=0; $i<count($this->__atabel); $i++) {
$this->__wbook->setColWidth(($i+1), $this->__atabel[$i][1]);
}
for ($i=0; $i<count($this->__amerge); $i++) {
$this->__wbook->mergeCells($this->__amerge[$i]);
}
$this->__wbook->downloadAs($tnama_file);
}
}
?>
-156
View File
@@ -1,156 +0,0 @@
<?php
/*******************************************************************
Module : /Data/XLS.php
Desc. : Class pembuatan file XLS
Created By : Siau Pheng ([email protected]).
Created Date : November 18th, 2012.
Last Modified : October 26th, 2023.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
//todo: deprecated
declare(strict_types=1);
namespace Webapp\Data;
use PhpOffice\PhpSpreadsheet\IOFactory;
final class XLS {
private $__tnamafile = null;
private $__bline = true;
private $__wbook = null;
private $__wsheet = null;
private $__baris = 0;
private $__kolom = 0;
private $__atabel = [];
private $__astyle =[];
private $__aheader = [];
private $__fhead = null;
private $__isheet = 0;
public function __construct($tnama_file="", $oprop=[]) {//oke
\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
$this->__tnamafile = $tnama_file;
$this->__wbook = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$this->__wbook->getProperties()
->setCreator($_SESSION['WEB_APP']['APP_NAME']." v".$_SESSION['WEB_APP']['APP_VER'])
->setLastModifiedBy($_SESSION['WEB_APP']['APP_NAME']." v".$_SESSION['WEB_APP']['APP_VER'])
->setTitle($oprop['title'] ?? "")
->setSubject($oprop['subject'] ?? "")
->setDescription($oprop['desc'] ?? "")
->setCompany($_SESSION['WEB_APP']['REG_NAME']);
$this->__wsheet = $this->__wbook->getActiveSheet();
$this->__fhead = [
'font' => ['bold' => true],
'alignment' => ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, 'wrapText' => true],
'fill' => ['fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID, 'startColor' => ['rgb'=>"D0D0D0"]],
'borders' => ['allBorders' => ['borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN, 'color' => ['rgb'=>"C0C0C0"]]]
];
}
public function create_style($tstyle="L") {//oke
$_astyle = explode(",", $tstyle);
$_tmp_style = [];
$_bline = $this->__bline;
foreach ($_astyle as $_key => $_val) {
if ($_val == "L") $_tmp_style['alignment'] = ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT];
if ($_val == "R") $_tmp_style['alignment'] = ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT];
if ($_val == "C") $_tmp_style['alignment'] = ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER];
if ($_val == "W") $_tmp_style['alignment'] = ['wrapText' => true];
if ($_val == "B") $_tmp_style['font'] = ['bold' => true];
if ($_val == "S") $_tmp_style['numberFormat'] = ['formatCode' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT];
if ($_val == "N") $_tmp_style['numberFormat'] = ['formatCode' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2];
if ($_val == "N0") $_tmp_style['numberFormat'] = ['formatCode' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2];
if ($_val == "NL") $_bline = false;
if ($_val == "H") {
$_bline = false;
$_tmp_style = $this->__fhead;
}
}
return $_tmp_style;
}
public function clear_field() {//up : 2014-06-19
$this->__atabel = [];
$this->__astyle = [];
}
public function set_pos($nbaris=0, $nkolom=0) {
$this->__baris = $nbaris;
$this->__kolom = $nkolom;
}
public function set_garis_bawah($bgaris=true) {}//todo: deleted
public function add_header($tjudul="") {//oke
if ($tjudul=="") return;
$this->__aheader[] = $tjudul;
}
public function add_empty_row($nrow=1) {//oke
$this->__baris += $nrow;
}
public function add_field($tnama="", $nlebar=0, $talign="L", $ffunc="") {//oke
$this->__atabel[] = [$tnama, $nlebar, $ffunc];
$this->__astyle[] = $this->create_style($talign);
}
public function add_sheet($tnama_sheet="BARU", $bw_header=true) {//not yet !!!
if ($this->__isheet > 0) {
$this->__wbook->createSheet();
$this->__wsheet = $this->__wbook->setActiveSheetIndex(++$this->__isheet);
}
$this->__wsheet->setTitle($tnama_sheet);
for ($i=0; $i<count($this->__atabel); $i++) {
//sampai disini dulu !!
$this->__wsheet->getColumnDimension($this->__kolom+$i)->setWidth($this->__atabel[$i][1]);
}
$_fjudul = $this->__wbook->addFormat();
$_fjudul->setBold();
$_fjudul->setAlign("center");
$_jkolom = count($this->__atabel);
if ($_jkolom>0) $_jkolom--;
foreach ($this->__aheader as $_key => $_val) {
$this->__wsheet->write($this->__baris,$this->__kolom,$_val,$_fjudul);
$this->__wsheet->setMerge($this->__baris,$this->__kolom,$this->__baris,$this->__kolom+$_jkolom);
$this->__baris++;
}
$this->__baris++;
if ($bw_header==true) $this->show_headers();
}
public function add_value() {
$tmp_arr = func_get_args();
if (is_array($tmp_arr[0])) $tmp_arr = $tmp_arr[0];
$tmp_out = "";
for ($i=0; $i<count($this->__atabel); $i++) {
$tmp_val = $tmp_arr[$i];
if (is_array($this->__atabel[$i][1]) && trim($tmp_val)<>"") {
$tmp_val = $this->__atabel[$i][1][$tmp_val];
} else if (function_exists($this->__atabel[$i][1]) && trim($tmp_val)<>"") {
$tmp_val = call_user_func($this->__atabel[$i][1], $tmp_val);
}
$tmp_out .= DELI_CSV . $tmp_val;
}
$tmp_out = substr($tmp_out, 1);
$this->__avalue[] = $tmp_out;
}
public function send($tnama_file="File_Excel") {//oke
$this->__wsheet->setActiveSheetIndex(0);
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="'.$tnama_file.'"');
header('Cache-Control: max-age=0');
$writer = IOFactory::createWriter($this->__wsheet, 'Xlsx');
$writer->save('php://output');
}
}
?>
+4 -3
View File
@@ -5,7 +5,7 @@
Module : /Printer/PrintPOS.php
Created By : Siau Pheng ([email protected]).
Created Date : June 15th, 2008.
Last Modified : August 21st, 2026.
Last Modified : September 21st, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
@@ -70,8 +70,9 @@ class PrintPOS {
}
public function set_header_logo(string $logo_file = ""): void {
if (!empty($logo_file) && file_exists(PROJECT_ROOT."assets/images/".$logo_file)) {
$this->_config['logo'] = PROJECT_BASE."assets/images/".$logo_file;
if (!empty($logo_file) && file_exists(PROJECT_ROOT."public/assets/images/".$logo_file)) {
//$this->_config['logo'] = PROJECT_BASE."assets/images/".$logo_file;
$this->_config['logo'] = base64_encode(file_get_contents(PROJECT_ROOT."public/assets/images/".$logo_file));
}
}
+26 -16
View File
@@ -5,7 +5,7 @@
Module : /Web/Param.php
Created By : Siau Pheng ([email protected]).
Created Date : November 14th, 2013.
Last Modified : August 22nd, 2026.
Last Modified : September 16th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
@@ -38,40 +38,50 @@ final class Param {
private static function __data(): void {
global $app;
if (empty($app)) $app = \Flight::app();
//$_asumber = array_merge($app->request()->query->getData(), $app->request()->data->getData());
$_asumber = $app->request()->query->getData() + $app->request()->data->getData();
foreach ($_asumber as $__key => $__val) {
self::$__ahasil[$__key] = is_string($__val) ? self::safeSQL($__val) : $__val;
if (in_array($__val, ['true','false'])) { $__val = ($__val === 'true'); }
else if (is_string($__val)) $__val = urldecode(self::safeSQL($__val));
self::$__ahasil[$__key] = $__val;
}
}
public static function safeSQL(string $str = ""): string {
$_se = array("\\","\0","\n","\r","\x1a","'",'"');
$_re = array("\\\\","\\0","\\n","\\r","\Z","\'",'\"');
$_se = ["\\","\0","\n","\r","\x1a","'",'"'];
$_re = ["\\\\","\\0","\\n","\\r","\Z","\'",'\"'];
return str_replace($_se, $_re, $str);
}
public static function Get(string $key = "", mixed $def = null): mixed {
if (count(self::$__ahasil)==0) self::__data();
if (isset(self::$__ahasil[$key]) && self::$__ahasil[$key]) return self::$__ahasil[$key];
if (empty(self::$__ahasil)) self::__data();
if (isset(self::$__ahasil[$key])) return self::$__ahasil[$key];
return $def;
}
public static function Get_Text(string $key, mixed $def = null): mixed {
if (count(self::$__ahasil)==0) self::__data();
$_str = (isset(self::$__ahasil[$key])) ? self::$__ahasil[$key] : $def;
$_str = str_replace("\\r", "", $_str);
$_str = str_replace("\\n", " ", $_str);
$_str = str_replace("\\t", " ", $_str);
return (trim($_str));
public static function Int(string $key = "", int $def = 0): int {
if (empty(self::$__ahasil)) self::__data();
if (isset(self::$__ahasil[$key])) return (int) self::$__ahasil[$key];
return $def;
}
public static function Get_Array(): array {
public static function Float(string $key = "", float $def = 0): float {
if (empty(self::$__ahasil)) self::__data();
if (isset(self::$__ahasil[$key])) return (float) self::$__ahasil[$key];
return $def;
}
public static function Get_All(): array {
if (count(self::$__ahasil)==0) self::__data();
return self::$__ahasil;
}
public static function Get_ArrayCBOX() {//delete
//delete
public static function Get_Text(string $key, mixed $def = null): mixed {
return self::Get($key, $def);
}
//delete
public static function Get_ArrayCBOX() {
return [];
}
}
+11 -1
View File
@@ -5,7 +5,7 @@
Module : /Web/Table.php
Created By : Siau Pheng ([email protected]).
Created Date : January 16th, 2008.
Last Modified : August 27th, 2026.
Last Modified : September 16th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
@@ -208,6 +208,11 @@ final class Table {
$tval = $row[$col['a']];
if (is_array($col['f'])) {
$tval = $col['f'][$tval];
} else if (!is_null($col['f']) && str_contains($col['f'], '::')) {
$tclass = explode("::", $col['f']);
if (class_exists($tclass[0]) && method_exists($tclass[0], $tclass[1])) {
$tval = call_user_func($col['f'], $tval);
}
} else if (!is_null($col['f']) && function_exists($col['f'])) {
$tval = call_user_func($col['f'], $tval);
} else if (is_string($tval)) {
@@ -291,6 +296,11 @@ final class Table {
$tval = $row[$col['a']];
if (is_array($col['f'])) {
$tval = $col['f'][$tval];
} else if (!is_null($col['f']) && str_contains($col['f'], '::')) {
$tclass = explode("::", $col['f']);
if (class_exists($tclass[0]) && method_exists($tclass[0], $tclass[1])) {
$tval = call_user_func($col['f'], $tval);
}
} else if (!is_null($col['f']) && function_exists($col['f'])) {
$tval = call_user_func($col['f'], $tval);
} else if (is_string($tval)) {