View | Details | Raw Unified | Return to bug 3710
Collapse All | Expand All

(-)a/C4/Auth.pm (+1 lines)
Lines 404-409 sub get_template_and_user { Link Here
404
            OPACPatronDetails        => C4::Context->preference("OPACPatronDetails"),
404
            OPACPatronDetails        => C4::Context->preference("OPACPatronDetails"),
405
            OPACFinesTab              => C4::Context->preference("OPACFinesTab"),
405
            OPACFinesTab              => C4::Context->preference("OPACFinesTab"),
406
            OpacTopissue              => C4::Context->preference("OpacTopissue"),
406
            OpacTopissue              => C4::Context->preference("OpacTopissue"),
407
            OpacRecentAcquisitions    => C4::Context->preference("OpacRecentAcquisitions"),
407
            RequestOnOpac             => C4::Context->preference("RequestOnOpac"),
408
            RequestOnOpac             => C4::Context->preference("RequestOnOpac"),
408
            TemplateEncoding          => "". C4::Context->preference("TemplateEncoding"),
409
            TemplateEncoding          => "". C4::Context->preference("TemplateEncoding"),
409
            'Version'                 => C4::Context->preference('Version'),
410
            'Version'                 => C4::Context->preference('Version'),
(-)a/C4/Biblio.pm (+113 lines)
Lines 57-62 BEGIN { Link Here
57
		&GetBiblioItemInfosOf
57
		&GetBiblioItemInfosOf
58
		&GetBiblioItemByBiblioNumber
58
		&GetBiblioItemByBiblioNumber
59
		&GetBiblioFromItemNumber
59
		&GetBiblioFromItemNumber
60
		&GetBiblioSummary
60
		
61
		
61
		&GetRecordValue
62
		&GetRecordValue
62
		&GetFieldMapping
63
		&GetFieldMapping
Lines 1267-1272 sub GetCOinSBiblio { Link Here
1267
1268
1268
    return $coins_value;
1269
    return $coins_value;
1269
}
1270
}
1271
=head2 GetBiblioSummary
1272
1273
=over 4
1274
1275
$summary = GetBiblioSummary($marcrecord);
1276
1277
Return the summary of a record.
1278
1279
=back
1280
1281
=cut
1282
1283
sub GetBiblioSummary {
1284
    my $recorddata =shift @_;
1285
    
1286
    my $marcflavour = C4::Context->preference("marcflavour");
1287
    my $marc=MARC::Record::new_from_xml($recorddata,"utf-8",$marcflavour);
1288
    
1289
    my $str;
1290
    
1291
    if($marcflavour eq "MARC21"){
1292
        $str="<b>".$marc->subfield('245',"a")."</b>" if $marc->subfield('245','a');
1293
        $str.= " <i>".$marc->subfield('245',"b")."</i> " if $marc->subfield('245','b');
1294
        
1295
        if ($marc->field('245')){
1296
            $str.=" / ";
1297
            foreach ($marc->field('100')->subfield("a")) {
1298
                $str.=$_." ; ";
1299
            }
1300
            $str=~s/ ; $/. /; 
1301
        }
1302
      
1303
        if ($marc->field('260')){
1304
            $str.=" - ";
1305
            $str.=$marc->subfield('260',"a")." " if $marc->subfield('260','a');
1306
            $str.=" : ".$marc->subfield('260',"b")." " if $marc->subfield('260','b');
1307
            $str.=", ".$marc->subfield('260',"c")." " if $marc->subfield('260','c');
1308
        }
1309
        if ($marc->field('300')){
1310
            $str.=" - ";
1311
            $str.=$marc->subfield('300','a') if ($marc->subfield(300,'a'));
1312
            $str.=" ; ".$marc->subfield('300','b') if $marc->subfield('300','b');
1313
            $str.=" ; ".$marc->subfield('300','c') if $marc->subfield('300','c');
1314
            $str.=" ; ".$marc->subfield('300','e') if $marc->subfield('300','e');
1315
        }
1316
        foreach ($marc->field('500')){
1317
            $str.= " - ";
1318
            foreach ($_->subfield("a")){
1319
                $str.=$_."; "
1320
            } 
1321
        }
1322
        my $itemtypes=GetItemTypes();
1323
        $str.=" - <u>".$itemtypes->{$marc->subfield('942','c')}->{'description'}."</u> ";
1324
        $str.="<br />\n";
1325
       
1326
    }else{
1327
        $str = "<b>".$marc->subfield('200','a')."</b>"   if $marc->subfield('200','a');
1328
        $str.= " <i>".$marc->subfield('200','e')."</i> " if $marc->subfield('200','e');
1329
        if ($marc->field('200')){
1330
            $str.=" / ";
1331
            foreach ($marc->field('200')->subfield("f")) {
1332
                $str.=$_." ; ";
1333
            }
1334
            $str=~s/ ; $/. /; 
1335
        }
1336
        
1337
        if ($marc->subfield('200','g')){
1338
            $str.=" ; ";
1339
            foreach ($marc->field('200')->subfield("g")){
1340
                $str.=$_." ; ";
1341
            } 
1342
            $str=~s/ ; $/. /; 
1343
        }
1344
        
1345
        if ($marc->field('461')){
1346
            $str.="- In :";
1347
            $str.=     $marc->subfield('461','t') if $marc->subfield('461','t');
1348
            $str.=", ".$marc->subfield('461','d') if $marc->subfield('461','d');
1349
            $str.=", ".$marc->subfield('461','v') if $marc->subfield('461','v');
1350
            $str.=", ".$marc->subfield('461','h') if $marc->subfield('461','h');
1351
            $str.=" ; ".$marc->subfield('461','x') if $marc->subfield('461','x');
1352
        }
1353
        
1354
        if ($marc->field('210')){
1355
            $str.=" - ";
1356
            $str.=$marc->subfield('210',"a")." " if $marc->subfield('210','a');
1357
            $str.=" : ".$marc->subfield('210',"c")." " if $marc->subfield('210','c');
1358
            $str.=", ".$marc->subfield('210',"d")." " if $marc->subfield('210','d');
1359
        }
1360
        
1361
        if ($marc->field('215')){
1362
            $str.=" - ";
1363
            $str.=$marc->subfield('215','a') if ($marc->subfield(215,'a'));
1364
            $str.=" ; ".$marc->subfield('215','d') if $marc->subfield('215','d');
1365
            $str.=" ; ".$marc->subfield('215','c') if $marc->subfield('215','c');
1366
            $str.=" ; ".$marc->subfield('215','e') if $marc->subfield('215','e');
1367
        }
1368
        foreach ($marc->field('300')){
1369
            $str.=" - ";
1370
            foreach ($_->subfield("a")){
1371
                $str.=$_."; "
1372
            } 
1373
        }
1374
        
1375
        my $itemtypes=GetItemTypes;
1376
        if($itemtypes->{$marc->subfield('200','b')}){
1377
            $str.=" - <u>".$itemtypes->{$marc->subfield('200','b')}->{'description'}."</u> ";
1378
        }
1379
        $str.="<br />\n";         
1380
    }    
1381
    return $str;
1382
}
1270
1383
1271
=head2 GetAuthorisedValueDesc
1384
=head2 GetAuthorisedValueDesc
1272
1385
(-)a/C4/Search.pm (+82 lines)
Lines 60-65 This module provides searching functions for Koha's bibliographic databases Link Here
60
  &FindDuplicate
60
  &FindDuplicate
61
  &SimpleSearch
61
  &SimpleSearch
62
  &searchResults
62
  &searchResults
63
  &SearchAcquisitions
63
  &getRecords
64
  &getRecords
64
  &buildQuery
65
  &buildQuery
65
  &NZgetRecords
66
  &NZgetRecords
Lines 1468-1473 sub searchResults { Link Here
1468
    return @newresults;
1469
    return @newresults;
1469
}
1470
}
1470
1471
1472
=head2 SearchAcquisitions
1473
    Search for acquisitions 
