Merge branch '5.0' of https://github.com/Dolibarr/dolibarr into 5.0
This commit is contained in:
commit
ea616114a9
@ -162,21 +162,13 @@ if ($type == 'directory')
|
|||||||
// Auto area for suppliers invoices
|
// Auto area for suppliers invoices
|
||||||
else if ($module == 'invoice') $upload_dir = $conf->facture->dir_output;
|
else if ($module == 'invoice') $upload_dir = $conf->facture->dir_output;
|
||||||
// Auto area for suppliers invoices
|
// Auto area for suppliers invoices
|
||||||
else if ($module == 'invoice_supplier')
|
else if ($module == 'invoice_supplier') $upload_dir = $conf->fournisseur->facture->dir_output;
|
||||||
{
|
|
||||||
$relativepath='facture';
|
|
||||||
$upload_dir = $conf->fournisseur->dir_output.'/'.$relativepath;
|
|
||||||
}
|
|
||||||
// Auto area for customers orders
|
// Auto area for customers orders
|
||||||
else if ($module == 'propal') $upload_dir = $conf->propal->dir_output;
|
else if ($module == 'propal') $upload_dir = $conf->propal->dir_output;
|
||||||
// Auto area for customers orders
|
// Auto area for customers orders
|
||||||
else if ($module == 'order') $upload_dir = $conf->commande->dir_output;
|
else if ($module == 'order') $upload_dir = $conf->commande->dir_output;
|
||||||
// Auto area for suppliers orders
|
// Auto area for suppliers orders
|
||||||
else if ($module == 'order_supplier')
|
else if ($module == 'order_supplier') $upload_dir = $conf->fournisseur->commande->dir_output;
|
||||||
{
|
|
||||||
$relativepath='commande';
|
|
||||||
$upload_dir = $conf->fournisseur->dir_output.'/'.$relativepath;
|
|
||||||
}
|
|
||||||
// Auto area for suppliers invoices
|
// Auto area for suppliers invoices
|
||||||
else if ($module == 'contract') $upload_dir = $conf->contrat->dir_output;
|
else if ($module == 'contract') $upload_dir = $conf->contrat->dir_output;
|
||||||
// Auto area for products
|
// Auto area for products
|
||||||
@ -197,10 +189,12 @@ if ($type == 'directory')
|
|||||||
$param.='&module='.$module;
|
$param.='&module='.$module;
|
||||||
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
|
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
|
||||||
|
|
||||||
|
if ($module == 'company') $excludefiles[]='^contact$'; // The subdir 'contact' contains files of contacts with no id of thirdparty.
|
||||||
|
|
||||||
$filearray=dol_dir_list($upload_dir,"files",1,'', $excludefiles, $sortfield, $sorting,1);
|
$filearray=dol_dir_list($upload_dir,"files",1,'', $excludefiles, $sortfield, $sorting,1);
|
||||||
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
|
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
|
||||||
}
|
}
|
||||||
//Manual area
|
// Manual area
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$relativepath=$ecmdir->getRelativePath();
|
$relativepath=$ecmdir->getRelativePath();
|
||||||
|
|||||||
@ -1469,7 +1469,7 @@ abstract class CommonObject
|
|||||||
$fieldname = 'multicurrency_code';
|
$fieldname = 'multicurrency_code';
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||||
$sql .= ' SET '.$fieldname.' = "'.$this->db->escape($code).'"';
|
$sql .= ' SET '.$fieldname." = '".$this->db->escape($code)."'";
|
||||||
$sql .= ' WHERE rowid='.$this->id;
|
$sql .= ' WHERE rowid='.$this->id;
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
|
|||||||
@ -331,11 +331,11 @@ class FormFile
|
|||||||
jQuery(\'#togglemassfilesarea\').text("('.dol_escape_js($langs->trans("Hide")).')");
|
jQuery(\'#togglemassfilesarea\').text("('.dol_escape_js($langs->trans("Hide")).')");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$titletoshow=$langs->trans("Documents");
|
$titletoshow=$langs->trans("Documents");
|
||||||
if (! empty($title)) $titletoshow=$title;
|
if (! empty($title)) $titletoshow=$title;
|
||||||
|
|
||||||
@ -556,7 +556,7 @@ class FormFile
|
|||||||
if (empty($noform)) $out.= '<form action="'.$urlsource.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc').'" name="'.$forname.'" id="'.$forname.'_form" method="post">';
|
if (empty($noform)) $out.= '<form action="'.$urlsource.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc').'" name="'.$forname.'" id="'.$forname.'_form" method="post">';
|
||||||
$out.= '<input type="hidden" name="action" value="builddoc">';
|
$out.= '<input type="hidden" name="action" value="builddoc">';
|
||||||
$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
|
||||||
$out.= load_fiche_titre($titletoshow, '', '');
|
$out.= load_fiche_titre($titletoshow, '', '');
|
||||||
$out.= '<table class="liste formdoc noborder" summary="listofdocumentstable" width="100%">';
|
$out.= '<table class="liste formdoc noborder" summary="listofdocumentstable" width="100%">';
|
||||||
|
|
||||||
@ -644,9 +644,9 @@ class FormFile
|
|||||||
$sortfield = $sortorder = null;
|
$sortfield = $sortorder = null;
|
||||||
$res = $link->fetchAll($link_list, $object->element, $object->id, $sortfield, $sortorder);
|
$res = $link->fetchAll($link_list, $object->element, $object->id, $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
$out.= '<!-- html.formfile::showdocuments -->'."\n";
|
$out.= '<!-- html.formfile::showdocuments -->'."\n";
|
||||||
|
|
||||||
// Show title of array if not already shown
|
// Show title of array if not already shown
|
||||||
if ((! empty($file_list) || ! empty($link_list) || preg_match('/^massfilesarea/', $modulepart)) && ! $headershown)
|
if ((! empty($file_list) || ! empty($link_list) || preg_match('/^massfilesarea/', $modulepart)) && ! $headershown)
|
||||||
{
|
{
|
||||||
@ -671,7 +671,7 @@ class FormFile
|
|||||||
|
|
||||||
$documenturl = DOL_URL_ROOT.'/document.php';
|
$documenturl = DOL_URL_ROOT.'/document.php';
|
||||||
if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) $documenturl=$conf->global->DOL_URL_ROOT_DOCUMENT_PHP;
|
if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) $documenturl=$conf->global->DOL_URL_ROOT_DOCUMENT_PHP;
|
||||||
|
|
||||||
// Show file name with link to download
|
// Show file name with link to download
|
||||||
$out.= '<td class="nowrap">';
|
$out.= '<td class="nowrap">';
|
||||||
$out.= '<a data-ajax="false" href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($relativepath).($param?'&'.$param:'').'"';
|
$out.= '<a data-ajax="false" href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($relativepath).($param?'&'.$param:'').'"';
|
||||||
@ -737,11 +737,11 @@ class FormFile
|
|||||||
if (is_array($link_list))
|
if (is_array($link_list))
|
||||||
{
|
{
|
||||||
$colspan=2;
|
$colspan=2;
|
||||||
|
|
||||||
foreach($link_list as $file)
|
foreach($link_list as $file)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
$out.= "<tr ".$bc[$var].">";
|
$out.= "<tr ".$bc[$var].">";
|
||||||
$out.='<td colspan="'.$colspan.'" class="maxwidhtonsmartphone">';
|
$out.='<td colspan="'.$colspan.'" class="maxwidhtonsmartphone">';
|
||||||
$out.='<a data-ajax="false" href="' . $link->url . '" target="_blank">';
|
$out.='<a data-ajax="false" href="' . $link->url . '" target="_blank">';
|
||||||
@ -756,7 +756,7 @@ class FormFile
|
|||||||
}
|
}
|
||||||
$this->numoffiles++;
|
$this->numoffiles++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($file_list) == 0 && count($link_list) == 0 && $headershown)
|
if (count($file_list) == 0 && count($link_list) == 0 && $headershown)
|
||||||
{
|
{
|
||||||
$out.='<tr '.$bc[0].'><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
$out.='<tr '.$bc[0].'><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
@ -799,7 +799,7 @@ class FormFile
|
|||||||
$this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array());
|
$this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array());
|
||||||
|
|
||||||
if (! empty($conf->dol_use_jmobile)) return '';
|
if (! empty($conf->dol_use_jmobile)) return '';
|
||||||
|
|
||||||
$file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir),'/').'[^\-]+', '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files)
|
$file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir),'/').'[^\-]+', '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files)
|
||||||
|
|
||||||
// For ajax treatment
|
// For ajax treatment
|
||||||
@ -919,7 +919,7 @@ class FormFile
|
|||||||
if ($user->rights->service->creer && $object->type == Product::TYPE_SERVICE) $permtoeditline=1;
|
if ($user->rights->service->creer && $object->type == Product::TYPE_SERVICE) $permtoeditline=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_UPLOAD_DOC))
|
if (empty($conf->global->MAIN_UPLOAD_DOC))
|
||||||
{
|
{
|
||||||
$permtoeditline=0;
|
$permtoeditline=0;
|
||||||
$permonobject=0;
|
$permonobject=0;
|
||||||
@ -928,7 +928,7 @@ class FormFile
|
|||||||
// Show list of existing files
|
// Show list of existing files
|
||||||
if (empty($useinecm)) print load_fiche_titre($title?$title:$langs->trans("AttachedFiles"));
|
if (empty($useinecm)) print load_fiche_titre($title?$title:$langs->trans("AttachedFiles"));
|
||||||
if (empty($url)) $url=$_SERVER["PHP_SELF"];
|
if (empty($url)) $url=$_SERVER["PHP_SELF"];
|
||||||
|
|
||||||
print '<!-- html.formfile::list_of_documents -->'."\n";
|
print '<!-- html.formfile::list_of_documents -->'."\n";
|
||||||
if (GETPOST('action') == 'editfile' && $permtoeditline)
|
if (GETPOST('action') == 'editfile' && $permtoeditline)
|
||||||
{
|
{
|
||||||
@ -938,7 +938,7 @@ class FormFile
|
|||||||
print '<input type="hidden" name="modulepart" value="'.$modulepart.'">';
|
print '<input type="hidden" name="modulepart" value="'.$modulepart.'">';
|
||||||
}
|
}
|
||||||
print '<table width="100%" class="'.($useinecm?'liste noborderbottom':'liste').'">'."\n";
|
print '<table width="100%" class="'.($useinecm?'liste noborderbottom':'liste').'">'."\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
@ -971,13 +971,13 @@ class FormFile
|
|||||||
$relativepath=preg_replace('/^.*\/produit\//','',$file['path']).'/';
|
$relativepath=preg_replace('/^.*\/produit\//','',$file['path']).'/';
|
||||||
}
|
}
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
$editline=0;
|
$editline=0;
|
||||||
|
|
||||||
print '<!-- Line list_of_documents '.$key.' -->'."\n";
|
print '<!-- Line list_of_documents '.$key.' -->'."\n";
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td class="tdoverflow">';
|
print '<td class="tdoverflow">';
|
||||||
|
|
||||||
//print "XX".$file['name']; //$file['name'] must be utf8
|
//print "XX".$file['name']; //$file['name'] must be utf8
|
||||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
|
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
|
||||||
if ($forcedownload) print '&attachment=1';
|
if ($forcedownload) print '&attachment=1';
|
||||||
@ -1007,7 +1007,7 @@ class FormFile
|
|||||||
print $file['name'];
|
print $file['name'];
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $editline) print $this->showPreview($file,$modulepart,$filepath);
|
if (! $editline) print $this->showPreview($file,$modulepart,$filepath);
|
||||||
|
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
@ -1038,7 +1038,7 @@ class FormFile
|
|||||||
// Delete or view link
|
// Delete or view link
|
||||||
// ($param must start with &)
|
// ($param must start with &)
|
||||||
print '<td class="valignmiddle right"><!-- action on files -->';
|
print '<td class="valignmiddle right"><!-- action on files -->';
|
||||||
if ($useinecm)
|
if ($useinecm)
|
||||||
{
|
{
|
||||||
print '<a href="'.DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_view('default', 0, 'class="paddingrightonly"').'</a>';
|
print '<a href="'.DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_view('default', 0, 'class="paddingrightonly"').'</a>';
|
||||||
}
|
}
|
||||||
@ -1046,10 +1046,10 @@ class FormFile
|
|||||||
{
|
{
|
||||||
$newmodulepart=$modulepart;
|
$newmodulepart=$modulepart;
|
||||||
if (in_array($modulepart, array('product','produit','service'))) $newmodulepart='produit|service';
|
if (in_array($modulepart, array('product','produit','service'))) $newmodulepart='produit|service';
|
||||||
|
|
||||||
$disablecrop=1;
|
$disablecrop=1;
|
||||||
if (in_array($modulepart, array('product','produit','service','holiday','project'))) $disablecrop=0;
|
if (in_array($modulepart, array('product','produit','service','holiday','project'))) $disablecrop=0;
|
||||||
|
|
||||||
if (! $disablecrop && image_format_supported($file['name']) > 0)
|
if (! $disablecrop && image_format_supported($file['name']) > 0)
|
||||||
{
|
{
|
||||||
if ($permtoeditline)
|
if ($permtoeditline)
|
||||||
@ -1058,7 +1058,7 @@ class FormFile
|
|||||||
print '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode($newmodulepart).'&id='.$object->id.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','class="paddingrightonly"',1).'</a>';
|
print '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode($newmodulepart).'&id='.$object->id.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','class="paddingrightonly"',1).'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($permtoeditline)
|
if ($permtoeditline)
|
||||||
{
|
{
|
||||||
print '<a href="'.(($useinecm && $useajax)?'#':$url.'?action=editfile&urlfile='.urlencode($filepath).$param).'" class="editfilelink" rel="'.$filepath.'">'.img_edit('default',0,'class="paddingrightonly"').'</a>';
|
print '<a href="'.(($useinecm && $useajax)?'#':$url.'?action=editfile&urlfile='.urlencode($filepath).$param).'" class="editfilelink" rel="'.$filepath.'">'.img_edit('default',0,'class="paddingrightonly"').'</a>';
|
||||||
@ -1076,7 +1076,7 @@ class FormFile
|
|||||||
if (! empty($conf->dol_use_jmobile)) $useajax=0;
|
if (! empty($conf->dol_use_jmobile)) $useajax=0;
|
||||||
if (empty($conf->use_javascript_ajax)) $useajax=0;
|
if (empty($conf->use_javascript_ajax)) $useajax=0;
|
||||||
if (! empty($conf->global->MAIN_ECM_DISABLE_JS)) $useajax=0;
|
if (! empty($conf->global->MAIN_ECM_DISABLE_JS)) $useajax=0;
|
||||||
|
|
||||||
print '<a href="'.(($useinecm && $useajax)?'#':$url.'?action=delete&urlfile='.urlencode($filepath).$param).'" class="deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>';
|
print '<a href="'.(($useinecm && $useajax)?'#':$url.'?action=delete&urlfile='.urlencode($filepath).$param).'" class="deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>';
|
||||||
}
|
}
|
||||||
print "</td>";
|
print "</td>";
|
||||||
@ -1103,7 +1103,7 @@ class FormFile
|
|||||||
{
|
{
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $nboffiles;
|
return $nboffiles;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1489,11 +1489,11 @@ class FormFile
|
|||||||
|
|
||||||
return $nboflinks;
|
return $nboflinks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show detail icon with link for preview
|
* Show detail icon with link for preview
|
||||||
*
|
*
|
||||||
* @param array $file File
|
* @param array $file File
|
||||||
* @param string $modulepart propal, facture, facture_fourn, ...
|
* @param string $modulepart propal, facture, facture_fourn, ...
|
||||||
* @param string $relativepath Relative path of docs
|
* @param string $relativepath Relative path of docs
|
||||||
|
|||||||
@ -141,7 +141,7 @@ else
|
|||||||
function constructGanttLine($tarr,$task,$project_dependencies,$level=0,$project_id=null)
|
function constructGanttLine($tarr,$task,$project_dependencies,$level=0,$project_id=null)
|
||||||
{
|
{
|
||||||
global $dateformatinput2;
|
global $dateformatinput2;
|
||||||
|
|
||||||
$start_date = $task["task_start_date"];
|
$start_date = $task["task_start_date"];
|
||||||
$end_date = $task["task_end_date"];
|
$end_date = $task["task_end_date"];
|
||||||
if (!$end_date) $end_date = $start_date;
|
if (!$end_date) $end_date = $start_date;
|
||||||
@ -206,7 +206,7 @@ function constructGanttLine($tarr,$task,$project_dependencies,$level=0,$project_
|
|||||||
$s = "\n// Add taks id=".$task["task_id"]." level = ".$level."\n";
|
$s = "\n// Add taks id=".$task["task_id"]." level = ".$level."\n";
|
||||||
// $s.= "g.AddTaskItem(new JSGantt.TaskItem(".$task['task_id'].",'".dol_escape_js($name)."','".$start_date."', '".$end_date."', '".$task['task_color']."', '".$link."', ".$task['task_milestone'].", '".$resources."', ".($percent >= 0 ? $percent : 0).", ".($task["task_is_group"]>0?1:0).", '".$parent."', 1, '".($depend?$depend:"")."', '".$note."'));";
|
// $s.= "g.AddTaskItem(new JSGantt.TaskItem(".$task['task_id'].",'".dol_escape_js($name)."','".$start_date."', '".$end_date."', '".$task['task_color']."', '".$link."', ".$task['task_milestone'].", '".$resources."', ".($percent >= 0 ? $percent : 0).", ".($task["task_is_group"]>0?1:0).", '".$parent."', 1, '".($depend?$depend:"")."', '".$note."'));";
|
||||||
// For JSGanttImproved
|
// For JSGanttImproved
|
||||||
$s.= "g.AddTaskItem(new JSGantt.TaskItem(".$task['task_id'].",'".dol_escape_js(trim($name))."','".$start_date."', '".$end_date."', '".$task['task_css']."', '".$link."', ".$task['task_milestone'].", '".$resources."', ".($percent >= 0 ? $percent : 0).", ".($task["task_is_group"]).", '".$parent."', 1, '".($depend?$depend:$parent."SS")."', '".($percent >= 0 ? $percent.'%' : '0%')."','".$task['note']."'));";
|
$s.= "g.AddTaskItem(new JSGantt.TaskItem(".$task['task_id'].",'".dol_escape_js(trim($name))."','".$start_date."', '".$end_date."', '".$task['task_css']."', '".$link."', ".$task['task_milestone'].", '".$resources."', ".($percent >= 0 ? $percent : 0).", ".($task["task_is_group"]).", '".$parent."', 1, '".($depend?$depend:$parent."SS")."', '".($percent >= 0 ? $percent.'%' : '0%')."','".dol_escape_js($task['note'])."'));";
|
||||||
echo $s;
|
echo $s;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -510,7 +510,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add a product line
|
// Add a product line
|
||||||
if ($action == 'addline' && $user->rights->supplier_proposal->creer)
|
if ($action == 'addline' && $user->rights->supplier_proposal->creer)
|
||||||
{
|
{
|
||||||
$langs->load('errors');
|
$langs->load('errors');
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -520,7 +520,7 @@ if (empty($reshook))
|
|||||||
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
|
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
|
||||||
$date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
|
$date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
|
||||||
$date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
|
$date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
|
||||||
|
|
||||||
if (GETPOST('prod_entry_mode') == 'free')
|
if (GETPOST('prod_entry_mode') == 'free')
|
||||||
{
|
{
|
||||||
$idprod=0;
|
$idprod=0;
|
||||||
@ -577,7 +577,7 @@ if (empty($reshook))
|
|||||||
if ((GETPOST('prod_entry_mode') != 'free') && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or ''
|
if ((GETPOST('prod_entry_mode') != 'free') && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or ''
|
||||||
{
|
{
|
||||||
$productsupplier = new ProductFournisseur($db);
|
$productsupplier = new ProductFournisseur($db);
|
||||||
|
|
||||||
if (empty($conf->global->SUPPLIER_PROPOSAL_WITH_NOPRICEDEFINED))
|
if (empty($conf->global->SUPPLIER_PROPOSAL_WITH_NOPRICEDEFINED))
|
||||||
{
|
{
|
||||||
$idprod=0;
|
$idprod=0;
|
||||||
@ -597,7 +597,7 @@ if (empty($reshook))
|
|||||||
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), -1); // We force qty to -1 to be sure to find if a supplier price exist
|
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), -1); // We force qty to -1 to be sure to find if a supplier price exist
|
||||||
$res=$productsupplier->fetch($idprod);
|
$res=$productsupplier->fetch($idprod);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($idprod > 0)
|
if ($idprod > 0)
|
||||||
{
|
{
|
||||||
$pu_ht = $productsupplier->fourn_pu;
|
$pu_ht = $productsupplier->fourn_pu;
|
||||||
@ -606,7 +606,7 @@ if (empty($reshook))
|
|||||||
$label = $productsupplier->label;
|
$label = $productsupplier->label;
|
||||||
$desc = $productsupplier->description;
|
$desc = $productsupplier->description;
|
||||||
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc);
|
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc);
|
||||||
|
|
||||||
$tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice'));
|
$tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice'));
|
||||||
$tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice'));
|
$tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice'));
|
||||||
if (empty($tva_tx)) $tva_npr=0;
|
if (empty($tva_tx)) $tva_npr=0;
|
||||||
@ -664,13 +664,13 @@ if (empty($reshook))
|
|||||||
$type = GETPOST('type');
|
$type = GETPOST('type');
|
||||||
|
|
||||||
$fk_unit= GETPOST('units', 'alpha');
|
$fk_unit= GETPOST('units', 'alpha');
|
||||||
|
|
||||||
$tva_tx = price2num($tva_tx); // When vat is text input field
|
$tva_tx = price2num($tva_tx); // When vat is text input field
|
||||||
|
|
||||||
// Local Taxes
|
// Local Taxes
|
||||||
$localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty);
|
$localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty);
|
||||||
$localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty);
|
$localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty);
|
||||||
|
|
||||||
if (GETPOST('price_ht')!=='')
|
if (GETPOST('price_ht')!=='')
|
||||||
{
|
{
|
||||||
$price_base_type = 'HT';
|
$price_base_type = 'HT';
|
||||||
@ -683,13 +683,13 @@ if (empty($reshook))
|
|||||||
$ht = $ttc / (1 + ($tva_tx / 100));
|
$ht = $ttc / (1 + ($tva_tx / 100));
|
||||||
$price_base_type = 'HT';
|
$price_base_type = 'HT';
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $ref_fourn, $fk_unit);
|
$result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $ref_fourn, $fk_unit);
|
||||||
//$result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end, $array_options, $fk_unit);
|
//$result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end, $array_options, $fk_unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (! $error && $result > 0)
|
if (! $error && $result > 0)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|
||||||
@ -706,7 +706,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
$model=$object->modelpdf;
|
$model=$object->modelpdf;
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
|
|
||||||
$result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
if ($result < 0) dol_print_error($db,$result);
|
if ($result < 0) dol_print_error($db,$result);
|
||||||
}
|
}
|
||||||
@ -716,7 +716,7 @@ if (empty($reshook))
|
|||||||
unset($_POST['qty']);
|
unset($_POST['qty']);
|
||||||
unset($_POST['type']);
|
unset($_POST['type']);
|
||||||
unset($_POST['remise_percent']);
|
unset($_POST['remise_percent']);
|
||||||
unset($_POST['pu']);
|
unset($_POST['pu']);
|
||||||
unset($_POST['price_ht']);
|
unset($_POST['price_ht']);
|
||||||
unset($_POST['multicurrency_price_ht']);
|
unset($_POST['multicurrency_price_ht']);
|
||||||
unset($_POST['price_ttc']);
|
unset($_POST['price_ttc']);
|
||||||
@ -747,8 +747,8 @@ if (empty($reshook))
|
|||||||
unset($_POST['date_endday']);
|
unset($_POST['date_endday']);
|
||||||
unset($_POST['date_endmonth']);
|
unset($_POST['date_endmonth']);
|
||||||
unset($_POST['date_endyear']);
|
unset($_POST['date_endyear']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
@ -1367,11 +1367,11 @@ if ($action == 'create')
|
|||||||
// Print form confirm
|
// Print form confirm
|
||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
|
|
||||||
|
|
||||||
// Supplier proposal card
|
// Supplier proposal card
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/supplier_proposal/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
$linkback = '<a href="' . DOL_URL_ROOT . '/supplier_proposal/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|
||||||
|
|
||||||
$morehtmlref='<div class="refidno">';
|
$morehtmlref='<div class="refidno">';
|
||||||
// Ref supplier
|
// Ref supplier
|
||||||
//$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1);
|
//$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1);
|
||||||
@ -1392,7 +1392,7 @@ if ($action == 'create')
|
|||||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
$morehtmlref.=$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$object->socid:-1), $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||||
$morehtmlref.='</form>';
|
$morehtmlref.='</form>';
|
||||||
} else {
|
} else {
|
||||||
@ -1411,15 +1411,15 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$morehtmlref.='</div>';
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
|
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="fichehalfleft">';
|
print '<div class="fichehalfleft">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Payment term
|
// Payment term
|
||||||
@ -1562,14 +1562,14 @@ if ($action == 'create')
|
|||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="fichehalfright">';
|
print '<div class="fichehalfright">';
|
||||||
print '<div class="ficheaddleft">';
|
print '<div class="ficheaddleft">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border centpercent">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
|
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
|
||||||
{
|
{
|
||||||
// Multicurrency Amount HT
|
// Multicurrency Amount HT
|
||||||
@ -1587,7 +1587,7 @@ if ($action == 'create')
|
|||||||
print '<td>' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td>' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Amount HT
|
// Amount HT
|
||||||
print '<tr><td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
|
print '<tr><td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
|
||||||
print '<td>' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
print '<td>' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||||
@ -1618,18 +1618,18 @@ if ($action == 'create')
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
// Margin Infos
|
// Margin Infos
|
||||||
/*if (! empty($conf->margin->enabled)) {
|
/*if (! empty($conf->margin->enabled)) {
|
||||||
$formmargin->displayMarginInfos($object);
|
$formmargin->displayMarginInfos($object);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<div class="clearboth"></div><br>';
|
print '<div class="clearboth"></div><br>';
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
|
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
|
||||||
$blocname = 'contacts';
|
$blocname = 'contacts';
|
||||||
$title = $langs->trans('ContactsAddresses');
|
$title = $langs->trans('ContactsAddresses');
|
||||||
@ -1666,7 +1666,7 @@ if ($action == 'create')
|
|||||||
// Add free products/services form
|
// Add free products/services form
|
||||||
global $forceall, $senderissupplier, $dateSelector;
|
global $forceall, $senderissupplier, $dateSelector;
|
||||||
$forceall=1; $senderissupplier=2; $dateSelector=0; // $senderissupplier=2 is same than 1 but disable test on minimum qty.
|
$forceall=1; $senderissupplier=2; $dateSelector=0; // $senderissupplier=2 is same than 1 but disable test on minimum qty.
|
||||||
|
|
||||||
if (! empty($object->lines))
|
if (! empty($object->lines))
|
||||||
$ret = $object->printObjectLines($action, $soc, $mysoc, $lineid, 1);
|
$ret = $object->printObjectLines($action, $soc, $mysoc, $lineid, 1);
|
||||||
|
|
||||||
@ -1814,12 +1814,12 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print $formfile->showdocuments('supplier_proposal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
|
print $formfile->showdocuments('supplier_proposal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
|
||||||
|
|
||||||
|
|
||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('supplier_proposal'));
|
$linktoelem = $form->showLinkToObjectBlock($object, null, array('supplier_proposal'));
|
||||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||||
|
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
// List of actions on element
|
// List of actions on element
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user