Fix add in basket

This commit is contained in:
Romain Neutron
2012-03-13 11:41:57 +01:00
parent a4501fc442
commit 90633ee61f
5 changed files with 10 additions and 6 deletions

View File

@@ -431,7 +431,7 @@ $npages = $result->get_total_pages();
<?php <?php
if ($ACL->has_right_on_base($record->get_base_id(), "canputinalbum")) if ($ACL->has_right_on_base($record->get_base_id(), "canputinalbum"))
{ {
?><div class="baskAdder" title="<?php echo _('action : ajouter au panier') ?>" onClick="evt_add_in_chutier('<?php echo $record->get_base_id() ?>', '<?php echo $record->get_record_id() ?>');"></div><?php ?><div class="baskAdder" title="<?php echo _('action : ajouter au panier') ?>" onClick="evt_add_in_chutier('<?php echo $record->get_sbas_id() ?>', '<?php echo $record->get_record_id() ?>');"></div><?php
} }
if ($mod_col != '1') if ($mod_col != '1')
{ {

View File

@@ -21,7 +21,7 @@ $session = $appbox->get_session();
$usr_id = $session->get_usr_id(); $usr_id = $session->get_usr_id();
$request = http_request::getInstance(); $request = http_request::getInstance();
$parm = $request->get_parms("bas", "courChuId", "act", "p0", "first"); $parm = $request->get_parms("sbas", "courChuId", "act", "p0", "first");
$parm['p0'] = utf8_decode($parm['p0']); $parm['p0'] = utf8_decode($parm['p0']);
@@ -41,7 +41,7 @@ if ($parm["act"] == "DELIMG" && $parm["p0"] != "")
if ($parm["act"] == "ADDIMG" && ($parm["p0"] != "" && $parm["p0"] != null)) if ($parm["act"] == "ADDIMG" && ($parm["p0"] != "" && $parm["p0"] != null))
{ {
$basket = basket_adapter::getInstance($appbox, $parm['courChuId'], $user->get_id()); $basket = basket_adapter::getInstance($appbox, $parm['courChuId'], $user->get_id());
$sbas_id = phrasea::sbasFromBas($parm['bas']); $sbas_id = (int) $parm['sbas'];
$record = new record_adapter($sbas_id, $parm['p0']); $record = new record_adapter($sbas_id, $parm['p0']);
$basket->push_element($record, false, false); $basket->push_element($record, false, false);
unset($record); unset($record);

View File

@@ -588,7 +588,7 @@ if ($cssfile)
</form> </form>
<div id="dialog_dwnl" title="<?php echo _('action : exporter') ?>" style="display:none;z-index12000;"></div> <div id="dialog_dwnl" title="<?php echo _('action : exporter') ?>" style="display:none;z-index12000;"></div>
<form name="formChu" id="formChu" action="./baskets.php" method="post" style="visibility:hidden; display:none" > <form name="formChu" id="formChu" action="./baskets.php" method="post" style="visibility:hidden; display:none" >
<input type="hidden" name="bas" id="formChubas" value=""> <input type="hidden" name="sbas" id="formChubas" value="">
<input type="hidden" name="act" id="formChuact" value=""> <input type="hidden" name="act" id="formChuact" value="">
<input type="hidden" name="p0" id="formChup0" value=""> <input type="hidden" name="p0" id="formChup0" value="">
<input type="hidden" name="ssel_id" value=""> <input type="hidden" name="ssel_id" value="">

View File

@@ -632,8 +632,8 @@ function clktri(id){
* CHUTIER * CHUTIER
**************/ **************/
function evt_add_in_chutier(base_id, record_id){ function evt_add_in_chutier(sbas_id, record_id){
$('#formChubas')[0].value = base_id; $('#formChubas')[0].value = sbas_id;
$('#formChuact')[0].value = "ADDIMG"; $('#formChuact')[0].value = "ADDIMG";
$('#formChup0')[0].value = record_id; $('#formChup0')[0].value = record_id;
$('#formChu').submit(); $('#formChu').submit();

View File

@@ -281,6 +281,7 @@ function dropOnBask(event,from,destKey)
{ {
sselcont = []; sselcont = [];
lstbr = p4.sel.join(';'); lstbr = p4.sel.join(';');
console.log(from, $(from).hasClass('baskAdder'));
if($(from).hasClass('baskAdder')) if($(from).hasClass('baskAdder'))
lstbr = $(from).attr('id').split('_').slice(2,4).join('_'); lstbr = $(from).attr('id').split('_').slice(2,4).join('_');
} }
@@ -3352,7 +3353,10 @@ function evt_print(value)
function evt_add_in_chutier(a,b,event,el) function evt_add_in_chutier(a,b,event,el)
{ {
if($('#baskets .SSTT.active').length == 1) if($('#baskets .SSTT.active').length == 1)
{
console.log('evaluating', '#PREV_BASKADD_'+a+'_'+b);
dropOnBask(event,$('#PREV_BASKADD_'+a+'_'+b),$('#baskets .SSTT.active')); dropOnBask(event,$('#PREV_BASKADD_'+a+'_'+b),$('#baskets .SSTT.active'));
}
} }