aa
This commit is contained in:
@@ -22,6 +22,8 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
define('QTA_IN_PREVENDITA', 10000);
|
define('QTA_IN_PREVENDITA', 10000);
|
||||||
define('QTA_MINIMA_PER_PREVENDITA', 9000);
|
define('QTA_MINIMA_PER_PREVENDITA', 9000);
|
||||||
|
|
||||||
|
setlocale(LC_TIME, 'it_IT.UTF-8');
|
||||||
|
|
||||||
function showarray($array)
|
function showarray($array)
|
||||||
{
|
{
|
||||||
echo '<pre>' . json_encode($array, JSON_PRETTY_PRINT) . '</pre>';
|
echo '<pre>' . json_encode($array, JSON_PRETTY_PRINT) . '</pre>';
|
||||||
@@ -87,6 +89,29 @@ function setPreOrderByIdArticolo($idarticolo, $aggiornapreordine, $debug)
|
|||||||
return setPreOrder($idarticolo, $aggiornapreordine, $debug);
|
return setPreOrder($idarticolo, $aggiornapreordine, $debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatDateToItalian($date_string, $input_format = 'Y-m-d H:i:s.u') {
|
||||||
|
// Crea un oggetto DateTime dal formato della stringa di input
|
||||||
|
$date = DateTime::createFromFormat($input_format, $date_string);
|
||||||
|
|
||||||
|
// Verifica se la creazione dell'oggetto DateTime è riuscita
|
||||||
|
if ($date) {
|
||||||
|
// Crea l'oggetto IntlDateFormatter per formattare la data in italiano
|
||||||
|
$formatter = new IntlDateFormatter(
|
||||||
|
'it_IT', // Imposta la localizzazione in italiano
|
||||||
|
IntlDateFormatter::FULL,
|
||||||
|
IntlDateFormatter::NONE,
|
||||||
|
'Europe/Rome', // Imposta il fuso orario (opzionale)
|
||||||
|
IntlDateFormatter::GREGORIAN,
|
||||||
|
'd MMMM yyyy' // Specifica il formato desiderato
|
||||||
|
);
|
||||||
|
|
||||||
|
// Formatta la data
|
||||||
|
return ucfirst($formatter->format($date));
|
||||||
|
} else {
|
||||||
|
return false; // Ritorna false se la data non è valida o il formato non è corretto
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setPreOrder($sku, $aggiornapreordine, $debug)
|
function setPreOrder($sku, $aggiornapreordine, $debug)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -141,8 +166,9 @@ function setPreOrder($sku, $aggiornapreordine, $debug)
|
|||||||
$datepubbl = DateTime::createFromFormat('Y-m-d H:i:s.u', $article->DataPubblicazione);
|
$datepubbl = DateTime::createFromFormat('Y-m-d H:i:s.u', $article->DataPubblicazione);
|
||||||
|
|
||||||
$datepubblstr = $datepubbl->format('Y-m-d');
|
$datepubblstr = $datepubbl->format('Y-m-d');
|
||||||
|
$datepubbllabel = formatDateToItalian($datepubbl);
|
||||||
|
|
||||||
$label_prenotalo_con_data = 'Prenotalo per riceverlo entro il ' . $article->DataPubblicazione;
|
$label_prenotalo_con_data = 'Prenotalo per riceverlo entro il ' . $datepubbllabel;
|
||||||
|
|
||||||
if ($idprodotto > 0) {
|
if ($idprodotto > 0) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user