Fix for Bug 4271, Offer choice of destination for save biblio operation
A follow-up to the fix for Bug 4121, the user should be able to control whether the action of saving a bibliographic record takes them to the add item screen or the detail screen, independently of whether they are adding or modifying the record. The addition of a "split button" would leave the default action in place if the user clicked the "main" part of the button. Clicking on the menu would give the user specific choices. Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
This commit is contained in:
parent
55492a640f
commit
4d50b4f4f0
2 changed files with 41 additions and 11 deletions
|
@ -829,6 +829,7 @@ my $z3950 = $input->param('z3950');
|
|||
my $op = $input->param('op');
|
||||
my $mode = $input->param('mode');
|
||||
my $frameworkcode = $input->param('frameworkcode');
|
||||
my $redirect = $input->param('redirect');
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
my $userflags = ($frameworkcode eq 'FA') ? "fast_cataloging" : "edit_catalogue";
|
||||
|
@ -930,13 +931,13 @@ if ( $op eq "addbiblio" ) {
|
|||
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode );
|
||||
}
|
||||
|
||||
if ($mode ne "popup" && !$is_a_modif){
|
||||
if (($mode ne "popup" && !$is_a_modif) || $redirect eq "items"){
|
||||
print $input->redirect(
|
||||
"/cgi-bin/koha/cataloguing/additem.pl?biblionumber=$biblionumber&frameworkcode=$frameworkcode"
|
||||
);
|
||||
exit;
|
||||
}
|
||||
elsif($is_a_modif){
|
||||
elsif($is_a_modif || $redirect eq "view"){
|
||||
my $defaultview = C4::Context->preference('IntranetBiblioDefaultView');
|
||||
my $views = { C4::Search::enabled_staff_search_views };
|
||||
if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) {
|
||||
|
|
|
@ -41,7 +41,7 @@ function confirmnotdup(){
|
|||
*
|
||||
*
|
||||
*/
|
||||
function Check(){
|
||||
function Check(dest){
|
||||
var StrAlert = AreMandatoriesNotOk();
|
||||
if( ! StrAlert ){
|
||||
document.f.submit();
|
||||
|
@ -631,6 +631,7 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
|
|||
</script>
|
||||
<!--TMPL_ELSE-->
|
||||
<form method="post" name="f" id="f" action="/cgi-bin/koha/cataloguing/addbiblio.pl" onsubmit="return Check();">
|
||||
<input type="hidden" value="" id="redirect" name="redirect" />
|
||||
<input type="hidden" value="0" id="confirm_not_duplicate" name="confirm_not_duplicate" />
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
|
@ -643,27 +644,55 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
|
|||
|
||||
$(document).ready(function() {
|
||||
$("#z3950searchc").empty();
|
||||
$("#savebutton").empty();
|
||||
yuiToolbar();
|
||||
});
|
||||
|
||||
var onOption = function () {
|
||||
return Check();
|
||||
}
|
||||
|
||||
function redirect(dest){
|
||||
$("#redirect").attr("value",dest);
|
||||
return Check();
|
||||
}
|
||||
|
||||
var savemenu = [
|
||||
{ text: _("Save and view record"), value: 1, onclick: {fn:function(){redirect("view");}} },
|
||||
{ text: _("Save and edit items"), value: 2, onclick: {fn:function(){redirect("items");}} }
|
||||
];
|
||||
|
||||
|
||||
// YUI Toolbar Functions
|
||||
|
||||
function yuiToolbar() {
|
||||
new YAHOO.widget.Button("addbiblio");
|
||||
// new YAHOO.widget.Button("addbiblio");
|
||||
|
||||
var savesplitmenu = new YAHOO.widget.Button({
|
||||
type: "split",
|
||||
label: _("Save"),
|
||||
id: "addbiblio",
|
||||
name: "savemenubutton",
|
||||
menu: savemenu,
|
||||
container: "savebutton"
|
||||
});
|
||||
|
||||
savesplitmenu.on("click", onOption);
|
||||
|
||||
new YAHOO.widget.Button({
|
||||
id: "z3950search",
|
||||
type: "button",
|
||||
label: _("Z39.50 Search"),
|
||||
container: "z3950searchc",
|
||||
onclick: {fn:function(){PopupZ3950()}}
|
||||
});
|
||||
id: "z3950search",
|
||||
type: "button",
|
||||
label: _("Z39.50 Search"),
|
||||
container: "z3950searchc",
|
||||
onclick: {fn:function(){PopupZ3950()}}
|
||||
});
|
||||
}
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<ul class="toolbar">
|
||||
<li><input id="addbiblio" type="submit" value="Save" /></li>
|
||||
<li id="savebutton"><input id="addbiblio" type="submit" value="Save" /></li>
|
||||
<li id="z3950searchc"><input type="button" id="z3950search" value="Z39.50 Search" onclick="PopupZ3950(); return false;" /></li>
|
||||
<li id="changeframework"><label for="Frameworks">Change framework: </label>
|
||||
<select name="Frameworks" id="Frameworks" onchange="Changefwk(this);">
|
||||
|
|
Loading…
Reference in a new issue