1474
=cut
1475
1476
sub SearchAcquisitions{
1477
    my ($datebegin, $dateend, $itemtypes,$criteria, $orderby) = @_;
1478
    
1479
    my $dbh=C4::Context->dbh;
1480
    # Variable initialization
1481
    my $str=qq|
1482
    SELECT marcxml 
1483
    FROM biblio 
1484
    LEFT JOIN biblioitems ON biblioitems.biblionumber=biblio.biblionumber
1485
    LEFT JOIN items ON items.biblionumber=biblio.biblionumber
1486
    WHERE dateaccessioned BETWEEN ? AND ? 
1487
    |;
1488
    
1489
    my (@params,@loopcriteria);
1490
    
1491
    push @params, $datebegin->output("iso");
1492
    push @params, $dateend->output("iso");
1493
1494
    if (scalar(@$itemtypes)>0 and $criteria ne "itemtype" ){
1495
        if(C4::Context->preference("item-level_itypes")){
1496
            $str .= "AND items.itype IN (?".( ',?' x scalar @$itemtypes - 1 ).") ";
1497
        }else{
1498
            $str .= "AND biblioitems.itemtype IN (?".( ',?' x scalar @$itemtypes - 1 ).") ";
1499
        }    
1500
        push @params, @$itemtypes;
1501
    }
1502
        
1503
    if ($criteria =~/itemtype/){
1504
        if(C4::Context->preference("item-level_itypes")){
1505
            $str .= "AND items.itype=? ";
1506
        }else{
1507
            $str .= "AND biblioitems.itemtype=? ";
1508
        }
1509
        @loopcriteria= @$itemtypes;
1510
    }elsif ($criteria=~/itemcallnumber/){
1511
        $str .= "AND (items.itemcallnumber LIKE CONCAT(?,'%') 
1512
                 OR items.itemcallnumber is NULL
1513
                 OR items.itemcallnumber = '')";
1514
        @loopcriteria = ("AA".."zz", "") unless (scalar(@loopcriteria)>0);  
1515
    }else {
1516
        $str .= "AND biblio.title LIKE CONCAT(?,'%') ";
1517
        @loopcriteria = ("A".."z") unless (scalar(@loopcriteria)>0);  
1518
    }
