mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-22 03:36:30 +01:00
refactoring some methodes
This commit is contained in:
parent
697a29b97d
commit
729dad2be4
28 changed files with 567 additions and 2323 deletions
|
@ -2144,9 +2144,10 @@ sub bikes_all(){
|
|||
$return->{$id}->{Ilockit_ID} = "$record->{$id}->{txt18}";
|
||||
#shareetool
|
||||
if($q->param('authcookie') && $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{id} && $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{id} == 187 && scalar(@{$user_tour} >= 1)){
|
||||
if(${$user_tour}[0] !~ /KN\d/){
|
||||
my @service_code = split(/\s/,$record->{$id}->{txt23});
|
||||
#2023-01-18 temporär deaktiviert
|
||||
#$return->{$id}->{service_code} = [@service_code];
|
||||
$return->{$id}->{service_code} = [@service_code];
|
||||
}
|
||||
}
|
||||
}elsif($record->{$id}->{int11} eq "3"){
|
||||
$return->{$id}->{system} = "sigo";
|
||||
|
|
|
@ -148,7 +148,8 @@ sub handler {
|
|||
$update_ctt->{int14} = 1;
|
||||
$update_ctt->{txt28} = "$now_dt $txaction\nSaldo > 0 Meldung\n" . $ctt->{txt28} if($ctt->{txt28} !~ /0 Meldung,/);#only once;
|
||||
}else{
|
||||
$update_adr->{int12} = "null";
|
||||
#2023-02-27, because this will be also done by manually user payment (without valid saved payment data)
|
||||
#$update_adr->{int12} = "null";
|
||||
$update_ctt->{int14} = "null";
|
||||
$update_ctt->{txt28} = "$now_dt $txaction\n" . $ctt->{txt28};
|
||||
}
|
||||
|
@ -159,6 +160,9 @@ sub handler {
|
|||
#set cardexpiredate
|
||||
if(($update_adr->{int24} && $update_adr->{int24} > 0 || $ctadr->{int12} ne $update_adr->{int12}) && $ctadr->{c_id} > 0){
|
||||
$dbt->update_record($dbh,$update_adr,$ctadr);
|
||||
#update adr also on primary
|
||||
my $dbh_primary = $dbt->dbconnect($dbt->{primary}->{sharee_primary}->{database}->{dbname});
|
||||
$dbt->update_record($dbh_primary,$update_adr,$ctadr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,21 +136,18 @@ sub sig_available {
|
|||
$response_out->{$station}->{operator_data} = {
|
||||
"operator_name" => "",
|
||||
"operator_hours" => "",
|
||||
"operator_color" => "",
|
||||
"operator_logo" => "",
|
||||
"operator_phone" => "",
|
||||
"operator_email" => "",
|
||||
};
|
||||
$response_out->{$station}->{operator_data}->{operator_name} = Encode::encode('utf-8', Encode::decode('iso-8859-1',$hotline_data->{txt01})) if($hotline_data->{txt01});
|
||||
$response_out->{$station}->{operator_data}->{operator_hours} = Encode::encode('utf-8', Encode::decode('iso-8859-1',$hotline_data->{txt84})) if($hotline_data->{txt84});
|
||||
$response_out->{$station}->{operator_data}->{operator_color} = $hotline_data->{txt85} if($hotline_data->{txt85});
|
||||
$response_out->{$station}->{operator_data}->{operator_logo} = $hotline_data->{img01} if($hotline_data->{img01});
|
||||
$response_out->{$station}->{operator_data}->{operator_phone} = $hotline_data->{txt07} if($hotline_data->{txt07});
|
||||
$response_out->{$station}->{operator_data}->{operator_email} = $hotline_data->{txt08} if($hotline_data->{txt08});
|
||||
|
||||
#just like caching
|
||||
$return2copri->{$station}->{barcode} = $1 if($response_out->{$station}->{station} =~ /(\d+)/);#new on station context
|
||||
$return2copri->{$station}->{int04} = $1 if($response_out->{$station}->{station} =~ /(\d+)/);
|
||||
$return2copri->{$station}->{txt12} = "SX";
|
||||
$return2copri->{$station}->{int06} = $1 if($response_out->{$station}->{gps_radius} =~ /(\d+)/);
|
||||
$return2copri->{$station}->{int05} = 2;#capacity
|
||||
$return2copri->{$station}->{int08} = 2;#energy adapter
|
||||
|
|
|
@ -37,34 +37,6 @@ my $day = strftime "%d", localtime;
|
|||
my $mon = strftime "%m", localtime;
|
||||
my $year = strftime "%Y", localtime;
|
||||
|
||||
#start- end- date time
|
||||
sub datetime_defaults(){
|
||||
my $self = shift;
|
||||
my ($in_date,$in_time,$lang) = @_;
|
||||
my $now_date_time = strftime "%Y-%m-%d %H:%M", localtime;
|
||||
my $now_date = strftime "%Y-%m-%d", localtime;
|
||||
my $now_time = strftime "%H:%M", localtime;
|
||||
|
||||
if($in_date =~ /(\d{4})-(\d+)-(\d+)/){
|
||||
$now_date = "$1-$2-$3";
|
||||
}elsif($in_date =~ /(\d+)\.(\d+)\.(\d+)/){
|
||||
$now_date = "$3-$2-$1";
|
||||
}
|
||||
|
||||
my ( $year, $month, $day ) = split( /-/, $now_date );
|
||||
|
||||
my ($nyear,$nmonth,$nday) = Add_Delta_YMD($year,$month,$day, 0,0,1);
|
||||
$nday = "0" . $nday if ( $nday < 10 );
|
||||
$nmonth = "0" . $nmonth if ( $nmonth < 10 );
|
||||
my $start_datetime = "$year-$month-$day";
|
||||
my $end_datetime = "$nyear-$nmonth-$nday";
|
||||
$start_datetime = "$day.$month.$year" if(lc($lang) eq "de");
|
||||
$end_datetime = "$nday.$nmonth.$nyear" if(lc($lang) eq "de");
|
||||
$start_datetime .= " $now_time" if(!$in_time);
|
||||
$end_datetime .= " $now_time" if(!$in_time);
|
||||
return ($start_datetime,$end_datetime);
|
||||
}
|
||||
|
||||
#month map
|
||||
sub monthmap(){
|
||||
my @_months = ("Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember");
|
||||
|
@ -139,65 +111,4 @@ sub split_date(){
|
|||
return ($yy,$mo,$dd,$hh,$mi);
|
||||
}
|
||||
|
||||
#time and date format for DE
|
||||
sub time4de(){
|
||||
my $self = shift;
|
||||
my ($time_db,$hhmi,$decode) = @_;
|
||||
$time_db =~ s/:\d{2}\..*$// if($time_db);
|
||||
my ($date,$time) = split(/ /,$time_db);
|
||||
my ($yy,$mo,$dd) = split(/-/,$date);
|
||||
my ($hh,$mi) = split(/\:/,$time);
|
||||
my $date_de = " ";
|
||||
$date_de = "$dd.$mo.$yy";
|
||||
$date_de = "$dd.$mo.$yy $hh:$mi" if($hhmi);
|
||||
|
||||
#Deutsch (German) ==> 3
|
||||
$date_de = Date_to_Text_Long($yy,$mo,$dd,3) if($decode eq "Date_to_Text_Long");
|
||||
$date_de =~ s/M.*rz/März/;
|
||||
return $date_de;
|
||||
}
|
||||
|
||||
|
||||
#Prepares contenttranspos start_time, end_time and count/Menge
|
||||
sub contenttranspos_dating() {
|
||||
my $self = shift;
|
||||
my ($pos_id,$pos_start_time,$pos_end_time,$today4db,$hours) = @_;
|
||||
my $menge = 0;
|
||||
|
||||
$bw->log("sub contenttranspos_dating call from Callib:",\@_,"");
|
||||
|
||||
my $start_datetime = $today4db;
|
||||
my $end_datetime = $today4db;
|
||||
$start_datetime = "$1-$2-$3 $4:$5" if($pos_start_time =~ /(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2})/);
|
||||
$start_datetime = "$3-$2-$1 $4:$5" if($pos_start_time =~ /(\d{2})\.(\d{2})\.(\d{4})\s(\d{2}):(\d{2})/);
|
||||
$end_datetime = "$1-$2-$3 $4:$5" if($pos_end_time =~ /(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2})/);
|
||||
$end_datetime = "$3-$2-$1 $4:$5" if($pos_end_time =~ /(\d{2})\.(\d{2})\.(\d{4})\s(\d{2}):(\d{2})/);
|
||||
|
||||
if($start_datetime && $end_datetime){
|
||||
my ($s_yy,$s_mo,$s_dd,$s_hh,$s_mi) = &split_date("",$start_datetime);
|
||||
my $s_time = Mktime($s_yy,$s_mo,$s_dd,$s_hh,$s_mi,0);
|
||||
|
||||
my ($e_yy,$e_mo,$e_dd,$e_hh,$e_mi) = &split_date("",$end_datetime);
|
||||
|
||||
#Add 1hour and rebuild end_datetime
|
||||
my $sec=0;
|
||||
($e_yy,$e_mo,$e_dd,$e_hh,$e_mi,$sec) = Add_Delta_DHMS($e_yy,$e_mo,$e_dd,$e_hh,$e_mi,0, 0,$hours,0,0) if($hours =~ /^\d+$/);
|
||||
my $e_time = Mktime($e_yy,$e_mo,$e_dd,$e_hh,$e_mi,0);
|
||||
$end_datetime = "$e_yy-$e_mo-$e_dd $e_hh:$e_mi";
|
||||
|
||||
#$menge not used via Transposition and at last Prelogic.pm,
|
||||
#we believe setting by manually insert of int03=$menge
|
||||
if(1==1){
|
||||
#Count Menge in hours
|
||||
my $diff_time = $e_time - $s_time;
|
||||
$menge = $diff_time / 3600;#to get hours
|
||||
}
|
||||
}
|
||||
|
||||
my @return_array = ($pos_id,$start_datetime,$end_datetime,$menge);
|
||||
$bw->log("sub contenttranspos_dating return from Callib:",\@return_array,"");
|
||||
|
||||
return ($start_datetime,$end_datetime,$menge);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -324,6 +324,19 @@ sub get_tpl {
|
|||
return $tpl;
|
||||
}
|
||||
|
||||
#all templates
|
||||
sub collect_tpl(){
|
||||
my $self = shift;
|
||||
my $tpl_ids = shift || "";
|
||||
my $dbh = shift || $dbh_intern;
|
||||
my $where = "where tpl_id != 98 and tpl_id != 97";#without meta-Config and EditNode
|
||||
$where .= " and tpl_id IN ($tpl_ids)" if($tpl_ids);
|
||||
my $sth = $dbh->prepare("SELECT * FROM template $where");
|
||||
my $rc = $sth->execute();
|
||||
my $tpl_all = $sth->fetchall_hashref("tpl_id");
|
||||
return $tpl_all;
|
||||
}
|
||||
|
||||
#get uri_path and meta data like tpl_order by menue path
|
||||
sub get_node_meta {
|
||||
my $self = shift;
|
||||
|
@ -351,7 +364,7 @@ sub get_node_meta {
|
|||
foreach(@reverse_viewsel){
|
||||
$where .= ")";
|
||||
}
|
||||
my $sql = "SELECT * FROM nodes n,relation rel, template tpl $where";
|
||||
my $sql = "SELECT n.owner AS nowner,n.change AS nchange,* FROM nodes n,relation rel, template tpl $where";
|
||||
my $sth = $dbh->prepare($sql);
|
||||
my $rc = $sth->execute();
|
||||
my $nrt = $sth->fetchrow_hashref();
|
||||
|
@ -709,6 +722,7 @@ sub fetch_record(){
|
|||
my $where = "where ct.c_id=rel.content_id and nd.main_id=rel.main_id";
|
||||
$where .= "$fetch_sql" if($fetch_sql);#enhancement to get bike_group OR
|
||||
my $order = "";
|
||||
$order = "order by ct.barcode DESC" if($fetch->{table} eq "content");
|
||||
|
||||
foreach my $key (keys %$fetch){
|
||||
if($fetch->{$key}){
|
||||
|
@ -749,7 +763,7 @@ sub fetch_record(){
|
|||
if($varenv{systype} && $varenv{systype} eq "azn" && $key =~ /start_time|end_time/){
|
||||
if($key =~ /start_time/){
|
||||
$where .= " and (ct.end_time >= '$fetch->{start_time}' AND ct.start_time <= '$fetch->{end_time}')";
|
||||
$order = " order by ct.start_time DESC";#because to get ct_id for contenttverpos Übertrag
|
||||
$order = "order by ct.start_time DESC";#because to get ct_id for contenttverpos Übertrag
|
||||
}
|
||||
}elsif($key =~ /close_time$/ && $value){
|
||||
$where .= " and ct.$key $op $value";
|
||||
|
@ -817,7 +831,7 @@ sub fetch_tablerecord(){
|
|||
$where .= " and $key $op $value";
|
||||
}elsif($key =~ /time$/ && $value){
|
||||
$where .= " and $key $op '$value'";
|
||||
}elsif($key =~ /^(c_id|u_id|ct_id|ca_id|barcode|int\d+|owner|template_id)$/ && (looks_like_number($value) || $value)){
|
||||
}elsif($key =~ /^(c_id|u_id|ct_id|ca_id|barcode|int\d+|owner|template_id)$/ && (looks_like_number($value) || $value eq "null")){
|
||||
if($value eq "null"){
|
||||
$where .= " and ($key is null OR $key = 0)";
|
||||
}elsif($value eq "nullOR1"){
|
||||
|
@ -1356,6 +1370,7 @@ sub copy_template(){
|
|||
my $dbh = shift || $dbh_intern;
|
||||
my $master_tpl_id = shift;
|
||||
my $new_tpl_id = shift;
|
||||
my $new_tpl_name = shift;
|
||||
my $owner = shift;
|
||||
|
||||
my $columns = "tpl_name,tpl_order,ct_table,tpl_height,tpl_width,bg_color";
|
||||
|
@ -1368,12 +1383,55 @@ sub copy_template(){
|
|||
my $auto_tpl_id = $sth->fetchrow_array();
|
||||
$bw->log("DBtank copy_template : $rows",$sql,"") if($debug);
|
||||
|
||||
my $sth2 = $dbh->prepare("UPDATE template set tpl_id=$new_tpl_id, change='now()',owner=$owner where tpl_id=$auto_tpl_id");
|
||||
my $sth2 = $dbh->prepare("UPDATE template set tpl_id=$new_tpl_id, tpl_name='$new_tpl_name', change='now()',owner=$owner where tpl_id=$auto_tpl_id");
|
||||
$rows = $sth2->execute();
|
||||
|
||||
return $new_tpl_id;
|
||||
}
|
||||
|
||||
#copy content
|
||||
sub copy_content {
|
||||
my $self = shift;
|
||||
my $dbh = shift || $dbh_intern;
|
||||
my $table = shift;
|
||||
my $sourcec_id = shift;
|
||||
my $targetc_id = shift;
|
||||
my $new_ct_name = shift;
|
||||
my $owner = shift;
|
||||
my $rows = 0;
|
||||
|
||||
my $cref = {
|
||||
table => $table,
|
||||
fetch => "one",
|
||||
c_id => $sourcec_id,
|
||||
};
|
||||
my $record = { c_id => 0 };
|
||||
$record = $self->fetch_record($dbh,$cref);
|
||||
|
||||
if($record->{c_id} > 0){
|
||||
delete $record->{c_id};
|
||||
delete $record->{ct_name};
|
||||
delete $record->{itime};
|
||||
delete $record->{mtime};
|
||||
delete $record->{owner};
|
||||
|
||||
my $update = {
|
||||
%$record,
|
||||
table => $table,
|
||||
ct_name => $new_ct_name,
|
||||
mtime => 'now()',
|
||||
owner => $owner,
|
||||
c_id => $targetc_id,
|
||||
};
|
||||
$rows = $self->update_record($dbh,$update,$update);
|
||||
|
||||
if($rows != 1){
|
||||
my $newc_id = $self->insert_contentoid($dbh,$update,"");
|
||||
$rows = 1 if($newc_id);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#content of txt08 changed to ctadr->{txt01} Name
|
||||
sub insert_pos(){
|
||||
|
@ -1742,4 +1800,38 @@ sub search_content(){
|
|||
return $search;
|
||||
}
|
||||
|
||||
#search json for automcomplete
|
||||
sub search_json(){
|
||||
my $self = shift;
|
||||
my $dbh = shift || $dbh_intern;
|
||||
my $table = shift;
|
||||
my $search = shift || "";
|
||||
my $template_id = shift || "";
|
||||
my $c_id = shift || "";
|
||||
my $catch_equal = shift || 0;
|
||||
|
||||
my $sel = "1=2";
|
||||
my $sth = "";
|
||||
my $rows = 0;
|
||||
|
||||
if($search =~ /^\d+$/ && $table eq "content"){
|
||||
if($catch_equal){
|
||||
$sel = "(ct_name ilike '$search' OR CAST(barcode AS text) like '$search') and c_id != $c_id";
|
||||
}else{
|
||||
$sel = "(ct_name ilike '$search%' OR CAST(barcode AS text) like '$search%') and c_id != $c_id";
|
||||
}
|
||||
$sth = $dbh->prepare("SELECT ct.ct_name || ' , ' || ct.barcode || ' , ' || ct.txt01 AS value, ct.ct_name AS spart_ct_name, ct.c_id FROM $table ct, relation rel WHERE ct.c_id=rel.content_id and rel.template_id IN ($template_id) and $sel");
|
||||
my $rc = $sth->execute();
|
||||
$rows = $sth->rows;
|
||||
|
||||
}elsif($search =~ /\w{3}/ && $table eq "contentadr"){
|
||||
my $sel = "txt01 ilike '%$search%'";
|
||||
$sth = $dbh->prepare("SELECT ct.txt01 || ', ' || ct.c_id AS value, ct.txt01 AS vorname_name, ct.c_id FROM $table ct, relation rel WHERE ct.c_id=rel.content_id and rel.template_id=$template_id and $sel");
|
||||
my $rc = $sth->execute();
|
||||
$rows = $sth->rows;
|
||||
}
|
||||
|
||||
return ($rows,$sth);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -32,6 +32,8 @@ sub handler {
|
|||
rcopy("$varenv{basedir}/pdfinvoice/$filesuff","$varenv{basedir}/cache/$coo/$filesuff");
|
||||
}elsif($filesuff =~ /got_last\.csv/i){
|
||||
rcopy("$varenv{basedir}/ftp/SWK_codes/$filesuff","$varenv{basedir}/cache/$coo/$filesuff");
|
||||
}elsif($filesuff =~ /\.csv/i){
|
||||
rcopy("$varenv{basedir}/csv/$filesuff","$varenv{basedir}/cache/$coo/$filesuff");
|
||||
}elsif($filesuff =~ /Statistik_\d{4}-\d{2}\.zip/i){
|
||||
rcopy("$varenv{basedir}/csv/$filesuff","$varenv{basedir}/cache/$coo/$filesuff");
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ use Mod::Buttons;
|
|||
use Mod::Prelogic;
|
||||
use Lib::Mlogic;
|
||||
use Mod::Basework;
|
||||
use Mod::Premain;
|
||||
#use Mod::Premain;
|
||||
use Mod::DBtank;
|
||||
use Mod::Libenzdb;
|
||||
use Mod::APIfunc;
|
||||
|
@ -46,7 +46,7 @@ sub handler {
|
|||
my $ml = new Mlogic;
|
||||
my $bw = new Basework;
|
||||
my $pre = new Prelogic;
|
||||
my $pm = new Premain;
|
||||
#my $pm = new Premain;
|
||||
my $tk = new Shareework;
|
||||
my $dbt = new DBtank;
|
||||
my $db = new Libenzdb;
|
||||
|
@ -182,7 +182,7 @@ sub handler {
|
|||
|
||||
#create_account. 2. inserts contentadr
|
||||
my $tinkc_id = $tk->create_account($aowner);
|
||||
($returnwww,$feedb) = $tk->save_account($tinkc_id,\%varenv,$aowner);
|
||||
($returnwww,$feedb) = $tk->save_account($q,$tinkc_id,\%varenv,$aowner);
|
||||
|
||||
#Like login_sharee, redundant
|
||||
my $hw_id = unpack ('H*', pack('Nc', time, $$ % 0xff));#old $co
|
||||
|
@ -316,66 +316,93 @@ sub handler {
|
|||
#permissions
|
||||
#DMS Kunden rw
|
||||
if($R::base_edit && $node_meta->{ct_table} eq "contentadr"){
|
||||
$bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table}|$R::c_id with: $R::base_edit","","");
|
||||
$bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table}",$q,"");
|
||||
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
|
||||
my $users_dms_primary = { u_id => 0 };
|
||||
$users_dms_primary = $dbt->select_users($dbh_primary,$users_dms->{u_id},"and int02 >= 1");
|
||||
|
||||
if($R::c_id && $R::base_edit eq "remove_chk4rel"){
|
||||
my $delete_key = "delete_content";
|
||||
$delete_key = "delete_adr";
|
||||
if($users_dms_primary->{u_id} && $users_dms_primary->{int02} == 2 && $users_dms->{u_id} && $users_dms->{int02} == 2){
|
||||
if($R::c_id && $R::base_edit eq "remove_chk4rel"){
|
||||
my $delete_key = "delete_adr";
|
||||
$return = "failure::Datensatz wirklich löschen. ::?base_edit=$delete_key\&exit_box2=1\&c_id=$R::c_id ::löschen";
|
||||
}elsif($users_dms_primary->{u_id} && $users_dms_primary->{int02} == 2 && $users_dms->{u_id} && $users_dms->{int02} == 2 && $R::c_id && $R::base_edit eq "save_adr"){
|
||||
($returnwww,$feedb) = $tk->save_account($R::c_id,\%varenv,$users_dms->{u_id});
|
||||
}elsif($users_dms_primary->{u_id} && $users_dms_primary->{int02} == 2 && $users_dms->{u_id} && $users_dms->{int02} == 2 && $R::c_id && $R::base_edit eq "delete_adr"){
|
||||
}elsif($R::c_id && $R::base_edit eq "delete_adr"){
|
||||
$return = $tk->delete_account($R::c_id,$users_dms->{u_id});
|
||||
}elsif($R::c_id && $R::base_edit eq "save_adr"){
|
||||
($returnwww,$feedb) = $tk->save_account($q,$R::c_id,\%varenv,$users_dms->{u_id});
|
||||
}
|
||||
}else{
|
||||
$return = "failure::Abbruch. Schreibender Zugriff \"Kunden Stammdaten\" verweigert.";
|
||||
$feedb->{message} = "failure::Abbruch. Schreibender Zugriff \"Kunden Stammdaten\" verweigert.";
|
||||
}
|
||||
}
|
||||
|
||||
#DMS users accounts
|
||||
if($R::base_edit && $node_meta->{ct_table} eq "users"){#DMS-Account rw
|
||||
$bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table} with: $R::base_edit","","");
|
||||
if($R::u_id && $R::base_edit eq "remove_chk4rel"){#users
|
||||
$bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table}",$q,"");
|
||||
if($users_dms->{u_id} && $users_dms->{int07} == 2){
|
||||
if($R::u_id && $R::base_edit eq "remove_chk4rel"){#users
|
||||
my $delete_key = "delete_dmsusers";
|
||||
$return = "failure::Datensatz wirklich löschen. ::?base_edit=$delete_key\&exit_box2=1\&u_id=$R::u_id ::löschen";
|
||||
}elsif($users_dms->{int07} == 2 && ($R::u_id || $R::c_idadr) && $R::base_edit =~ /_dmsusers/){
|
||||
}elsif(($R::u_id || $R::c_idadr) && $R::base_edit =~ /_dmsusers/){
|
||||
my $u_id = $1 if($R::u_id && $R::u_id =~ /(\d+)/);
|
||||
$u_id = $1 if($R::c_idadr && $R::c_idadr =~ /(\d+)/ && $R::base_edit eq "new_dmsusers");
|
||||
$return = $tk->manage_dmsusers($R::base_edit,$u_id,$users_dms);
|
||||
$return = $tk->manage_dmsusers($q,$R::base_edit,$u_id,$users_dms);
|
||||
}
|
||||
}else{
|
||||
$return = "failure::Abbruch. Schreibender Zugriff \"DMS-Account\" verweigert.";
|
||||
$feedb->{message} = "failure::Abbruch. Schreibender Zugriff \"DMS-Account\" verweigert.";
|
||||
}
|
||||
}
|
||||
|
||||
#DMS Waren || Einstellung/Service* rw
|
||||
if(($node_meta->{ct_table} eq "content" || $node_meta->{ct_table} eq "contentuser") && $R::main_id && $R::main_id >= 200000){
|
||||
$bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table}|$R::main_id with: $R::rel_edit","","");
|
||||
if(($node_meta->{ct_table} eq "content" && $users_dms->{int01} == 2) || ($node_meta->{ct_table} eq "contentuser" && $users_dms->{int08} == 2)){
|
||||
if($R::rel_edit eq "save_relation"){
|
||||
#DMS Waren
|
||||
if($node_meta->{ct_table} eq "content"){
|
||||
$bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table}",$q,"");
|
||||
if($users_dms->{u_id} && $users_dms->{int01} == 2){
|
||||
if($R::rel_edit eq "save_relation" && $R::main_id && $R::main_id >= 200000){
|
||||
$return = $pl->save_relation($q,$R::main_id,$users_dms->{u_id});
|
||||
}elsif($R::rel_edit eq "delete_relation"){
|
||||
}elsif($R::rel_edit eq "delete_relation" && $R::main_id && $R::main_id >= 200000){
|
||||
$return = $pl->delete_relation($q,$R::main_id,$users_dms->{u_id});
|
||||
}elsif($R::rel_edit eq "new_relation"){
|
||||
}elsif($R::rel_edit eq "new_relation" && $R::main_id && $R::main_id >= 200000){
|
||||
$return = $pl->new_relation($q,$R::main_id,$users_dms->{u_id});
|
||||
}elsif($R::rel_edit eq "save_ctuser"){
|
||||
$return = $pl->save_service_desc($q,$R::c_id,$users_dms);
|
||||
}elsif($R::base_edit eq "new_contentcms"){
|
||||
$feedb = $pl->new_contentcms($q,$users_dms);
|
||||
}elsif($R::base_edit eq "save_contentcms"){
|
||||
}elsif($R::base_edit eq "new_content" && $R::main_id && $R::main_id >= 200000){
|
||||
$feedb = $pl->new_content($q,$users_dms);
|
||||
}elsif($R::base_edit eq "save_content"){
|
||||
$feedb = $pl->save_content($q,$users_dms,$node_meta,$R::c_id) if(looks_like_number($R::c_id));
|
||||
}elsif($R::rel_edit){
|
||||
$return = $pm->maininit($users_dms);
|
||||
}elsif($R::c_id && $R::base_edit eq "remove_chk4rel"){
|
||||
my $delete_key = "delete_content";
|
||||
$feedb->{message} = "failure::Datensatz wirklich löschen. ::?base_edit=$delete_key\&exit_box2=1\&c_id=$R::c_id ::löschen";
|
||||
}elsif($R::c_id && $R::base_edit eq "delete_content"){
|
||||
$feedb = $pl->delete_content($node_meta,$R::c_id);
|
||||
|
||||
#}elsif($R::rel_edit){
|
||||
#$return = $pm->maininit($users_dms);
|
||||
}
|
||||
}elsif($R::rel_edit){
|
||||
$return = "failure::Abbruch. Schreibender Zugriff \"Waren Stammdaten\" verweigert.";
|
||||
}else{
|
||||
$feedb->{message} = "failure::Abbruch. Schreibender Zugriff \"Waren Stammdaten\" verweigert.";
|
||||
}
|
||||
}
|
||||
|
||||
#Einstellung
|
||||
if($node_meta->{ct_table} eq "contentuser"){
|
||||
$bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table}",$q,"");
|
||||
if($users_dms->{u_id} && $users_dms->{int08} == 2){
|
||||
if($R::rel_edit eq "save_ctuser" && $R::main_id && $R::main_id >= 200000){
|
||||
$return = $pl->save_service_desc($q,$R::c_id,$users_dms);
|
||||
}elsif($R::base_edit eq "new_contentcms" && $R::main_id && $R::main_id >= 200000){
|
||||
$feedb = $pl->new_content($q,$users_dms);
|
||||
}elsif($R::base_edit eq "save_contentcms" && $R::main_id && $R::main_id >= 200000){
|
||||
$feedb = $pl->save_content($q,$users_dms,$node_meta,$R::c_id) if(looks_like_number($R::c_id));
|
||||
}elsif($R::c_id && $R::base_edit eq "remove_chk4rel"){
|
||||
my $delete_key = "delete_contentuser";
|
||||
$feedb->{message} = "failure::Datensatz wirklich löschen. ::?base_edit=$delete_key\&exit_box2=1\&c_id=$R::c_id ::löschen";
|
||||
}elsif($R::c_id && $R::base_edit eq "delete_contentuser"){
|
||||
$feedb = $pl->delete_content($node_meta,$R::c_id);
|
||||
}
|
||||
}else{
|
||||
$feedb->{message} = "failure::Abbruch. Schreibender Zugriff \"Einstellung\" verweigert.";
|
||||
}
|
||||
}
|
||||
|
||||
#DMS Faktura
|
||||
if($node_meta->{ct_table} eq "contenttrans"){
|
||||
$bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table}|$R::c_id4trans,$R::tpl_id4trans with: $R::ct_trans","","");
|
||||
$bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table}",$q,"");
|
||||
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
|
||||
my $users_dms_primary = { u_id => 0 };
|
||||
$users_dms_primary = $dbt->select_users($dbh_primary,$users_dms->{u_id},"and int03 >= 1");
|
||||
|
@ -395,14 +422,15 @@ sub handler {
|
|||
my $ck4ex = "@R::ck4ex" || "";
|
||||
$return = $pl->operator_accounting($q,$users_dms,$users_sharee,$R::accounting_type,$ck4ex);
|
||||
}elsif($R::ct_trans || $R::v_abschluss || $R::trans2edit){
|
||||
if($R::ct_trans ne "open" && looks_like_number($R::c_id4trans) && !$R::v_abschluss && !$R::trans2edit){
|
||||
#should do all else invoice text save , without positions and booking payment
|
||||
if($R::ct_trans !~ /_pos|open/ && looks_like_number($R::c_id4trans) && !$R::v_abschluss && !$R::trans2edit){
|
||||
$feedb = $pl->save_text2contenttrans($q,$users_dms,$R::c_id4trans);
|
||||
}
|
||||
$return .= "|";
|
||||
$return .= $pre->preinit($users_dms,$lang);#transactions logic
|
||||
}
|
||||
}elsif($R::ct_trans){
|
||||
$return = "failure::Abbruch. Schreibender Zugriff \"Faktura\" verweigert.";
|
||||
$feedb->{message} = "failure::Abbruch. Schreibender Zugriff \"Faktura\" verweigert.";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -426,11 +454,11 @@ sub handler {
|
|||
|
||||
#save_account. 3. updates contentadr
|
||||
if($users_sharee->{c_id} && $R::sharee_edit && $R::sharee_edit =~ /save_account/){
|
||||
($returnwww,$feedb) = $tk->save_account($users_sharee->{c_id},\%varenv,$aowner);
|
||||
($returnwww,$feedb) = $tk->save_account($q,$users_sharee->{c_id},\%varenv,$aowner);
|
||||
}
|
||||
|
||||
if($users_sharee->{c_id} && $R::sharee_edit && $R::sharee_edit =~ /save_transact/){
|
||||
$returnwww = $tk->save_transact($users_sharee->{c_id},$coo,$aowner);
|
||||
$returnwww = $tk->save_transact($q,$users_sharee->{c_id},$coo,$aowner);
|
||||
}
|
||||
|
||||
if($returnwww && $returnwww =~ /failure::(.*)/){
|
||||
|
@ -484,9 +512,10 @@ sub handler {
|
|||
$update_adr->{txt23} = "";
|
||||
$update_adr->{ct_name} = $q->escapeHTML($R::pseudocardpan);
|
||||
$update_adr->{txt27} = $q->escapeHTML($R::status);
|
||||
$update_adr->{txt28} = $now_dt . " pseudocardpan\n" . $q->escapeHTML($payone_return);
|
||||
$update_adr->{txt28} = $now_dt . "\n" . $q->escapeHTML($payone_return);
|
||||
$update_adr->{int12} = 0 if($users_sharee->{int12} != 2);#Vde hard set by fibu
|
||||
$update_adr->{int03} = 2;
|
||||
$update_adr->{int24} = "null";#cpdate reset
|
||||
$dbt->update_record($dbh,$update_adr,$users_sharee) if($users_sharee->{c_id} > 0);
|
||||
($api_return,$users_sharee) = $apif->auth_verify($q,$coo,"");
|
||||
|
||||
|
@ -810,7 +839,7 @@ sub handler {
|
|||
}elsif($return =~ /failure::/){
|
||||
$feedb->{message} = $return;
|
||||
}
|
||||
$ml->tpl($node_meta,$users_dms,$mode,\%varenv,$users_sharee,$feedb);
|
||||
$ml->tpl($q,$node_meta,$users_dms,$mode,\%varenv,$users_sharee,$feedb);
|
||||
|
||||
if(ref($api_return) eq "HASH" && $api_return->{response_text}){
|
||||
print<<EOF
|
||||
|
|
|
@ -1,831 +0,0 @@
|
|||
package Mod::Indextest;
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
|
||||
#
|
||||
#
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use POSIX;
|
||||
use CGI::Cookie ();
|
||||
use CGI ':standard';
|
||||
use DateTime;
|
||||
use DateTime::Format::Pg;
|
||||
use DBI;
|
||||
use Apache2::RequestUtil ();
|
||||
use Apache2::RequestIO ();
|
||||
use Apache2::Const -compile => qw(OK);
|
||||
use LWP::UserAgent;
|
||||
use Digest::MD5 qw(md5 md5_hex);
|
||||
use Scalar::Util qw(looks_like_number);
|
||||
#use Encode;
|
||||
#use URI::Encode qw(uri_encode uri_decode);
|
||||
|
||||
use Lib::Config;
|
||||
use Mod::Buttons;
|
||||
use Mod::Prelogic;
|
||||
use Lib::Mlogic;
|
||||
use Mod::Basework;
|
||||
use Mod::Premain;
|
||||
use Mod::DBtank;
|
||||
use Mod::Libenzdb;
|
||||
use Mod::APIfunc;
|
||||
use Mod::Shareework;
|
||||
use Mod::Prelib;
|
||||
use Mod::Payment;
|
||||
use Mod::Modalbox;
|
||||
use Mod::Modalbox3;
|
||||
use Data::Dumper;
|
||||
|
||||
sub handler {
|
||||
my $re = shift;
|
||||
my $q = new CGI();
|
||||
$q->import_names('R');
|
||||
my $cf = new Config;
|
||||
my $ml = new Mlogic;
|
||||
my $bw = new Basework;
|
||||
my $pre = new Prelogic;
|
||||
my $pm = new Premain;
|
||||
my $tk = new Shareework;
|
||||
my $dbt = new DBtank;
|
||||
my $db = new Libenzdb;
|
||||
my $apif = new APIfunc;
|
||||
my $but = new Buttons;
|
||||
my $pl = new Prelib;
|
||||
my $payone = new Payment;
|
||||
|
||||
my %varenv = $cf->envonline();
|
||||
my $netloc = $q->url(-base=>1);
|
||||
my $dbh = "";
|
||||
my $script = $q->script_name();
|
||||
my $path = $q->path_info();
|
||||
$path = "$script" . "$path";
|
||||
my $refer = $ENV{HTTP_REFERER};
|
||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
my $return = "";
|
||||
my $returnwww = "";
|
||||
my $html_charset = "utf-8";
|
||||
my $user_agent = $q->user_agent();
|
||||
$path =~ s/\.html//;
|
||||
|
||||
#$mode is used to set GUI features like "maintainer" contextmenue
|
||||
my $modes = $dbt->{shareedms_conf}->{modes};
|
||||
my $mode = "";
|
||||
if($R::mode && length($R::mode) >= 5 && $R::mode =~ /($modes)/){
|
||||
$mode = "$R::mode";
|
||||
}elsif($path && $path =~ /\/($modes)$/){
|
||||
$mode = $1;
|
||||
}elsif($path && $path =~ /\/($modes)\?\w/){
|
||||
$mode = $1;
|
||||
}
|
||||
|
||||
#main datadir is main config directive like "shareeapp-kn" and catched by syshost name
|
||||
if($netloc =~ /:\/\/(sharee\w+-\w+)\.copri/){
|
||||
#$bw->log("Indexsharee merchant select by netloc:",$netloc,"");
|
||||
$varenv{syshost} = $1 if( -d "/var/www/copri-bike/$1");
|
||||
$mode = "manager" if($varenv{syshost} =~ /shareedms-/ && !$mode);
|
||||
}
|
||||
die "no configuration available" if(!$varenv{syshost});
|
||||
|
||||
|
||||
if($varenv{orga} ne "dms" && $path =~ /DMS|Waren|Kunden\/|Einstellung|journal|Faktur/i){
|
||||
print redirect("$varenv{wwwhost}");
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $lang = "de";
|
||||
my $dyn_js = "";
|
||||
my $users_dms = {};
|
||||
my $users_sharee = {};
|
||||
my $api_return = {};
|
||||
|
||||
print $q->header(-charset=>"$html_charset");
|
||||
|
||||
my $coo = $q->cookie('domcookie') || $R::sessionid || "";
|
||||
#Prio sessionid if also domcookie is set ... and s.u.
|
||||
if($R::sessionid && $R::sessionid ne $q->cookie('domcookie')){
|
||||
$coo = $q->param('sessionid');
|
||||
my $cookie = CGI::Cookie->new(-name => 'domcookie',-value => $coo);
|
||||
print $q->header(-charset=>"$html_charset", -cookie=>$cookie);
|
||||
}
|
||||
|
||||
(my $aowner,my $return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$R::merchant_id);
|
||||
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
||||
$bw->log("Indexsharee merchant select used with access_owner $aowner",$varenv{merchant_id},"");
|
||||
|
||||
($api_return,$users_sharee) = $apif->auth_verify($q,$coo,"");
|
||||
|
||||
#login-screen should only be available if auth_verify fails
|
||||
if($R::login_sharee || $R::login_dms){
|
||||
|
||||
#1. logout
|
||||
$apif->authout($q,$coo);
|
||||
|
||||
my $hw_id = unpack ('H*', pack('Nc', time, $$ % 0xff));#old $co
|
||||
#3. authorize
|
||||
my $author = $apif->authorization($q,$varenv{merchant_id},$hw_id,$aowner);#$co like browser hw_id
|
||||
#4. verify and get user values
|
||||
($api_return,$users_sharee) = $apif->auth_verify($q,$author->{authcookie},"",$author->{new_authcoo});
|
||||
|
||||
#5. domcookie by authcookie substr (cut first 15 chars), AND also sessionid
|
||||
if($author->{authcookie} && length($author->{authcookie}) > 30){
|
||||
# take last 21 chars
|
||||
$coo = substr $author->{authcookie}, 15;
|
||||
my $cookie = CGI::Cookie->new(-name => 'domcookie',-value => $coo);
|
||||
print $q->header(-charset=>"$html_charset", -cookie=>$cookie);
|
||||
|
||||
#DMS login
|
||||
if($users_sharee->{c_id} && $varenv{orga} eq "dms" && $R::login_dms eq "Login" && $coo && length($coo) > 20){
|
||||
$users_dms = $dbt->select_users($dbh,$users_sharee->{c_id});
|
||||
my $update_users = {
|
||||
table => "users",
|
||||
owner => $aowner,
|
||||
u_id => $users_dms->{u_id}
|
||||
};
|
||||
$dbt->update_one($dbh,$update_users,"cookie='$coo'") if($users_dms->{u_id});
|
||||
|
||||
print redirect("$varenv{wwwhost}$path");
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $session="";
|
||||
my $session_and="";
|
||||
if(length($coo) > 20 && !$q->cookie(-name=>'domcookie')){
|
||||
$session = "?sessionid=$coo";
|
||||
$session_and = "&sessionid=$coo";
|
||||
}
|
||||
|
||||
#DMS
|
||||
if($users_sharee->{c_id} && $varenv{orga} eq "dms" && $coo && length($coo) > 20){
|
||||
$users_dms = $dbt->select_users($dbh,$users_sharee->{c_id},"and cookie='$coo'");
|
||||
}
|
||||
|
||||
|
||||
#Save anyway on create ... and hopefully delete it later
|
||||
if($R::sharee_edit && $R::sharee_edit =~ /create_account/ && $R::txt04 && $R::txt04 =~ /\w+/ && $R::txt08 && $R::txt08 =~ /\w+\@\w+/){
|
||||
|
||||
#1. logout
|
||||
$apif->authout($q,$coo);
|
||||
|
||||
#create_account. 2. inserts contentadr
|
||||
my $tinkc_id = $tk->create_account($aowner);
|
||||
($returnwww,$return) = $tk->save_account($tinkc_id,\%varenv,$aowner);
|
||||
|
||||
#Like login_sharee, redundant
|
||||
my $hw_id = unpack ('H*', pack('Nc', time, $$ % 0xff));#old $co
|
||||
#3. authorize
|
||||
my $author = $apif->authorization($q,$varenv{merchant_id},$hw_id,$aowner);#$co like browser hw_id
|
||||
#print "3. authorize: " . $author->{authcookie} . " -- " . $q->param('authcookie') . " ++ " . $coo . "<br>";
|
||||
|
||||
#4. verify and get user values
|
||||
($api_return,$users_sharee) = $apif->auth_verify($q,$author->{authcookie},"",$author->{new_authcoo});
|
||||
#print "4. verifyize: " . $author->{authcookie} . " -- c_id: " . $users_sharee->{c_id} . " ++ " . $coo . "<br>";
|
||||
|
||||
#5. domcookie by authcookie substr (cut first 15 chars), AND also sessionid
|
||||
if($author->{authcookie} && length($author->{authcookie}) > 30){
|
||||
# take last 21 chars
|
||||
$coo = substr $author->{authcookie}, 15;
|
||||
my $cookie = CGI::Cookie->new(-name => 'domcookie',-value => $coo);
|
||||
print $q->header(-charset=>"$html_charset", -cookie=>$cookie);
|
||||
#print "5. set cookie: " . $author->{authcookie} . " -- " . $q->param('authcookie') . " ++ " . $coo . "<br>";
|
||||
|
||||
#2020-07-09 if user-pw authorized, then ignore conflict_ because it matches exist user-data
|
||||
if($tinkc_id && $returnwww && $returnwww =~ /conflict_txt07|conflict_txt08/){
|
||||
#delete user-pw conflict registration and going on with existing data
|
||||
#$db->delete_content("contentadr",$tinkc_id);
|
||||
$return = $tk->delete_account($tinkc_id,$users_dms->{u_id});
|
||||
|
||||
$apif->authout($q,$coo) if($coo);
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Anmelden?conflict_failure=1");
|
||||
exit 0;
|
||||
}
|
||||
elsif(length($coo) > 20){
|
||||
#we need this to get $R::sessionid to FormEdit
|
||||
#if(length($coo) > 20 && !$q->cookie(-name=>'domcookie')){
|
||||
($api_return,$users_sharee) = $apif->auth_verify($q,$author->{authcookie},"");
|
||||
if(($returnwww && $returnwww =~ /failure::(.*)/) || ($users_sharee->{txt31} && $users_sharee->{txt31} =~ /\w/)){
|
||||
$returnwww =~ s/::/=/g;
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1}?sessionid=$coo\&$returnwww");
|
||||
exit 0;
|
||||
}else{
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1_5}?sessionid=$coo");
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $payable_check=0;
|
||||
if($users_sharee->{int03} && $users_sharee->{ct_name} && ($users_sharee->{int03} == 1 && $users_sharee->{ct_name} =~ /\w{2}-\d+/) || ($users_sharee->{int03} == 2 && length($users_sharee->{ct_name}) >= 19)){
|
||||
$payable_check=1;
|
||||
}
|
||||
|
||||
|
||||
# Logout
|
||||
if($mode =~ /logout/){
|
||||
if($mode =~ /logout_sharee/){
|
||||
$apif->authout($q,$coo);
|
||||
}else{
|
||||
$db->cook_out($coo);
|
||||
}
|
||||
print redirect("$varenv{wwwhost}");
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $tpl = $dbt->get_tpl($dbh,"302001");#Kundendaten template
|
||||
$tpl->{tpl_order} .= ",txt04,txt08";
|
||||
|
||||
|
||||
if($R::login_sharee){
|
||||
if($users_sharee->{c_id} && (($users_sharee->{int03} != 1 && $users_sharee->{int03} != 2)|| ($users_sharee->{txt31} && $tpl->{tpl_order} =~ /$users_sharee->{txt31}/))){
|
||||
my $row = $db->updater("contentadr","c_id","$users_sharee->{c_id}","int12","1");#Vde
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1}$session");
|
||||
exit 0;
|
||||
}elsif($users_sharee->{c_id} && !$payable_check){
|
||||
#print redirect("$varenv{wwwhost}/$varenv{mandant}/$varenv{profile}");
|
||||
#print redirect("$varenv{wwwhost}/$varenv{mandant}/$varenv{start}");
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_2}$session");
|
||||
exit 0;
|
||||
}elsif(!$users_sharee->{c_id} || ($users_sharee->{c_id} && $users_sharee->{c_id} !~ /^\d+$/)){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Anmelden?failure=1$session_and");
|
||||
exit 0;
|
||||
}else{
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/$varenv{profile}$session");
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
||||
my $oncontextmenu="";
|
||||
$oncontextmenu="return false;";# if($mode =~ /maintainer/);
|
||||
$oncontextmenu="" if(!$users_dms->{u_id});
|
||||
|
||||
|
||||
#Menu & node_path handling
|
||||
my ($view,$view_post);
|
||||
my @viewsel = ("shareestart");
|
||||
if($path =~ /^\/(.*)/){
|
||||
@viewsel = split /\//,$1;
|
||||
if("$path" =~ /\/($modes)$/){
|
||||
pop @viewsel;
|
||||
}
|
||||
$view_post = $viewsel[-1] || "root";
|
||||
#$view_post = encode('iso-8859-1',decode('utf-8', $view_post));
|
||||
$view = $viewsel[0];
|
||||
}
|
||||
my $depth = scalar(@viewsel);
|
||||
$view = "root" if(!$view);
|
||||
|
||||
my $node_meta = $dbt->get_node_meta($dbh,\@viewsel);
|
||||
|
||||
#DMS & Tools
|
||||
if($varenv{orga} eq "dms" && $users_dms->{u_id}){
|
||||
if($R::cal_delta_start){
|
||||
use Date::Calc qw(Add_Delta_YMD);
|
||||
my $day = strftime "%d", localtime;
|
||||
my $mon = strftime "%m", localtime;
|
||||
my $year = strftime "%Y", localtime;
|
||||
$users_dms->{cal_start} =~ s/\s.*//;
|
||||
($year,$mon,$day) = split(/-/,$users_dms->{cal_start}) if($users_dms->{cal_start});
|
||||
my ($year1,$mon1,$day1) = split(/:/,$R::cal_delta_start);
|
||||
my ($Dy,$Dm,$Dd) = Add_Delta_YMD($year,$mon,$day, $year1,$mon1,$day1);
|
||||
$db->users_up("cal_start","$Dy-$Dm-$Dd",$users_dms->{u_id});
|
||||
}
|
||||
if($R::cal_today){
|
||||
my $today4db = strftime("%Y-%m-%d %H:%M",localtime(time));
|
||||
$db->users_up("cal_start","$today4db",$users_dms->{u_id});
|
||||
}
|
||||
if($R::col_sort){
|
||||
$db->users_up("col_sort",$R::col_sort,$users_dms->{u_id});
|
||||
}
|
||||
if($R::sort_updown){
|
||||
$db->users_up("sort_updown",$R::sort_updown,$users_dms->{u_id});
|
||||
}
|
||||
if($R::cal_sort_updown){
|
||||
$db->users_up("cal_sort_updown",$R::cal_sort_updown,$users_dms->{u_id});
|
||||
}
|
||||
|
||||
#base_edit implements new DMS methodes without Pre* things
|
||||
#permissions
|
||||
#DMS Kunden rw
|
||||
if($R::base_edit && $node_meta->{ct_table} eq "contentadr"){
|
||||
$bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table}|$R::c_id with: $R::base_edit","","");
|
||||
if($R::c_id && $R::base_edit eq "remove_chk4rel"){
|
||||
my $delete_key = "delete_content";
|
||||
$delete_key = "delete_adr";
|
||||
$return = "failure::Datensatz wirklich löschen. ::?base_edit=$delete_key\&exit_box2=1\&c_id=$R::c_id ::löschen";
|
||||
}elsif($users_dms->{int02} == 2 && $R::c_id && $R::base_edit eq "save_adr"){
|
||||
($returnwww,$return) = $tk->save_account($R::c_id,\%varenv,$users_dms->{u_id});
|
||||
}elsif($users_dms->{int02} == 2 && $R::c_id && $R::base_edit eq "delete_adr"){
|
||||
$return = $tk->delete_account($R::c_id,$users_dms->{u_id});
|
||||
}else{
|
||||
$return = "failure::Abbruch. Schreibender Zugriff \"Kunden Stammdaten\" verweigert.";
|
||||
}
|
||||
}
|
||||
|
||||
#DMS users accounts
|
||||
if($R::base_edit && $node_meta->{ct_table} eq "users"){#DMS-Account rw
|
||||
$bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table} with: $R::base_edit","","");
|
||||
if($R::u_id && $R::base_edit eq "remove_chk4rel"){#users
|
||||
my $delete_key = "delete_dmsusers";
|
||||
$return = "failure::Datensatz wirklich löschen. ::?base_edit=$delete_key\&exit_box2=1\&u_id=$R::u_id ::löschen";
|
||||
}elsif($users_dms->{int07} == 2 && ($R::u_id || $R::c_idadr) && $R::base_edit =~ /_dmsusers/){
|
||||
my $u_id = $1 if($R::u_id && $R::u_id =~ /(\d+)/);
|
||||
$u_id = $1 if($R::c_idadr && $R::c_idadr =~ /(\d+)/ && $R::base_edit eq "new_dmsusers");
|
||||
$return = $tk->manage_dmsusers($R::base_edit,$u_id,$users_dms);
|
||||
}else{
|
||||
$return = "failure::Abbruch. Schreibender Zugriff \"DMS-Account\" verweigert.";
|
||||
}
|
||||
}
|
||||
|
||||
#DMS Waren || Einstellung/Service* rw
|
||||
if($node_meta->{ct_table} eq "content" || $node_meta->{ct_table} eq "contentuser"){
|
||||
$bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table}|$R::main_id with: $R::rel_edit","","");
|
||||
if(($node_meta->{ct_table} eq "content" && $users_dms->{int01} == 2) || ($node_meta->{ct_table} eq "contentuser" && $users_dms->{int08} == 2)){
|
||||
if($R::rel_edit eq "save_relation" && $R::main_id && $R::main_id >= 200000){
|
||||
$return = $pl->save_relation($R::main_id,$users_dms->{u_id});
|
||||
}elsif($R::rel_edit eq "delete_relation" && $R::main_id && $R::main_id >= 200000){
|
||||
$return = $pl->delete_relation($R::main_id,$users_dms->{u_id});
|
||||
}elsif($R::rel_edit eq "new_relation" && $R::main_id && $R::main_id >= 200000){
|
||||
$return = $pl->new_relation($R::main_id,$users_dms->{u_id});
|
||||
}elsif($R::rel_edit && $R::main_id && $R::main_id >= 200000){
|
||||
$return = $pm->maininit($users_dms);
|
||||
}
|
||||
}elsif($R::rel_edit){
|
||||
$return = "failure::Abbruch. Schreibender Zugriff \"Waren Stammdaten\" verweigert.";
|
||||
}
|
||||
}
|
||||
|
||||
#DMS Faktura
|
||||
if($node_meta->{ct_table} eq "contenttrans"){
|
||||
$bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table}|$R::c_id4trans,$R::tpl_id4trans with: $R::ct_trans","","");
|
||||
if($users_dms->{int03} == 1 && $R::ct_trans eq "open"){#DMS Faktura read
|
||||
$db->update_users4trans($R::c_id4trans,$R::tpl_id4trans,"",$users_dms->{u_id}) if(looks_like_number($R::c_id4trans) && looks_like_number($R::tpl_id4trans));
|
||||
}elsif($users_dms->{int03} == 2){#DMS Faktura rw
|
||||
$db->update_users4trans($R::c_id4trans,$R::tpl_id4trans,"",$users_dms->{u_id}) if(looks_like_number($R::c_id4trans) && looks_like_number($R::tpl_id4trans));
|
||||
if($R::ct_trans =~ /set_workflow2invoice|set_workflow2storno/){
|
||||
$return = $pl->set_workflow($users_dms,$R::c_id4trans,$R::set_main_id4workflow) if(looks_like_number($R::c_id4trans) && looks_like_number($R::tpl_id4trans) && looks_like_number($R::set_main_id4workflow));
|
||||
}else{
|
||||
$return .= "|";
|
||||
$return .= $pre->preinit($users_dms,$lang);#transactions logic
|
||||
}
|
||||
}elsif($R::ct_trans){
|
||||
$return = "failure::Abbruch. Schreibender Zugriff \"Faktura\" verweigert.";
|
||||
}
|
||||
}
|
||||
$users_dms = $dbt->select_users($dbh,$users_dms->{u_id},"");#just to get update after save
|
||||
|
||||
#none DMS hosts ----------------------------------------------------
|
||||
}elsif($varenv{orga} ne "dms"){
|
||||
|
||||
|
||||
|
||||
|
||||
#save_account. 3. updates contentadr
|
||||
if($users_sharee->{c_id} && $R::sharee_edit && $R::sharee_edit =~ /save_account/){
|
||||
($returnwww,$return) = $tk->save_account($users_sharee->{c_id},\%varenv,$aowner);
|
||||
}
|
||||
|
||||
if($users_sharee->{c_id} && $R::sharee_edit && $R::sharee_edit =~ /save_transact/){
|
||||
$returnwww = $tk->save_transact($users_sharee->{c_id},$coo,$aowner);
|
||||
}
|
||||
|
||||
if($returnwww && $returnwww =~ /failure::(.*)/){
|
||||
$returnwww =~ s/::/=/g;
|
||||
($api_return,$users_sharee) = $apif->auth_verify($q,$coo,"");
|
||||
|
||||
if($returnwww =~ /txt22|txt23/){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_2}?cum=1$session_and\&$returnwww");
|
||||
}elsif($returnwww =~ /int03/){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1_5}?cum=1$session_and\&$returnwww");
|
||||
}elsif($returnwww =~ /txt09|txt16/){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=1$session_and\&$returnwww");
|
||||
}elsif($returnwww =~ /int01/ && $R::radID){
|
||||
print redirect("$varenv{wwwhost}/?ask_radID=$R::radID\&failure=not-synced$session_and");
|
||||
}else{
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1}?cum=1$session_and\&$returnwww");
|
||||
}
|
||||
exit 0;
|
||||
}else{
|
||||
($api_return,$users_sharee) = $apif->auth_verify($q,$coo,"");
|
||||
|
||||
|
||||
#Payone Response POST (TransactionStatus)
|
||||
#payone response ($R::pseudocardpan || $R::status)
|
||||
if($users_sharee->{c_id} && ($R::pseudocardpan || $R::status)){
|
||||
my $payone_return;
|
||||
open(FILE,">>$varenv{logdir}/payone-return-post.log");
|
||||
print FILE "<--- $now_dt from Indexsharee.pm \nPayone return-way by ajaxCall: $R::status\n";
|
||||
my @keywords = $q->param;
|
||||
foreach(@keywords){
|
||||
my $val = $q->param($_);
|
||||
print FILE "$_=$val\n";
|
||||
#TODO, check errormessages. At first we have do indicate what comes from payone!
|
||||
$payone_return .= "$_=$val\n";# if($_ =~ /error|message/i);
|
||||
}
|
||||
close(FILE);
|
||||
|
||||
my $update_adr = {
|
||||
table => "contentadr",
|
||||
mtime => "now()",
|
||||
owner => $aowner,
|
||||
c_id => $users_sharee->{c_id}
|
||||
};
|
||||
my $vde_on_fail = $users_sharee->{int12} || 3;#keep last or set 3
|
||||
|
||||
#SEPA, done in payone Payment
|
||||
#CC
|
||||
if($R::pseudocardpan && length($R::pseudocardpan) >= 19){#done by payone AJAX return
|
||||
#if($R::status eq "APPROVED")
|
||||
$update_adr->{txt22} = "";
|
||||
$update_adr->{txt23} = "";
|
||||
$update_adr->{ct_name} = $q->escapeHTML($R::pseudocardpan);
|
||||
$update_adr->{txt27} = $q->escapeHTML($R::status);
|
||||
$update_adr->{txt28} = "";
|
||||
$update_adr->{int12} = 0;
|
||||
$update_adr->{int03} = 2;
|
||||
$dbt->update_record($dbh,$update_adr,$users_sharee) if($users_sharee->{c_id} > 0);
|
||||
($api_return,$users_sharee) = $apif->auth_verify($q,$coo,"");
|
||||
|
||||
#define fictiv invoice to get 1 € test
|
||||
my $epoche = time();
|
||||
my $ctt = {
|
||||
c_id => 1,
|
||||
int01 => 0,#capture amount
|
||||
int15 => 1,#preauth amount
|
||||
txt16 => "",
|
||||
reference => "$users_sharee->{c_id}_$epoche",
|
||||
payone_reset => ''
|
||||
};
|
||||
|
||||
my $payone_txid = "";
|
||||
##preauthorization and/or capture needs to much time, must be done async!
|
||||
#$payone_txid = $payone->preauthorizationCC_main(\%varenv,$users_sharee,$ctt,$aowner);
|
||||
#if($payone_txid)
|
||||
if(1==1){
|
||||
|
||||
#$ctt->{txt16} = "$payone_txid";
|
||||
#$payone_txid = $payone->captureCC_main(\%varenv,$users_sharee,$ctt,$aowner);
|
||||
#int12=0 should be set after capture success in payment module
|
||||
|
||||
if(($users_sharee->{int04} != 1) && ($users_sharee->{txt08} =~ /\w\@\w/)){
|
||||
$tk->emailack($users_sharee->{c_id});
|
||||
}
|
||||
if(($users_sharee->{int13} != 1) && ($users_sharee->{txt07} =~ /\d{9}/ && length($users_sharee->{txt07}) <= 16)){
|
||||
$tk->smsack($users_sharee);
|
||||
}
|
||||
|
||||
}else{
|
||||
$dbt->update_one($dbh,$update_adr,"int12=$vde_on_fail");#Vde
|
||||
}
|
||||
|
||||
$dbt->update_operatorsloop($varenv{dbname},$users_sharee->{c_id},"update");
|
||||
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/$varenv{profile}?$returnwww$session_and");
|
||||
exit 0;
|
||||
}else{
|
||||
$update_adr->{txt28} = $q->escapeHTML($payone_return);
|
||||
$update_adr->{int12} = $vde_on_fail;
|
||||
$dbt->update_record($dbh,$update_adr,$users_sharee) if($users_sharee->{c_id} > 0);
|
||||
$dbt->update_operatorsloop($varenv{dbname},$users_sharee->{c_id},"update");
|
||||
}
|
||||
}#end payone response with pseudocardpan
|
||||
}
|
||||
|
||||
|
||||
my $debug=0;
|
||||
$debug=1;
|
||||
#send confirm codes
|
||||
if($users_sharee->{c_id} && $users_sharee->{txt34} && length($users_sharee->{txt34}) > 20 && $payable_check && $R::sharee_edit && $R::sharee_edit =~ /save_account|send_email|send_sms/){
|
||||
|
||||
if(($users_sharee->{int04} != 1 || $R::sharee_edit =~ /send_email/) && ($users_sharee->{txt08} =~ /\w\@\w/)){
|
||||
$tk->emailack($users_sharee->{c_id});
|
||||
}
|
||||
if(($users_sharee->{int13} != 1 || $R::sharee_edit =~ /send_sms/) && ($users_sharee->{txt07} =~ /\d{9}/ && length($users_sharee->{txt07}) <= 16)){
|
||||
$tk->smsack($users_sharee);
|
||||
}
|
||||
}#send confirm code
|
||||
|
||||
#email and sms acknowledgments, check and save confirm states
|
||||
if($R::confirm_userid && $R::confirm_userid =~ /^\d+$/ && ($R::confirm_code && length($R::confirm_code) >= 5 || $R::confirm_smscode && length($R::confirm_smscode) >= 5)){
|
||||
|
||||
#keep in mind, for now and just for testing confirm codes are just c_id
|
||||
open(FILE,">>$varenv{logdir}/confirm.log") if($debug);
|
||||
print FILE "\n\n*--> $now_dt done by $0\n" if($debug);
|
||||
print FILE "confirm_userid:$R::confirm_userid\nconfirm_code:$R::confirm_code\nconfirm_smscode:$R::confirm_smscode\n" if($debug);
|
||||
$R::confirm_code =~ s/\s//g;
|
||||
$R::confirm_smscode =~ s/\s//g;
|
||||
my $confirm_code = $q->escapeHTML($R::confirm_code);
|
||||
my $confirm_smscode = $q->escapeHTML($R::confirm_smscode);
|
||||
|
||||
#confirm email
|
||||
if($confirm_code){
|
||||
my $authref = {
|
||||
table => "contentadr",
|
||||
fetch => "one",
|
||||
template_id => "202",
|
||||
c_id => $R::confirm_userid,
|
||||
txt34 => "ilike::$confirm_code%",
|
||||
};
|
||||
my $confirmed_email = $dbt->fetch_record($dbh,$authref);
|
||||
|
||||
#($api_return,$users_sharee) = $apif->auth_verify($q,"",$R::confirm_code);
|
||||
if($confirmed_email->{c_id}){
|
||||
$db->updater("contentadr","c_id","$confirmed_email->{c_id}","int04","1");
|
||||
#save verified email
|
||||
$db->updater("contentadr","c_id","$confirmed_email->{c_id}","txt32","$confirmed_email->{txt08}");
|
||||
print FILE "confirmed_email: $confirmed_email->{c_id} update because confirm_code:$confirm_code\n" if($debug);
|
||||
|
||||
#after mailAck, delete all douple adr with no mailAck and no invoices
|
||||
my $ctadr = $db->collect_ct4rel3("contentadr","","","ilike","txt08","$confirmed_email->{txt08}","","","");
|
||||
foreach my $aid (keys(%$ctadr)){
|
||||
if(!$ctadr->{$aid}->{int04}){
|
||||
my $ctctt = $db->get_content6("contenttrans","int10",$ctadr->{$aid}->{c_id});
|
||||
$db->delete_content("contentadr",$ctadr->{$aid}->{c_id}) if(!$ctctt->{c_id});
|
||||
print FILE "c_id $ctadr->{$aid}->{c_id} $confirmed_email->{txt08} delete because of dopplel\n" if($debug);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#confirm sms
|
||||
if($confirm_smscode){
|
||||
my $authref = {
|
||||
table => "contentadr",
|
||||
fetch => "one",
|
||||
template_id => "202",
|
||||
c_id => $R::confirm_userid,
|
||||
txt34 => "ilike::%$confirm_smscode",
|
||||
};
|
||||
my $confirmed_sms = $dbt->fetch_record($dbh,$authref);
|
||||
|
||||
#($api_return,$users_sharee) = $apif->auth_verify($q,"",$R::confirm_smscode);
|
||||
if($confirmed_sms->{c_id}){
|
||||
$db->updater("contentadr","c_id","$confirmed_sms->{c_id}","int13","1");
|
||||
#save verified telnr
|
||||
$db->updater("contentadr","c_id","$confirmed_sms->{c_id}","txt33","$confirmed_sms->{txt07}");
|
||||
print FILE "confirmed_sms: $confirmed_sms->{c_id} update because confirm_smscode:$confirm_smscode\n" if($debug);
|
||||
}
|
||||
}
|
||||
|
||||
($api_return,$users_sharee) = $apif->auth_verify($q,"",$users_sharee->{c_id}) if($users_sharee->{c_id});
|
||||
|
||||
if($users_sharee->{int12} != 2 && $users_sharee->{int04} && $users_sharee->{int13}){
|
||||
my $row = $db->updater("contentadr","c_id","$users_sharee->{c_id}","int12","0");#Vde
|
||||
$dbt->update_operatorsloop($varenv{dbname},$users_sharee->{c_id},"update");
|
||||
}else{
|
||||
my $field = "int13";
|
||||
$field = "int04" if(!$users_sharee->{int04});
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=3$session_and\&failure=$field#top");
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if(!$coo){
|
||||
print FILE "c_id: $users_sharee->{c_id} empty auth because of no cookie\n" if($debug);
|
||||
$users_sharee = { c_id => 0 };
|
||||
}
|
||||
close(FILE) if($debug);
|
||||
if($users_sharee->{c_id} && $users_sharee->{int04} && $users_sharee->{int13}){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?confirm_success=1");
|
||||
exit 0;
|
||||
}
|
||||
}#end confirm
|
||||
|
||||
if($R::email && $R::sharee_edit =~ /password_forgotten/){
|
||||
my $hw_id = unpack ('H*', pack('Nc', time, $$ % 0xff));#old $co
|
||||
$tk->send_password($R::email,$hw_id,$aowner);
|
||||
}
|
||||
|
||||
#redirections
|
||||
if($users_sharee->{c_id} && ($path =~ /$varenv{mandant}\/$varenv{profile}/ || $path =~ /$varenv{mandant}\/Account/)){
|
||||
|
||||
if($R::sharee_edit =~ /save_account/){
|
||||
$returnwww =~ s/::/=/g if($returnwww && $returnwww =~ /success::\w+/);
|
||||
|
||||
if((!$users_sharee->{int14}) || ($users_sharee->{txt31} && $tpl->{tpl_order} =~ /$users_sharee->{txt31}/)){
|
||||
#failure redirect should do the delete job
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1}?failure=$users_sharee->{txt31}$session_and#top");
|
||||
exit 0;
|
||||
}
|
||||
elsif(!$users_sharee->{int03}){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1_5}$session");
|
||||
exit 0;
|
||||
}
|
||||
elsif($payable_check && (!$users_sharee->{int04} || !$users_sharee->{int13})){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=2$session_and\&$returnwww");
|
||||
exit 0;
|
||||
}
|
||||
elsif($users_sharee->{int03} && (($users_sharee->{int03} == 1 && $users_sharee->{ct_name} !~ /\w{2}-\d+/) || ($users_sharee->{int03} == 2 && length($users_sharee->{ct_name}) < 19))){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_2}$session");
|
||||
exit 0;
|
||||
}
|
||||
elsif($payable_check){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=2$session_and\&$returnwww");
|
||||
exit 0;
|
||||
}
|
||||
}elsif($path =~ /$varenv{mandant}\/$varenv{profile}/){
|
||||
if((!$users_sharee->{int14}) || ($users_sharee->{txt31} && $tpl->{tpl_order} =~ /$users_sharee->{txt31}/)){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1}?failure=$users_sharee->{txt31}$session_and#top");
|
||||
exit 0;
|
||||
}elsif(!$payable_check){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1_5}$session");
|
||||
exit 0;
|
||||
}else{
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=2$session_and\&$returnwww");
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
}elsif($users_sharee->{c_id} && ($path =~ /$varenv{mandant}\/Anmelden|$varenv{mandant}\/$varenv{profile}/)){
|
||||
if(!$users_sharee->{int14}){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1}?cum=2$session_and\&$returnwww");
|
||||
exit 0;
|
||||
}else{
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=2$session_and\&$returnwww");
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
###
|
||||
}
|
||||
|
||||
my $nodev = $db->get_node("$view_post","$lang");
|
||||
#Printpreview
|
||||
if($view =~ /Printpreview/){
|
||||
require "Mod/Printpreview.pm";
|
||||
&Printpreview::printpre();
|
||||
exit 0;
|
||||
}
|
||||
elsif($view =~ /PDFGenerator/){
|
||||
require "Mod/PDFGenerator.pm";
|
||||
&PDFGenerator::printpre();
|
||||
exit 0;
|
||||
}
|
||||
|
||||
#else global REDIRECT. Availability check for redirect
|
||||
#elsif(!$nodev->{main_id} || ($nodev->{main_id} == 100 && $R::rel_edit eq "save_content")){
|
||||
#print redirect("$varenv{wwwhost}$session");
|
||||
#exit 0;
|
||||
#}
|
||||
|
||||
|
||||
#CSVout
|
||||
if($R::rel_edit && $R::rel_edit =~ /XLSout/){
|
||||
$users_dms = $dbt->select_users($dbh,$users_dms->{u_id});
|
||||
if(-f "$dbt->{copri_conf}->{basedir}/pdf/$users_dms->{owner}-$users_dms->{time4csv}.xls"){
|
||||
print $q->redirect(-uri=>"$varenv{metahost}/pdf/$users_dms->{owner}-$users_dms->{time4csv}.xls", -type=>"application/octet-stream", -target=>'_blank');
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
||||
my $dyn_css = "";
|
||||
if(1==1){
|
||||
my $background = "";
|
||||
$background = "$varenv{metahost}/img/$varenv{background_image}" if($varenv{background_image});
|
||||
$dyn_css = "
|
||||
html,body {
|
||||
background-image:url('$background');
|
||||
background-repeat: $varenv{background_repeat};
|
||||
background-position: right bottom;
|
||||
background-attachment:fixed;
|
||||
background-size:$varenv{background_size};
|
||||
font-family: $varenv{font_family};
|
||||
font-size: $varenv{font_size};
|
||||
line-height: $varenv{line_height};
|
||||
margin: 0; padding: 0;
|
||||
text-align:$varenv{background_align};
|
||||
|
||||
}\n";
|
||||
}
|
||||
|
||||
|
||||
my $url = "$varenv{wwwhost}/$path";
|
||||
#my $onload="onLoad();";
|
||||
my $onload="";
|
||||
|
||||
my $local_style = "$varenv{metahost}/$dbt->{shareeapp_conf}->{local_style}";
|
||||
my $jquery = "";#"$varenv{metahost}/$dbt->{shareeapp_conf}->{jquery}";
|
||||
my $jquery_ui = "";
|
||||
my $style_jquery_ui = "";
|
||||
my $js_bootstrap = "$varenv{metahost}/$dbt->{shareeapp_conf}->{js_bootstrap}";
|
||||
my $style_bootstrap = "$varenv{metahost}/$dbt->{shareeapp_conf}->{style_bootstrap}";
|
||||
my $jquery_resize = "";
|
||||
|
||||
if($varenv{wwwhost} =~ /shareedms/){
|
||||
$local_style = "$varenv{metahost}/$dbt->{shareedms_conf}->{local_style}";
|
||||
$jquery = "$varenv{metahost}/$dbt->{shareedms_conf}->{jquery}";
|
||||
$jquery_ui = "$varenv{metahost}/$dbt->{shareedms_conf}->{jquery_ui}";
|
||||
$style_jquery_ui = "$varenv{metahost}/$dbt->{shareedms_conf}->{style_jquery_ui}";
|
||||
$js_bootstrap = "$varenv{metahost}/$dbt->{shareedms_conf}->{js_bootstrap}";
|
||||
$style_bootstrap = "$varenv{metahost}/$dbt->{shareedms_conf}->{style_bootstrap}";
|
||||
$jquery_resize = "$varenv{metahost}/$dbt->{shareedms_conf}->{jquery_resize}";
|
||||
$dyn_js = "\$(function() {
|
||||
\$( '#datepicker1' ).datepicker({ dateFormat: 'dd.mm.yy', dayNamesMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], monthNames: ['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember']});
|
||||
\$( '#datepicker2' ).datepicker({ dateFormat: 'dd.mm.yy', dayNamesMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], monthNames: ['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember']});
|
||||
\$( '#datepicker3' ).datepicker({ dateFormat: 'dd.mm.yy', dayNamesMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], monthNames: ['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember']});
|
||||
});";
|
||||
}
|
||||
|
||||
my $base_uri = "true";
|
||||
my $title = "$varenv{syshost} ";
|
||||
$title .= $dbt->{primary}->{$varenv{dbname}}->{pprefix} if($dbt->{primary}->{$varenv{dbname}}->{pprefix});
|
||||
$title .= $dbt->{operator}->{$varenv{dbname}}->{project} if($dbt->{operator}->{$varenv{dbname}}->{project});
|
||||
$title .= " " . $dbt->{operator}->{$varenv{dbname}}->{oprefix} if($dbt->{operator}->{$varenv{dbname}}->{oprefix});
|
||||
$title .= $dbt->{website}->{$varenv{syshost}}->{project} if($dbt->{website}->{$varenv{syshost}}->{project});
|
||||
$title .= " DEVEL $varenv{dbname}" if($dbt->{copri_conf}->{stage} eq "test");
|
||||
my $html5 = $q->start_html(-title=>"$title",
|
||||
-lang=>'de',
|
||||
-onload=>"$onload",
|
||||
-oncontextmenu=>"$oncontextmenu",
|
||||
#-id=>"page-top",
|
||||
#'-data-spy'=>"scroll",
|
||||
#'-data-target'=>".navbar-fixed-top",
|
||||
-encoding=>"$html_charset",
|
||||
-base=>"$base_uri",
|
||||
-target=>"",
|
||||
-head=>[
|
||||
Link({
|
||||
-rel=>'shortcut icon',
|
||||
-type=>'image/x-icon',
|
||||
-href=>"$varenv{metahost}/css/favicon.ico"
|
||||
})
|
||||
],
|
||||
-meta=>{
|
||||
'viewport'=>"width=device-width,initial-scale=1,user-scalable=yes",
|
||||
'author'=>"Rainer Gümpelein",
|
||||
'publisher'=>"TeilRad GmbH",
|
||||
'copyright'=>"TeilRad GmbH",
|
||||
'keywords'=>"",
|
||||
'description'=>"sharee.bike Mietradmanagementsystem"
|
||||
},
|
||||
-script=>[
|
||||
{-language=>'JAVASCRIPT',
|
||||
-src=>"$jquery"},
|
||||
{-language=>'JAVASCRIPT',
|
||||
-src=>"$jquery_ui"},
|
||||
{-language=>'JAVASCRIPT',
|
||||
-src=>"$jquery_resize"},
|
||||
{-language=>'JAVASCRIPT',
|
||||
-src=>"$varenv{metahost}/$dbt->{copri_conf}->{jsscript}"},
|
||||
{-language=>'JAVASCRIPT',
|
||||
-code=>"$dyn_js"}
|
||||
],
|
||||
-STYLE=>{
|
||||
-code=>"$dyn_css",
|
||||
-src=>[
|
||||
"$local_style",
|
||||
"$style_bootstrap",
|
||||
"$varenv{metahost}/$dbt->{copri_conf}->{style_bootstrap_icons}",
|
||||
"$style_jquery_ui"
|
||||
],
|
||||
-verbatim=>"\@import url(\"$local_style\");",
|
||||
-media=>'screen'
|
||||
}
|
||||
);
|
||||
# CGI.pm doesn't support HTML5 DTD; replace the one it puts in.
|
||||
$html5 =~ s{<!DOCTYPE.*?>}{<!DOCTYPE html>}s;
|
||||
$html5 =~ s{<html.*?>}{<html lang='de'>}s;
|
||||
print $html5;
|
||||
|
||||
my $sharee_agb_text = {};
|
||||
$sharee_agb_text->{ct_name} = "AGB";
|
||||
$sharee_agb_text->{txt01} = "<iframe src='$varenv{wwwhost}/site/agb.html' style='width:100%;height:8000px;border:none;' scrolling='auto'></iframe>";
|
||||
|
||||
my $sharee_privacy_text = {};
|
||||
$sharee_privacy_text->{ct_name} = "Datenschutzhinweise";
|
||||
$sharee_privacy_text->{txt01} = "<iframe src='$varenv{wwwhost}/site/privacy_2.html' style='width:100%;height:8000px;border:none;' scrolling='auto'></iframe>";
|
||||
|
||||
|
||||
print <<EOF
|
||||
|
||||
<div class="modal fade" id="sharee_agb" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">$sharee_agb_text->{ct_name}</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="text-default">$sharee_agb_text->{txt01}</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Button trigger modal -->
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#sharee_agb">
|
||||
Launch demo modal
|
||||
</button>
|
||||
|
||||
EOF
|
||||
;
|
||||
|
||||
|
||||
print "<script src='$js_bootstrap'></script>\n";
|
||||
|
||||
print $q->end_html;
|
||||
return Apache2::Const::OK;
|
||||
}
|
||||
1;
|
|
@ -164,48 +164,6 @@ sub read_dirfiles(){
|
|||
return @dirfiles;
|
||||
}
|
||||
|
||||
#return message
|
||||
sub return_feedback(){
|
||||
my $self = shift;
|
||||
my ($return,$kind_of_trans,$owner,$terminal) = @_;
|
||||
|
||||
if($owner > 0){
|
||||
print<<EOF
|
||||
<script>
|
||||
\$(document).ready(function(){
|
||||
\$( "#retm" ).fadeOut(7000);
|
||||
})
|
||||
</script>
|
||||
EOF
|
||||
;
|
||||
$return = $R::return if($R::return);
|
||||
my ($ret_pm,$ret_pl,$ret_er) = split(/\|/,$return);
|
||||
my ($i_pm,$s_pm,$d_pm) = split(/-/,$ret_pm);
|
||||
my ($i_pl,$s_pl,$d_pl) = split(/-/,$ret_pl);
|
||||
my $pre = "";
|
||||
$kind_of_trans = "Transaktions" if(!$kind_of_trans);
|
||||
my $feedb = "";
|
||||
$feedb = "neue $pre Daten eingefügt" if($i_pm);
|
||||
$feedb = "insert successfully " if($i_pm && $varenv{html_lang} eq "en");
|
||||
$feedb = "$pre Daten gespeichert" if($s_pm);
|
||||
$feedb = "saved successfully" if($s_pm && $varenv{html_lang} eq "en");
|
||||
$feedb = "$pre Daten gelöscht" if($d_pm);
|
||||
$feedb = "deleted successfully" if($d_pm && $varenv{html_lang} eq "en");
|
||||
$feedb = "neue $kind_of_trans Daten eingefügt" if($i_pl);
|
||||
$feedb = "$kind_of_trans Daten gespeichert" if($s_pl);
|
||||
$feedb = "$kind_of_trans Daten gelöscht" if($d_pl);
|
||||
$feedb = "Artikel eingefügt" if($i_pl =~ /ctpos_id=\d+/);
|
||||
my $debug;
|
||||
$debug = "($ret_pm|$ret_pl)" if($owner eq "101");
|
||||
if($return !~ /failure/ && $feedb){
|
||||
print $q->div({-id=>'retm'},"$feedb $debug"),"\n";
|
||||
}
|
||||
}
|
||||
|
||||
$return = $1 if($return =~ /(failure.*)/);
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
#Quersumme
|
||||
sub quersum(){
|
||||
|
@ -556,10 +514,13 @@ sub split_date(){
|
|||
return ($yy,$mo,$dd,$hh,$mi);
|
||||
}
|
||||
|
||||
#time and date format for DE (moved partly to Callib)
|
||||
#time and date format for DE
|
||||
sub time4de(){
|
||||
my $self = shift;
|
||||
my ($time_db,$hhmi,$decode) = @_;
|
||||
my $time_db = shift;
|
||||
my $hhmi = shift || "";
|
||||
my $decode = shift || "";
|
||||
|
||||
$time_db =~ s/:\d{2}\..*$// if($time_db);
|
||||
my ($date,$time) = split(/ /,$time_db);
|
||||
my ($yy,$mo,$dd) = split(/-/,$date);
|
||||
|
|
|
@ -52,14 +52,10 @@ sub mobox3(){
|
|||
my $height = $node_meta->{tpl_height} || "990";
|
||||
my $width = $node_meta->{tpl_width} || "990";
|
||||
|
||||
if($mode eq "maintainer"){
|
||||
if($R::node2edit eq "edit_relation" || $R::rel_edit =~ /_relation/){
|
||||
$title = "Node Editor";
|
||||
$height = "300";
|
||||
$width = "600";
|
||||
}elsif($mode eq "supervisor"){
|
||||
$title = "Datenfeld Eigenschaft bearbeiten";
|
||||
$height = "450";
|
||||
$width = "500";
|
||||
}elsif($R::rel_edit =~ /dialog4menu|dialog4content/){
|
||||
$title = "Relation Editor";
|
||||
$height = "300";
|
||||
|
@ -122,10 +118,10 @@ EOF
|
|||
# require "Tpl/APIdialog.pm";
|
||||
# &APIdialog::tpl($node_meta,$users_dms,$mode,$return);
|
||||
#}
|
||||
elsif($R::relate_dialog || $R::rel_edit =~ /dialog4menu|dialog4content/){
|
||||
require "Mod/RelationEdit.pm";
|
||||
&RelationEdit::tpl($node_meta,$users_dms,$mode,$return);
|
||||
}
|
||||
#elsif($R::relate_dialog || $R::rel_edit =~ /dialog4menu|dialog4content/){
|
||||
# require "Mod/RelationEdit.pm";
|
||||
# &RelationEdit::tpl($node_meta,$users_dms,$mode,$return);
|
||||
#}
|
||||
elsif(($R::node2edit && $R::node2edit =~ /editpart/) || ($R::base_edit && $R::base_edit !~ /delete/)){
|
||||
require "Tpl/BaseEdit.pm";
|
||||
&BaseEdit::tpl($node_meta,$users_dms,$feedb);
|
||||
|
|
|
@ -11,7 +11,6 @@ use CGI ':standard';
|
|||
use Lib::Config;
|
||||
use Mod::Buttons;
|
||||
use Mod::Libenz;
|
||||
use Mod::Libenzdb;
|
||||
use Mod::Basework;
|
||||
use Mod::DBtank;
|
||||
use Mod::Relation;
|
||||
|
@ -32,13 +31,10 @@ sub admin_tpl(){
|
|||
my $return = shift;
|
||||
my $superu_id = shift || "";
|
||||
|
||||
#print Dumper($node_meta);exit;
|
||||
|
||||
my $q = new CGI;
|
||||
my @keywords = $q->param;
|
||||
my $cf = new Config;
|
||||
my $lb = new Libenz;
|
||||
my $db = new Libenzdb;
|
||||
my $bw = new Basework;
|
||||
my $dbt = new DBtank;
|
||||
my $but = new Buttons;
|
||||
|
@ -49,27 +45,23 @@ sub admin_tpl(){
|
|||
$path = "$script" . "$path";
|
||||
my $lang = "de";
|
||||
|
||||
#$path =~ s/\/login|\/user|\/manager|\/admin//;
|
||||
my $coo = $q->cookie(-name=>'domcookie');
|
||||
my %ib = $but->ibuttons();
|
||||
my $dbh = "";
|
||||
|
||||
my $u_name = $node_meta->{owner};
|
||||
$u_name = $dbt->sys_username($dbh,$node_meta->{owner});
|
||||
my $u_name = $node_meta->{nowner};
|
||||
$u_name = $dbt->sys_username($dbh,$node_meta->{nowner});
|
||||
|
||||
my $change = $lb->time4de($node_meta->{change},"1") if($node_meta->{change});
|
||||
my $change = $lb->time4de($node_meta->{nchange},"1") if($node_meta->{nchange});
|
||||
my $subid = $1 if($node_meta->{main_id} =~ /^(\d)/);
|
||||
|
||||
#Node templates
|
||||
my $tpl_id = 97;#Standard for CMS
|
||||
#Selektierbare Tabellen Layout templates
|
||||
my $tpl_lists4selection;
|
||||
my $tpl_id = 97;
|
||||
my $tpl_lists4selection = "";
|
||||
|
||||
#if($node_meta->{ct_table} eq "content" || $node_meta->{ct_table} eq "contentpos"){
|
||||
if($node_meta->{ct_table} eq "content"){
|
||||
$tpl_id = 100;
|
||||
if($node_meta->{template_id} eq "205"){
|
||||
#$tpl_id = 102;
|
||||
$tpl_lists4selection = 205;
|
||||
}elsif($node_meta->{template_id} eq "225"){
|
||||
$tpl_lists4selection = 225;
|
||||
|
@ -89,31 +81,17 @@ sub admin_tpl(){
|
|||
$tpl_lists4selection = "401,402,403";
|
||||
}
|
||||
|
||||
#Defaults to tpl_id=97
|
||||
my $tpl = $db->get_tpl($tpl_id);
|
||||
my $tpl = $dbt->get_tpl($dbh,$tpl_id);
|
||||
my @tpl_order = ("");
|
||||
@tpl_order = split /,/,$tpl->{tpl_order};
|
||||
|
||||
|
||||
my @_templates;
|
||||
my $tpl_all = $db->collect_tpl($tpl_lists4selection);
|
||||
my $tpl_all = $dbt->collect_tpl($tpl_lists4selection);
|
||||
foreach my $id (sort {$tpl_all->{$a}->{tpl_name} cmp $tpl_all->{$b}->{tpl_name}} keys (%$tpl_all)){
|
||||
push (@_templates, "$id:$tpl_all->{$id}->{tpl_name}") if($tpl_all->{$id}->{tpl_name} !~ /dummy/);
|
||||
}
|
||||
|
||||
#reading mounted project data-dir
|
||||
#Test: mount /dev/sda2 data/Projekte
|
||||
my @_projectdir;
|
||||
#my $dir = "$varenv{data}/Projekte";
|
||||
my $dir = "$varenv{data}/fileserver";
|
||||
if( -d "$dir"){
|
||||
opendir(DIR, "$dir");
|
||||
foreach(sort(readdir(DIR))){
|
||||
push (@_projectdir, "$_");
|
||||
}
|
||||
closedir DIR;
|
||||
}
|
||||
|
||||
#content container
|
||||
print "<div id='Container_cms'>$superu_id";
|
||||
|
||||
|
@ -122,23 +100,18 @@ sub admin_tpl(){
|
|||
print $q->hidden(-name=>'parent_id', -value=>"$node_meta->{parent_id}");
|
||||
print $q->hidden(-name=>'main_id', -value=>"$node_meta->{main_id}");
|
||||
#print $q->hidden(-name=>'template_id', -value=>"$node_meta->{template_id}");
|
||||
print $q->hidden(-name=>'mode', -value=>"admin");
|
||||
|
||||
print $q->start_table({-style=>'margin-top:6px;', -border=>'0', -width=>'100%', -align=>'left', -cellpadding=>'3', -cellspacing=>'3'});
|
||||
print $q->Tr();
|
||||
if(1==1){
|
||||
if(($users_dms->{u_id} > 0) || ($u_group eq "admin")){
|
||||
if($users_dms->{u_id}){
|
||||
print "<td style='background:#a7a18f;margin:1px 0;padding:2px;' colspan='2' nowrap>\n";
|
||||
#print "<td style='margin:1px 0;padding:0px;' colspan='2' nowrap>\n";
|
||||
print $but->singlesubmit7("rel_edit","save_relation","$ib{save_relation}","","modal_position(xpos,ypos)");
|
||||
#look at dialog4menu, it seems better. vise a verse
|
||||
print $q->span({-style=>'margin:0 0.2em;'}," ");
|
||||
print $but->singlesubmit7("rel_edit","delete_relation","$ib{delete_relation}","","modal_position(xpos,ypos)");
|
||||
print $q->span({-style=>'margin:0 0.2em;'}," ");
|
||||
print $but->singlesubmit7("rel_edit","new_relation","$ib{new_relation}","","modal_position(xpos,ypos)");
|
||||
#$R::new_submenu = 1 if($subid < 4);
|
||||
print $q->span({ -style=>'margin:4px 0 0 4px;'},$but->checkbox("1","new_submenu","$R::new_submenu"),"Submenu") if($subid < 3 && $node_meta->{template_id} !~ /205/);#no submenue if bikes);
|
||||
print $q->span({-style=>'margin-left:5em; font-size:0.91em;'}, "$u_name / $change") if($u_name);
|
||||
print $but->singlesubmit7("rel_edit","save_relation","$ib{save_relation}","","");
|
||||
print $q->span({-style=>'margin:0 0.2em;'}," ");
|
||||
print $but->singlesubmit7("rel_edit","delete_relation","$ib{delete_relation}","","");
|
||||
print $q->span({-style=>'margin:0 0.2em;'}," ");
|
||||
print $but->singlesubmit7("rel_edit","new_relation","$ib{new_relation}","","");
|
||||
print $q->span({ -style=>'margin:4px 0 0 4px;'},$but->checkbox("1","new_submenu","$R::new_submenu"),"Submenu") if($subid < 3 && $node_meta->{template_id} !~ /205/);#no submenue if bikes);
|
||||
print $q->span({-style=>'margin-left:10em; font-size:0.91em;'}, "$u_name / $change") if($u_name);
|
||||
print "</td>\n";
|
||||
|
||||
print $q->Tr();
|
||||
|
@ -153,24 +126,10 @@ sub admin_tpl(){
|
|||
print $q->Tr();
|
||||
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
||||
print $q->td({-class=>'content1_cms'},$but->checkbox("1","$key","$node_meta->{$key}")),"\n";
|
||||
}elsif($key =~ /txt01/ && $isize =~ /select/){
|
||||
print $q->Tr();
|
||||
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
||||
print $q->td({-class=>'content1_cms'},$but->selector("$key","250px","$node_meta->{$key}",@_projectdir)),"\n";
|
||||
|
||||
}elsif($key =~ /tpl_name/){
|
||||
print $q->Tr();
|
||||
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
||||
print $q->td({-class=>'content1_cms'},$but->selector("template_id","200px",$node_meta->{template_id},@_templates)),"\n";
|
||||
}elsif($key eq "txt01" && $isize eq "select"){
|
||||
my @_valxx = ("");
|
||||
#TODO
|
||||
#foreach my $rid (sort { $bike_nodes->{$a}->{node_name} cmp $bike_nodes->{$b}->{node_name} } keys (%$bike_nodes)){
|
||||
# push (@_valxx, "$bike_nodes->{$rid}->{main_id}:$bike_nodes->{$rid}->{node_name} - $bike_nodes->{$rid}->{main_id}");
|
||||
#}
|
||||
print $q->Tr();
|
||||
print $q->td({-class=>'left_italic_cms',-colspan=>'1'},"$des");
|
||||
print $q->td({-class=>'content1_cms',-colspan=>'1'},$but->selector_class("$key","eselect","width:250px;",$node_meta->{$key},@_valxx));
|
||||
}elsif($key =~ /node_name/){
|
||||
print $q->Tr();
|
||||
print $q->td({-class=>'left_italic_cms'},"$des");
|
||||
|
@ -179,16 +138,30 @@ sub admin_tpl(){
|
|||
print $q->Tr();
|
||||
print $q->td({-class=>'left_italic_cms'},"$des");
|
||||
print $q->td({-class=>'content1_cms'},$q->textfield(-class=>'etxt',-name=>"$key",-default=>"$node_meta->{$key}",-override=>'1',-size=>"$isize",-maxlength=>120)),"\n";
|
||||
}elsif($key eq "type_id" && $isize eq "select" && $node_meta->{template_id} eq "205"){
|
||||
my @s_valxx = ();
|
||||
my $s_hash = {};
|
||||
$s_hash = $dbt->{copri_conf}->{type_id};
|
||||
print $q->Tr();
|
||||
print $q->td({-class=>'left_italic_cms',-colspan=>'1'},"$des");
|
||||
foreach my $s_key (sort keys (%{ $s_hash })) {
|
||||
push @s_valxx, "$s_key:$s_hash->{$s_key}";
|
||||
}
|
||||
print $q->td({-class=>'content1_cms'},$but->selector_class("$key","","",$node_meta->{$key},@s_valxx)),"\n";
|
||||
}elsif($key eq "energy_id" && $isize eq "checkbox"){
|
||||
print $q->Tr();
|
||||
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
||||
print $q->td({-class=>'content1_cms', -colspan=>'1'}, $but->checkbox("1","$key","$node_meta->{$key}")),"\n";
|
||||
print $q->hidden(-name=>"$key",-override=>1,-value=>"null");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
print $q->div({-style=>'text-align:left;margin:0.5em;padding:1em;background-color:white;'},"Im \"admin\" Modus können die Gruppen-Ordner verwaltet werden.<br />--> Dazu erst einen Gruppen-Ordner öffnen!");
|
||||
print $q->div({-style=>'text-align:left;margin:0.5em;padding:1em;background-color:white;'},"Keine Zugriffsrechte");
|
||||
}
|
||||
|
||||
print $q->end_table;
|
||||
|
||||
my $debug;
|
||||
my $debug = "";
|
||||
$debug = "(ct_table: $node_meta->{ct_table} | main_id: $node_meta->{main_id} | tpl_id: $node_meta->{template_id} | type_id: $node_meta->{type_id} | energy_id: $node_meta->{energy_id}" if($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id});
|
||||
print $q->div({-style=>'position:absolute;bottom:2%;right:2%;z-index:10;font-size:13px;'},"$debug"),"\n";
|
||||
print "</div>";
|
||||
|
|
|
@ -15,7 +15,7 @@ use CGI::Carp qw(fatalsToBrowser);
|
|||
use Scalar::Util qw(looks_like_number);
|
||||
use DateTime;
|
||||
use DateTime::Format::Pg;
|
||||
|
||||
use Text::CSV_XS;
|
||||
use Lib::Config;
|
||||
use Mod::Libenzdb;
|
||||
use Mod::Libenz;
|
||||
|
@ -51,8 +51,8 @@ my %varenv = $cf->envonline();
|
|||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
my $debug=1;
|
||||
|
||||
#insert text-cms
|
||||
sub new_contentcms {
|
||||
#insert content or contentuser
|
||||
sub new_content {
|
||||
my $self = shift;
|
||||
my $q = shift;
|
||||
my $users_dms = shift;
|
||||
|
@ -60,17 +60,31 @@ sub new_contentcms {
|
|||
my $dbh = "";
|
||||
my $feedb = { message => "" };
|
||||
|
||||
my $pref_cc = {
|
||||
table => "$R::ct_table",
|
||||
fetch => "one",
|
||||
template_id => "$R::template_id",
|
||||
main_id => "$R::main_id",
|
||||
};
|
||||
|
||||
my $cc_part = { c_id => 0 };
|
||||
$cc_part = $dbt->fetch_record($dbh,$pref_cc);#get last barcode by order barcode DESC
|
||||
my $next_barcode = $cc_part->{c_id};
|
||||
$next_barcode = $cc_part->{barcode} + 1 if($cc_part->{barcode} > 0);
|
||||
|
||||
my $insert_ctu = {
|
||||
table => "contentuser",
|
||||
table => "$R::ct_table",
|
||||
itime => 'now()',
|
||||
mtime => 'now()',
|
||||
owner => "$users_dms->{u_id}",
|
||||
barcode => "$next_barcode",
|
||||
ct_name => "---",
|
||||
template_id => "$R::template_id",
|
||||
main_id => "$R::main_id",
|
||||
txt12 => "$dbt->{operator}->{$varenv{dbname}}->{oprefix}",
|
||||
};
|
||||
my $c_idnew = 0;
|
||||
$c_idnew = $dbt->insert_contentoid($dbh,$insert_ctu,"") if($R::template_id && $R::main_id);
|
||||
$c_idnew = $dbt->insert_contentoid($dbh,$insert_ctu,"") if($R::ct_table && $R::template_id && $R::main_id);
|
||||
|
||||
if($c_idnew){
|
||||
$feedb->{c_id} = $c_idnew;
|
||||
|
@ -79,18 +93,17 @@ sub new_contentcms {
|
|||
return $feedb;
|
||||
}
|
||||
|
||||
#save contentuser cms and maybe useable at all content*!?
|
||||
#save content or contentuser
|
||||
sub save_content {
|
||||
my $self = shift;
|
||||
my $q = shift;
|
||||
my $users_dms = shift;
|
||||
my $node_meta = shift;
|
||||
my $c_id = shift || "";
|
||||
|
||||
$q->import_names('R');
|
||||
my @keywords = $q->param;
|
||||
my $dbh = "";
|
||||
my $feedb = { message => "" };
|
||||
my $feedb = { message => "", u_rows => 0 };
|
||||
|
||||
my $ct = { c_id => $c_id };
|
||||
my $update_ct = {
|
||||
|
@ -100,21 +113,102 @@ sub save_content {
|
|||
};
|
||||
|
||||
foreach(@keywords){
|
||||
my $val = $q->param($_);
|
||||
my $valxx = $q->escapeHTML("$val");
|
||||
#my $val = $q->param($_);
|
||||
#my $valxx = $q->escapeHTML("$val");
|
||||
my @val = $q->param($_);
|
||||
$valxx = $q->escapeHTML("@val");
|
||||
if($_ =~ /ct_name|txt|int|state|time/){
|
||||
my $valxx = $q->escapeHTML("@val");
|
||||
|
||||
#txt24 bike_node/station_group and txt25 bike_group multiple select
|
||||
if($node_meta->{template_id} == 225 && $_ eq "txt24"){
|
||||
my %station_filter_hash = ();
|
||||
my @_valxx_filter = ();
|
||||
my $node = {
|
||||
template_id => 205,
|
||||
parent_id => 200013,
|
||||
fetch => "all",
|
||||
keyfield => "main_id",
|
||||
};
|
||||
my $bike_nodes = {};
|
||||
$bike_nodes = $dbt->fetch_rel4tpl4nd($dbh,$node);
|
||||
|
||||
foreach my $bike_node (@val){
|
||||
foreach my $rid ( keys (%$bike_nodes)){
|
||||
if($bike_node == $bike_nodes->{$rid}->{main_id} && $bike_nodes->{$rid}->{type_id}){
|
||||
$station_filter_hash{$bike_nodes->{$rid}->{type_id}} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $type_id (keys (%station_filter_hash)){
|
||||
push (@_valxx_filter, "$type_id");
|
||||
}
|
||||
|
||||
$update_ct->{txt25} = "@_valxx_filter";
|
||||
$update_ct->{$_} = "$valxx";
|
||||
}elsif($node_meta->{template_id} == 205 && $_ eq "txt06"){#GPS
|
||||
if($valxx =~ /^(\d{1,2}\.\d+),\s?(\d{1,2}\.\d+)$/ || !$valxx || $valxx eq "null"){
|
||||
$update_ct->{$_} = "$valxx";
|
||||
}else{
|
||||
$feedb->{message} = "failure::Eingabefehler \"$valxx\", falsches GPS Format. Bitte folgendes Format mit latitude, longitude verwenden. Bsp: 47.927738,7.973855";
|
||||
}
|
||||
}elsif($node_meta->{template_id} == 205 && $_ =~ /byte/){
|
||||
if(!$valxx){
|
||||
$update_ct->{$_} = "";
|
||||
}elsif($valxx !~ /[g-z]/ig && length($valxx) == 32){
|
||||
$update_ct->{$_} = "\\x$valxx";
|
||||
}else{
|
||||
$feedb->{message} = "failure::Eingabefehler \"$valxx\", der Token muss 32 HEX Zeichen enthalten";
|
||||
}
|
||||
}elsif($_ =~ /^time\d+/){
|
||||
$valxx = "00:00" if($valxx !~ /\d{1,2}:\d{2}/);
|
||||
$update_ct->{$_} = "$valxx";
|
||||
}elsif($_ =~ /date_time\d+/){
|
||||
my ($date_time,$chck) = $lb->checkdate($valxx);
|
||||
if(!$chck){
|
||||
$update_ct->{$_} = "$valxx";
|
||||
}else{
|
||||
$feedb->{message} = "failure::Eingabefehler \"$valxx\", falsche Datum Uhrzeit Format";
|
||||
}
|
||||
}elsif($_ =~ /^int|barcode/){
|
||||
if(($valxx && $valxx =~ /\d/) || looks_like_number($valxx)){
|
||||
$valxx =~ s/,/./;
|
||||
$valxx =~ s/\s//g;
|
||||
if(looks_like_number($valxx)){
|
||||
$update_ct->{$_} = "$valxx";
|
||||
}else{
|
||||
$feedb->{message} = "failure::Eingabefehler \"$valxx\", hier sind nur numerische Werte erlaubt";
|
||||
}
|
||||
}elsif(!$valxx){
|
||||
$update_ct->{$_} = "null";
|
||||
}else{
|
||||
$feedb->{message} = "failure::Eingabefehler \"$valxx\", hier sind nur numerische Werte erlaubt";
|
||||
}
|
||||
}elsif($_ =~ /ct_name|txt|state|time/){
|
||||
$update_ct->{$_} = "$valxx";
|
||||
}
|
||||
}
|
||||
|
||||
$u_rows += $dbt->update_record($dbh,$update_ct,$ct) if($ct->{c_id});
|
||||
if($ct->{c_id}){
|
||||
$feedb->{u_rows} += $dbt->update_record($dbh,$update_ct,$ct);
|
||||
}
|
||||
|
||||
$feedb->{u_rows} = $u_rows;
|
||||
return $feedb;
|
||||
}#end save_content
|
||||
|
||||
#delete content
|
||||
sub delete_content {
|
||||
my $self = shift;
|
||||
my $node_meta = shift || "";
|
||||
my $c_id = shift || "";
|
||||
my $users_dms = shift;
|
||||
my $dbh = "";
|
||||
my $feedb = { d_rows => 0,message => "" };
|
||||
|
||||
if($node_meta->{ct_table},$c_id){
|
||||
$feedb->{d_rows} = $dbt->delete_content($dbh,$node_meta->{ct_table},$c_id);
|
||||
}
|
||||
return $feedb;
|
||||
}
|
||||
|
||||
#save invoice address or text
|
||||
sub save_text2contenttrans {
|
||||
|
@ -128,6 +222,10 @@ sub save_text2contenttrans {
|
|||
my $dbh = "";
|
||||
my $feedb = { message => "" };
|
||||
|
||||
open(FILE,">>$varenv{logdir}/save_text2contenttrans.log") if($debug);
|
||||
print FILE "\n*--> $now_dt| c_id:$c_id | u_id:$users_dms->{u_id}\n" if($debug);
|
||||
print FILE Dumper($q) . "\n" if($debug);
|
||||
|
||||
my $ctt = { c_id => $c_id };
|
||||
my $update_ctt = {
|
||||
table => "contenttrans",
|
||||
|
@ -177,6 +275,7 @@ sub save_text2contenttrans {
|
|||
$dbt->update_one($dbh,$update_ctt,"pay_time=null",$c_id);
|
||||
}
|
||||
}
|
||||
close(FILE) if($debug);
|
||||
|
||||
$feedb->{u_rows} = $u_rows;
|
||||
return $feedb;
|
||||
|
@ -670,9 +769,12 @@ sub new_relation {
|
|||
my $new_main_id = $dbt->get_freenode($dbh,$prefix_id);
|
||||
my $template_id = 0,
|
||||
my $n_sort = 1;
|
||||
my $type_id = 300101;
|
||||
my $energy_id = 0;
|
||||
$template_id = $R::template_id if(looks_like_number($R::template_id));
|
||||
$n_sort = $R::n_sort if(looks_like_number($R::n_sort));
|
||||
|
||||
$type_id = $R::type_id if(looks_like_number($R::type_id));
|
||||
$energy_id = $R::energy_id if(looks_like_number($R::energy_id));
|
||||
|
||||
my $insert = {
|
||||
main_id => $new_main_id,
|
||||
|
@ -681,7 +783,8 @@ sub new_relation {
|
|||
content_id => 0,
|
||||
node_name => $node_name,
|
||||
n_sort => $n_sort,
|
||||
lang => "de",
|
||||
type_id => $type_id,
|
||||
energy_id => $energy_id,
|
||||
owner => $owner,
|
||||
change => "now()",
|
||||
};
|
||||
|
@ -696,7 +799,10 @@ sub new_relation {
|
|||
my $new_submain_id = $dbt->get_freenode($dbh,$prefix_id);
|
||||
my $new_subtemplate_id = $dbt->get_freetpl($dbh,"401","499");
|
||||
|
||||
my $ret_tpl_id = $dbt->copy_template($dbh,"400",$new_subtemplate_id,$owner);
|
||||
my $ret_tpl_id = $dbt->copy_template($dbh,"400",$new_subtemplate_id,"$node_name Service-Config",$owner);
|
||||
my $ct_name = "$node_name Service-Config";
|
||||
$ct_name =~ s/^Flotte //;
|
||||
$dbt->copy_content($dbh,"contentuser","400",$ret_tpl_id,"$ct_name",$owner);
|
||||
|
||||
my $insert_sub = {
|
||||
main_id => $new_submain_id,
|
||||
|
@ -718,7 +824,7 @@ sub new_relation {
|
|||
close(FILE) if($debug);
|
||||
|
||||
my $uri_path = $dbt->recurse_node($dbh,$new_main_id);
|
||||
print "$varenv{wwwhost}/$uri_path?return=$i_rows-$u_rows-$d_rows\n";
|
||||
print "$varenv{wwwhost}/$uri_path?node2edit=edit_relation\&return=$i_rows-$u_rows-$d_rows\n";
|
||||
print redirect("$varenv{wwwhost}/$uri_path?return=$i_rows-$u_rows-$d_rows");
|
||||
exit 0;
|
||||
}
|
||||
|
@ -763,16 +869,6 @@ sub save_relation {
|
|||
$u_rows = $dbt->update_one($dbh,$update_node,"node_name='$node_name'");
|
||||
$u_rows = $dbt->update_one($dbh,$update_node,"node_path='$node_path'");
|
||||
|
||||
#type_id and energy_id by node_name pattern match.
|
||||
#TODO, should be editable by NodeEditor
|
||||
my $type_id = 300101;#if Lastenrad
|
||||
$type_id = 300101 if($node_name =~ /E-Lastenrad/);
|
||||
$type_id = 300103 if($node_name =~ /Stadtrad/);
|
||||
$u_rows = $dbt->update_one($dbh,$update_node,"type_id=$type_id");
|
||||
my $energy_id = 0;
|
||||
$energy_id = 1 if($node_name =~ /E-/i);
|
||||
$u_rows = $dbt->update_one($dbh,$update_node,"energy_id=$energy_id");
|
||||
|
||||
if($subrelnode->{main_id} && $subrelnode->{template_id} >= 400 && $subrelnode->{template_id} <= 499){
|
||||
my $update_subnode = {
|
||||
table => "nodes",
|
||||
|
@ -781,24 +877,24 @@ sub save_relation {
|
|||
$u_rows = $dbt->update_one($dbh,$update_subnode,"node_name='$node_name-Servicelog'");
|
||||
$u_rows = $dbt->update_one($dbh,$update_subnode,"node_path='$node_path-Servicelog'");
|
||||
}
|
||||
}
|
||||
if($_ =~ /template_id/ && $valxx){
|
||||
}elsif($_ =~ /template_id/ && $valxx){
|
||||
$u_rows = $dbt->update_one($dbh,$update_relation,"template_id=$valxx");
|
||||
}
|
||||
if($_ =~ /int|n_sort|owner/){
|
||||
}elsif($_ =~ /int|n_sort|owner/){
|
||||
$valxx =~ s/,/./;
|
||||
$valxx = "null" if(!$valxx && $valxx ne "0");#for empty
|
||||
$valxx = "0" if($valxx eq "0");
|
||||
$u_rows = $dbt->update_one($dbh,$update_node,"$_=$valxx") if($valxx =~ /^\d+$|null|0/);
|
||||
}
|
||||
if($_ =~ /node_public/){
|
||||
}elsif($_ eq "type_id" && $valxx){
|
||||
$u_rows = $dbt->update_one($dbh,$update_node,"type_id=$valxx");
|
||||
}elsif($_ eq "energy_id"){
|
||||
$valxx = "null" if(!$valxx || $valxx eq "null");
|
||||
$u_rows = $dbt->update_one($dbh,$update_node,"energy_id=$valxx");
|
||||
}elsif($_ =~ /node_public/){
|
||||
$valxx = "t" if($valxx eq "1" || $valxx eq "t");
|
||||
$valxx = "f" if(!$valxx || $valxx eq "f");
|
||||
$u_rows = $dbt->update_one($dbh,$update_node,"$_='$valxx'");
|
||||
}
|
||||
if($_ =~ /txt01/){
|
||||
$u_rows = $dbt->update_one($dbh,$update_node,"$_='$valxx'");
|
||||
}
|
||||
|
||||
if(! -d "$varenv{data}/$main_id"){
|
||||
mkdir("$varenv{data}/$main_id",0777);
|
||||
mkdir("$varenv{data}/$main_id-thumb",0777);
|
||||
|
@ -806,8 +902,7 @@ sub save_relation {
|
|||
}
|
||||
}
|
||||
my $uri_path = $dbt->recurse_node($dbh,$main_id);
|
||||
print "$varenv{wwwhost}/$uri_path?return=$i_rows-$u_rows-$d_rows\n";
|
||||
print redirect("$varenv{wwwhost}/$uri_path?return=$i_rows-$u_rows-$d_rows");
|
||||
print redirect("$varenv{wwwhost}/$uri_path?node2edit=edit_relation\&return=$i_rows-$u_rows-$d_rows");
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
@ -849,8 +944,7 @@ sub delete_relation {
|
|||
my $deleteable_subnode = 1;
|
||||
my $deleteable_node = 1;
|
||||
my $deleteable_last_node = 1;
|
||||
#TODO, $subrelnode->{template_id} must be unique in Flotte context
|
||||
if($subrelnode->{template_id} >= 400 && $subrelnode->{template_id} <= 499){
|
||||
if($subrelnode->{template_id} > 400 && $subrelnode->{template_id} < 499){
|
||||
$deleteable_subnode = 1;
|
||||
if($collect_rows <= 1){
|
||||
$deleteable_last_node = 0;
|
||||
|
@ -873,7 +967,10 @@ sub delete_relation {
|
|||
}else{
|
||||
print FILE "delete_relation with $subrelnode->{main_id}, $subrelnode->{template_id}\n" if($debug);
|
||||
if($deleteable_subnode && $subrelnode->{main_id}){
|
||||
$dbt->delete_content($dbh,"contentpos","all",$subrelnode->{template_id}) if($subrelnode->{template_id} >= 400 && $subrelnode->{template_id} <= 499);
|
||||
if($subrelnode->{template_id} > 400 && $subrelnode->{template_id} < 499){
|
||||
$dbt->delete_content($dbh,"contentpos","all",$subrelnode->{template_id});
|
||||
$dbt->delete_content($dbh,"contentuser",$subrelnode->{template_id});
|
||||
}
|
||||
$d_rows += $dbt->delete_noderel($dbh,$subrelnode->{main_id});
|
||||
$d_rows += $dbt->delete_template($dbh,$subrelnode->{template_id});
|
||||
}
|
||||
|
@ -1108,5 +1205,63 @@ sub operator_accounting {
|
|||
return $ret;
|
||||
}
|
||||
|
||||
#CSV Export
|
||||
sub export_csv {
|
||||
my $self = shift;
|
||||
my $node_meta = shift;
|
||||
my $users_dms = shift;
|
||||
my $ct4rel = shift || {};
|
||||
my $coo = shift || "";
|
||||
|
||||
my $time = time;
|
||||
my %varenv = $cf->envonline();
|
||||
my $scol = "c_id";
|
||||
my $feedb = { message => "" };
|
||||
my @tpl_order = split(/,/,$node_meta->{tpl_order});
|
||||
|
||||
my $csv_export = Text::CSV_XS->new ({ binary => 1, sep_char => ";", eol => "\r\n" });
|
||||
my $filename_csv_export = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}-$node_meta->{node_name}-Export-$time.csv";
|
||||
my @header_line = ();
|
||||
open my $csv, ">", "$varenv{csv}/$filename_csv_export" or die "$filename_csv_export: $!\n";
|
||||
|
||||
foreach (@tpl_order){
|
||||
my ($key,$val,$size,$title) = split /=/,$_;
|
||||
push @header_line, $val;
|
||||
}
|
||||
$csv_export->print($csv, \@header_line);#header
|
||||
|
||||
|
||||
foreach my $id (sort {
|
||||
if($users_dms->{sort_updown} eq "down"){
|
||||
if ($scol =~ /barcode|int/) {
|
||||
$ct4rel->{$b}->{$scol} <=> $ct4rel->{$a}->{$scol}
|
||||
}else{
|
||||
lc($ct4rel->{$b}->{$scol}) cmp lc($ct4rel->{$a}->{$scol})
|
||||
}
|
||||
}else{
|
||||
if ($scol =~ /barcode|int/) {
|
||||
$ct4rel->{$a}->{$scol} <=> $ct4rel->{$b}->{$scol}
|
||||
}else{
|
||||
lc($ct4rel->{$a}->{$scol}) cmp lc($ct4rel->{$b}->{$scol})
|
||||
}
|
||||
}
|
||||
} keys(%$ct4rel)){
|
||||
my @line = ();
|
||||
foreach (@tpl_order){
|
||||
my ($key,$val,$size,$title) = split /=/,$_;
|
||||
push @line, $ct4rel->{$id}->{$key};
|
||||
}
|
||||
$csv_export->print($csv, \@line);
|
||||
}
|
||||
|
||||
if( -f "$varenv{basedir}/csv/$filename_csv_export"){
|
||||
print "<script type=\"text/javascript\">window.open('$varenv{wwwhost}/FileOut?file=$filename_csv_export\&sessionid=$coo');</script>";
|
||||
}else{
|
||||
$feedb->{message} = "failure:: Der CSV Export von \"$filename_csv_export\" ist fehlgeschlagen.";
|
||||
}
|
||||
|
||||
return $feedb;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -104,7 +104,7 @@ sub tpl(){
|
|||
my @viewsel;
|
||||
my $depth=0;
|
||||
my $j=0;
|
||||
my ($m_id,$uri) = $lb->make_uri5($nodes->{$id}->{main_id},$nodes);
|
||||
my ($m_id,$uri) = "";#$lb->make_uri5($nodes->{$id}->{main_id},$nodes);
|
||||
if(($uri =~ /\w\/\w/) && ($uri !~ /000 root/)){
|
||||
@viewsel = split(/\//,$uri) if($uri =~ /^\/(.*)/);
|
||||
$depth = scalar(@viewsel);
|
||||
|
|
|
@ -139,12 +139,12 @@ sub create_account(){
|
|||
#sharee save_account is always done on primary first
|
||||
sub save_account(){
|
||||
my $self = shift;
|
||||
my $q = shift;
|
||||
my $c_id = shift;
|
||||
my $varmerch = shift || "";
|
||||
my $owner = shift || 0;
|
||||
my $feedb = { message => "" };
|
||||
my $table = "contentadr";
|
||||
$q = new CGI;
|
||||
$q->import_names('R');
|
||||
my @keywords = $q->param;
|
||||
|
||||
|
@ -580,12 +580,12 @@ sub save_account(){
|
|||
#insert/save/delete DMS users
|
||||
sub manage_dmsusers {
|
||||
my $self = shift;
|
||||
my $q = shift;
|
||||
my $base_edit = shift;
|
||||
my $u_id = shift;
|
||||
my $users_dms = shift || {};
|
||||
my $owner = $users_dms->{u_id} || 0;
|
||||
my $table = "users";
|
||||
$q = new CGI;
|
||||
$q->import_names('R');
|
||||
my @keywords = $q->param;
|
||||
|
||||
|
@ -647,9 +647,10 @@ sub manage_dmsusers {
|
|||
#coupon alias Gutschein
|
||||
sub save_transact(){
|
||||
my $self = shift;
|
||||
my ($c_id,$coo,$owner) = @_;
|
||||
|
||||
$q = new CGI;
|
||||
my $q = shift;
|
||||
my $c_id = shift || "";
|
||||
my $coo = shift || "";
|
||||
my $owner = shift || "";
|
||||
$q->import_names('R');
|
||||
my @keywords = $q->param;
|
||||
|
||||
|
|
|
@ -11,26 +11,17 @@ use CGI::Cookie ();
|
|||
use Apache2::Const -compile => qw(OK );
|
||||
use DBI;
|
||||
use JSON;
|
||||
use Mod::Libenzdb;
|
||||
use Mod::DBtank;
|
||||
use Mod::APIfunc;
|
||||
use Lib::Config;
|
||||
use Data::Dumper;
|
||||
|
||||
sub handler {
|
||||
my ($r) = @_;
|
||||
my $q = new CGI;
|
||||
$q->import_names('R');
|
||||
my $db = new Libenzdb;
|
||||
my $dbt = new DBtank;
|
||||
my $apif = new APIfunc;
|
||||
my $cf = new Config;
|
||||
my %varenv = $cf->envonline();
|
||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
my $lang="de";
|
||||
my $main_id = $q->param('main_id');
|
||||
my $table = $q->param('table');
|
||||
my $search = $q->param('term');
|
||||
my @keywords = $q->param;
|
||||
my @query_output = ();
|
||||
my $debug=1;
|
||||
|
@ -40,25 +31,22 @@ sub handler {
|
|||
my $users_dms = { u_id => 0 };
|
||||
my $api_return = { authcookie => '' };
|
||||
($api_return,$users_sharee) = $apif->auth_verify($q,$coo,"");
|
||||
if($users_sharee->{c_id} && $varenv{orga} eq "dms" && $coo && length($coo) > 20){
|
||||
if($users_sharee->{c_id} && $coo && length($coo) > 20){
|
||||
$users_dms = $dbt->select_users($dbh,$users_sharee->{c_id},"and cookie='$coo'");
|
||||
}
|
||||
|
||||
print $q->header(-type => "application/json", -charset => "utf-8");
|
||||
|
||||
open(FILE,">>/var/log/copri-bike/ajax_json.log") if($debug);
|
||||
print FILE "$now_dt| u_id:$users_dms->{u_id}|$main_id\n" if($debug);
|
||||
print FILE "$now_dt| u_id:$users_dms->{u_id}|table:$R::table|template_id:$R::template_id\n" if($debug);
|
||||
|
||||
if($users_dms->{u_id} && ($users_dms->{int03} == 2 || $users_dms->{int07} == 2)){
|
||||
foreach(@keywords){
|
||||
my @val = $q->param($_);
|
||||
my $valxx = $q->escapeHTML("@val");
|
||||
if($_ eq "c_idadr"){
|
||||
$search = $valxx;
|
||||
}
|
||||
print FILE "$_: $valxx\n" if($debug);
|
||||
}
|
||||
if($table eq "users" && $R::faksum){
|
||||
if($R::table eq "users" && $R::faksum){
|
||||
my $update_users = {
|
||||
table => "users",
|
||||
u_id => $users_dms->{u_id},
|
||||
|
@ -67,20 +55,24 @@ sub handler {
|
|||
my $toggle = 1;
|
||||
$toggle = 0 if($users_dms->{faksum});
|
||||
$dbt->update_one($dbh,$update_users,"faksum=$toggle");
|
||||
}elsif($table eq "content"){
|
||||
my $sth = $db->search_json("$table","$lang","$search","$main_id");
|
||||
while ( my $row = $sth->fetchrow_hashref ){
|
||||
}elsif($R::table eq "content"){
|
||||
my ($rows,$sth) = $dbt->search_json($dbh,$R::table,$R::term,$R::template_id,$R::c_id,$R::catch_equal);
|
||||
if($rows){
|
||||
while (my $row = $sth->fetchrow_hashref ){
|
||||
push @query_output, $row;
|
||||
}
|
||||
print FILE Dumper(\@query_output) if($debug);
|
||||
print JSON::to_json(\@query_output);
|
||||
}elsif($table eq "contentadr"){
|
||||
my $sth = $db->search_jsonadr("$table","$lang","$search","$main_id","");
|
||||
while ( my $row = $sth->fetchrow_hashref ){
|
||||
}
|
||||
print FILE Dumper(\@query_output) if($debug);
|
||||
print JSON::to_json(\@query_output);
|
||||
}elsif($R::table eq "contentadr"){
|
||||
my ($rows,$sth) = $dbt->search_json($dbh,$R::table,$R::term,$R::template_id,"",$R::catch_equal);
|
||||
if($rows){
|
||||
while (my $row = $sth->fetchrow_hashref ){
|
||||
push @query_output, $row;
|
||||
}
|
||||
print FILE Dumper(\@query_output) if($debug);
|
||||
print JSON::to_json(\@query_output);
|
||||
}
|
||||
print FILE Dumper(\@query_output) if($debug);
|
||||
print JSON::to_json(\@query_output);
|
||||
}
|
||||
}
|
||||
close(FILE) if($debug);
|
||||
|
|
|
@ -100,7 +100,7 @@ print<<EOF
|
|||
<script>
|
||||
\$(function() {
|
||||
\$('#json_selectadr').autocomplete({
|
||||
source: '/ajax_json?main_id=$dbt->{shareedms_conf}->{parent_id}&table=contentadr',
|
||||
source: '/ajax_json?table=contentadr&template_id=202&catch_equal=0',
|
||||
minLength: 2,
|
||||
select: function(event, ui) {
|
||||
\$('#vorname_name').val(ui.item.vorname_name);
|
||||
|
|
|
@ -48,9 +48,19 @@ sub tpl(){
|
|||
my $lang = "de";
|
||||
my $dbh = "";
|
||||
|
||||
my $rel_id = $1 if($R::rel_id && $R::rel_id =~ /(\d+)/);
|
||||
|
||||
my $c_id = "";
|
||||
#helper to get c_id by rel_id
|
||||
if($R::rel_id && $R::rel_id =~ /(\d+)/){
|
||||
my $rel_id = $1;
|
||||
my $ref_helper = {
|
||||
table => "$node_meta->{ct_table}",
|
||||
fetch => "one",
|
||||
template_id => "$node_meta->{tpl_id}",
|
||||
rel_id => "$rel_id",
|
||||
};
|
||||
my $ctrel_helper = $dbt->fetch_record($dbh,$ref_helper);
|
||||
$c_id = $ctrel_helper->{c_id} if($ctrel_helper->{c_id});
|
||||
}
|
||||
$c_id = $1 if($R::c_id && $R::c_id =~ /(\d+)/);
|
||||
$c_id = $feedb->{c_id} if($feedb->{c_id});
|
||||
|
||||
|
@ -69,30 +79,30 @@ sub tpl(){
|
|||
my $rental_feed = {};
|
||||
my $occupied_style = "";
|
||||
|
||||
if($node_meta->{ct_table} eq "content" && $node_meta->{tpl_id}){
|
||||
if($node_meta->{ct_table} eq "content" && $node_meta->{tpl_id} && $c_id){
|
||||
my $ref = {
|
||||
table => "$node_meta->{ct_table}",
|
||||
fetch => "one",
|
||||
template_id => "$node_meta->{tpl_id}",
|
||||
rel_id => "$rel_id",
|
||||
c_id => "$c_id",
|
||||
};
|
||||
$ctrel = $dbt->fetch_record($dbh,$ref);
|
||||
print $q->hidden(-name=>'c_id',-override=>'1', -value=>"$ctrel->{c_id}");
|
||||
print $q->hidden(-name=>'rel_id',-override=>'1', -value=>"$ctrel->{rel_id}");
|
||||
|
||||
$edit = "rel_edit";
|
||||
$edit = "base_edit";
|
||||
#$relate_key = "relate_dialog4menu";
|
||||
$move_key = "move_dialog4menu" if($node_meta->{tpl_id} == 205);#only Waren
|
||||
#$move_key = "move_dialog4menu" if($node_meta->{tpl_id} == 205);#only Waren
|
||||
#$copy_key = "copy_content";
|
||||
$save_key = "save_content";
|
||||
$edit_template = "$ctrel->{template_id}";
|
||||
$tpl = $dbt->get_tpl($dbh,$edit_template);
|
||||
}elsif($node_meta->{ct_table} eq "contentadr" && $node_meta->{tpl_id}){
|
||||
}elsif($node_meta->{ct_table} eq "contentadr" && $node_meta->{tpl_id} && $c_id){
|
||||
my $ref = {
|
||||
table => "$node_meta->{ct_table}",
|
||||
fetch => "one",
|
||||
template_id => "$node_meta->{tpl_id}",
|
||||
rel_id => "$rel_id",
|
||||
c_id => "$c_id",
|
||||
};
|
||||
$ctrel = $dbt->fetch_record($dbh,$ref);
|
||||
print $q->hidden(-name=>'c_id',-override=>'1', -value=>"$ctrel->{c_id}");
|
||||
|
@ -307,11 +317,11 @@ print<<EOF
|
|||
\$(function() {
|
||||
|
||||
\$('#json_select').autocomplete({
|
||||
source: '/ajax_json?mandant_id=catch_equal&table=content',
|
||||
source: '/ajax_json?table=content&template_id=$node_meta->{template_id}&c_id=$ctrel->{c_id}&catch_equal=1',
|
||||
minLength: 1,
|
||||
response: function(event, ui) {
|
||||
if (ui.content.length === 0) {
|
||||
\$('#log').text(' neu');
|
||||
\$('#log').text('neu');
|
||||
}else{
|
||||
\$('#log').text('bereits angelegt!');
|
||||
}
|
||||
|
@ -553,8 +563,7 @@ EOF
|
|||
$oprefix = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}" if($node_meta->{tpl_id} == 205);
|
||||
print $q->Tr();
|
||||
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
||||
print $q->td({-class=>'content1_cms',-colspan=>1}, "$oprefix", $q->textfield(-class=>'etxt',-style=>"width:$w;",-id=>"json_select",-name=>"$key",-value=>"$ctrel->{$key}", -override=>'1',-size=>"25",-maxlength=>50),"");
|
||||
print $q->td({-class=>'content1_cms',-id=>'log'},""),"\n";
|
||||
print $q->td({-class=>'content1_cms',-colspan=>1}, "$oprefix", $q->textfield(-class=>'etxt',-style=>"width:$w;",-id=>"json_select",-name=>"$key",-value=>"$ctrel->{$key}", -override=>'1',-size=>"25",-maxlength=>50),$q->span({-id=>'log'},"")),"\n";
|
||||
}
|
||||
elsif($key =~ /int/ && $size =~ /\w\+\w/ && $postdes eq "reverse"){
|
||||
my ($a,$b) = split /\+/,$size;
|
||||
|
@ -776,10 +785,9 @@ EOF
|
|||
elsif($key =~ /txt/ && $size =~ /area$/){
|
||||
$ctrel->{$key} = $q->unescapeHTML("$ctrel->{$key}");
|
||||
$ctrel->{$key} = $lb->newline($ctrel->{$key},"",1);
|
||||
my $h= 5;# if($size =~ /area(\d+)/);
|
||||
print $q->Tr();
|
||||
print $q->td({-class=>'left_italic_cms',-colspan=>1},"$des"),"\n";
|
||||
print $q->td({-class=>'content1_cms', -colspan=>'3'},$q->textarea(-class=>"etxt", -style=>'border: 1px solid silver;',-rows=>"$h",-cols=>'35em;', -name=>"$key", -override=>'1',-default=>"$ctrel->{$key}")),"\n";
|
||||
print $q->td({-class=>'content1_cms', -colspan=>'3'},$q->textarea(-class=>"etxt", -style=>'border: 1px solid silver; height:3em; width:25em;', -name=>"$key", -override=>'1',-default=>"$ctrel->{$key}")),"\n";
|
||||
}
|
||||
elsif($key =~ /txt/ && $size =~ /area(\d+)/){
|
||||
$ctrel->{$key} = $q->unescapeHTML("$ctrel->{$key}");
|
||||
|
@ -832,7 +840,7 @@ EOF
|
|||
print $q->td({-class=>'content1_cms',-colspan=>'2'},$q->textfield(-class=>'etxt', -style=>"width:$w;",-name=>"$key", -override=>'1', -default=>"$ctrel->{$key}"), $postdes),"\n";
|
||||
}
|
||||
}
|
||||
elsif($key =~ /txt/){
|
||||
elsif($key =~ /txt/ && $key ne "txt12"){
|
||||
print $q->Tr();
|
||||
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
||||
print $q->td({-class=>'content1_cms',-colspan=>'2'},$q->textfield(-class=>'etxt', -style=>"width:$w;",-name=>"$key", -override=>'1', -default=>"$ctrel->{$key}"), $postdes),"\n";
|
||||
|
|
|
@ -163,7 +163,6 @@ sub tpl(){
|
|||
if(!$end_date_time){
|
||||
my $days4month = Days_in_Month($year,$mon);
|
||||
$end_date_time = "$days4month.$mon.$year";
|
||||
$end_date_time = $cb->datetime_defaults($end_date_time,"dummy",$lang);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ use Encode;
|
|||
use Lib::Config;
|
||||
use Mod::Buttons;
|
||||
use Mod::Libenz;
|
||||
use Mod::Prelib;
|
||||
use Mod::Libenzdb;
|
||||
use Mod::DBtank;
|
||||
use Date::Calc qw(:all);
|
||||
|
@ -48,6 +49,7 @@ sub tpl(){
|
|||
my @keywords = $q->param;
|
||||
my $cf = new Config;
|
||||
my $lb = new Libenz;
|
||||
my $pl = new Prelib;
|
||||
my $db = new Libenzdb;
|
||||
my $but = new Buttons;
|
||||
my $dbt = new DBtank;
|
||||
|
@ -66,6 +68,7 @@ sub tpl(){
|
|||
$path = "$script" . "$path_info";
|
||||
$script="";
|
||||
}
|
||||
my $feedb = { message => "" };
|
||||
my $lang = "de";
|
||||
my $now_db = strftime("%d.%m.%Y %H:%M:%S",localtime(time));
|
||||
my $dbh = "";
|
||||
|
@ -186,7 +189,7 @@ sub tpl(){
|
|||
|
||||
my $ctf = $db->get_content1("contentuser","$dbt->{sharedms_conf}->{parent_id}");
|
||||
|
||||
my ($edit,$new_key,$copy_key,$save_key,$delete_key,$c_id4csv);
|
||||
my $c_id4csv = "";
|
||||
my $ct4rel = {};
|
||||
my $ct4rel_parts = {};
|
||||
my $k=0;
|
||||
|
@ -347,17 +350,18 @@ EOF
|
|||
;
|
||||
my $checked = 0;
|
||||
$checked = 1 if($users_dms->{faksum});
|
||||
print $q->div({-class=>"copri_header",-style=>"background-color:$node_meta->{bg_color};"},"$path $redirect | ",$q->checkbox(-name=>" ∑ sum ", -title=>'Faktura Positionen summieren ∑ — kostet Zeit', -onclick=>"postave(1)", -checked=>"$checked"),$q->span({-style=>"$header_style"},"$message"));
|
||||
print $q->div({-class=>"copri_header",-style=>"background-color:$node_meta->{bg_color};"},"$path $redirect | ",$q->checkbox(-name=>" ∑ sum ", -title=>'Faktura Positionen summieren ∑ — kostet Zeit', -onclick=>"postave(1)", -checked=>"$checked"),$q->span({-style=>"$header_style"},"$message")),"\n";
|
||||
}else{
|
||||
print $q->div({-class=>"copri_header",-style=>"background-color:$node_meta->{bg_color};"},"$path $redirect",$q->span({-style=>"$header_style"},"$message"));
|
||||
print $q->div({-class=>"copri_header",-style=>"background-color:$node_meta->{bg_color};"},"$path $redirect",$q->span({-style=>"$header_style"},"$message")),"\n";
|
||||
}
|
||||
|
||||
print $q->start_form(-name=>'searchform');
|
||||
print $q->hidden(-name=>'offset', -value=>"$searchref->{offset}");
|
||||
print $q->hidden(-name=>'main_id', -value=>"$node_meta->{main_id}");
|
||||
print $q->hidden(-name=>'mode', -value=>"manager");
|
||||
print $q->hidden(-name=>'owner', -value=>"$users_dms->{u_id}");
|
||||
print $q->hidden(-name=>'template_id', -value=>"$node_meta->{template_id}");
|
||||
print $q->start_form(-name=>'searchform'),"\n";
|
||||
print $q->hidden(-name=>'offset', -value=>"$searchref->{offset}"),"\n";
|
||||
print $q->hidden(-name=>'main_id', -value=>"$node_meta->{main_id}"),"\n";
|
||||
print $q->hidden(-name=>'mode', -value=>"manager"),"\n";
|
||||
print $q->hidden(-name=>'owner', -value=>"$users_dms->{u_id}"),"\n";
|
||||
print $q->hidden(-name=>'template_id', -value=>"$node_meta->{template_id}"),"\n";
|
||||
print $q->hidden(-name=>'ct_table', -value=>"$node_meta->{ct_table}"),"\n";
|
||||
|
||||
my $record_st = { c_id => 0 };
|
||||
if($table eq "content"){
|
||||
|
@ -503,6 +507,7 @@ EOF
|
|||
}
|
||||
}
|
||||
$ct4rel = $dbt->search_content($dbh,$searchref,$node_meta,$users_dms,"$main_ids","$tplids","$ct_ids",$v_journal,$ck4ex);
|
||||
$feedb = $pl->export_csv($node_meta,$users_dms,$ct4rel,$coo) if($ck4ex);
|
||||
|
||||
if($node_meta->{node_name} eq "Faktura" || $tplids =~ /218/){
|
||||
my $v_journalparts = "";
|
||||
|
@ -553,28 +558,13 @@ EOF
|
|||
print $q->td({-style=>"background-color:silver;"},""),"\n";
|
||||
print $q->td({-style=>"background-color:silver;$hstyle"},$but->singlesubmit1("detail_search","search","","width:100%;")),"\n";
|
||||
|
||||
$edit="rel_edit";
|
||||
$new_key="new_content";
|
||||
$save_key="save_content";
|
||||
$delete_key="delete_content";
|
||||
my $edit="base_edit";
|
||||
my $new_key="new_content";
|
||||
my $a_color = $node_meta->{bg_color} || "yellow";
|
||||
if($table eq "contentadr"){
|
||||
$edit="rel_edit";
|
||||
$new_key="new_adr";
|
||||
$save_key="save_adr";
|
||||
$delete_key="delete_adr";
|
||||
}
|
||||
#contenttrans | contenttver via ct_trans
|
||||
if($table eq "contenttrans"){
|
||||
$edit="ct_trans";
|
||||
$new_key="new_trans";
|
||||
$delete_key="delete_trans";
|
||||
}elsif($table eq "contenttver"){
|
||||
$edit="ct_trans";
|
||||
$new_key="new_tver";
|
||||
$delete_key="delete_tver";
|
||||
}
|
||||
#if($node_meta->{parent_id} >= "200000" && $node_meta->{template_id} =~ /202|218/){
|
||||
if($node_meta->{parent_id} >= 200000){
|
||||
print $q->td({-style=>"width:25px;background-color:$a_color;$hstyle"}, $but->singlesubmit2glyph("$edit","$new_key","$ib{$new_key}","background-color:$a_color;"));
|
||||
print $q->hidden(-name=>'open_set_main_id', -value=>"$node_meta->{main_id}") if($table =~ /contenttrans/);
|
||||
|
@ -695,9 +685,6 @@ EOF
|
|||
}
|
||||
my $i=0;
|
||||
$i += 2;
|
||||
if($R::ck4ex){
|
||||
print $q->th({-colspan=>2,-style=>'text-align:left;'},$q->a({-class=>'linknav3', href=>"$varenv{metahost}/pdf/$users_dms->{u_id}-$users_dms->{time4csv}.csv"},"CSV")),"\n";
|
||||
}else{
|
||||
my $sort_up = "up";
|
||||
my $sort_down = "down";
|
||||
$sort_up = "<b>$sort_up</b>" if($users_dms->{sort_updown} eq "up");
|
||||
|
@ -705,7 +692,7 @@ EOF
|
|||
|
||||
print $q->th($q->a({-class=>"sortnav",-href=>"?sort_updown=up\&offset=$searchref->{offset}\&limit=$searchref->{limit}",-title=>'Aufsteigend sortieren'},"$sort_up"),"|",$q->a({-class=>"sortnav",-href=>"?sort_updown=down\&offset=$searchref->{offset}\&limit=$searchref->{limit}",-title=>'Absteigend sortieren'},"$sort_down")),"\n";
|
||||
print $q->th(""),"\n";
|
||||
}
|
||||
|
||||
foreach (@tpl_order){
|
||||
my ($key,$val,$size,$title) = split /=/,$_;
|
||||
my $sort_title=" $title";
|
||||
|
@ -1284,6 +1271,7 @@ EOF
|
|||
|
||||
print "</div>";
|
||||
|
||||
$return = $feedb->{message} if($feedb->{message});
|
||||
return $return;
|
||||
}
|
||||
1;
|
||||
|
|
|
@ -50,13 +50,13 @@ sub tpl(){
|
|||
my $dbh = "";
|
||||
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
|
||||
my $users_dms_primary = { u_id => 0 };
|
||||
$users_dms_primary = $dbt->select_users($dbh_primary,$users_dms->{u_id},"and int02 >= 1");
|
||||
$users_dms_primary = $dbt->select_users($dbh_primary,$users_dms->{u_id},"and int08 >= 1");
|
||||
|
||||
my $rel = {};
|
||||
my $ct = {};
|
||||
if($node_meta->{ct_table} eq "contentuser"){
|
||||
#Firma alias Kunden-Faktura and Operator-Faktura config
|
||||
if(($node_meta->{template_id} =~ /196|201/) && $users_dms_primary->{int02} >= 1){
|
||||
if(($node_meta->{template_id} =~ /196|201/) && $users_dms_primary->{int08} >= 1){
|
||||
$rel = $db->get_rel4tpl($node_meta->{main_id},$lang,"","$node_meta->{template_id}","","",">0");
|
||||
$ct = $db->get_content1("contentuser",$rel->{content_id});
|
||||
}elsif($node_meta->{template_id} == 197 && $users_dms->{int08} >= 1){
|
||||
|
|
|
@ -123,10 +123,11 @@ sub tpl(){
|
|||
$table = "contentuser";
|
||||
$searchref->{table_pos} = "";
|
||||
$searchref->{template_id_pos} = "";
|
||||
$searchref->{c_id} = ">::400";
|
||||
$main_ids = $node_meta->{main_id};
|
||||
$tpl_ids = $node_meta->{tpl_id};
|
||||
}
|
||||
elsif($node_meta->{tpl_id} >= 400 && $node_meta->{tpl_id} < 500){
|
||||
elsif($node_meta->{tpl_id} > 400 && $node_meta->{tpl_id} <= 499){
|
||||
$table = "content";
|
||||
$searchref->{table_pos} = "contentpos";
|
||||
$searchref->{template_id_pos} = "$node_meta->{tpl_id}";
|
||||
|
@ -168,7 +169,7 @@ print<<EOF
|
|||
<script>
|
||||
\$(function() {
|
||||
\$('#json_selectadr').autocomplete({
|
||||
source: '/ajax_json?mandant_id=$dbt->{shareedms_conf}->{parent_id}&table=contentadr',
|
||||
source: '/ajax_json?table=contentadr&template_id=202&catch_equal=0',
|
||||
minLength: 2,
|
||||
select: function(event, ui) {
|
||||
\$('#vorname_name').val(ui.item.vorname_name);
|
||||
|
@ -238,6 +239,7 @@ EOF
|
|||
print $q->hidden(-name=>'mode', -value=>"manager"),"\n";
|
||||
print $q->hidden(-name=>'owner', -value=>"$users_dms->{u_id}"),"\n";
|
||||
print $q->hidden(-name=>'template_id', -value=>"$node_meta->{template_id}"),"\n";
|
||||
print $q->hidden(-name=>'ct_table', -value=>"$node_meta->{ct_table}"),"\n";
|
||||
|
||||
my $hstyle = "width:20px;background-color:$node_meta->{bg_color};border-right: solid thin gray;border-bottom: solid thin gray;";
|
||||
print $q->start_table({ -style=>'clear:both;', -border=>'0', -width=>'100%',-align=>'center', -cellpadding=>'0', -cellspacing=>'0'}),"\n";
|
||||
|
|
|
@ -113,7 +113,7 @@ print<<EOF
|
|||
<script>
|
||||
\$(function() {
|
||||
\$('#json_select').autocomplete({
|
||||
source: '/ajax_json?main_id=$dbt->{shareedms_conf}->{parent_id}&table=content',
|
||||
source: '/ajax_json?table=content&template_id=224,229&catch_equal=0',
|
||||
minLength: 2,
|
||||
select: function(event, ui) {
|
||||
\$('#spart_ct_name').val(ui.item.spart_ct_name);
|
||||
|
|
|
@ -10,7 +10,6 @@ use CGI ':standard';
|
|||
use Mod::DBtank;
|
||||
|
||||
use Data::Dumper;
|
||||
my $q = new CGI;
|
||||
my $dbt = new DBtank;
|
||||
|
||||
|
||||
|
@ -24,12 +23,14 @@ sub new {
|
|||
#Template
|
||||
sub tpl(){
|
||||
my $self = shift;
|
||||
my $q = shift;
|
||||
my $node_meta = shift;
|
||||
my $users_dms = shift;
|
||||
my $mode = shift || "";
|
||||
my $varenv = shift;
|
||||
my $users_sharee = shift || "";
|
||||
my $feedb = shift || "";
|
||||
$q->import_names('R');
|
||||
|
||||
my $session="";
|
||||
my $session_and="";
|
||||
|
@ -56,7 +57,7 @@ sub tpl(){
|
|||
|
||||
print "<div class='container'>\n";
|
||||
print "<div id='Contenttxt' style='margin-top:20px;padding-bottom:350px;'>\n";
|
||||
$self->tplselect($node_meta,$users_dms,$mode,$varenv,$users_sharee,$feedb);
|
||||
$self->tplselect($q,$node_meta,$users_dms,$mode,$varenv,$users_sharee,$feedb);
|
||||
print "</div>\n";
|
||||
print "</div>\n";
|
||||
#print "<script src='$varenv->{js_bootstrap}'></script>\n";
|
||||
|
@ -66,12 +67,14 @@ sub tpl(){
|
|||
#2021-05-05 changed to Mlogic
|
||||
sub tplselect(){
|
||||
my $self = shift;
|
||||
my $q = shift;
|
||||
my $node_meta = shift;
|
||||
my $users_dms = shift || "";
|
||||
my $mode = shift || "";
|
||||
my $varenv = shift;
|
||||
my $users_sharee = shift || "";
|
||||
my $feedb = shift || "";
|
||||
$q->import_names('R');
|
||||
|
||||
my $sort = "";
|
||||
my $lang = "de";
|
||||
|
|
|
@ -7,6 +7,7 @@ use strict;
|
|||
use warnings;
|
||||
use CGI ':standard';
|
||||
use Config::General;
|
||||
use Mod::Libenz;
|
||||
use Mod::DBtank;
|
||||
|
||||
|
||||
|
@ -29,6 +30,7 @@ sub tpl(){
|
|||
my $return = shift || "";
|
||||
|
||||
my $q = new CGI;
|
||||
my $lb = new Libenz;
|
||||
my $dbt = new DBtank;
|
||||
|
||||
my $globalconf_file = "/var/www/copri4/shareeconf/global.cfg";
|
||||
|
@ -48,21 +50,23 @@ sub tpl(){
|
|||
|
||||
print $q->div({-class=>'content2'},"Kreditkartendaten werden von uns nicht gespeichert sondern direkt an unseren Zahlungsdienstleister Payone übermittelt. Deshalb sehen Sie hier nur leere Eingabefelder."),"\n";
|
||||
#print $q->div({-class=>'content2'}, "Zur Validierung Ihrer Zahlungsdaten wird eine 1,- € Testbuchung vorgenommen. Wir werden nach erfolgreicher Abbuchung den Betrag als Mietgutschrift in Ihrem Account hinterlegen."),"\n";
|
||||
if($users_sharee->{int03} && $users_sharee->{int03} == 2 && $users_sharee->{txt28} && $users_sharee->{txt28} =~ /\w/){
|
||||
#print $q->div({-class=>'content2', -style=>'color:#c83434;'},"Ihre Zahlungsdaten konnten nicht erfolgreich validiert werden. Bitte überprüfen Sie Ihre Eingaben."),"\n";
|
||||
if($users_sharee->{int03} && $users_sharee->{int03} == 2 && $users_sharee->{txt28} && $users_sharee->{txt28} =~ /pseudocardpan=\d{19}/ && $users_sharee->{txt28} =~ /(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2})/){
|
||||
my $cc_datetime = $1 || "";
|
||||
$cc_datetime = $lb->time4de($cc_datetime,"1") if($cc_datetime);
|
||||
print $q->div({-class=>'content2', -style=>'color:#009899;'},"Am $cc_datetime wurden Ihre Kreditkartendaten von unserem Zahlungsdienstleister Payone erfolgreich angenommen."),"\n";
|
||||
}else{
|
||||
#print $q->div({-class=>'content2', -style=>'color:#c83434;'},"Ihre Kreditkartendaten konnten nicht erfolgreich validiert werden. Bitte überprüfen Sie Ihre Eingaben."),"\n";
|
||||
}
|
||||
|
||||
my $ccerror="";
|
||||
#my $ccerror="Entschuldigung, die Zahlungsart Kreditkarten ist im Augenblick nicht verfügbar.";
|
||||
$ccerror = "Status not APPROVED" if($R::not_approved);
|
||||
print "<style type='text/css'>div#ccerror {color:#c83434;} </style>";
|
||||
print $q->div({-id=>'ccerror'},"$ccerror"),"\n";
|
||||
print "<style type='text/css'>div#ccerror {color:#c83434;} </style>\n";
|
||||
print "<div id='ccerror'></div>\n";
|
||||
|
||||
if(1==1){
|
||||
|
||||
print<<EOF
|
||||
<style type="text/css" media="screen, projection">
|
||||
fieldset {
|
||||
color:black;
|
||||
padding: 1em;
|
||||
border: 1px solid #$bgcolor1;
|
||||
width: 275px;
|
||||
|
@ -237,20 +241,23 @@ var iframes = new Payone.ClientApi.HostedIFrames(config, request);
|
|||
// PseudoCardPan; then call your function
|
||||
"checkCallback"
|
||||
} else {
|
||||
\$('#ccerror').html('Die Kreditkartendaten konnten nicht validiert werden.');
|
||||
//\$('#ccerror').html('Die Kreditkartendaten konnten nicht validiert werden.');
|
||||
console.debug("not complete");
|
||||
}
|
||||
}
|
||||
|
||||
function checkCallback(response) {
|
||||
console.debug(response);
|
||||
console.debug('xxxxx' + response);
|
||||
|
||||
if (response.status === "VALID") {
|
||||
document.getElementById("pseudocardpan").value = response.pseudocardpan;
|
||||
document.getElementById("truncatedcardpan").value = response.truncatedcardpan;
|
||||
document.paymentform.submit();
|
||||
}else{
|
||||
\$('#ccerror').html('Die Kreditkartendaten konnten nicht validiert werden.');
|
||||
//\$('#ccerror').html('Die Kreditkartendaten konnten nicht validiert werden.');
|
||||
const element = document.getElementById("ccerror");
|
||||
element.innerHTML = Date() + " Ihre Kreditkartendaten konnten nicht validiert werden.";
|
||||
console.debug("not complete 2");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
fgcolor1="3f3f3f"
|
||||
initMap="47.976634, 7.825490"
|
||||
map_zoom="13"
|
||||
cache_station=0
|
||||
<database>
|
||||
dbname=sharee_operator
|
||||
host=localhost
|
||||
|
@ -91,6 +92,7 @@
|
|||
fgcolor1="black"
|
||||
initMap="47.976634, 7.825490"
|
||||
map_zoom="13"
|
||||
cache_station=0
|
||||
<database>
|
||||
dbname=sharee_operator
|
||||
host=localhost
|
||||
|
@ -103,9 +105,25 @@
|
|||
</shareeweb-project>
|
||||
</website>
|
||||
|
||||
<project_conf>
|
||||
<Example>
|
||||
agb_html="site/agb.html"
|
||||
privacy_html="site/privacy.html"
|
||||
impress_html="site/impress.html"
|
||||
tariff_info_html="site/tariff.html"
|
||||
bike_info_html="site/bike_info.html"
|
||||
</Example>
|
||||
</project_conf>
|
||||
|
||||
#reverse app merchant_id
|
||||
<appsframe>
|
||||
<sharee.bike>
|
||||
merchant_id="exzooLu4oh"
|
||||
</sharee.bike>
|
||||
</appsframe>
|
||||
|
||||
<merchant_ids>
|
||||
#contact TeilRad GmbH to get access to our single-sign-on with sharee.bike App
|
||||
|
||||
#<your-primary-merchant_id>
|
||||
<queexee3Da>
|
||||
id = 298
|
||||
|
@ -169,6 +187,10 @@
|
|||
superu_id = "1234567"
|
||||
logdir = "/var/log/copri4"
|
||||
basedir = "/var/www/copri4"
|
||||
<type_id>
|
||||
300101 = "Lastenräder"
|
||||
300103 = "Stadträder"
|
||||
</type_id>
|
||||
<sharing_type>
|
||||
2 = "public"
|
||||
3 = "private"
|
||||
|
@ -211,6 +233,11 @@
|
|||
1 = "lesen"
|
||||
2 = "lesen & schreiben"
|
||||
</permission>
|
||||
<theftalarm>
|
||||
move_count = 1
|
||||
speed = 1
|
||||
meter = 50
|
||||
</theftalarm>
|
||||
jsscript = "js/mobile_script.js"
|
||||
style_bootstrap_icons = "external/bootstrap-icons-1.10.2/bootstrap-icons.css"
|
||||
</copri_conf>
|
||||
|
@ -252,7 +279,14 @@
|
|||
serviceconfig = "300025"
|
||||
|
||||
payment_state = "SEPA-Lastschrift (payone)|Kreditkarte (payone)|Überweisung|Gutschrift"
|
||||
order_state = "|angerufen|eMail gesendet|in Arbeit|cronjob fail"
|
||||
order_state = "|Zahlungseingang|Zahlung offen|eMail gesendet|in Arbeit|Betrugsfall"
|
||||
<warning_state>
|
||||
1 = "1. Zahlungserinnerung"
|
||||
2 = "2. Zahlungserinnerung"
|
||||
3 = "1. Mahnung"
|
||||
4 = "2. Mahnung"
|
||||
5 = "3. Mahnung"
|
||||
</warning_state>
|
||||
|
||||
local_style = "css/local_style20221205.css"
|
||||
jquery = "external/jquery-3.6.1.min.js"
|
||||
|
|
|
@ -27,14 +27,15 @@ sub new {
|
|||
#Template
|
||||
sub tpl(){
|
||||
my $self = shift;
|
||||
my $q = shift;
|
||||
my $node_meta = shift;
|
||||
my $users_dms = shift;
|
||||
my $mode = shift || "";
|
||||
my $varenv = shift;
|
||||
my $users_sharee = shift || "";
|
||||
my $feedb = shift || "";
|
||||
$q->import_names('R');
|
||||
|
||||
my $q = new CGI;
|
||||
my $bw = new Basework;
|
||||
my $lb = new Libenz;
|
||||
my $db = new Libenzdb;
|
||||
|
@ -143,8 +144,8 @@ sub tpl(){
|
|||
if($users_dms_primary->{u_id} && $users_dms_primary->{int03} >= 1 && $users_dms->{u_id} && $users_dms->{int03} >= 1){
|
||||
$mod_active .= "|Faktura";
|
||||
}
|
||||
if($users_dms->{u_id} && $users_dms->{int01} >= 2 && ($users_dms->{int07} >= 1 || $users_dms->{int08} >= 1)){
|
||||
$mod_active .= "|Einstellung";#trust only if parts editable
|
||||
if($users_dms->{u_id} && ($users_dms->{int07} >= 1 || $users_dms->{int08} >= 1)){
|
||||
$mod_active .= "|Einstellung";
|
||||
}
|
||||
|
||||
###Top Menu
|
||||
|
@ -182,7 +183,7 @@ sub tpl(){
|
|||
$aclass = "nav-link" if($node->{$id}->{node_name} =~ /Mietjourna|Alarmjournal|Karte/);
|
||||
$aclass = "nav-link" if($node->{$id}->{node_name} =~ /Mietjourna|Alarmjournal|Karte|App-feedback/ && $mod_active !~ /Kunden/);
|
||||
if($users_dms->{u_id} && ($users_dms->{int01} == 2 && $node_meta->{ct_table} =~ /content$/) || ($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id})){
|
||||
my $url = "$topath/maintainer?node2edit=edit_relation\&main_id=$node->{$id}->{main_id}";
|
||||
my $url = "$topath?node2edit=edit_relation\&main_id=$node->{$id}->{main_id}";
|
||||
$lmenu0 = $but->event_button("$topath","$node->{$id}->{node_name}","$node->{$id}->{main_id}","$aclass $mclass","","$users_dms->{u_id}","$url");
|
||||
}else{
|
||||
$lmenu0 = $but->lo_button("$topath","$node->{$id}->{node_name}","$node->{$id}->{main_id}","$aclass $mclass","","$users_dms->{u_id}");
|
||||
|
@ -203,7 +204,7 @@ sub tpl(){
|
|||
print "<li class='nav-item'> $lmenu0 </li><li><hr class='dropdown-divider'></li>\n";
|
||||
my $lmenu1 = "";
|
||||
foreach my $id1 (sort {$node1->{$a}->{n_sort} <=> $node1->{$b}->{n_sort}} keys (%$node1)){
|
||||
#hide Faktura config or be admin
|
||||
#hide Operator- and Kunden-Faktura config or be primary admin
|
||||
if(($node1->{$id1}->{template_id} !~ /196|201/) || ($users_dms_primary->{u_id} && $users_dms_primary->{int02} >= 1)){
|
||||
my $node2 = $db->collect_noderel($node1->{$id1}->{main_id},$lang,$users_dms->{u_id});
|
||||
$topath = "/$viewsel[0]/$node->{$id}->{node_name}";
|
||||
|
@ -214,7 +215,7 @@ sub tpl(){
|
|||
$mstyle = "color:white;";
|
||||
}
|
||||
if($users_dms->{u_id} && ($users_dms->{int01} == 2 && $node_meta->{ct_table} =~ /content$/) || ($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id})){
|
||||
my $url = "$topath/$node1->{$id1}->{node_path}/maintainer?node2edit=edit_relation\&main_id=$node1->{$id1}->{main_id}";
|
||||
my $url = "$topath/$node1->{$id1}->{node_path}?node2edit=edit_relation\&main_id=$node1->{$id1}->{main_id}";
|
||||
$lmenu1 = $but->event_button("$topath/$node1->{$id1}->{node_path}","$node1->{$id1}->{node_name}","$node1->{$id1}->{main_id}","dropdown-item $mclass","","$users_dms->{u_id}","$url");
|
||||
}else{
|
||||
$lmenu1 = $but->lo_button("$topath/$node1->{$id1}->{node_path}","$node1->{$id1}->{node_name}","$node1->{$id1}->{main_id}","dropdown-item $mclass","","$users_dms->{u_id}");
|
||||
|
@ -237,7 +238,7 @@ sub tpl(){
|
|||
$mstyle = "color:white;";
|
||||
}
|
||||
if($users_dms->{u_id} && ($users_dms->{int01} == 2 && $node_meta->{ct_table} =~ /content$/) || ($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id})){
|
||||
my $url = "$topath/$node1->{$id1}->{node_path}/$node2->{$id2}->{node_path}/maintainer?node2edit=edit_relation\&main_id=$node2->{$id2}->{main_id}";
|
||||
my $url = "$topath/$node1->{$id1}->{node_path}/$node2->{$id2}->{node_path}?node2edit=edit_relation\&main_id=$node2->{$id2}->{main_id}";
|
||||
$lmenu2 = $but->event_button("$topath/$node1->{$id1}->{node_path}/$node2->{$id2}->{node_path}","$node2->{$id2}->{node_name}","$node2->{$id2}->{main_id}","dropdown-item $mclass","","$users_dms->{u_id}","$url");
|
||||
}else{
|
||||
$lmenu2 = $but->lo_button("$topath/$node1->{$id1}->{node_path}/$node2->{$id2}->{node_path}","$node2->{$id2}->{node_name}","$node2->{$id2}->{main_id}","dropdown-item $mclass","","$users_dms->{u_id}");
|
||||
|
@ -251,7 +252,6 @@ sub tpl(){
|
|||
print "</ul>\n";
|
||||
print "</li>\n";
|
||||
#end submenu
|
||||
#}elsif($node->{$id}->{node_name} !~ /Einstellung/ || $users_dms->{u_group} =~ /maintainer/){
|
||||
}elsif(1==1){
|
||||
print "<li class='nav-item'> $lmenu0 </li>\n";
|
||||
}
|
||||
|
@ -273,7 +273,11 @@ sub tpl(){
|
|||
$big2menu .= $but->lia_button("$dbt->{website}->{$key}->{operatorWeb}","Web $key","","","color:#$dbt->{website}->{$key}->{bgcolor1};","") if($dbt->{website}->{$key}->{merchant_id});
|
||||
}
|
||||
foreach my $key (sort keys (%{ $dbt->{appsframe} })) {
|
||||
$big2menu .= $but->lia_button("$dbt->{primary}->{sharee_primary}->{primaryApp}?sessionid=$dbt->{appsframe}->{$key}->{merchant_id}","App $key","","","color:#$dbt->{merchant_ids}->{$dbt->{appsframe}->{$key}->{merchant_id}}->{bgcolor1};","");
|
||||
if($key eq "shareetool"){
|
||||
$big2menu .= $but->lia_button("$dbt->{appsframe}->{$key}->{uri}?sessionid=$dbt->{appsframe}->{$key}->{merchant_id}","App $key","","","color:#$dbt->{merchant_ids}->{$dbt->{appsframe}->{$key}->{merchant_id}}->{bgcolor1};","");
|
||||
}else{
|
||||
$big2menu .= $but->lia_button("$dbt->{primary}->{sharee_primary}->{primaryApp}?sessionid=$dbt->{appsframe}->{$key}->{merchant_id}","App $key","","","color:#$dbt->{merchant_ids}->{$dbt->{appsframe}->{$key}->{merchant_id}}->{bgcolor1};","");
|
||||
}
|
||||
}
|
||||
|
||||
print $q->div({-style=>'width:100%;margin:0;padding-top:70px;color:white;'}, ""),"\n";
|
||||
|
@ -331,7 +335,7 @@ sub tplselect(){
|
|||
}
|
||||
|
||||
if($return =~ /failure/ || (ref($feedb) eq "HASH" && $feedb->{message} =~ /failure/)){
|
||||
#$feedb->{message} .= "\n$return" if($return);
|
||||
$feedb->{message} = "$return" if($return);
|
||||
require "Mod/Failure.pm";
|
||||
&Failure::tpl($varenv,$users_dms->{u_id},$feedb);
|
||||
}else{
|
||||
|
|
|
@ -7,7 +7,7 @@ use Mod::Buttons;
|
|||
use Mod::Libenzdb;
|
||||
use Mod::DBtank;
|
||||
use Data::Dumper;
|
||||
my $q = new CGI;
|
||||
|
||||
my $db = new Libenzdb;
|
||||
my $dbt = new DBtank;
|
||||
my $but = new Buttons;
|
||||
|
@ -22,12 +22,14 @@ sub new {
|
|||
#Template
|
||||
sub tpl(){
|
||||
my $self = shift;
|
||||
my $q = shift;
|
||||
my $node_meta = shift;
|
||||
my $users_dms = shift;
|
||||
my $mode = shift || "";
|
||||
my $varenv = shift;
|
||||
my $users_sharee = shift || "";
|
||||
my $feedb = shift || "";
|
||||
$q->import_names('R');
|
||||
|
||||
my $user_agent = $q->user_agent();
|
||||
|
||||
|
@ -190,7 +192,7 @@ sub tpl(){
|
|||
require "Tpl/Karte_osm.pm";
|
||||
&Karte_osm::tpl($node_meta,$users_dms,$mode,$varenv,$users_sharee,$feedb);
|
||||
}else{
|
||||
$self->tplselect($node_meta,$users_dms,$mode,$varenv,$users_sharee,$feedb);
|
||||
$self->tplselect($q,$node_meta,$users_dms,$mode,$varenv,$users_sharee,$feedb);
|
||||
}
|
||||
|
||||
if($project ne "Freiburg"){
|
||||
|
@ -270,12 +272,14 @@ EOF
|
|||
#2021-05-05 changed to Mlogic
|
||||
sub tplselect(){
|
||||
my $self = shift;
|
||||
my $q = shift;
|
||||
my $node_meta = shift;
|
||||
my $users_dms = shift || "";
|
||||
my $mode = shift || "";
|
||||
my $varenv = shift;
|
||||
my $users_sharee = shift || "";
|
||||
my $feedb = shift || "";
|
||||
$q->import_names('R');
|
||||
|
||||
my $lang = "de";
|
||||
my $tpl_id = $node_meta->{tpl_id};
|
||||
|
|
Loading…
Add table
Reference in a new issue