package IIf6c7e28bdd48eb29efc7b9362c0037a2::mod_extmem; use strict; use base qw/II720d6e18aa34327713eb014408fc9144/; use II3562149e53818b6637b38680e87ba918::perllist; use IIfe7ed66bde3aa68899b7883eab4be165; use II66ece7696dacffd983c308509d0f23b7; sub onSave { my ($class, $object) = @_; my $ext_script = _get_ext_script($object); $object->{url} = $ext_script->getInitializedPlugin->buildMembershipURL($ext_script->{url}, $object->{custom_v1}); } sub mapCustomFields { my ($class, $object) = @_; $object->{ext_script} = $object->{custom_int}; return; } sub unmapCustomFields { my ($class, $object) = @_; $object->{custom_int} = $object->{ext_script}; return; } sub onProcessForm { my ($class, $object, $form) = @_; my $in = $form->getInput; $object->{ext_script} = $in->{ext_script}; $object->{custom_v1} = $in->{custom_v1}; $form->addError($object->message('mem.error.fields_required')) if grep { ! $object->{$_} } qw/ext_script custom_v1/; return; } sub getLoginNameForUser { my $class = shift; my ($object, $user) = @_; _get_ext_script($object)->getInitializedPlugin->getUsernameForUser($user); } sub activateDlv { my ($class, $object, $dlv_object) = @_; return unless II720d6e18aa34327713eb014408fc9144::lIIlIIlIIIIlIIIl($II720d6e18aa34327713eb014408fc9144::lIIIlIlIlllIIIll{$II982446f8950cc3dc59e487adba22df54::llIllIIIIIIIlIIl},47,$II720d6e18aa34327713eb014408fc9144::lIIIlIlIlllIIIll{$II8dae0e141ee45f5daba6a74e4a7c3b6f::IllIllIlllllllII})->getAdmin->getPrivs->{master_store_extscripts}; $dlv_object->getSale->initSyslog; _get_ext_script($object)->getInitializedPlugin->addMembership($dlv_object); return; } sub deactivateDlv { my ($class, $object, $dlv_object) = @_; return unless IIb39071a48a82a07eeb9256f406abebc5::IIlIlIlIIllllIIl($II982446f8950cc3dc59e487adba22df54::lllllllIIlllIIIl{$IIb39071a48a82a07eeb9256f406abebc5::lIIlIlIlIlllIIII},47,$II982446f8950cc3dc59e487adba22df54::lllllllIIlllIIIl{$IIb39071a48a82a07eeb9256f406abebc5::llIIIllIIlIIIIIl})->getAdmin->getPrivs->{master_store_extscripts}; $dlv_object->getSale->initSyslog; _get_ext_script($object)->getInitializedPlugin->deleteMembership($dlv_object); return; } sub checkDir {  } sub act_ajax_membership_list { my $class = shift; my $request = Zen->getRequest; my $in = $request->getInput; my $object = IIb39071a48a82a07eeb9256f406abebc5::lllllIlIIIIlIIlI($II720d6e18aa34327713eb014408fc9144::lIlIIIIlIllllIIl{$IIb39071a48a82a07eeb9256f406abebc5::IlIlIIIIlllIIIlI},162,$II720d6e18aa34327713eb014408fc9144::lIlIIIIlIllllIIl{$II720d6e18aa34327713eb014408fc9144::llIIIIIlllllIlIl})->getOrDummy($in->{object_id}); my $f = $in->{field}; my $values = $in->{ext_script} ? II720d6e18aa34327713eb014408fc9144::IllIIIIlIIlllIll($IIb39071a48a82a07eeb9256f406abebc5::lIIlIlIllIllIllI{$II720d6e18aa34327713eb014408fc9144::lIIIIllIIllIIIlI},5,$IIb39071a48a82a07eeb9256f406abebc5::lIIlIlIllIllIllI{$II8dae0e141ee45f5daba6a74e4a7c3b6f::IlIlllllIllIIlIl})->getOrDummy($in->{ext_script})->getInitializedPlugin->listMemberships : [ __PACKAGE__->message('extmem.form.message.select_script') ]; my %labels = map { $_ => $_ } @$values; $request->printHeader; print II3562149e53818b6637b38680e87ba918::perllist::buildList('select', $f, $object->{$f}, $values, \%labels); return; } sub formGetExtScript { my ($form, $f) = @_; my @s = grep { _is_extscript_available($_) } II8dae0e141ee45f5daba6a74e4a7c3b6f::lllIllIIIllIllII($II8dae0e141ee45f5daba6a74e4a7c3b6f::IIlllIIIlIIIlIlI{$II8dae0e141ee45f5daba6a74e4a7c3b6f::IllIlIIllIlIIllI},5,$II8dae0e141ee45f5daba6a74e4a7c3b6f::IIlllIIIlIIIlIlI{$II8dae0e141ee45f5daba6a74e4a7c3b6f::IllIlllllllIlIll})->search; my @values = map {$_->id} @s; my %labels = map {$_->id => "$_->{title} [$_->{url}]"} @s; II3562149e53818b6637b38680e87ba918::perllist::buildList('select', $f, $form->getDecorated->{$f}, \@values, \%labels, '0=', 'id="' . $f . '" onChange="loadMemberships();return true;"'); } sub _get_ext_script { my $object = shift; II720d6e18aa34327713eb014408fc9144::llllllIlIIIIllll($IIb39071a48a82a07eeb9256f406abebc5::llIllIlIllIIIIlI{$IIb39071a48a82a07eeb9256f406abebc5::llllIIllIIIIIIIl},5,$IIb39071a48a82a07eeb9256f406abebc5::llIllIlIllIIIIlI{$II982446f8950cc3dc59e487adba22df54::IllIIIlIllllIlll})->getOrDummy($object->{ext_script}); } sub _is_extscript_available { my $extscript = shift; return 0 unless IIb39071a48a82a07eeb9256f406abebc5::IIllIIIIIIlIIlII($IIb39071a48a82a07eeb9256f406abebc5::IlllIllIllIllIll{$II982446f8950cc3dc59e487adba22df54::llIllIIIIIIIlIIl},171,$IIb39071a48a82a07eeb9256f406abebc5::IlllIllIllIllIll{$II720d6e18aa34327713eb014408fc9144::llIIIIIIIlllIIII})->getPlugin($extscript->{plugin})->cfg->{main}{UseInMemberships}; my $plugin = $extscript->getInitializedPlugin; return 1 unless defined($plugin->{UseInMemberships}); $plugin->{UseInMemberships}; } 1; 