# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use strict;
use warnings;
query => $input,
type => "intranet",
authnotrequired => 0,
- flagsrequired => {parameters => 1},
+ flagsrequired => {parameters => 'parameters_remaining_permissions'},
debug => 1,
});
#---- if primkey exists, it's a modify action, so read values to modify...
my $data;
if ($cityid) {
- my $sth=$dbh->prepare("select cityid,city_name,city_zipcode from cities where cityid=?");
+ my $sth=$dbh->prepare("select cityid,city_name,city_state,city_zipcode,city_country from cities where cityid=?");
$sth->execute($cityid);
$data=$sth->fetchrow_hashref;
}
$template->param(
city_name => $data->{'city_name'},
- city_zipcode => $data->{'city_zipcode'});
+ city_state => $data->{'city_state'},
+ city_zipcode => $data->{'city_zipcode'},
+ city_country => $data->{'city_country'});
# END $OP eq ADD_FORM
################## ADD_VALIDATE ##################################
# called by add_form, used to insert/modify data in DB
my $sth;
if ($input->param('cityid') ){
- $sth=$dbh->prepare("UPDATE cities SET city_name=?,city_zipcode=? WHERE cityid=?");
- $sth->execute($input->param('city_name'),$input->param('city_zipcode'),$input->param('cityid'));
+ $sth=$dbh->prepare("UPDATE cities SET city_name=?,city_state=?,city_zipcode=?,city_country=? WHERE cityid=?");
+ $sth->execute($input->param('city_name'),$input->param('city_state'),$input->param('city_zipcode'),$input->param('city_country'),$input->param('cityid'));
}
else{
- $sth=$dbh->prepare("INSERT INTO cities (city_name,city_zipcode) values (?,?)");
- $sth->execute($input->param('city_name'),$input->param('city_zipcode'));
+ $sth=$dbh->prepare("INSERT INTO cities (city_name,city_state,city_zipcode,city_country) values (?,?,?,?)");
+ $sth->execute($input->param('city_name'),$input->param('city_state'),$input->param('city_zipcode'),$input->param('city_country'));
}
print $input->redirect($script_name);
exit;
# called by default form, used to confirm deletion of data in DB
} elsif ($op eq 'delete_confirm') {
$template->param(delete_confirm => 1);
- my $sth=$dbh->prepare("select count(*) as total from borrowers,cities where borrowers.city=cities.city_name and cityid=?");
- # FIXME: this check used to pretend there was a FK "select_city" in borrowers.
+ my $sth=$dbh->prepare("select cityid,city_name,city_state,city_zipcode,city_country from cities where cityid=?");
$sth->execute($cityid);
- my $total = $sth->fetchrow_hashref;
- my $sth2=$dbh->prepare("select cityid,city_name,city_zipcode from cities where cityid=?");
- $sth2->execute($cityid);
- my $data=$sth2->fetchrow_hashref;
+ my $data=$sth->fetchrow_hashref;
$template->param(
- total => $total->{'total'},
city_name => $data->{'city_name'},
+ city_state => $data->{'city_state'},
city_zipcode => $data->{'city_zipcode'},
+ city_country => $data->{'city_country'},
);
################## DELETE_CONFIRMED ##################################
# called by delete_confirm, used to effectively confirm deletion of data in DB