1519
        
1520
    if ($orderby =~ /date_desc/){
1521
        $str.=" ORDER BY dateaccessioned DESC";
1522
    } else {
1523
        $str.=" ORDER BY title";
1524
    }
1525
    
1526
    my $qdataacquisitions=$dbh->prepare($str);
1527
        
1528
    my @loopacquisitions;
1529
    foreach my $value(@loopcriteria){
1530
        push @params,$value;
1531
        my %cell;
1532
        $cell{"title"}=$value;
1533
        $cell{"titlecode"}=$value;
1534
        
1535
        eval{$qdataacquisitions->execute(@params);};
1536
  
1537
        if ($@){ warn "recentacquisitions Error :$@";}
1538
        else {
1539
            my @loopdata;
1540
            while (my $data=$qdataacquisitions->fetchrow_hashref){
1541
                push @loopdata, {"summary"=>GetBiblioSummary( $data->{'marcxml'} ) };
1542
            }
1543
            $cell{"loopdata"}=\@loopdata;
1544
        }
1545
        push @loopacquisitions,\%cell if (scalar(@{$cell{loopdata}})>0);
1546
        pop @params;
1547
    }
1548
    $qdataacquisitions->finish;
1549
    return \@loopacquisitions;
1550
}
1551
1552
1471
#----------------------------------------------------------------------
1553
#----------------------------------------------------------------------
1472
#
1554
#
1473
# Non-Zebra GetRecords#
1555
# Non-Zebra GetRecords#
(-)a/admin/systempreferences.pl (+1 lines)
Lines 345-350 $tabsysprefs{AnonSuggestions} = "OPAC"; Link Here
345
$tabsysprefs{suggestion}           = "OPAC";
345
$tabsysprefs{suggestion}           = "OPAC";
346
$tabsysprefs{OpacTopissue}         = "OPAC";
346
$tabsysprefs{OpacTopissue}         = "OPAC";
347
$tabsysprefs{OpacBrowser}          = "OPAC";
347
$tabsysprefs{OpacBrowser}          = "OPAC";
348
$tabsysprefs{OpacRecentAcquisitions} = "OPAC";
348
$tabsysprefs{kohaspsuggest}        = "OPAC";
349
$tabsysprefs{kohaspsuggest}        = "OPAC";
349
$tabsysprefs{OpacRenewalAllowed}   = "OPAC";
350
$tabsysprefs{OpacRenewalAllowed}   = "OPAC";
350
$tabsysprefs{OPACItemHolds}        = "OPAC";
351
$tabsysprefs{OPACItemHolds}        = "OPAC";
(-)a/catalogue/recentacquisitions.pl (+84 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
#attention fichier pour notices MARC21
4
5
use strict;
6
use warnings;
7
8
use C4::Context;
9
use C4::Search;
10
use MARC::File::XML;
11
#use XML::LibXML;
12
#use XML::LibXSLT;
13
use CGI;
14
use C4::Dates;
15
use Date::Calc;
16
use C4::Auth;
17
use C4::Output;
18
use C4::Koha;
19
20
my $query= new CGI;
21
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
22
    {
23
        template_name   => "catalogue/recentacquisitions.tmpl",
24
        query           => $query,
25
        type            => "intranet",
26
        authnotrequired => 0,
27
        flagsrequired   => {catalogue => 1},
28
        debug           => 1,
29
    }
30
);
31
32
my $op = $query->param('op');
33
if ($op eq "show_list"){
34
35
    my $datebegin           = C4::Dates->new($query->param('datebegin'));
36
    my $dateend             = C4::Dates->new($query->param('dateend')) if ($query->param('dateend'));
37
38
    my $orderby             = $query->param('orderby') if ($query->param('orderby'));
39
    my $criteria            = $query->param('criteria');
40
    my @itemtypes           = $query->param('itemtypes');
41
    
42
    
43
    my $loopacquisitions = SearchAcquisitions($datebegin, $dateend, \@itemtypes,
44
                                                $criteria, $orderby);
45
    
46
    $template->param(loopacquisitions=>$loopacquisitions,
47
                     show_list=>1);
48
} else {
49
    my $period      = C4::Context->preference("recentacquisitionregularPeriod")||30;
50
    my $dateend     = C4::Dates->new();
51
    #warn " dateend :".$dateend->output("syspref");
52
    my @dateend     = Date::Calc::Today;
53
    my @datebegin   = Date::Calc::Add_Delta_Days(@dateend,-$period) if ($period);
54
    my $datebegin   = C4::Dates->new(sprintf("%04d-%02d-%02d",@datebegin[0..2]),'iso');
55
    #warn 'datebegin :'.$datebegin->output("syspref")." dateend :".$dateend->output("syspref");
56
    my $itemtypes   = GetItemTypes;
57
    
58
    my @itemtypesloop;
59
    my $selected=1;
60
    my $cnt;
61
    my $imgdir = getitemtypeimagesrc();
62
    
63
    foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
64
        my %row =(  number=>$cnt++,
65
                    imageurl=> $itemtypes->{$thisitemtype}->{'imageurl'}?($imgdir."/".$itemtypes->{$thisitemtype}->{'imageurl'}):"",
66
                    code => $thisitemtype,
67
                    selected => $selected,
68
                    description => $itemtypes->{$thisitemtype}->{'description'},
69
                    count5 => $cnt % 4,
70
                );
71
        $selected = 0 if ($selected) ;
72
        push @itemtypesloop, \%row;
73
    }
