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');
|
$trclass=($var?'pair':'impair');
|
||||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||||
?>
|
?>
|
||||||
<tr class="<?php echo $trclass; ?>">
|
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >
|
||||||
<td><?php echo $langs->trans("Proposal"); ?></td>
|
<td class="linkedcol-element" ><?php echo $langs->trans("Proposal"); ?></td>
|
||||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
<td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||||
<td><?php echo $objectlink->ref_client; ?></td>
|
<td class="linkedcol-ref" ><?php echo $objectlink->ref_client; ?></td>
|
||||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||||
<td align="right"><?php
|
<td class="linkedcol-amount" align="right"><?php
|
||||||
if ($user->rights->propale->lire) {
|
if ($user->rights->propale->lire) {
|
||||||
$total = $total + $objectlink->total_ht;
|
$total = $total + $objectlink->total_ht;
|
||||||
echo price($objectlink->total_ht);
|
echo price($objectlink->total_ht);
|
||||||
} ?></td>
|
} ?></td>
|
||||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
<td class="linkedcol-statut" 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-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>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2451,7 +2451,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
/*
|
/*
|
||||||
* Form to add new line
|
* 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')
|
if ($action != 'editline')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -48,17 +48,19 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
|||||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||||
?>
|
?>
|
||||||
<tr class="<?php echo $trclass; ?>" >
|
<tr class="<?php echo $trclass; ?>" >
|
||||||
<td><?php echo $langs->trans("CustomerOrder"); ?></td>
|
<td class="linkedcol-element" ><?php echo $langs->trans("CustomerOrder"); ?>
|
||||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
<?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 align="center"><?php echo $objectlink->ref_client; ?></td>
|
</td>
|
||||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
<td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||||
<td align="right"><?php
|
<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) {
|
if ($user->rights->commande->lire) {
|
||||||
$total = $total + $objectlink->total_ht;
|
$total = $total + $objectlink->total_ht;
|
||||||
echo price($objectlink->total_ht);
|
echo price($objectlink->total_ht);
|
||||||
} ?></td>
|
} ?></td>
|
||||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
<td class="linkedcol-statut" align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||||
<td align="right">
|
<td class="linkedcol-action" align="right">
|
||||||
<?php
|
<?php
|
||||||
// For now, shipments must stay linked to order, so link is not deletable
|
// For now, shipments must stay linked to order, so link is not deletable
|
||||||
if($object->element != 'shipping') {
|
if($object->element != 'shipping') {
|
||||||
|
|||||||
@ -2095,6 +2095,82 @@ if (empty($reshook))
|
|||||||
exit();
|
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
|
// Actions when printing a doc from card
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||||
|
|
||||||
@ -4156,7 +4232,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
// Form to add new line
|
// 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 ($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
|
// Add free products/services
|
||||||
$object->formAddObjectLine(1, $mysoc, $soc);
|
$object->formAddObjectLine(1, $mysoc, $soc);
|
||||||
@ -4448,7 +4524,15 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice'));
|
$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
|
// Show online payment link
|
||||||
|
|||||||
@ -769,10 +769,16 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
else if ($reshook < 0) $error++;*/
|
else if ($reshook < 0) $error++;*/
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
if (! $notrigger)
|
||||||
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('BILL_CREATE',$user);
|
$result=$this->call_trigger('BILL_CREATE',$user);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
// End call triggers
|
// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -47,12 +47,12 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
|||||||
$trclass=($var?'pair':'impair');
|
$trclass=($var?'pair':'impair');
|
||||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||||
?>
|
?>
|
||||||
<tr class="<?php echo $trclass; ?>">
|
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >
|
||||||
<td><?php echo $langs->trans("CustomerInvoice"); ?></td>
|
<td class="linkedcol-element" ><?php echo $langs->trans("CustomerInvoice"); ?></td>
|
||||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
<td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||||
<td align="center"><?php echo $objectlink->ref_client; ?></td>
|
<td class="linkedcol-ref" align="center"><?php echo $objectlink->ref_client; ?></td>
|
||||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||||
<td align="right"><?php
|
<td class="linkedcol-amount" align="right"><?php
|
||||||
if ($user->rights->facture->lire) {
|
if ($user->rights->facture->lire) {
|
||||||
$sign = 1;
|
$sign = 1;
|
||||||
if ($object->type == Facture::TYPE_CREDIT_NOTE) $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>';
|
echo '<strike>'.price($objectlink->total_ht).'</strike>';
|
||||||
}
|
}
|
||||||
} ?></td>
|
} ?></td>
|
||||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
<td class="linkedcol-statut" 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-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>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3735,6 +3735,14 @@ abstract class CommonObject
|
|||||||
|
|
||||||
print '<td class="linecolmove" width="10"></td>';
|
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";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5986,19 +5994,29 @@ abstract class CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$csstyle='';
|
$csstyle='';
|
||||||
$class=(!empty($extrafields->attribute_hidden[$key]) ? 'class="hideobject" ' : '');
|
$class=(!empty($extrafields->attribute_hidden[$key]) ? 'hideobject ' : '');
|
||||||
if (is_array($params) && count($params)>0) {
|
if (is_array($params) && count($params)>0) {
|
||||||
if (array_key_exists('style',$params)) {
|
if (array_key_exists('style',$params)) {
|
||||||
$csstyle=$params['style'];
|
$csstyle=$params['style'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$out .= '<tr '.$class.$csstyle.' class="'.$this->element.'_extras_'.$key.'">';
|
// add html5 elements
|
||||||
if (empty($onetrtd))
|
$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 (! 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)
|
// Convert date into timestamp format (value in memory must be a timestamp)
|
||||||
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
|
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>';
|
$labeltoshow = '<span'.($mode != 'view' ? ' class="fieldrequired"':'').'>'.$labeltoshow.'</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($onetrtd)) $out .= '<td>';
|
$out .= '<td>'.$labeltoshow.'</td>';
|
||||||
else $out .= '<td'.($colspan?' colspan="'.($colspan+1).'"':'').'>';
|
|
||||||
|
|
||||||
$out .= $labeltoshow;
|
|
||||||
|
|
||||||
if (empty($onetrtd)) $out .= '</td><td'.($colspan?' colspan="'.($colspan).'"':'').'>';
|
|
||||||
else $out.=' ';
|
|
||||||
|
|
||||||
$html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : '';
|
$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) {
|
switch($mode) {
|
||||||
case "view":
|
case "view":
|
||||||
@ -6038,8 +6050,9 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$out .= '</td>';
|
$out .= '</td>';
|
||||||
$out .= '</tr>';
|
|
||||||
|
|
||||||
|
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= '</tr>';
|
||||||
|
else $out .= '</tr>';
|
||||||
$e++;
|
$e++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6051,7 +6064,7 @@ abstract class CommonObject
|
|||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
function showOptions(child_list, parent_list)
|
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;
|
var parentVal = parent_list + ":" + val;
|
||||||
if(val > 0) {
|
if(val > 0) {
|
||||||
$("select[name=\""+child_list+"\"] option[parent]").hide();
|
$("select[name=\""+child_list+"\"] option[parent]").hide();
|
||||||
|
|||||||
@ -5988,9 +5988,10 @@ class Form
|
|||||||
*
|
*
|
||||||
* @param CommonObject $object Object we want to show links to
|
* @param CommonObject $object Object we want to show links to
|
||||||
* @param string $morehtmlright More html to show on right of title
|
* @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
|
* @return int <0 if KO, >=0 if OK
|
||||||
*/
|
*/
|
||||||
function showLinkedObjectBlock($object, $morehtmlright='')
|
function showLinkedObjectBlock($object, $morehtmlright='',$compatibleImportElementsList=false)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$hookmanager;
|
global $conf,$langs,$hookmanager;
|
||||||
global $bc;
|
global $bc;
|
||||||
@ -5999,7 +6000,9 @@ class Form
|
|||||||
|
|
||||||
// Bypass the default method
|
// Bypass the default method
|
||||||
$hookmanager->initHooks(array('commonobject'));
|
$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
|
$reshook=$hookmanager->executeHooks('showLinkedObjectBlock',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
@ -6011,7 +6014,7 @@ class Form
|
|||||||
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
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 '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Type").'</td>';
|
print '<td>'.$langs->trans("Type").'</td>';
|
||||||
@ -6029,6 +6032,12 @@ class Form
|
|||||||
{
|
{
|
||||||
$tplpath = $element = $subelement = $objecttype;
|
$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))
|
if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
|
||||||
{
|
{
|
||||||
$element = $regs[1];
|
$element = $regs[1];
|
||||||
@ -6104,6 +6113,13 @@ class Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
if(!empty($compatibleImportElementsList))
|
||||||
|
{
|
||||||
|
$res=@include dol_buildpath('core/tpl/ajax/objectlinked_lineimport.tpl.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
return $nbofdifferenttypes;
|
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($inputalsopricewithtax)) $inputalsopricewithtax=0;
|
||||||
if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=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; ?>
|
<?php $coldisplay=0; ?>
|
||||||
<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->
|
<!-- 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)) { ?>
|
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
|
||||||
<td class="linecolnum" align="center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
|
<td class="linecolnum" align="center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@ -264,7 +271,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
|
|||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($this->statut == 0 && ($object_rights->creer)) { ?>
|
if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines' ) { ?>
|
||||||
<td class="linecoledit" align="center"><?php $coldisplay++; ?>
|
<td class="linecoledit" align="center"><?php $coldisplay++; ?>
|
||||||
<?php if (($line->info_bits & 2) == 2 || ! empty($disableedit)) { ?>
|
<?php if (($line->info_bits & 2) == 2 || ! empty($disableedit)) { ?>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
@ -304,6 +311,9 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
|
|||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<td colspan="3"><?php $coldisplay=$coldisplay+3; ?></td>
|
<td colspan="3"><?php $coldisplay=$coldisplay+3; ?></td>
|
||||||
<?php } ?>
|
<?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>
|
</tr>
|
||||||
|
|
||||||
|
|||||||
@ -246,3 +246,4 @@ WEBSITE_PAGEURL=URL of page
|
|||||||
WEBSITE_TITLE=Title
|
WEBSITE_TITLE=Title
|
||||||
WEBSITE_DESCRIPTION=Description
|
WEBSITE_DESCRIPTION=Description
|
||||||
WEBSITE_KEYWORDS=Keywords
|
WEBSITE_KEYWORDS=Keywords
|
||||||
|
LinesToImport=Lines to import
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user