[freeside-commits] freeside/httemplate/edit part_pkg.cgi, 1.83, 1.84 part_pkg_taxoverride.html, 1.1, 1.2
Jeff Finucane,420,,
jeff at wavetail.420.am
Wed Apr 2 13:42:46 PDT 2008
Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail.420.am:/tmp/cvs-serv23940/httemplate/edit
Modified Files:
part_pkg.cgi part_pkg_taxoverride.html
Log Message:
checkpoint tax editors and correct a blunder
Index: part_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/part_pkg.cgi,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- part_pkg.cgi 1 Apr 2008 00:54:43 -0000 1.83
+++ part_pkg.cgi 2 Apr 2008 20:42:43 -0000 1.84
@@ -94,13 +94,13 @@
<TD align="right">Tax product</TD>
<TD>
<INPUT name="part_pkg_taxproduct_taxproductnum" id="taxproductnum" type="hidden" value="<% $hashref->{'taxproductnum'}%>">
- <INPUT name="part_pkg_taxproduct_description" id="taxproduct_description" type="text" value="<% $taxproduct_description %>" size="12" onclick="overlib( OLiframeContent('part_pkg_taxproduct.html?'+document.getElementById('taxproductnum').value, 800, 400, 'tax_product_popup'), CAPTION, 'Select product', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK); return false;">
+ <INPUT name="part_pkg_taxproduct_description" id="taxproduct_description" type="text" value="<% $taxproduct_description %>" size="12" onclick="overlib( OLiframeContent('part_pkg_taxproduct.html?'+document.getElementById('taxproductnum').value, 1000, 400, 'tax_product_popup'), CAPTION, 'Select product', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK); return false;">
</TD>
</TR>
<TR>
<TD colspan="2" align="right">
<INPUT name="tax_override" id="tax_override" type="hidden" value="<% $tax_override %>">
- <A href="javascript:void(0)" onclick="overlib( OLiframeContent('part_pkg_taxoverride.html?'+document.getElementById('tax_override').value, 800, 400, 'tax_product_popup'), CAPTION, 'Edit product tax overrides', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK); return false;">
+ <A href="javascript:void(0)" onclick="overlib( OLiframeContent('part_pkg_taxoverride.html?selected='+document.getElementById('tax_override').value, 1100, 600, 'tax_product_popup'), CAPTION, 'Edit product tax overrides', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK); return false;">
<% $tax_override ? 'Edit tax overrides' : 'Override taxes' %>
</A>
</TD>
@@ -467,7 +467,8 @@
(@agent_type) = map {$_->typenum} qsearch('type_pkgs',{'pkgpart'=>$1})
unless $part_pkg;
$tax_override =
- join (",", map {$_->taxnum} qsearch('part_pkg_taxoverride',{'pkgpart'=>$1}))
+ join (",", map {$_->taxclassnum}
+ qsearch('part_pkg_taxoverride',{'pkgpart'=>$1}))
unless $part_pkg;
$part_pkg ||= qsearchs('part_pkg',{'pkgpart'=>$1});
$pkgpart = $part_pkg->pkgpart;
Index: part_pkg_taxoverride.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/part_pkg_taxoverride.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- part_pkg_taxoverride.html 1 Apr 2008 00:54:43 -0000 1.1
+++ part_pkg_taxoverride.html 2 Apr 2008 20:42:44 -0000 1.2
@@ -1,61 +1,124 @@
-<%doc>
+<% include('/elements/header-popup.html', 'Override taxes', '', 'onload="resizeFrames()"') %>
- The crappy version
-
-</%doc>
-<% include('/elements/header-popup.html', 'Select tax product') %>
+<TABLE WIDTH="100%" HEIGHT="100%">
+ <TR><TD>
+ <iframe name="selected" src="<% $p %>browse/tax_class.html?_type=select;magic=select;maxrecords=15;offset=<% $selected_offset %>;selected=<% $selected %>;" width="100%" frameborder="0" border="0" id="selectorSelected" scrolling="no">
+</iframe>
+ <BR>
+ </TD></TR>
+
+ <TR><TD>
+<FORM="dummy">
+ <CENTER>
+ <INPUT type="submit" value="Finish" onclick="s=fetchSelected(); s.shift(); parent.document.getElementById('tax_override').value=s.toString(); parent.cClick();">
+ <INPUT type="reset" value="Cancel" onclick="parent.cClick();">
+ </CENTER>
+</FORM>
+ </TD></TR>
+
+ <TR><TD>
+ <iframe name="unselected" src="<% $p %>browse/tax_class.html?_type=select;magic=omit;maxrecords=15;offset=<% $unselected_offset %>;omit=<% $selected %>;" width="100%" frameborder="0" border="0" id="selectorUnselected" scrolling="no">
+</iframe>
+ <BR>
+ </TD></TR>
+
+</TABLE>
<SCRIPT>
- function saveit2() {
- var num = parent.document.getElementById('tax_override');
- var sel = document.getElementById('taxoverride_popup_select');
- var value = '';
- for (i=0; i< sel.length; i++) {
- if (sel.options[i].selected) {
- value = value + sel.options[i].value + ",";
+
+ function resizeFrames() {
+ //frames['selected'].style.height =
+ // frames['selected'].contentWindow.document.body.scrollHeight + "px";
+ //frames['unselected'].style.height =
+ // frames['unselected'].contentWindow.document.body.scrollHeight + "px";
+ var f = document.getElementById('selectorSelected');
+ f.style.height = f.contentWindow.document.body.scrollHeight + "px";
+ var f = document.getElementById('selectorUnselected');
+ f.style.height = f.contentWindow.document.body.scrollHeight + "px";
+ }
+
+ function fetchOffset(search) {
+ var value = 0;
+ if (search.length > 1) {
+ var params = search.split(';');
+ for (i=0; i<params.length; i++) {
+ if (params[i].substr(0,7) == 'offset=') {
+ value = params[i].substr(7);
+ }
+ }
}
+ return value;
}
- if (value.length > 0) {
- value = value.substr(0, value.length-1);
+
+ function fetchOffsetStrings() {
+ return 'selected_offset=' +
+ fetchOffset(frames['selected'].location.search) + ';' +
+ 'unselected_offset=' +
+ fetchOffset(frames['unselected'].location.search) + ';';
+ }
+
+ function fetchSelected() {
+ var i;
+ var selected = new Array;
+ var replace = '?';
+ if (window.location.search.length > 1) {
+ var search = window.location.search.substr(1).split(';');
+ for (i=0; i<search.length; i++) {
+ if (search[i].substr(0,9) == 'selected=') {
+ selected = search[i].substr(9).split(',')
+ }else if (search[i].substr(0,16) == 'selected_offset=') {
+ }else if (search[i].substr(0,18) == 'unselected_offset=') {
+ }else if (search[i].length) {
+ replace += search[i] + ';';
+ }
+ }
+ }
+ selected.unshift(replace);
+ return selected;
+ }
+ function doUnselect(classnum) {
+ var selected = fetchSelected();
+ var search = selected.shift();
+ //alert("discovered: "+selected.toString());
+ var i=-1, j=-1, k=selected.length;
+ while(++j < k) {
+ if (!(selected[j]==classnum)) {
+ selected[++i]=selected[j];
+ }
+ }
+ selected.length = ++i;
+ //alert("finished: "+selected.toString());
+
+ search += "selected=" + selected.toString() + ';';
+ window.location.search = search + fetchOffsetStrings();
+ }
+ function doSelect(classnum) {
+ var selected = fetchSelected();
+ var search = selected.shift();
+ selected.push(classnum);
+ search += "selected=" + selected.toString() + ';';
+ window.location.search = search + fetchOffsetStrings();
}
-
- num.value = value;
- parent.cClick();
- }
</SCRIPT>
-<FORM="dummy" METHOD="POST" onsubmit="saveit2();return false;" >
-<% ntable("#cccccc", 2) %>
-<TR>
- <TD align="left">Tax override</TD>
- <TD>
- <% include( '/elements/select-table.html',
- 'table' => 'tax_rate',
- 'name_col' => 'taxname',
- 'curr_value' => \@curr_value,
- 'element_etc' => "id='taxoverride_popup_select'",
- 'multiple' => '1',
- )
- %>
- </TD>
-</TR>
-</TABLE>
-<BR><BR>
-<CENTER><INPUT type="submit" value="Select"></CENTER>
-</FORM>
<% include('/elements/footer.html') %>
+<%once>
+
+my $conf = new FS::Conf;
+</%once>
<%init>
-my $conf = new FS::Conf;
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
-my @curr_value;
-my ( $query ) = $cgi->keywords;
-$query =~ /^([\d,]+)$/;
-push @curr_value, split ',', $1
- if $1;
-unless (scalar(@curr_value)) {
- #push @curr_value, map {$_=>taxnum} $part_pkg->tax_rate;
-}
+my $selected_offset = $1
+ if $cgi->param('selected_offset') =~/^(\d+)$/;
+
+my $unselected_offset = $1
+ if $cgi->param('unselected_offset') =~/^(\d+)$/;
+
+my $selected = $1
+ if $cgi->param('selected') =~/^([,\d]+)$/;
</%init>
More information about the freeside-commits
mailing list