74
    
75
    $template->param(datebegin  => $datebegin->output("syspref"),
76
                     dateend    => $dateend->output("syspref"),);
77
    $template->param(period                   => $period,
78
                     itemtypeloop             => \@itemtypesloop,
79
                     DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),        
80
                    );
81
          
82
}
83
output_html_with_http_headers $query, $cookie, $template->output;
84
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +7 lines)
Lines 3064-3070 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
3064
    SetVersion ($DBversion);
3064
    SetVersion ($DBversion);
3065
}
3065
}
3066
3066
3067
3067
$DBversion = "3.01.00.116";
3068
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
3069
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,type)
3070
         VALUES ('OpacRecentAcquisitions','1','If on, show OPAC link to recent acquisitions page.','YesNo');");
3071
    print "Upgrade to $DBversion done drop column budget_amount_sublevel from aqbudgets\n";
3072
    SetVersion ($DBversion);
3073
}
3068
3074
3069
=item DropAllForeignKeys($table)
3075
=item DropAllForeignKeys($table)
3070
3076
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/recentacquisitions.tmpl (+108 lines)
Line 0 Link Here
1
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2
<title>
3
    Catalogue &rsaquo; Recent Acquisitions <!-- TMPL_IF NAME="show_list" -->&rsaquo; Results<!-- TMPL_ELSE -->&rsaquo; Choose<!-- /TMPL_IF -->
