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

(-)a/C4/Circulation.pm (-20 / +317 lines)
Lines 419-425 sub transferbook { Link Here
419
419
420
=head2 TooMany
420
=head2 TooMany
421
421
422
Missing POD for TooMany.
422
    my $result = TooMany($patron, $item, $params);
423
424
Check if a patron has too many items checked out according to circulation rules.
425
This function checks both item-type specific rules and branch-level rules.
426
427
=over 4
428
429
=item Parameters
430
431
=over 8
432
433
=item C<$patron>
434
435
A Koha::Patron object representing the patron.
436
437
=item C<$item>
438
439
A Koha::Item object representing the item to be checked out.
440
441
=item C<$params>
442
443
A hashref containing:
444
- onsite_checkout: Boolean indicating if this is an onsite checkout
445
- switch_onsite_checkout: Boolean indicating if this is switching to an onsite checkout
446
447
=back
448
449
=item Returns
450
451
A hashref containing:
452
- reason: The reason why the checkout is not allowed (e.g., 'TOO_MANY', 'TOO_MANY_ONSITE')
453
- max_allowed: The maximum number of items allowed
454
- current: The current number of items checked out
455
- count: The number of items over the limit
456
457
Returns undef if the checkout is allowed.
458
459
=back
423
460
424
=cut
461
=cut
425
462
Lines 1414-1430 sub CanBookBeReturned { Link Here
1414
    return ( $allowed, $message );
1451
    return ( $allowed, $message );
1415
}
1452
}
1416
1453
1417
=head2 CheckHighHolds
1454
=head2 checkHighHolds
1418
1455
1419
    used when syspref decreaseLoanHighHolds is active. Returns 1 or 0 to define whether the minimum value held in
1456
    my $result = checkHighHolds($item, $patron);
1420
    decreaseLoanHighHoldsValue is exceeded, the total number of outstanding holds, the number of days the loan
1421
    has been decreased to (held in syspref decreaseLoanHighHoldsValue), and the new due date
