From: Kilian Saffran Date: Fri, 6 May 2022 12:15:00 +0000 (+0200) Subject: v20220506 1.6.19 X-Git-Url: http://cloud.dks.lu/git/?a=commitdiff_plain;h=HEAD;p=qube.git v20220506 1.6.19 --- diff --git a/public_html/api/bin/getapidata.pl b/public_html/api/bin/getapidata.pl index 38504a4..de66bce 100644 --- a/public_html/api/bin/getapidata.pl +++ b/public_html/api/bin/getapidata.pl @@ -755,7 +755,7 @@ if ($onlyget == 0){ when code_document in ('art_soumis') then 'soumission' when code_document in ('art_brochure') then 'securite' else null end as tblcolumn, - case when commentaire is not null + case when commentaire like 'http%' then commentaire else concat(case when code_document in ('art_bro_pdf') then 'brochure' when code_document in ('art_fiche') then 'fiche' @@ -771,17 +771,28 @@ if ($onlyget == 0){ code_document,commentaire,nom_fichier from wiges_ole_article where code_document!='art_image' and article LIKE '&%';"; my $filedata = $db->queryarray($sqlfiles); foreach my $f (@{$filedata}){ - if (($f->{tblcolumn} ne "") && ($f->{tblvalue} !~ /^http/) && (-e $cfg->{mediapath}.'/'.$f->{nom_fichier})){ - if (! -d dirname($cfg->{path}.'/'.$f->{tblvalue})){ - mkdir dirname($cfg->{mediapath}.'/'.$f->{tblvalue}); - } - #print 'cp "'.$cfg->{mediapath}.'/'.$f->{nom_fichier}.'" "'.$cfg->{mediapath}.''.$f->{tblvalue}.'"'."\n"; - system('cp "'.$cfg->{mediapath}.'/'.$f->{nom_fichier}.'" "'.$cfg->{mediapath}.''.$f->{tblvalue}.'"'); - #print "UPDATE article_groups SET ".$f->{tblcolumn}."='".$f->{tblvalue}."' where article='".$f->{article}."';"."\n"; - $db->exec("UPDATE article_groups SET ".$f->{tblcolumn}."='".$f->{tblvalue}."' where article='".$f->{article}."';"); - } elsif (($f->{tblcolumn} ne "") && ($f->{tblvalue} =~ /^http/)){ - #print "UPDATE article_groups SET ".$f->{tblcolumn}."='".$f->{tblvalue}."' where article='".$f->{article}."';"."\n"; + # if (-e $cfg->{mediapath}.'/'.$f->{nom_fichier}) && (){ + # $stat = stat($cfg->{mediapath}.'/'.$f->{nom_fichier}); + # if ($stat[7] ne "0"){ + # $db->exec("UPDATE article_groups SET ".$f->{tblcolumn}."='".$f->{tblvalue}."' where article='".$f->{article}."';"); + # } + # } + if ($f->{tblvalue} =~ /^http/){ $db->exec("UPDATE article_groups SET ".$f->{tblcolumn}."='".$f->{tblvalue}."' where article='".$f->{article}."';"); + } elsif (-e $cfg->{mediapath}.'/'.$f->{nom_fichier}){ + my @stat = stat($cfg->{mediapath}.'/'.$f->{nom_fichier}); + if ($stat[7] ne "0"){ + $db->exec("UPDATE article_groups SET ".$f->{tblcolumn}."='".$f->{nom_fichier}."' where article='".$f->{article}."';"); + if (-e $cfg->{mediapath}.'/'.$f->{tblvalue}){ + my @stat2 = stat($cfg->{mediapath}.'/'.$f->{tblvalue}); + if ($stat2[7] ne $stat[7]){ + system('cp "'.$cfg->{mediapath}.'/'.$f->{nom_fichier}.'" "'.$cfg->{mediapath}.'/'.$f->{tblvalue}.'"'); + } + } else { + system('cp "'.$cfg->{mediapath}.'/'.$f->{nom_fichier}.'" "'.$cfg->{mediapath}.'/'.$f->{tblvalue}.'"'); + } + + } } } @@ -889,21 +900,38 @@ if ($onlyget == 0){ code_document,commentaire,nom_fichier from wiges_ole_article where code_document!='art_image' and article NOT LIKE '&%';"; my $filedata = $db->queryarray($sqlfiles); foreach my $f (@{$filedata}){ - if (($f->{tblcolumn} ne "") && ($f->{tblvalue} !~ /^http/)){ - if (! -d dirname($cfg->{mediapath}.''.$f->{tblvalue})){ - mkdir dirname($cfg->{mediapath}.''.$f->{tblvalue}); - } - #print 'cp "'.$cfg->{mediapath}.'/'.$f->{nom_fichier}.'" "'.$cfg->{mediapath}.''.$f->{tblvalue}.'"'."\n"; - system('cp "'.$cfg->{mediapath}.'/'.$f->{nom_fichier}.'" "'.$cfg->{mediapath}.''.$f->{tblvalue}.'"'); - #print "UPDATE articles SET ".$f->{tblcolumn}."='".$f->{tblvalue}."' where article='".$f->{article}."';"."\n"; - $db->exec("UPDATE articles SET ".$f->{tblcolumn}."='".$f->{tblvalue}."' where article='".$f->{article}."';"); - } elsif (($f->{tblcolumn} ne "") && ($f->{tblvalue} =~ /^http/)){ - #print "UPDATE articles SET ".$f->{tblcolumn}."='".$f->{tblvalue}."' where article='".$f->{article}."';"."\n"; + if ($f->{tblvalue} =~ /^http/){ $db->exec("UPDATE articles SET ".$f->{tblcolumn}."='".$f->{tblvalue}."' where article='".$f->{article}."';"); + } elsif (-e $cfg->{mediapath}.'/'.$f->{nom_fichier}){ + my @stat = stat($cfg->{mediapath}.'/'.$f->{nom_fichier}); + if ($stat[7] ne "0"){ + $db->exec("UPDATE articles SET ".$f->{tblcolumn}."='".$f->{nom_fichier}."' where article='".$f->{article}."';"); + if (-e $cfg->{mediapath}.'/'.$f->{tblvalue}){ + my @stat2 = stat($cfg->{mediapath}.'/'.$f->{tblvalue}); + if ($stat2[7] ne $stat[7]){ + system('cp "'.$cfg->{mediapath}.'/'.$f->{nom_fichier}.'" "'.$cfg->{mediapath}.'/'.$f->{tblvalue}.'"'); + } + } else { + system('cp "'.$cfg->{mediapath}.'/'.$f->{nom_fichier}.'" "'.$cfg->{mediapath}.'/'.$f->{tblvalue}.'"'); + } + + } } + # if (($f->{tblcolumn} ne "") && ($f->{tblvalue} !~ /^http/)){ + # if (! -d dirname($cfg->{mediapath}.''.$f->{tblvalue})){ + # mkdir dirname($cfg->{mediapath}.''.$f->{tblvalue}); + # } + # #print 'cp "'.$cfg->{mediapath}.'/'.$f->{nom_fichier}.'" "'.$cfg->{mediapath}.''.$f->{tblvalue}.'"'."\n"; + # system('cp "'.$cfg->{mediapath}.'/'.$f->{nom_fichier}.'" "'.$cfg->{mediapath}.''.$f->{tblvalue}.'"'); + # #print "UPDATE articles SET ".$f->{tblcolumn}."='".$f->{tblvalue}."' where article='".$f->{article}."';"."\n"; + # $db->exec("UPDATE articles SET ".$f->{tblcolumn}."='".$f->{tblvalue}."' where article='".$f->{article}."';"); + # } elsif (($f->{tblcolumn} ne "") && ($f->{tblvalue} =~ /^http/)){ + # #print "UPDATE articles SET ".$f->{tblcolumn}."='".$f->{tblvalue}."' where article='".$f->{article}."';"."\n"; + # $db->exec("UPDATE articles SET ".$f->{tblcolumn}."='".$f->{tblvalue}."' where article='".$f->{article}."';"); + # } } - $api->writelog("end copy articles files..."); + $api->writelog("end copy articles files..."); } if (($steps =~ /prices,/) || ($steps =~ /articles,/)){ $api->writelog("copy article prices..."); diff --git a/public_html/index.php b/public_html/index.php index d1f2620..fd68f15 100644 --- a/public_html/index.php +++ b/public_html/index.php @@ -157,7 +157,7 @@ $site = new Site($db,$cfg); -home/home/matieres-premieres/fr/" /> +/home/1/fr/" /> " /> @@ -176,8 +176,8 @@ $site = new Site($db,$cfg); - - + + diff --git a/public_html/js/askprice.js b/public_html/js/askprice.js index ea9025e..f77ca48 100644 --- a/public_html/js/askprice.js +++ b/public_html/js/askprice.js @@ -5,11 +5,12 @@ let publicaskprice = { }, loadTable: function(){ postData({"ac":"getOrderItems","id_user":mysite.iduser,"type":"askprice","lang":preferences.lang}).then(ogrps => { + this.setTable(ogrps.data); }); }, setTable: function(odata){ - //console.log("odata",odata); + //console.log("order table to fill!",odata); let bs = document.getElementById("lst_order_askprice"); if (!bs){ return false; @@ -73,8 +74,8 @@ let publicaskprice = { cval = cval.replace(/,/,'.'); cval = parseFloat(cval); } - console.log("RecalcValue",cval); - console.log("Send",{"ac":"setUserItem","article":obj.dataset.article,"quantity":cval,"id_user":mysite.iduser,"type":'askprice'}); + //console.log("RecalcValue",cval); + //console.log("Send",{"ac":"setUserItem","article":obj.dataset.article,"quantity":cval,"id_user":mysite.iduser,"type":'askprice'}); postData({"ac":"setUserItem","article":obj.dataset.article,"quantity":cval,"id_user":mysite.iduser,"type":'askprice'}).then(data => { //console.log("AC quRecalc returned",data); }); @@ -88,7 +89,7 @@ let publicaskprice = { }, getItemCount: function(){ - console.log("mysite",mysite); + //console.log("mysite",mysite); postData({"ac":"getOrderItemCount","id_user":mysite.iduser,"type":'askprice'}).then(data => { publicaskprice.itemscount = data.data.cnt; //console.log("Items",data.data); diff --git a/public_html/js/shop.js b/public_html/js/shop.js index 8dccaf9..2ccbd25 100644 --- a/public_html/js/shop.js +++ b/public_html/js/shop.js @@ -10,7 +10,7 @@ let shop = { }, getCounterfield: function(labels,unit){ labels.unshift(''); - let stf = null; + let stf = null; for (var l=1;l<=labels.length;l++){ if (/^Carton/.test(labels[l])){ stf="c0"+l}; @@ -296,10 +296,11 @@ let shop = { }); }, initEvents(){ + //console.log("init events now!"); if (document.getElementById("searchtopnav")){ //console.log("Shop SET search event!"); document.getElementById("searchtopnav").addEventListener("keypress", function(event) { - console.log("Enter Search",event.keyCode) + //console.log("Enter Search",event.keyCode) //console.log("Keypress ",event.keyCode); if (event.keyCode === 13) { //console.log("Keypress ",event.keyCode); diff --git a/public_html/lib/modules/Orders.php b/public_html/lib/modules/Orders.php index ffd03a1..051dba9 100644 --- a/public_html/lib/modules/Orders.php +++ b/public_html/lib/modules/Orders.php @@ -61,10 +61,10 @@ class Orders { $ng[$grps[$g]["article_group"]] = $grps[$g]; $ng[$grps[$g]["article_group"]]["articles"] = array(); } - $arsql ="select ar.id, UPPER(ar.article_group) as article_group, UPPER(ar.article) as article,oa.quantity, ar.gp_art, ar.famille_art, ar.c01, ar.c02, ar.c03, ar.c04, ar.c05, ap.prix_net, ar.unite_quantite, qte_stock, qte_commandee, ar.doc_ft, ar.doc_mo, ar.doc_fs, case when ar.creationdate + INTERVAL 1 month > CURRENT_DATE then 1 else null end as isnew, ar.videolink , oa.comment - from articles ar left join article_prices ap on (ar.article = ap.article) + $arsql ="select ar.id, UPPER(ar.article_group) as article_group, UPPER(ar.article) as article,oa.quantity, ar.gp_art, ar.famille_art, ar.c01, ar.c02, ar.c03, ar.c04, ar.c05, ar.unite_quantite, qte_stock, qte_commandee, ar.doc_ft, ar.doc_mo, ar.doc_fs, case when ar.creationdate + INTERVAL 1 month > CURRENT_DATE then 1 else null end as isnew, ar.videolink , oa.comment + from articles ar join order_articles oa on (ar.article = oa.article and id_user='".$id_user."' and id_order is null and code_document='".$type."') - where ar.isactive=1 group by ar.article,ar.id,oa.quantity,oa.comment,ap.prix_net order by ar.article_group,ar.article;"; + where ar.isactive=1 group by ar.article,ar.id,oa.quantity,oa.comment order by ar.article_group,ar.article;"; $arts = $this->dbh->queryarray($arsql); for ($a=0;$a < count($arts);$a++){ if (isset($ng[$arts[$a]["article_group"]])){ diff --git a/public_html/lib/modules/Site.php b/public_html/lib/modules/Site.php index 5eaf9ac..78c0726 100644 --- a/public_html/lib/modules/Site.php +++ b/public_html/lib/modules/Site.php @@ -75,9 +75,9 @@ class Site{
-
+
- <?php echo $agr['article'];?> + <?php echo $agr['article'];?>
diff --git a/public_html/lib/version.php b/public_html/lib/version.php index c7b6116..3a8df56 100644 --- a/public_html/lib/version.php +++ b/public_html/lib/version.php @@ -1,5 +1,5 @@ 1){ } ?> -