4
</title>
5
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
6
<!-- TMPL_INCLUDE NAME="calendar.inc" -->
7
</head>
8
<body>
9
10
<!-- TMPL_INCLUDE NAME="header.inc" -->
11
<!-- TMPL_INCLUDE NAME="cat-search.inc" -->
12
13
<div id="doc3" class="yui-t2">
14
   
15
   <div id="bd">
16
	<div id="yui-main">
17
	<div class="yui-b">
18
19
<!-- TMPL_IF NAME="show_list" -->
20
  <h1>Recent Acquisitions </h1>
21
  <!-- TMPL_LOOP NAME="loopacquisitions" -->
22
  	<a href="#<!--TMPL_VAR Name="titlecode"-->"><!--TMPL_VAR Name="title"--></a><br />
23
  <!-- /TMPL_LOOP -->
24
 
25
  <!-- TMPL_LOOP NAME="loopacquisitions" -->
26
  	<h2><a name="<!--TMPL_VAR Name="titlecode"-->"><!--TMPL_VAR Name="title"--></a></h2>
27
	  <!-- TMPL_LOOP NAME="loopdata" -->
28
    	<!--TMPL_VAR Name="summary"--><br /> <br/>
29
	  <!-- /TMPL_LOOP-->
30
  <!-- /TMPL_LOOP -->
31
<!-- TMPL_ELSE -->
32
	<form method="get" action="">
33
	<fieldset class="rows"><legend>Recent Acquisitions </legend>
34
                <p>Between <input type="text" readonly="readonly" size="10" id="datebegin" name="datebegin" value="<!--TMPL_VAR Name="datebegin"-->"/>
35
                   <script type="text/javascript">
36
				   //<![CDATA[
37
                    Calendar.setup(
38
                        {
39
                            inputField : "datebegin",
40
                            ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
41
                            button : "openCalendarDateBegin",
42
                        }
43
                    );
44
					//]]>
45
                    </script>
46
                    and <input readonly="readonly" size="10" id="dateend" name="dateend" value="<!--TMPL_VAR Name="dateend"-->" type="text" />
47
                        
48
                          <script type="text/javascript">
49
						  //<![CDATA[ 
50
                            Calendar.setup(
51
                                {
52
                                    inputField : "dateend",
53
                                    ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
54
                                    button : "openCalendarDateEnd",
55
                                }
56
                            );
57
							//]]>
58
                </script></p> 
59
   			<p>
60
   				List by: 
61
   				<select name="criteria">
62
   					<option value="itemtype">Item Type</option>
63
		            <option value="itemcallnumber">Call Number</option>
64
        		    <option value="title">Title</option>
65
	            </select>
66
	        </p>
67
68
   			<p>Limit by item type:</p>
69
		    <table>
70
		        <tr>
71
		      <!--TMPL_LOOP Name="itemtypeloop"-->
72
		        <td>
73
			        <!-- TMPL_IF name="imageurl"-->
74
			        	<img border="0" src="<!--TMPL_VAR Name="imageurl" -->" alt="<!--TMPL_VAR Name="description" -->" />
75
			        <!-- /TMPL_IF -->
76
				    <input type="checkbox" id="mc-<!--TMPL_VAR Name="number" -->" name="itemtypes" value="<!--TMPL_VAR Name="code" -->" />&nbsp;
77
			        <label for="mc-<!--TMPL_VAR Name="number" -->">
78
			        	<!--TMPL_VAR Name="description" -->
79
			        </label>
80
		        </td>
81
		        <!-- TMPL_UNLESS name="count5" --></tr><tr><!-- /TMPL_UNLESS -->
