my $itemtype = 'UT_DVD';
my $frameworkcode = 'UTFW'; # frameworkcode is only 4 characters max!
my $branchcode = 'UT_BC';
-my $categoryname = 'Test';
+my $av_category = 'AV_CAT_TEST';
our ($cleanup_needed);
SKIP: {
$s->click( { href => '/admin/authorised_values.pl', main => 'doc' } ); #Authorized values
- $s->click( { href => '/admin/authorised_values.pl?op=add_form&category=Adult', main => 'doc3' } ); # New category
- $s->fill_form( { authorised_value => 'Hardover', lib => 'Hardcover book'} );
+ $s->click( { href => { 'ends-with' => '/admin/authorised_values.pl?op=add_form' }, main => 'doc3' } ); # New category
+ $s->fill_form( { category => $av_category } );
$s->submit_form;
$s->click(
{
- href => '/admin/authorised_values.pl?op=delete&searchfield=Adult&id=400',
+ href => '/admin/authorised_values.pl?op=add_form&category=' . $av_category,
+ main => 'doc3'
+ }
+ ); # New authorised value for ...
+ $s->fill_form(
+ {
+ authorised_value => "$av_category" . "_xxx",
+ lib => "This is a description for staff",
+ lib_opac => "This is a description for OPAC"
+ }
+ );
+ $s->submit_form;
+
+ my $dbh = C4::Context->dbh;
+ my ( $av_id ) = $dbh->selectrow_array(q|
+ SELECT id FROM authorised_values WHERE category=?|, undef, $av_category );
+ $s->click(
+ {
+ href => '/admin/authorised_values.pl?op=delete&searchfield=' . $av_category . '&id=' . $av_id,
main => 'doc3'
}
);
+ $s->driver->accept_alert;
};
{ #Patron categories
$dbh->do(q|DELETE FROM itemtypes WHERE itemtype=?|, undef, $itemtype);
$dbh->do(q|DELETE FROM biblio_framework WHERE frameworkcode=?|, undef, $frameworkcode);
$dbh->do(q|DELETE FROM branches WHERE branchcode=?|, undef, $branchcode);
+ $dbh->do(q|DELETE FROM authorised_value_categories WHERE category_name=?|, undef, $av_category);
}
$xpath_selector = '//div[@id="'.$params->{main}.'"]';
}
if ( exists $params->{href} ) {
- $xpath_selector .= '//a[contains(@href, "'.$params->{href}.'")]';
+ if ( ref( $params->{href} ) ) {
+ for my $k ( keys %{ $params->{href} } ) {
+ if ( $k eq 'ends-with' ) {
+ # ends-with version for xpath version 1
+ my $ends_with = $params->{href}{"ends-with"};
+ $xpath_selector .= '//a[substring(@href, string-length(@href) - string-length("'.$ends_with.'") + 1 ) = "'.$ends_with.'"]';
+ # ends-with version for xpath version 2
+ #$xpath_selector .= '//a[ends-with(@href, "'.$ends_with.'") ]';
+
+ } else {
+ die "Only ends-with is supported so far ($k)";
+ }
+ }
+ } else {
+ $xpath_selector .= '//a[contains(@href, "'.$params->{href}.'")]';
+ }
}
if ( exists $params->{id} ) {
$xpath_selector .= '//*[@id="'.$params->{id}.'"]';