1422
1457
1423
=cut
1458
Check if an item has a high number of holds and determine if the loan period should be reduced.
1424
1459
1425
=head2 checkHighHolds
1460
=over 4
1461
1462
=item Parameters
1463
1464
=over 8
1465
1466
=item C<$item>
1467
1468
A Koha::Item object representing the item to be checked out.
1469
1470
=item C<$patron>
1426
1471
1427
Missing POD for checkHighHolds.
1472
A Koha::Patron object representing the patron.
1473
1474
=back
1475
1476
=item Returns
1477
1478
A hashref containing:
1479
- exceeded: Boolean indicating if the holds threshold is exceeded
1480
- outstanding: Number of outstanding holds on the item
1481
- duration: The reduced loan duration if applicable
1482
- due_date: The reduced due date if applicable
1483
1484
=back
1428
1485
1429
=cut
1486
=cut
1430
1487
Lines 3547-3553 sub AddRenewal { Link Here
3547
3604
3548
=head2 GetRenewCount
3605
=head2 GetRenewCount
3549
3606
3550
Missing POD for GetRenewCount.
3607
  my ($renewcount, $renewsallowed, $renewsleft, $unseencount, $unseenallowed, $unseenleft) = GetRenewCount($borrowernumber_or_patron, $itemnumber_or_item);
3608
3609
Get the renewal counts and limits for a patron and item.
3610
3611
Parameters:
3612
  $borrowernumber_or_patron - Either a borrowernumber or a Koha::Patron object
3613
  $itemnumber_or_item      - Either an itemnumber or a Koha::Item object
3614
3615
Returns:
3616
  A list of six values:
3617
  - $renewcount     - Number of times the item has been renewed
3618
  - $renewsallowed  - Maximum number of renewals allowed
3619
  - $renewsleft     - Number of renewals remaining
3620
  - $unseencount    - Number of unseen renewals used
3621
  - $unseenallowed  - Maximum number of unseen renewals allowed
3622
  - $unseenleft     - Number of unseen renewals remaining
3551
3623
3552
=cut
3624
=cut
3553
3625
Lines 4174-4180 sub CalcDateDue { Link Here
4174
4246
4175
=head2 CheckValidBarcode
4247
=head2 CheckValidBarcode
4176
4248
4177
Missing POD for CheckValidBarcode.
4249
  my $exists = CheckValidBarcode($barcode);
4250
4251
Check if a barcode exists in the items table.
4252
4253
Parameters:
4254
  $barcode - The barcode to check
4255
4256
Returns:
4257
  The count of items with this barcode (1 if exists, 0 if not)
4178
4258
4179
=cut
4259
=cut
4180
4260
Lines 4269-4275 sub DeleteBranchTransferLimits { Link Here
4269
4349
4270
=head2 ReturnLostItem
4350
=head2 ReturnLostItem
4271
4351
4272
Missing POD for ReturnLostItem.
4352
    ReturnLostItem($borrowernumber, $itemnum);
4353
4354
Mark a lost item as returned. This is a wrapper around MarkIssueReturned that specifically
4355
handles the return of items that were previously marked as lost.
4356
4357
=over 4
4358
4359
=item Parameters
4360
4361
=over 8
4362
4363
=item C<$borrowernumber>
4364
4365
The borrower number of the patron who had the item checked out.
4366
4367
=item C<$itemnum>
4368
4369
The item number of the lost item being returned.
4370
4371
=back
4372
4373
=back
4273
4374
4274
=cut
4375
=cut
4275
4376
Lines 4362-4368 sub LostItem { Link Here
4362
4463
4363
=head2 GetOfflineOperations
4464
=head2 GetOfflineOperations
4364
4465
4365
Missing POD for GetOfflineOperations.
4466
  my $operations = GetOfflineOperations();
4467
4468
Retrieve all pending offline operations for the current branch.
4469
4470
Returns:
4471
  An array reference of hash references containing pending offline operations:
4472
  - operationid
4473
  - userid
4474
  - branchcode
4475
  - timestamp
4476
  - action
4477
  - barcode
4478
  - cardnumber
4479
  - amount
4366
4480
4367
=cut
4481
=cut
4368
4482
Lines 4376-4382 sub GetOfflineOperations { Link Here
4376
4490
4377
=head2 GetOfflineOperation
4491
=head2 GetOfflineOperation
4378
4492
4379
Missing POD for GetOfflineOperation.
4493
  my $operation = GetOfflineOperation($operationid);
4494
4495
Retrieve a specific pending offline operation by its ID.
4496
4497
Parameters:
4498
  $operationid - The ID of the operation to retrieve
4499
4500
Returns:
4501
  A hash reference containing the operation details:
4502
  - operationid
4503
  - userid
4504
  - branchcode
4505
  - timestamp
4506
  - action
4507
  - barcode
4508
  - cardnumber
4509
  - amount
4510
  Returns undef if the operation is not found.
4380
4511
4381
=cut
4512
=cut
4382
4513
Lines 4391-4397 sub GetOfflineOperation { Link Here
4391
4522
4392
=head2 AddOfflineOperation
4523
=head2 AddOfflineOperation
4393
4524
4394
Missing POD for AddOfflineOperation.
4525
  my $operationid = AddOfflineOperation($userid, $branchcode, $action, $barcode, $cardnumber, $amount);
4526
4527
Add a new pending offline operation to the database.
4528
4529
Parameters:
4530
  $userid - The ID of the staff member who created the operation
4531
  $branchcode - The branch code where the operation was created
4532
  $action - The type of operation (ISSUE, RETURN, PAYMENT)
4533
  $barcode - The barcode of the item (for ISSUE/RETURN) or empty string
4534
  $cardnumber - The card number of the patron (for ISSUE/RETURN) or empty string
4535
  $amount - The amount for payment operations or 0 for other operations
4536
4537
Returns:
4538
  The ID of the newly created operation, or undef on failure.
4395
4539
4396
=cut
4540
=cut
4397
4541
Lines 4407-4413 sub AddOfflineOperation { Link Here
4407
4551
4408
=head2 DeleteOfflineOperation
4552
=head2 DeleteOfflineOperation
4409
4553
4410
Missing POD for DeleteOfflineOperation.
4554
    my $result = DeleteOfflineOperation($operationid);
4555
4556
Delete a pending offline operation from the database.
4557
4558
=over 4
4559
4560
=item Parameters
4561
4562
=over 8
4563
4564
=item C<$operationid>
4565
4566
The ID of the operation to delete.
4567
4568
=back
4569
4570
=item Returns
4571
4572
A string containing "Deleted." on success.
4573
4574
=back
4411
4575
4412
=cut
4576
=cut
4413
4577
Lines 4420-4426 sub DeleteOfflineOperation { Link Here
4420
4584
4421
=head2 ProcessOfflineOperation
4585
=head2 ProcessOfflineOperation
4422
4586
4423
Missing POD for ProcessOfflineOperation.
4587
    my $report = ProcessOfflineOperation($operation);
4588
4589
Process an offline circulation operation that was previously stored in the database.
4590
This function handles three types of operations: returns, issues, and payments.
4591
4592
=over 4
4593
4594
=item Parameters
4595
4596
=over 8
4597
4598
=item C<$operation>
4599
4600
A hashref containing the operation details:
4601
- action: The type of operation ('return', 'issue', or 'payment')
4602
- operationid: The ID of the operation in the pending_offline_operations table
4603
- barcode: The item barcode (for returns and issues)
4604
- Additional fields specific to each operation type
4605
4606
=back
4607
4608
=item Returns
4609
4610
A report string containing the result of processing the operation.
4611
4612
=back
4424
4613
4425
=cut
4614
=cut
4426
4615
Lines 4443-4449 sub ProcessOfflineOperation { Link Here
4443
4632
4444
=head2 ProcessOfflineReturn
4633
=head2 ProcessOfflineReturn
4445
4634
4446
Missing POD for ProcessOfflineReturn.
4635
    my $result = ProcessOfflineReturn($operation);
4636
4637
Process an offline return operation that was previously stored in the database.
4638
4639
=over 4
4640
4641
=item Parameters
4642
4643
=over 8
4644
4645
=item C<$operation>
4646
4647
A hashref containing the operation details:
4648
- barcode: The barcode of the item being returned
4649
- timestamp: The timestamp of when the return was recorded
4650
4651
=back
4652
4653
=item Returns
4654
4655
A string containing:
4656
- "Success." if the return was processed successfully
4657
- "Item not issued." if the item was not checked out
4658
- "Item not found." if the item barcode was not found
4659
4660
=back
4447
4661
4448
=cut
4662
=cut
4449
4663
Lines 4476-4482 sub ProcessOfflineReturn { Link Here
4476
4690
4477
=head2 ProcessOfflineIssue
4691
=head2 ProcessOfflineIssue
4478
4692
4479
Missing POD for ProcessOfflineIssue.
4693
    my $result = ProcessOfflineIssue($operation);
4694
4695
Process an offline issue operation that was previously stored in the database.
4696
4697
=over 4
4698
4699
=item Parameters
4700
4701
=over 8
4702
4703
=item C<$operation>
4704
4705
A hashref containing the operation details:
4706
- barcode: The barcode of the item being issued
4707
- cardnumber: The patron's card number or userid
4708
- timestamp: The timestamp of when the issue was recorded
4709
4710
=back
4711
4712
=item Returns
4713
4714
A string containing:
4715
- "Success." if the issue was processed successfully
4716
- "Barcode not found." if the item barcode was not found
4717
- "Borrower not found." if the patron was not found
4718
4719
=back
4480
4720
4481
=cut
4721
=cut
4482
4722
Lines 4518-4524 sub ProcessOfflineIssue { Link Here
4518
4758
4519
=head2 ProcessOfflinePayment
4759
=head2 ProcessOfflinePayment
4520
4760
4521
Missing POD for ProcessOfflinePayment.
4761
    my $result = ProcessOfflinePayment($operation);
4762
4763
Process an offline payment operation that was previously stored in the database.
4764
4765
=over 4
4766
4767
=item Parameters
4768
4769
=over 8
4770
4771
=item C<$operation>
4772
4773
A hashref containing the operation details:
4774
- cardnumber: The patron's card number or userid
4775
- amount: The amount to be paid
4776
- branchcode: The branch where the payment was recorded
4777
4778
=back
4779
4780
=item Returns
4781
4782
A string containing "Success." if the payment was processed successfully.
4783
4784
=back
4522
4785
4523
=cut
4786
=cut
4524
4787
Lines 4697-4702 sub GetPendingOnSiteCheckouts { Link Here
4697
4960
4698
=head2 GetTopIssues
4961
=head2 GetTopIssues
4699
4962
4963
    my @top_issues = GetTopIssues($params);
4964
4965
Get a list of the most frequently issued items based on specified criteria.
4966
4967
=over 4
4968
4969
=item Parameters
4970
4971
=over 8
4972
4973
=item C<$params>
4974
4975
A hashref containing:
4976
- count: The number of items to return
4977
- branch: The branch code to filter by (optional)
4978
- itemtype: The item type to filter by (optional)
4979
- ccode: The collection code to filter by (optional)
4980
- newness: The number of days since creation to filter by (optional)
4981
4982
=back
4983
4984
=item Returns
4985
4986
An array of hashrefs containing:
4987
- biblionumber: The bibliographic record number
4988
- title: The title of the item
4989
- author: The author of the item
4990
- itemtype: The item type
4991
- publishercode: The publisher code
4992
- place: The place of publication
4993
- publicationyear: The year of publication
4994
- copyrightdate: The copyright date
4995
- pages: The number of pages
4996
- size: The size of the item
4997
- ccode: The collection code
4700
Missing POD for GetTopIssues.
4998
Missing POD for GetTopIssues.
4701
4999
4702
=cut
5000
=cut
4703
- 

Return to bug 39705