Koha::MarcOrder - Koha Marc Order Object class
my $result = Koha::MarcOrder->create_order_lines_from_file($args); Controller for file staging, basket creation and order line creation when using the cronjob in marc_ordering_process.pl
my $result = Koha::MarcOrder->import_record_and_create_order_lines($args); Controller for record import and order line creation when using the interface in addorderiso2709.pl
my $basket_id = _create_basket_for_file({ filename => $filename, vendor_id => $vendor_id }); Creates a basket ready to receive order lines based on the imported file
$file->_stage_file($params) Stages a file directly using parameters from a marc ordering account
my $syspref_info = _get_syspref_mappings( $marcrecord, $syspref_name ); Fetches data from a marc record based on the mappings in the syspref MarcFieldsToOrder or MarcItemFieldsToOrder using the fields selected in $fields (array).
my $tags_count = _verify_number_of_fields(\@tags_list, $record); Verifies that the number of fields in the record is consistent for each field
my ($record_results, $duplicates_in_batch) = add_biblio_from_import_record({ import_record => $import_record, matcher_id => $matcher_id, overlay_action => $overlay_action, import_record_id_selected => $import_record_id_selected, agent => $agent, import_batch_id => $import_batch_id }); Takes a set of import records and adds biblio records based on the file content. Params matcher_id and overlay_action are taken from the marc ordering account. Returns the new or matched biblionumber and the marc record for each import record.
my $order_line_details = add_items_from_import_record({ record_result => $record_result, basket_id => $basket_id, vendor => $vendor, budget_id => $budget_id, agent => $agent, client_item_fields => $client_item_fields }); Adds items to biblio records based on mappings in MarcItemFieldsToOrder. Returns an array of order line details based on newly added items. If being called from addorderiso2709.pl then client_item_fields is a hash of all the UI form inputs needed by the script.
my $file_match = Koha::MarcOrder->match_file_to_account({ filename => $filename, filepath => $filepath, profile => $profile }); Used by the cronjob to detect whether a file matches the account and should be processed This method only checks the first record in the file.
Fetches import batches matching the batch to be added to the basket and returns these to the template
Koha::MarcOrder->import_batches_list();
For an import batch, this function reads the files and creates all the relevant data pertaining to that file It then returns this to the template to be shown in the UI
Koha::MarcOrder->import_biblios_list( $cgiparams->{'import_batch_id'} );
This function takes inputs from either the cronjob or UI and then parses that into a single set of order line fields that can be used to create items and order lines
my $order_line_fields = parse_input_into_order_line_fields( { agent => $agent, biblionumber => $biblionumber, budget_id => $budget_id, basket_id => $basket_id, fields => $item_fields, marcrecord => $marcrecord, } );
This method is used from both the cronjob and the UI to create items and generate order line details for those new items
my $order_line_details = create_items_and_generate_order_hash( { fields => $order_line_fields, vendor => $vendor, agent => $agent, active_currency => $active_currency, } );
In France, the cents separator is the ',' but sometimes a '.' is used In this case, the price will be x100 when unformatted The '.' needs replacing by a ',' to get a proper price calculation
Takes the two sysprefs and returns the item fields required to process and create orderlines
my $item_fields = _create_item_fields_from_syspref( { marc_fields_to_order => $marc_fields_to_order, marc_item_fields_to_order => $marc_item_fields_to_order } );