Bugzilla – Attachment 17756 Details for
Bug 10135
Adding the ability to define customised basketgroups PDF layouts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PATCH] Bug 10135 : Add the ability to define customised basketgroups pdf layouts
0001-patch.patch (text/plain), 4.91 KB, created by
Mathieu Saby
on 2013-04-27 17:38:09 UTC
(
hide
)
Description:
[PATCH] Bug 10135 : Add the ability to define customised basketgroups pdf layouts
Filename:
MIME Type:
Creator:
Mathieu Saby
Created:
2013-04-27 17:38:09 UTC
Size:
4.91 KB
patch
obsolete
>From 3f19cda107d75c6d1849970a8e3f09ddd13c3258 Mon Sep 17 00:00:00 2001 >From: Mathieu Saby <mathieu.saby@univ-rennes2.fr> >Date: Sat, 27 Apr 2013 19:08:56 +0200 >Subject: [PATCH] Bug 10135 : Add the ability to define customised basketgroups pdf layouts > >This patch create a sub in Koha.pm which get the list of .pm files in acqui/pdfformat. >The list is used to build an option list for OrderPdfFormat syspref, instead of a free input. >In a standard Koha, only the design of OrderPdfFormat should be altered. >If you put a new .pm file in acqui/pdfformat (and if needed a new pdf file in koha-tmpl/intranet/prog/pdf), you will see the name of the file as a new option in OrderPdfFormat. > >To test : >A. in a standard Koha, check everything is working like before: >- 1. you have 2 options in OrderPdfFormat (pdfformat::layout2pages ; pdfformat::layout3pages) >- 2. select one layout, and try to print a basketgroup >- 3. select the 2d layout, and try to print a basketgroup > >B. check you can add a new layout >- 1. Either create your own layout if you know how to do > Or dowload and apply the 2d attachment to this bug. It contains an example : a layout named "pdfformat::msaby" >- 2. Check the new layout is visible in OrderPdfFormat >- 3. Select it, and try to print a basketgroup >- 4. Select one of the "old" layouts, and try to print a basketgroup. >--- > C4/Koha.pm | 28 ++++++++++++++++++++ > acqui/basketgroup.pl | 11 -------- > admin/preferences.pl | 2 ++ > .../en/modules/admin/preferences/acquisitions.pref | 1 + > 4 files changed, 31 insertions(+), 11 deletions(-) > >diff --git a/C4/Koha.pm b/C4/Koha.pm >index 3648dcc..383ff8a 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -47,6 +47,7 @@ BEGIN { > &getframeworks &getframeworkinfo > &getauthtypes &getauthtype > &getallthemes >+ getallbasketgroupslayouts > &getFacets > &displayServers > &getnbpages >@@ -684,6 +685,33 @@ sub getallthemes { > return @themes; > } > >+=head2 getallbasketgroupslayouts >+ >+ (@pdflayouts) = &getallbasketgroupslayouts(); >+ >+Returns an array of all available basketgroup layouts >+based on *. pm files in acqui/pdfformat >+ >+=cut >+ >+sub getallbasketgroupslayouts { >+ my $type = shift; >+ my $pdfdir; >+ my @pdflayouts; >+ $pdfdir = C4::Context->config('intranetdir'); >+ $pdfdir .= "/acqui/pdfformat"; >+ opendir DIR, $pdfdir; >+ my @filelist = readdir DIR; >+ foreach my $myfile (@filelist) { >+ next unless (-f "$pdfdir/$myfile"); >+ next unless ($myfile =~ m/\.pm$/); >+#keeping only *.pm files >+ $myfile =~s/\.pm$//; >+ push @pdflayouts,"pdfformat::".$myfile; >+ } >+ return @pdflayouts; >+} >+ > sub getFacets { > my $facets; > if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) { >diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl >index d6bd5d1..8cc2c41 100755 >--- a/acqui/basketgroup.pl >+++ b/acqui/basketgroup.pl >@@ -184,24 +184,13 @@ sub displaybasketgroups { > > sub printbasketgrouppdf{ > my ($basketgroupid) = @_; >- > my $pdfformat = C4::Context->preference("OrderPdfFormat"); >- if ($pdfformat eq 'pdfformat::layout3pages' || $pdfformat eq 'pdfformat::layout2pages'){ > eval { > eval "require $pdfformat"; > import $pdfformat; > }; > if ($@){ > } >- } >- else { >- print $input->header; >- print $input->start_html; # FIXME Should do a nicer page >- print "<h1>Invalid PDF Format set</h1>"; >- print "Please go to the systempreferences and set a valid pdfformat"; >- exit; >- } >- > my $basketgroup = GetBasketgroup($basketgroupid); > my $bookseller = GetBookSellerFromId($basketgroup->{'booksellerid'}); > my $baskets = GetBasketsByBasketgroup($basketgroupid); >diff --git a/admin/preferences.pl b/admin/preferences.pl >index 2182591..dcfe4a0 100755 >--- a/admin/preferences.pl >+++ b/admin/preferences.pl >@@ -93,6 +93,8 @@ sub _get_chunk { > $options{'choices'} = { map { $_ => $_ } getallthemes( 'opac' ) } > } elsif ( $options{'choices'} eq 'staff-templates' ) { > $options{'choices'} = { map { $_ => $_ } getallthemes( 'intranet' ) } >+ } elsif ( $options{'choices'} eq 'basketgroupspdflayouts' ) { >+ $options{'choices'} = { map { $_ => $_ } getallbasketgroupslayouts ()} > } else { > die 'Unrecognized source of preference values: ' . $options{'choices'}; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >index 1ec49ff..e16e1bc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >@@ -40,4 +40,5 @@ Acquisitions: > - > - Use > - pref: OrderPdfFormat >+ choices: basketgroupspdflayouts > - when printing basket groups. >-- >1.7.9.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10135
:
17756
|
17757
|
18226