[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Ask about frequency of items-under-review mailings:



Hi John,

I already try this and success. But it only for live archive, not for item
that just deposited. I already try add below, but I dont know is it right
or wrong.


$c->add_dataset_trigger( "eprint", EP_TRIGGER_STATUS_CHANGE, sub{
    my( %o ) = @_;

    my $eprint = $o{dataobj};
    my $old_status = $o{old_status};
    my $new_status = $o{new_status};

    my $session = $eprint->get_session;

    my $user = $eprint->get_user(); *#user that only editor/administrator
only*

    my $user_email = $user->get_value( "email" ); #when you are testing,
set this to your email - so you don't spam people!


#   EXAMPLE of a deposit receipt
   if( $old_status eq "inbox" && $new_status eq "buffer" ){
       # send a deposit receipt?
       # Do something similar to the stuff below - but with different
phrases!

        my $title = $eprint->render_value( "title" );
        my $users_name = $user->render_value( "name" );

        my $mail = $session->make_element( "mail" );
        $mail->appendChild( $session->html_phrase(
"status_change_inbox_to_review_body",
            users_name => $users_name,
                 title => $title
        ) );

        my $userMailOK = EPrints::Email::send_mail(
            session => $session,
            langid => $session->get_langid,
            to_email => *#EDITOR OR ADMINISTRATOR* *EMAIL?*,
            subject => $session->phrase(
"status_change_inbox_to_review_subject" ),
            message => $mail,
            sig => $session->html_phrase( "mail_sig" )
        );

   }


#    NOTIFICATION FOR LIVE ARCHIVE

    if( $old_status eq "buffer" && $new_status eq "archive" ){
        # you might want to check what the datestamp is - and not send an
email if this item has
        # been moved from archive -> buffer -> archive for some reason.

        my $title = $eprint->render_value( "title" );
        my $users_name = $user->render_value( "name" );
        my $url = $session->render_link( $eprint->get_url );
        $url->appendChild( $session->make_text( $eprint->get_url ) );

        my $mail = $session->make_element( "mail" );
        $mail->appendChild( $session->html_phrase(
"status_change_buffer_to_archive_user_body",
            users_name => $users_name,
                 title => $title,
            eprint_url => $url
        ) );

        my $userMailOK = EPrints::Email::send_mail(
            session => $session,
            langid => $session->get_langid,
            to_email => $user_email,
            subject => $session->phrase(
"status_change_buffer_to_archive_user_subject" ),
            message => $mail,
            sig => $session->html_phrase( "mail_sig" )
        );

        # you could check the value of $userMailOK - in case the email
wasn't sent
    } # END of buffer-to-archive

});

Thank you

On Tue, Jan 30, 2018 at 5:13 PM, John Salter <J.Salter at leeds.ac.uk> wrote:

> Hi Agung,
>
>
>
> Yes - there is a way to do this.
>
> I wrote this page a while ago to explain how - let me know if there are
> parts that you don't understand!
>
>
>
> https://wiki.eprints.org/w/Sending_email_when_item_is_
> made_live_or_deposited
>
>
>
> Cheers,
>
> John
>
>
>
>
>
> *From:* eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces@
> ecs.soton.ac.uk] *On Behalf Of *Ajunk Pracetio
> *Sent:* 28 January 2018 06:52
> *To:* eprints-tech at ecs.soton.ac.uk
> *Subject:* [EP-tech] Ask about frequency of items-under-review mailings:
>
>
>
> Hi,
>
> Is it possible to send email frequencies directly to the editor whenever a
> depositor uploads an item? Because the setting is only once per day.
>
> If you have to make modifications, which files should I edit?
>
> thank you.
>
> Greetings,
> Agung P.W
>
> --
>
> Life isn't valuable if you don't have someone to care
>
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: http://www.eprints.org/tech.php/
> *** EPrints community wiki: http://wiki.eprints.org/
> *** EPrints developers Forum: http://forum.eprints.org/
>
>


-- 
Life isn't valuable if you don't have someone to care
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20180131/348a6b5e/attachment-0001.html