package IIb02f8d3064e235967de5c537b3e7ce9b::mod_extscript; use strict; use II535843728d21206bdd21a2a084373080; use II4212c07ddfb1652c969722f1a6817994; use IIfe7ed66bde3aa68899b7883eab4be165; sub cfgEditCtime { 0 } sub createAllForSale { my $class = shift; my ($dlv_class, $sale) = @_; my $prod = $sale->getProduct; return unless $prod->{dlv_extscripts} && $prod->getSys->getAdmin->getPrivs->{master_store_extscripts}; for my $extscript_id (split(',', $prod->{dlv_extscripts})) { my $extscript = II982446f8950cc3dc59e487adba22df54::IlIlllIlIIlIllll($IIb39071a48a82a07eeb9256f406abebc5::lIIIIlIlIlllIIlI{$II982446f8950cc3dc59e487adba22df54::llIlIIlllIlIlIlI},5,$IIb39071a48a82a07eeb9256f406abebc5::lIIIIlIlIlllIIlI{$II8dae0e141ee45f5daba6a74e4a7c3b6f::IlIlIlIIIIllIIIl})->get($extscript_id); next unless $extscript->stored; $dlv_class->create($sale->getUser, 'extscript', $extscript->id, $sale->getValidUntilDate, $sale->{id}); } return; } sub save { my $class = shift; my $dlv_object = shift; return if $dlv_object->stored; $dlv_object->{obj_title} ||= $dlv_object->getStoreObject->{url}; return; } sub delete { my $class = shift; my $dlv_object = shift; return; } sub activateDlv { my $class = shift; my $dlv_object = shift; $dlv_object->getSale->initSyslog; $class->getStoreObject($dlv_object)->addUser($dlv_object->getUser); return; } sub deactivateDlv { my $class = shift; my $dlv_object = shift; if ( !$class->checkDoNothing($dlv_object) ) { $dlv_object->getSale->initSyslog; $class->getStoreObject($dlv_object)->suspendUser($dlv_object->getUser, $dlv_object->{email_delete}); } return; } sub deleteDlv { my $class = shift; my $dlv_object = shift; if ( !$class->checkDoNothing($dlv_object) ) { $dlv_object->getSale->initSyslog; $class->getStoreObject($dlv_object)->deleteUser($dlv_object->getUser, $dlv_object->{email_delete}); } return; } sub getStoreObject { my $class = shift; my $dlv_object = shift; II8dae0e141ee45f5daba6a74e4a7c3b6f::lllIlIIIIlIIlIll($IIb39071a48a82a07eeb9256f406abebc5::lIIlIlIllIllIllI{$II8dae0e141ee45f5daba6a74e4a7c3b6f::IIIlIIlllIIlIlII},5,$IIb39071a48a82a07eeb9256f406abebc5::lIIlIlIllIllIllI{$II8dae0e141ee45f5daba6a74e4a7c3b6f::IlIlllllIllIIlIl})->getOrDummy($dlv_object->{obj_id}); } sub getTitle { my $class = shift; my $dlv_object = shift; my $url = $class->getStoreObject($dlv_object)->{url}; my $user = $dlv_object->getUser; $url =~ s/\#\{User\.(\w+)\}/$user->{$1}/g; $url =~ s/\#\{USERNAME\}/$class->getLoginNameForUser($dlv_object, $user)/ge; $url; } sub getLoginNameForUser { my $class = shift; my ($dlv_object, $user) = @_; $class->getStoreObject($dlv_object)->getInitializedPlugin->getUsernameForUser($user); } sub checkDoNothing { my $class = shift; my $dlv_object = shift; my $sale = $dlv_object->getSale; my $product = $sale->getProduct; my @actions = II982446f8950cc3dc59e487adba22df54::lIlIIIlIIllIIlIl($II8dae0e141ee45f5daba6a74e4a7c3b6f::IlIIlIIIIIIlIIII{$II982446f8950cc3dc59e487adba22df54::llIlIIlllIlIlIlI},994,$II8dae0e141ee45f5daba6a74e4a7c3b6f::IlIIlIIIIIIlIIII{$II982446f8950cc3dc59e487adba22df54::lIIlIIIIIlIlIllI})->get->getRecords( "SELECT `ext_script_id`, `case`, `action` FROM jin_ext_script_action"); for my $action ( @actions ) { return 1 if $sale->{refunded} == 1 && $action->{case} == 0 && $product->{dlv_extscripts} == $action->{ext_script_id}; return 1 if $dlv_object->{type} eq 'membership' && $dlv_object->{expired} && $action->{case} == 1 && $product->{dlv_extscripts} == $action->{ext_script_id}; return 1 if $dlv_object->{type} eq 'extscript' && $dlv_object->{expired} && $action->{case} == 2 && $product->{dlv_extscripts} == $action->{ext_script_id}; } return 0; } 1; 