82
		      <!--/TMPL_LOOP-->
83
		      </tr>
84
		    </table>     
85
   
86
		    <p>Order by: 
87
		    	<select name="orderby">
88
		            <option value=""> </option>
89
		            <option value="date_desc">Date desc</option>
90
		            <option value="title">Title</option>
91
	            </select>
92
            </p>
93
      
94
                   
95
  		</fieldset>
96
	<fieldset class="action">
97
		<input type="submit" value="Submit" name="OK"/>
98
		<input type="hidden" name="op" value="show_list" />
99
	</fieldset>
100
	</form>
101
<!-- /TMPL_IF -->
102
103
</div>
104
</div>
105
<div class="yui-b">
106
</div>
107
</div>
108
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tmpl (+3 lines)
Lines 48-53 Link Here
48
                        <input type="submit" value=" OK " class="submit" />
48
                        <input type="submit" value=" OK " class="submit" />
49
                        </form>
49
                        </form>
50
                     </li>
50
                     </li>
51
                     <li>
52
                     	<a accesskey="v" href="/cgi-bin/koha/catalogue/recentacquisitions.pl">Recent Acquisitions</a>
53
                     </li>
51
				</ul>
54
				</ul>
52
   <!-- /TMPL_IF -->
55
   <!-- /TMPL_IF -->
53
                <h3><a href="/cgi-bin/koha/virtualshelves/shelves.pl">Lists</a></h3>
56
                <h3><a href="/cgi-bin/koha/virtualshelves/shelves.pl">Lists</a></h3>
(-)a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc (+1 lines)
Lines 85-90 Link Here
85
<!-- TMPL_IF NAME="TagsEnabled"     --><span class="pipe"> | </span><a href="/cgi-bin/koha/opac-tags.pl">Tag Cloud</a><!-- /TMPL_IF -->
85
<!-- TMPL_IF NAME="TagsEnabled"     --><span class="pipe"> | </span><a href="/cgi-bin/koha/opac-tags.pl">Tag Cloud</a><!-- /TMPL_IF -->
86
<!-- TMPL_IF NAME="OpacCloud"       --><span class="pipe"> | </span><a href="/cgi-bin/koha/opac-tags_subject.pl">Subject Cloud</a><!-- /TMPL_IF -->
86
<!-- TMPL_IF NAME="OpacCloud"       --><span class="pipe"> | </span><a href="/cgi-bin/koha/opac-tags_subject.pl">Subject Cloud</a><!-- /TMPL_IF -->
87
<!-- TMPL_IF NAME="OpacTopissue"    --><span class="pipe"> | </span><a href="/cgi-bin/koha/opac-topissues.pl">Most Popular</a><!-- /TMPL_IF -->
87
<!-- TMPL_IF NAME="OpacTopissue"    --><span class="pipe"> | </span><a href="/cgi-bin/koha/opac-topissues.pl">Most Popular</a><!-- /TMPL_IF -->
88
<!-- TMPL_IF NAME="OpacRecentAcquisitions"    --><span class="pipe"> | </span><a href="/cgi-bin/koha/opac-recentacquisitions.pl">Recent Acquisitions</a><!-- /TMPL_IF -->
88
<!-- TMPL_IF NAME="suggestion" -->
89
<!-- TMPL_IF NAME="suggestion" -->
89
  <!-- TMPL_IF NAME="AnonSuggestions" --><span class="pipe"> | </span><a href="/cgi-bin/koha/opac-suggestions.pl">Purchase Suggestions</a>
90
  <!-- TMPL_IF NAME="AnonSuggestions" --><span class="pipe"> | </span><a href="/cgi-bin/koha/opac-suggestions.pl">Purchase Suggestions</a>
90
  <!-- TMPL_ELSIF NAME="OPACViewOthersSuggestions" --><span class="pipe"> | </span><a href="/cgi-bin/koha/opac-suggestions.pl">Purchase Suggestions</a>
