Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
658e1224d1
@ -52,18 +52,18 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
<td><?php echo $langs->trans("Proposal"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td><?php echo $objectlink->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >
|
||||
<td class="linkedcol-element" ><?php echo $langs->trans("Proposal"); ?></td>
|
||||
<td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td class="linkedcol-ref" ><?php echo $objectlink->ref_client; ?></td>
|
||||
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td class="linkedcol-amount" align="right"><?php
|
||||
if ($user->rights->propale->lire) {
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||
<td class="linkedcol-statut" align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td class="linkedcol-action" align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
@ -2451,7 +2451,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
/*
|
||||
* Form to add new line
|
||||
*/
|
||||
if ($object->statut == Commande::STATUS_DRAFT && $user->rights->commande->creer)
|
||||
if ($object->statut == Commande::STATUS_DRAFT && $user->rights->commande->creer && $action != 'selectlines')
|
||||
{
|
||||
if ($action != 'editline')
|
||||
{
|
||||
|
||||
@ -47,18 +47,20 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
<td><?php echo $langs->trans("CustomerOrder"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
<tr class="<?php echo $trclass; ?>" >
|
||||
<td class="linkedcol-element" ><?php echo $langs->trans("CustomerOrder"); ?>
|
||||
<?php if(!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0,'',0,1).'&action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a'; ?>
|
||||
</td>
|
||||
<td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td class="linkedcol-ref" align="center"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td class="linkedcol-amount" align="right"><?php
|
||||
if ($user->rights->commande->lire) {
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right">
|
||||
<td class="linkedcol-statut" align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td class="linkedcol-action" align="right">
|
||||
<?php
|
||||
// For now, shipments must stay linked to order, so link is not deletable
|
||||
if($object->element != 'shipping') {
|
||||
|
||||
@ -2095,6 +2095,82 @@ if (empty($reshook))
|
||||
exit();
|
||||
}
|
||||
|
||||
// add lines from objectlinked
|
||||
elseif($action == 'import_lines_from_object'
|
||||
&& $user->rights->facture->creer
|
||||
&& $object->statut == Facture::STATUS_DRAFT
|
||||
&& ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION))
|
||||
{
|
||||
$fromElement = GETPOST('fromelement');
|
||||
$fromElementid = GETPOST('fromelementid');
|
||||
$importLines = GETPOST('line_checkbox');
|
||||
|
||||
if(!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid))
|
||||
{
|
||||
if($fromElement == 'commande')
|
||||
{
|
||||
dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class');
|
||||
$lineClassName = 'OrderLine';
|
||||
}
|
||||
$nextRang = count($object->lines) + 1;
|
||||
$importCount = 0;
|
||||
$error = 0;
|
||||
foreach($importLines as $lineId)
|
||||
{
|
||||
$lineId = intval($lineId);
|
||||
$originLine = new $lineClassName($db);
|
||||
if(intval($fromElementid) > 0 && $originLine->fetch( $lineId ) > 0)
|
||||
{
|
||||
$originLine->fetch_optionals($lineId);
|
||||
$desc = $originLine->desc;
|
||||
$pu_ht = $originLine->subprice;
|
||||
$qty = $originLine->qty;
|
||||
$txtva = $originLine->tva_tx;
|
||||
$txlocaltax1 = $originLine->localtax1_tx;
|
||||
$txlocaltax2 = $originLine->localtax2_tx;
|
||||
$fk_product = $originLine->fk_product;
|
||||
$remise_percent = $originLine->remise_percent;
|
||||
$date_start = $originLine->date_start;
|
||||
$date_end = $originLine->date_end;
|
||||
$ventil = 0;
|
||||
$info_bits = $originLine->info_bits;
|
||||
$fk_remise_except = $originLine->fk_remise_except;
|
||||
$price_base_type='HT';
|
||||
$pu_ttc=0;
|
||||
$type = $originLine->product_type;
|
||||
$rang=$nextRang++;
|
||||
$special_code = $originLine->special_code;
|
||||
$origin = $originLine->element;
|
||||
$origin_id = $originLine->id;
|
||||
$fk_parent_line=0;
|
||||
$fk_fournprice=$originLine->fk_fournprice;
|
||||
$pa_ht = $originLine->pa_ht;
|
||||
$label = $originLine->label;
|
||||
$array_options = $originLine->array_options;
|
||||
$situation_percent = 100;
|
||||
$fk_prev_id = '';
|
||||
$fk_unit = $originLine->fk_unit;
|
||||
$pu_ht_devise = $originLine->multicurrency_subprice;
|
||||
|
||||
$res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $ventil, $info_bits, $fk_remise_except, $price_base_type, $pu_ttc, $type, $rang, $special_code, $origin, $origin_id, $fk_parent_line, $fk_fournprice, $pa_ht, $label, $array_options, $situation_percent, $fk_prev_id, $fk_unit,$pu_ht_devise);
|
||||
if($res > 0){
|
||||
$importCount++;
|
||||
}else{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if($error)
|
||||
{
|
||||
setEventMessage($langs->trans('ErrorsOnXLines',$error), 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Actions when printing a doc from card
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
@ -4156,7 +4232,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
// Form to add new line
|
||||
if ($object->statut == 0 && $user->rights->facture->creer && $action != 'valid' && $action != 'editline' && ($object->is_first() || !$object->situation_cycle_ref))
|
||||
{
|
||||
if ($action != 'editline')
|
||||
if ($action != 'editline' && $action != 'selectlines')
|
||||
{
|
||||
// Add free products/services
|
||||
$object->formAddObjectLine(1, $mysoc, $soc);
|
||||
@ -4448,8 +4524,16 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
|
||||
$compatibleImportElementsList = false;
|
||||
if($user->rights->facture->creer
|
||||
&& $object->statut == Facture::STATUS_DRAFT
|
||||
&& ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) )
|
||||
{
|
||||
$compatibleImportElementsList = array('commande'); // import from linked elements
|
||||
}
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem,$compatibleImportElementsList);
|
||||
|
||||
|
||||
// Show online payment link
|
||||
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
||||
|
||||
@ -769,10 +769,16 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
else if ($reshook < 0) $error++;*/
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_CREATE',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_CREATE',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
@ -47,12 +47,12 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
<td><?php echo $langs->trans("CustomerInvoice"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >
|
||||
<td class="linkedcol-element" ><?php echo $langs->trans("CustomerInvoice"); ?></td>
|
||||
<td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td class="linkedcol-ref" align="center"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td class="linkedcol-amount" align="right"><?php
|
||||
if ($user->rights->facture->lire) {
|
||||
$sign = 1;
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = -1;
|
||||
@ -66,8 +66,8 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
echo '<strike>'.price($objectlink->total_ht).'</strike>';
|
||||
}
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||
<td class="linkedcol-statut" align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td class="linkedcol-action" align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
@ -87,4 +87,4 @@ if (count($linkedObjectBlock) > 1)
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
<!-- END PHP TEMPLATE -->
|
||||
|
||||
@ -3735,6 +3735,14 @@ abstract class CommonObject
|
||||
|
||||
print '<td class="linecolmove" width="10"></td>';
|
||||
|
||||
if($action == 'selectlines')
|
||||
{
|
||||
print '<td class="linecolcheckall" align="center">';
|
||||
print '<input type="checkbox" class="linecheckboxtoggle" />';
|
||||
print '<script type="text/javascript">$(document).ready(function() {$(".linecheckboxtoggle").click(function() {var checkBoxes = $(".linecheckbox");checkBoxes.prop("checked", this.checked);})});</script>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@ -5986,19 +5994,29 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$csstyle='';
|
||||
$class=(!empty($extrafields->attribute_hidden[$key]) ? 'class="hideobject" ' : '');
|
||||
$class=(!empty($extrafields->attribute_hidden[$key]) ? 'hideobject ' : '');
|
||||
if (is_array($params) && count($params)>0) {
|
||||
if (array_key_exists('style',$params)) {
|
||||
$csstyle=$params['style'];
|
||||
}
|
||||
}
|
||||
|
||||
$out .= '<tr '.$class.$csstyle.' class="'.$this->element.'_extras_'.$key.'">';
|
||||
if (empty($onetrtd))
|
||||
// add html5 elements
|
||||
$domData = ' data-element="extrafield"';
|
||||
$domData .= ' data-targetelement="'.$this->element.'"';
|
||||
$domData .= ' data-targetid="'.$this->id.'"';
|
||||
|
||||
$html_id = !empty($this->id) ? 'extrarow-'.$this->element.'_'.$key.'_'.$this->id : '';
|
||||
|
||||
$out .= '<tr id="'.$html_id.'" '.$csstyle.' class="'.$class.$this->element.'_extras_'.$key.'" '.$domData.' >';
|
||||
|
||||
if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0)
|
||||
{
|
||||
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { $colspan='0'; }
|
||||
}
|
||||
|
||||
if($action == 'selectlines'){ $colspan++; }
|
||||
|
||||
// Convert date into timestamp format (value in memory must be a timestamp)
|
||||
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
|
||||
{
|
||||
@ -6017,16 +6035,10 @@ abstract class CommonObject
|
||||
$labeltoshow = '<span'.($mode != 'view' ? ' class="fieldrequired"':'').'>'.$labeltoshow.'</span>';
|
||||
}
|
||||
|
||||
if (empty($onetrtd)) $out .= '<td>';
|
||||
else $out .= '<td'.($colspan?' colspan="'.($colspan+1).'"':'').'>';
|
||||
|
||||
$out .= $labeltoshow;
|
||||
|
||||
if (empty($onetrtd)) $out .= '</td><td'.($colspan?' colspan="'.($colspan).'"':'').'>';
|
||||
else $out.=' ';
|
||||
$out .= '<td>'.$labeltoshow.'</td>';
|
||||
|
||||
$html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : '';
|
||||
$out .='<span id="'.$html_id.'" class="'.$this->element.'_extras_'.$key.'">';
|
||||
$out .='<td id="'.$html_id.'" class="'.$this->element.'_extras_'.$key.'" '.($colspan?' colspan="'.$colspan.'"':'').'>';
|
||||
|
||||
switch($mode) {
|
||||
case "view":
|
||||
@ -6038,8 +6050,9 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
$out .= '</td>';
|
||||
$out .= '</tr>';
|
||||
|
||||
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= '</tr>';
|
||||
else $out .= '</tr>';
|
||||
$e++;
|
||||
}
|
||||
}
|
||||
@ -6051,7 +6064,7 @@ abstract class CommonObject
|
||||
jQuery(document).ready(function() {
|
||||
function showOptions(child_list, parent_list)
|
||||
{
|
||||
var val = $("select[name="+parent_list+"]").val();
|
||||
var val = $("select[name=\"options_"+parent_list+"\"]").val();
|
||||
var parentVal = parent_list + ":" + val;
|
||||
if(val > 0) {
|
||||
$("select[name=\""+child_list+"\"] option[parent]").hide();
|
||||
|
||||
@ -5988,9 +5988,10 @@ class Form
|
||||
*
|
||||
* @param CommonObject $object Object we want to show links to
|
||||
* @param string $morehtmlright More html to show on right of title
|
||||
* @param array $compatibleImportElementsList Array of compatibles elements object for "import from" action
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function showLinkedObjectBlock($object, $morehtmlright='')
|
||||
function showLinkedObjectBlock($object, $morehtmlright='',$compatibleImportElementsList=false)
|
||||
{
|
||||
global $conf,$langs,$hookmanager;
|
||||
global $bc;
|
||||
@ -5999,7 +6000,9 @@ class Form
|
||||
|
||||
// Bypass the default method
|
||||
$hookmanager->initHooks(array('commonobject'));
|
||||
$parameters=array();
|
||||
$parameters=array(
|
||||
'compatibleImportElementsList' =>& $compatibleImportElementsList,
|
||||
);
|
||||
$reshook=$hookmanager->executeHooks('showLinkedObjectBlock',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
if (empty($reshook))
|
||||
@ -6011,7 +6014,7 @@ class Form
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder allwidth">';
|
||||
print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'" data-elementid="'.$object->id.'" >';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
@ -6028,7 +6031,13 @@ class Form
|
||||
foreach($object->linkedObjects as $objecttype => $objects)
|
||||
{
|
||||
$tplpath = $element = $subelement = $objecttype;
|
||||
|
||||
|
||||
// to display inport button on tpl
|
||||
$showImportButton=false;
|
||||
if(!empty($compatibleImportElementsList) && in_array($element,$compatibleImportElementsList)){
|
||||
$showImportButton=true;
|
||||
}
|
||||
|
||||
if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
|
||||
{
|
||||
$element = $regs[1];
|
||||
@ -6088,7 +6097,7 @@ class Form
|
||||
global $noMoreLinkedObjectBlockAfter;
|
||||
$noMoreLinkedObjectBlockAfter=1;
|
||||
}
|
||||
|
||||
|
||||
$res=@include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');
|
||||
if ($res)
|
||||
{
|
||||
@ -6104,6 +6113,13 @@ class Form
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
if(!empty($compatibleImportElementsList))
|
||||
{
|
||||
$res=@include dol_buildpath('core/tpl/ajax/objectlinked_lineimport.tpl.php');
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
return $nbofdifferenttypes;
|
||||
|
||||
106
htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php
Normal file
106
htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- START TEMPLATE IMPORT OBJECT LINKED LINES -->
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function(){
|
||||
$('.objectlinked_importbtn').click(function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
var page = $(this).attr("href");
|
||||
|
||||
var fromelement = $(this).attr("data-element");
|
||||
var fromelementid = $(this).attr("data-id");
|
||||
|
||||
if( page != undefined && fromelement != undefined && fromelementid != undefined)
|
||||
{
|
||||
var windowWidth = $(window).width()*0.8; //retrieve current window width
|
||||
var windowHeight = $(window).height()*0.8; //retrieve current window height
|
||||
var htmlLines;
|
||||
var formId = "ajaxloaded_tablelinesform_" + fromelement + "_" + fromelementid;
|
||||
$.get(page, function (data) {
|
||||
htmlLines = $(data).find('#tablelines') ;
|
||||
});
|
||||
|
||||
|
||||
var $dialog = $('<form id="' + formId + '" action="<?php print $object->getNomUrl(0,'',0,1); ?>" method="post" ></form>')
|
||||
.load( page + " #tablelines", function() {
|
||||
|
||||
$("#" + formId + " #tablelines").prop("id", "ajaxloaded_tablelines"); // change id attribute
|
||||
|
||||
$("#" + formId + " .linecheckbox,#" + formId + " .linecheckboxtoggle").prop("checked", true); // checked by default
|
||||
|
||||
// reload checkbox toggle function
|
||||
$("#" + formId + " .linecheckboxtoggle").click(function(){
|
||||
var checkBoxes = $("#" + formId + " .linecheckbox");
|
||||
checkBoxes.prop("checked", this.checked);
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
.html(htmlLines)
|
||||
.dialog({
|
||||
autoOpen: false,
|
||||
modal: true,
|
||||
height: windowHeight,
|
||||
width: windowWidth,
|
||||
title: "<?php echo $langs->trans('LinesToImport'); ?>",
|
||||
buttons: {
|
||||
"<?php echo $langs->trans('Import'); ?>": function() {
|
||||
$( this ).dialog( "close" );
|
||||
$("#" + formId).append('<input type="hidden" name="action" value="import_lines_from_object" />');
|
||||
$("#" + formId).append('<input type="hidden" name="fromelement" value="' + fromelement + '" />');
|
||||
$("#" + formId).append('<input type="hidden" name="fromelementid" value="' + fromelementid + '" />');
|
||||
$("#" + formId).submit();
|
||||
},
|
||||
"<?php echo $langs->trans('Cancel'); ?>": function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$dialog.dialog('open');
|
||||
}
|
||||
else
|
||||
{
|
||||
$.jnotify("<?php echo $langs->trans('ErrorNoUrl'); ?>", "error", true);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.objectlinked_importbtn{
|
||||
cursor:pointer;
|
||||
}
|
||||
</style>
|
||||
<!-- END TEMPLATE IMPORT OBJECT LINKED LINES -->
|
||||
@ -56,10 +56,17 @@ if (empty($senderissupplier)) $senderissupplier=0;
|
||||
if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
|
||||
if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
|
||||
|
||||
// add html5 elements
|
||||
$domData = ' data-element="'.$line->element.'"';
|
||||
$domData .= ' data-id="'.$line->id.'"';
|
||||
$domData .= ' data-qty="'.$line->qty.'"';
|
||||
$domData .= ' data-product_type="'.$line->product_type.'"';
|
||||
|
||||
|
||||
?>
|
||||
<?php $coldisplay=0; ?>
|
||||
<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->
|
||||
<tr <?php echo 'id="row-'.$line->id.'" '.$bcdd[$var]; ?>>
|
||||
<tr <?php echo 'id="row-'.$line->id.'" '.$bcdd[$var]; echo $domData; ?> >
|
||||
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
|
||||
<td class="linecolnum" align="center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
|
||||
<?php } ?>
|
||||
@ -264,7 +271,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
|
||||
|
||||
|
||||
<?php
|
||||
if ($this->statut == 0 && ($object_rights->creer)) { ?>
|
||||
if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines' ) { ?>
|
||||
<td class="linecoledit" align="center"><?php $coldisplay++; ?>
|
||||
<?php if (($line->info_bits & 2) == 2 || ! empty($disableedit)) { ?>
|
||||
<?php } else { ?>
|
||||
@ -304,6 +311,9 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
|
||||
<?php } else { ?>
|
||||
<td colspan="3"><?php $coldisplay=$coldisplay+3; ?></td>
|
||||
<?php } ?>
|
||||
<?php if($action == 'selectlines'){ ?>
|
||||
<td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td>
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
@ -246,3 +246,4 @@ WEBSITE_PAGEURL=URL of page
|
||||
WEBSITE_TITLE=Title
|
||||
WEBSITE_DESCRIPTION=Description
|
||||
WEBSITE_KEYWORDS=Keywords
|
||||
LinesToImport=Lines to import
|
||||
|
||||
Loading…
Reference in New Issue
Block a user