- $builder->schema->resultset( 'AuthorisedValue' )->delete_all();
- $builder->build({
- source => 'AuthorisedValue',
- value => {
- category => 'Z3950_STATUS',
- authorised_value => 'AVAILABLE',
- lib => "Free as a bird"
- }
- });
- $builder->build({
- source => 'AuthorisedValue',
- value => {
- category => 'Z3950_STATUS',
- authorised_value => 'DAMAGED',
- lib => "Borked completely"
- }
- });
+
+ my $available = Koha::AuthorisedValues->find({ category => 'Z3950_STATUS', authorised_value => 'AVAILABLE' });
+ unless( $available ){
+ $available = $builder->build_object({
+ class => 'Koha::AuthorisedValues',
+ value => {
+ category => 'Z3950_STATUS',
+ authorised_value => 'AVAILABLE',
+ lib => "Free as a bird"
+ }
+ });
+ }
+ my $available_status = $available->lib;
+
+ my $damaged = Koha::AuthorisedValues->find({ category => 'Z3950_STATUS', authorised_value => 'DAMAGED' });
+ unless( $damaged ){
+ $damaged = $builder->build_object({
+ class => 'Koha::AuthorisedValues',
+ value => {
+ category => 'Z3950_STATUS',
+ authorised_value => 'DAMAGED',
+ lib => "Borked completely"
+ }
+ });
+ }
+ my $damaged_status = $damaged->lib;