mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-01-19 06:47:56 -05:00
Add jquery-ui datepicker Format dates in sale and receiving forms according to configured dateformat and timeformat settings Add missing translations in sale (click delete when not selecting anything) Add search box back to search for customer sales and ticket numbers
69 lines
1.5 KiB
PHP
69 lines
1.5 KiB
PHP
<?php
|
|
|
|
/*
|
|
* Matches each symbol of PHP date format standard
|
|
* with jQuery equivalent codeword
|
|
* @author Tristan Jahier
|
|
*/
|
|
function dateformat_jquery($php_format)
|
|
{
|
|
$SYMBOLS_MATCHING = array(
|
|
// Day
|
|
'd' => 'dd',
|
|
'D' => 'D',
|
|
'j' => 'd',
|
|
'l' => 'DD',
|
|
'N' => '',
|
|
'S' => '',
|
|
'w' => '',
|
|
'z' => 'o',
|
|
// Week
|
|
'W' => '',
|
|
// Month
|
|
'F' => 'MM',
|
|
'm' => 'mm',
|
|
'M' => 'M',
|
|
'n' => 'm',
|
|
't' => '',
|
|
// Year
|
|
'L' => '',
|
|
'o' => '',
|
|
'Y' => 'yy',
|
|
'y' => 'y',
|
|
// Time
|
|
'a' => '',
|
|
'A' => '',
|
|
'B' => '',
|
|
'g' => '',
|
|
'G' => '',
|
|
'h' => '',
|
|
'H' => '',
|
|
'i' => '',
|
|
's' => '',
|
|
'u' => ''
|
|
);
|
|
$jqueryui_format = "";
|
|
$escaping = false;
|
|
for($i = 0; $i < strlen($php_format); $i++)
|
|
{
|
|
$char = $php_format[$i];
|
|
if($char === '\\') // PHP date format escaping character
|
|
{
|
|
$i++;
|
|
if($escaping) $jqueryui_format .= $php_format[$i];
|
|
else $jqueryui_format .= '\'' . $php_format[$i];
|
|
$escaping = true;
|
|
}
|
|
else
|
|
{
|
|
if($escaping) { $jqueryui_format .= "'"; $escaping = false; }
|
|
if(isset($SYMBOLS_MATCHING[$char]))
|
|
$jqueryui_format .= $SYMBOLS_MATCHING[$char];
|
|
else
|
|
$jqueryui_format .= $char;
|
|
}
|
|
}
|
|
return $jqueryui_format;
|
|
}
|
|
|
|
?>
|