91
  <!-- TMPL_ELSIF NAME="OPACViewOthersSuggestions" --><span class="pipe"> | </span><a href="/cgi-bin/koha/opac-suggestions.pl">Purchase Suggestions</a>
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-recentacquisitions.tmpl (+106 lines)
Line 0 Link Here
1
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2
<!-- TMPL_IF NAME="LibraryNameTitle" --><!-- TMPL_VAR NAME="LibraryNameTitle" --><!-- TMPL_ELSE -->Koha en ligne<!-- /TMPL_IF -->
3
    Catalogue &rsaquo; Acquisitions  RĂ©centes <!-- TMPL_IF NAME="show_list" -->&rsaquo; Resultats<!-- TMPL_ELSE -->&rsaquo; Choisir<!-- /TMPL_IF -->
4
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
5
<!-- TMPL_INCLUDE NAME="calendar.inc" -->
6
</head>
7
<body>
8
<!-- TMPL_INCLUDE NAME="masthead.inc" -->
9
10
11
<div id="doc3" class="yui-t2">
12
   
13
   <div id="bd">
14
	<div id="yui-main">
15
	<div class="yui-b">
16
17
<!-- TMPL_IF NAME="show_list" -->
18
  <h1>Recent Acquisitions </h1>
19
  <!-- TMPL_LOOP NAME="loopacquisitions" -->
20
  	<a href="#<!--TMPL_VAR Name="titlecode"-->"><!--TMPL_VAR Name="title"--></a><br />
21
  <!-- /TMPL_LOOP -->
22
 
23
  <!-- TMPL_LOOP NAME="loopacquisitions" -->
24
  	<h2><a name="<!--TMPL_VAR Name="titlecode"-->"><!--TMPL_VAR Name="title"--></a></h2>
25
	  <!-- TMPL_LOOP NAME="loopdata" -->
26
    	<!--TMPL_VAR Name="summary"--><br /> <br/>
27
	  <!-- /TMPL_LOOP-->
28
  <!-- /TMPL_LOOP -->
29
<!-- TMPL_ELSE -->
30
	<form method="get" action="">
31
	<fieldset class="rows"><legend>Recent Acquisitions </legend>
32
                <p>Between <input type="text" readonly="readonly" size="10" id="datebegin" name="datebegin" value="<!--TMPL_VAR Name="datebegin"-->"/>
33
                   <script type="text/javascript">
34
				   //<![CDATA[
35
                    Calendar.setup(
36
                        {
37
                            inputField : "datebegin",
38
                            ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
39
                            button : "openCalendarDateBegin",
40
                        }
41
                    );
42
					//]]>
43
                    </script>
44
                    and <input readonly="readonly" size="10" id="dateend" name="dateend" value="<!--TMPL_VAR Name="dateend"-->" type="text" />
45
                        
46
                          <script type="text/javascript">
47
						  //<![CDATA[ 
48
                            Calendar.setup(
49
                                {
50
                                    inputField : "dateend",
51
                                    ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
52
                                    button : "openCalendarDateEnd",
53
                                }
54
                            );
55
							//]]>
56
                </script></p> 
57
   			<p>
58
   				List by: 
59
   				<select name="criteria">
60
   					<option value="itemtype">Item Type</option>
61
		            <option value="itemcallnumber">Call Number</option>
62
        		    <option value="title">Title</option>
63
	            </select>
64
	        </p>
65
66
   			<p>Limit by item type:</p>
67
		    <table>
68
		        <tr>
69
		      <!--TMPL_LOOP Name="itemtypeloop"-->
70
		        <td>
71
			        <!-- TMPL_IF name="imageurl"-->
72
			        	<img border="0" src="<!--TMPL_VAR Name="imageurl" -->" alt="<!--TMPL_VAR Name="description" -->" />
73
			        <!-- /TMPL_IF -->
74
				    <input type="checkbox" id="mc-<!--TMPL_VAR Name="number" -->" name="itemtypes" value="<!--TMPL_VAR Name="code" -->" />&nbsp;
75
			        <label for="mc-<!--TMPL_VAR Name="number" -->">
76
			        	<!--TMPL_VAR Name="description" -->
77
			        </label>
78
		        </td>
79
		        <!-- TMPL_UNLESS name="count5" --></tr><tr><!-- /TMPL_UNLESS -->
80
		      <!--/TMPL_LOOP-->
