From 5352f6623ffdc793a9bc3812ae03f96f818a0a64 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Tue, 13 Oct 2015 14:56:10 +0000
Subject: [PATCH] Bug 15005: Replace CGI->url with the corresponding url

CGI->url does not return the correct url on install using packages.

Test plan:
1/ Try to reproduce the bug from the description of bug 15005.
You should be able to login to the intranet and the OPAC
2/ Send a basket and a list from the intranet and the OPAC.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
---
 C4/Auth.pm                                                              | 2 --
 C4/InstallAuth.pm                                                       | 2 --
 koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt                         | 2 +-
 koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasketform.tt        | 2 +-
 koha-tmpl/intranet-tmpl/prog/en/modules/installer/auth.tt               | 2 +-
 koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelfform.tt | 2 +-
 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt                   | 2 +-
 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasketform.tt         | 2 +-
 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendshelfform.tt          | 2 +-
 9 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/C4/Auth.pm b/C4/Auth.pm
index ef0c585..284cfe7 100644
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -1245,9 +1245,7 @@ sub checkauth {
         );
     }
 
-    my $self_url = $query->url( -absolute => 1 );
     $template->param(
-        url         => $self_url,
         LibraryName => C4::Context->preference("LibraryName"),
     );
     $template->param(%info);
diff --git a/C4/InstallAuth.pm b/C4/InstallAuth.pm
index c1eba6a..de304ba 100644
--- a/C4/InstallAuth.pm
+++ b/C4/InstallAuth.pm
@@ -381,8 +381,6 @@ sub checkauth {
     $template->param( login => 1 );
     $template->param( loginprompt => 1 ) unless $info{'nopermission'};
 
-    my $self_url = $query->url( -absolute => 1 );
-    $template->param( url => $self_url, );
     $template->param( \%info );
     $cookie = $query->cookie(
         -name    => 'CGISESSID',
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt
index b43143f..cfd7efe 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt
@@ -40,7 +40,7 @@
 [% END %]
 
 <!-- login prompt time-->
-<form action="[% url %]" method="post" name="loginform" id="loginform">
+<form action="/cgi-bin/koha/mainpage.pl" method="post" name="loginform" id="loginform">
     <input type="hidden" name="koha_login_context" value="intranet" />
 [% FOREACH INPUT IN INPUTS %]
     <input type="hidden" name="[% INPUT.name |html %]" value="[% INPUT.value |html %]" />
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasketform.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasketform.tt
index d0f7957..93a0f9d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasketform.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasketform.tt
@@ -16,7 +16,7 @@
 	
 [% ELSE %]
 
-<form action="[% url %]" method="post">
+<form action="/cgi-bin/koha/basket/sendbasket.pl" method="post">
 
 <fieldset class="rows"> 
 <legend>Sending your cart</legend>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/auth.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/auth.tt
index d55c71e..c3509cd 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/auth.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/auth.tt
@@ -29,7 +29,7 @@
 
 [% IF ( loginprompt ) %]
 <!-- login prompt time-->
-<form action="[% url %]" method="post" name="mainform" id="mainform">
+<form action="/cgi-bin/koha/installer/install.pl" method="post" name="mainform" id="mainform">
 [% FOREACH INPUT IN INPUTS %]
     <input type="hidden" name="[% INPUT.name |html %]" value="[% INPUT.value |html %]" />
 [% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelfform.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelfform.tt
index e38a071..8c44afa 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelfform.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelfform.tt
@@ -15,7 +15,7 @@
     
 [% ELSE %]
 
-<form action="[% url %]" method="post">
+<form action="/cgi-bin/koha/virtualshelves/sendshelf.pl" method="post">
 
 <fieldset class="rows"> 
 <legend>Sending your list</legend>
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt
index 6a3f9e2..3dc1c56 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt
@@ -138,7 +138,7 @@
 
                             [% END # / IF casAuthentication %]
 
-                            <form action="[% url %]" name="auth" id="auth" method="post">
+                            <form action="/cgi-bin/koha/opac-user.pl" name="auth" id="auth" method="post">
                                 <input type="hidden" name="koha_login_context" value="opac" />
                                 <fieldset class="brief">
                                     [% FOREACH INPUT IN INPUTS %]
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasketform.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasketform.tt
index ad4ce33..aa46c6a 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasketform.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasketform.tt
@@ -27,7 +27,7 @@
 
                         [% ELSE %]
                             <h1>Sending your cart</h1>
-                            <form action="[% url %]" method="post" id="sendbasketform">
+                            <form action="/cgi-bin/koha/opac-sendbasket.pl" method="post" id="sendbasketform">
                                 <fieldset>
                                     <label for="email_add">Email address:</label>
                                     <input type="text" id="email_add" name="email_add" size="43" class="focus" />
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendshelfform.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendshelfform.tt
index 3b38535..14a9165 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendshelfform.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendshelfform.tt
@@ -30,7 +30,7 @@
                                 <p><a class="button close" href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% shelfid %]">Back to lists</a></p>
                             [% ELSE %]
                                 <h1>Sending your list</h1>
-                                <form action="[% url %]" method="post" id="sendshelfform">
+                                <form action="/cgi-bin/koha/opac-sendshelf.pl" method="post" id="sendshelfform">
                                     <fieldset>
                                         <label for="email">Email address:</label>
                                         <input type="text" id="email" name="email" size="43" class="focus" />
-- 
2.1.4