From: Kilian Saffran Date: Sat, 10 Aug 2019 09:58:51 +0000 (+0200) Subject: billjee un-publish done X-Git-Url: http://cloud.dks.lu/git/?a=commitdiff_plain;h=46585b3f90a0c76f4000d5a396ca5b21d89332d2;p=juridig_lu.git billjee un-publish done --- diff --git a/backoffice/api/process.cgi b/backoffice/api/process.cgi index d7c07f7..1f74f4b 100644 --- a/backoffice/api/process.cgi +++ b/backoffice/api/process.cgi @@ -264,7 +264,7 @@ if (($cgi->request_method() eq "GET") || ($cgi->request_method() eq "POST")){ # } elsif($p->{fn} eq "getmonthbilljees"){ - my $sql = "select eventdate,count(*) from billjeetickets where eventdate between date('".$p->{startdate}."') and date(date('".$p->{startdate}."') + interval '41 days') and isdisabled is null group by eventdate order by eventdate;"; + my $sql = "select eventdate,count(*) from billjeetickets where eventdate between date('".$p->{startdate}."') and date(date('".$p->{startdate}."') + interval '41 days') and isdisabled is null and id_user != '".$sess->{id}."' group by eventdate order by eventdate;"; my $res = $db->dbquerybykey("eventdate",$sql); $html->{result}->{events} = $res; } @@ -304,7 +304,7 @@ where bt.eventdate between date('".$p->{startdate}."') and date('".$p->{enddate} } elsif($p->{fn} eq "getbilljeeeventsbyuser"){ #ownevents - my $sql ="select bt.id,bt.id_user,bt.isdisabled,bt.court,bt.room,to_char(bt.eventdate,'DD.MM.YYYY') as dspdate,bt.dayperiod,bt.eventmsg as msg ,bt.eventtype,us.prename,us.surname + my $sql ="select bt.id,bt.id_user,bt.isdisabled,bt.court,bt.room,to_char(bt.eventdate,'DD.MM.YYYY') as dspdate,bt.dayperiod,bt.eventmsg as msg ,bt.eventtype,case when bt.eventtype ='offer' then 'offre' else 'demande' end as dspeventtype,us.prename,us.surname from billjeetickets bt join billjee bj on (bj.id_user=bt.id_user) join (select users.id,users.prename,users.surname,appaccess.privateenabled from users join appaccess on (appaccess.id_user=users.id) and appaccess.id_app=7) us on (bt.id_user=us.id) @@ -315,14 +315,15 @@ where bt.eventdate between date('".$p->{startdate}."') and date('".$p->{enddate} $html->{result}->{events} = $res; } elsif($p->{fn} eq "billjeepublishevent"){ - my $sql = "UPDATE billjeetickets set isdisabled=null where id=".$p->{id}." and id_user=".$sess->{id}.";"; - $db->dbexec($sql); - $html->{result}->{publish} = "ok"; - } - elsif($p->{fn} eq "billjeeunpublishevent"){ + $html->{result}->{id} = $p->{id}; my $sql = "UPDATE billjeetickets set isdisabled=true where id=".$p->{id}." and id_user=".$sess->{id}.";"; + $html->{result}->{isdisabled} = 1; + if ($p->{isdisabled} eq "1"){ + $sql = "UPDATE billjeetickets set isdisabled=null where id=".$p->{id}." and id_user=".$sess->{id}.";"; + $html->{result}->{isdisabled} =""; + } + # $html->{result}->{sql} = $sql; $db->dbexec($sql); - $html->{result}->{unpublish} = $p->{id}; } } diff --git a/backoffice/tmpl/block/dlgpublish.tt b/backoffice/tmpl/block/dlgpublish.tt index 3051cc0..b38813d 100644 --- a/backoffice/tmpl/block/dlgpublish.tt +++ b/backoffice/tmpl/block/dlgpublish.tt @@ -3,7 +3,7 @@
× -

Êtes-vous sûre de publier ce billjee?

+

MSG

@@ -16,26 +16,40 @@
\ No newline at end of file diff --git a/backoffice/tmpl/module/billjee/index.js b/backoffice/tmpl/module/billjee/index.js index 6a8911b..919a97e 100644 --- a/backoffice/tmpl/module/billjee/index.js +++ b/backoffice/tmpl/module/billjee/index.js @@ -15,8 +15,6 @@ function initpage(){ } - - function search_data(){ //document.getElementById('pnlresult').innerHTML = ''; var start = document.getElementById("filterdatefrom").value; @@ -36,17 +34,7 @@ function display_results(data){ '
' + courts[data.events[i].court] + ((data.events[i].room)?' (' + data.events[i].room + ')':'') + '
'+'
'; card += '
' + data.events[i].msg + '
'; card += ''; card += ''; res.innerHTML = res.innerHTML + card; diff --git a/backoffice/tmpl/module/billjee/index.tt b/backoffice/tmpl/module/billjee/index.tt index 9500382..602b8a6 100644 --- a/backoffice/tmpl/module/billjee/index.tt +++ b/backoffice/tmpl/module/billjee/index.tt @@ -53,8 +53,6 @@ -[% INCLUDE block/dlgdelete.tt %] -[% INCLUDE block/dlgunpublish.tt %] [% INCLUDE block/dlgcontactpublisher.tt %] diff --git a/backoffice/tmpl/module/billjee/mytickets.js b/backoffice/tmpl/module/billjee/mytickets.js index cbb3d2f..944cdf3 100644 --- a/backoffice/tmpl/module/billjee/mytickets.js +++ b/backoffice/tmpl/module/billjee/mytickets.js @@ -40,10 +40,16 @@ function display_results(data){ card += ''; //if (data.events.isdisabled) //card += ''; + console.log("Dis: " + data.events[i].isdisabled) ; - - card += ''; - card += ''; + card += ''; card += ''; } else { card += ''; diff --git a/backoffice/tmpl/module/billjee/mytickets.tt b/backoffice/tmpl/module/billjee/mytickets.tt index de57143..c83c0a9 100644 --- a/backoffice/tmpl/module/billjee/mytickets.tt +++ b/backoffice/tmpl/module/billjee/mytickets.tt @@ -21,5 +21,4 @@ [% INCLUDE block/dlgdelete.tt %] -[% INCLUDE block/dlgunpublish.tt %] [% INCLUDE block/dlgpublish.tt %] \ No newline at end of file