81
		      </tr>
82
		    </table>     
83
   
84
		    <p>Order by: 
85
		    	<select name="orderby">
86
		            <option value=""> </option>
87
		            <option value="date_desc">Date desc</option>
88
		            <option value="title">Title</option>
89
	            </select>
90
            </p>
91
      
92
                   
93
  		</fieldset>
94
	<fieldset class="action">
95
		<input type="submit" value="Submit" name="OK"/>
96
		<input type="hidden" name="op" value="show_list" />
97
	</fieldset>
98
	</form>
99
<!-- /TMPL_IF -->
100
101
</div>
102
</div>
103
<div class="yui-b">
104
</div>
105
</div>
106
<!-- TMPL_INCLUDE NAME="opac-bottom.inc" -->
(-)a/opac/opac-recentacquisitions.pl (-1 / +86 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
#attention fichier pour notices MARC21
4
5
use strict;
6
use warnings;
7
8
use C4::Context;
9
use C4::Search;
10
use MARC::File::XML;
11
#use XML::LibXML;
12
#use XML::LibXSLT;
13
use CGI;
14
use C4::Dates;
15
use Date::Calc;
16
use C4::Auth;
17
use C4::Output;
18
use C4::Koha;
19
20
my $query= new CGI;
21
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
22
    {
23
        template_name   => "opac-recentacquisitions.tmpl",
24
        query           => $query,
25
        type            => "opac",
26
        authnotrequired => 1,
27
        flagsrequired   => {},
28
        debug           => 1,
29
    }
30
);
31
32
die() unless C4::Context->preference("OpacRecentAcquisitions");
33
34
my $op = $query->param('op');
35
if ($op eq "show_list"){
36
37
    my $datebegin           = C4::Dates->new($query->param('datebegin'));
38
    my $dateend             = C4::Dates->new($query->param('dateend')) if ($query->param('dateend'));
39
40
    my $orderby             = $query->param('orderby') if ($query->param('orderby'));
41
    my $criteria            = $query->param('criteria');
42
    my @itemtypes           = $query->param('itemtypes');
43
    
44
    
45
    my $loopacquisitions = SearchAcquisitions($datebegin, $dateend, \@itemtypes,
46
                                                $criteria, $orderby);
47
    
48
    $template->param(loopacquisitions=>$loopacquisitions,
49
                     show_list=>1);
50
} else {
51
    my $period      = C4::Context->preference("recentacquisitionregularPeriod")||30;
52
    my $dateend     = C4::Dates->new();
53
    #warn " dateend :".$dateend->output("syspref");
54
    my @dateend     = Date::Calc::Today;
55
    my @datebegin   = Date::Calc::Add_Delta_Days(@dateend,-$period) if ($period);
56
    my $datebegin   = C4::Dates->new(sprintf("%04d-%02d-%02d",@datebegin[0..2]),'iso');
57
    #warn 'datebegin :'.$datebegin->output("syspref")." dateend :".$dateend->output("syspref");
58
    my $itemtypes   = GetItemTypes;
59
    
60
    my @itemtypesloop;
61
    my $selected=1;
62
    my $cnt;
63
    my $imgdir = getitemtypeimagesrc();
64
    
65
    foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
66
        my %row =(  number=>$cnt++,
67
                    imageurl=> $itemtypes->{$thisitemtype}->{'imageurl'}?($imgdir."/".$itemtypes->{$thisitemtype}->{'imageurl'}):"",
68
                    code => $thisitemtype,
69
                    selected => $selected,
70
                    description => $itemtypes->{$thisitemtype}->{'description'},
71
                    count5 => $cnt % 4,
72
                );
73
        $selected = 0 if ($selected) ;
74
        push @itemtypesloop, \%row;
75
    }
76
    
77
    $template->param(datebegin  => $datebegin->output("syspref"),
78
                     dateend    => $dateend->output("syspref"),);
79
    $template->param(period                   => $period,
80
                     itemtypeloop             => \@itemtypesloop,
81
                     DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),        
82
                    );
83
          
84
}
85
output_html_with_http_headers $query, $cookie, $template->output;
86

Return to bug 3710