Works on ODT import

This commit is contained in:
Laurent Destailleur 2010-03-27 00:33:28 +00:00
parent eb3e50537b
commit bdf4bbaa1f
19 changed files with 47 additions and 42 deletions

View File

@ -664,7 +664,7 @@ if (window.parent.frames[1]) {
<?php
$result=$formfile->show_documents('systemtools','backup',$conf->admin->dir_output.'/backup',$_SERVER['PHP_SELF'],0,1,'','',0,0,54,0,'',$langs->trans("PreviousDumpFiles"));
$result=$formfile->show_documents('systemtools','backup',$conf->admin->dir_output.'/backup',$_SERVER['PHP_SELF'],0,1,'',1,0,0,54,0,'',$langs->trans("PreviousDumpFiles"));
//if ($result) print '<br><br>';

View File

@ -296,7 +296,7 @@ if ($what)
}
}
$result=$formfile->show_documents('systemtools','backup',$conf->admin->dir_output.'/backup',$_SERVER['PHP_SELF'],0,1,'',array(),0,0,54,0,'',$langs->trans("PreviousDumpFiles"));
$result=$formfile->show_documents('systemtools','backup',$conf->admin->dir_output.'/backup',$_SERVER['PHP_SELF'],0,1,'',1,0,0,54,0,'',$langs->trans("PreviousDumpFiles"));
if ($result == 0)
{

View File

@ -319,7 +319,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
$filename=dol_sanitizeFileName($objp->ref);
$filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid;
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>';
print '</td>';
@ -579,7 +579,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$obj->propalid;
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>';
print "</td>";

View File

@ -1955,7 +1955,7 @@ if ($id > 0 || ! empty($ref))
$var=true;
$somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf,'',0,0,28,0,'',0,'',$societe->default_lang);
$somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf,1,0,0,28,0,'',0,'',$societe->default_lang);
/*
@ -2215,7 +2215,7 @@ else
$filename=dol_sanitizeFileName($objp->ref);
$filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid;
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>';
if ($objp->client == 1)

View File

@ -2188,7 +2188,7 @@ else
$genallowed=$user->rights->commande->creer;
$delallowed=$user->rights->commande->supprimer;
$somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf,'',0,0,28,0,'','','',$soc->default_lang);
$somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
/*
* Liste des factures

View File

@ -173,7 +173,7 @@ if ($resql)
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>';
print '</td>';
@ -240,7 +240,7 @@ if ($conf->commande->enabled)
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>';
print '</td>';
@ -309,7 +309,7 @@ if ($conf->commande->enabled)
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>';
print '</td>';

View File

@ -205,7 +205,7 @@ if ($resql)
$filename=dol_sanitizeFileName($objp->ref);
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>';
print '</td>';

View File

@ -151,7 +151,7 @@ if ($resql)
$filename=dol_sanitizeFileName($objp->ref);
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>';
print '</td>';

View File

@ -3502,7 +3502,7 @@ else
$var=true;
print '<br>';
$somethingshown=$formfile->show_documents('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$fac->modelpdf,'',0,0,28,0,'','','',$soc->default_lang);
$somethingshown=$formfile->show_documents('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$fac->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
/*
* Propales rattachees
@ -3961,7 +3961,7 @@ else
$filename=dol_sanitizeFileName($objp->facnumber);
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($objp->facnumber);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid;
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td>';
print '</tr></table>';

View File

@ -341,7 +341,7 @@ if ($result)
print '<td width="16" align="right" class="nobordernopadding">';
$filename=dol_sanitizeFileName($objp->facnumber);
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($objp->facnumber);
$foundpdf=$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1,$param);
$foundpdf=$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','',1,'',1,$param);
print '</td>';
print '</tr></table>';
@ -403,7 +403,7 @@ if ($result)
print '<br>';
print '<input type="hidden" name="option" value="'.$option.'">';
$formfile->show_documents('unpaid','',$filedir,$urlsource,$genallowed,$delallowed,'','',0,0,48,1,$param,'',$langs->trans("PDFMerge"));
$formfile->show_documents('unpaid','',$filedir,$urlsource,$genallowed,$delallowed,'',1,0,0,48,1,$param,'',$langs->trans("PDFMerge"));
print '</form>';
$db->free();

View File

@ -354,7 +354,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
$filename=dol_sanitizeFileName($obj->facnumber);
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid;
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>';
print '</td>';
@ -714,7 +714,7 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>';
print '</td>';
@ -809,7 +809,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
$filename=dol_sanitizeFileName($obj->facnumber);
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid;
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>';
print '</td>';

View File

@ -724,7 +724,7 @@ else
$filename=dol_sanitizeFileName($objp->ref);
$filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid;
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>';

View File

@ -315,7 +315,7 @@ if ($_GET["action"] == 'create')
// Date
print "<tr><td>".$langs->trans("Date")."</td>";
print '<td colspan="3">'.dol_print_date($object->date,"day")."</td></tr>\n";
// Date delivery planned
print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>';
print '<td colspan="3">'.dol_print_date($object->date_livraison,'day')."</td>\n";
@ -599,7 +599,7 @@ else
{
print '<div class="error">'.$mesg.'</div>';
}
$typeobject = $expedition->origin;
$origin = $expedition->origin;
$expedition->fetch_object();
@ -614,7 +614,7 @@ else
// delivery link
$expedition->load_object_linked($expedition->id,$expedition->element,-1,-1);
$head=shipping_prepare_head($expedition);
dol_fiche_head($head, 'shipping', $langs->trans("Sending"), 0, 'sending');
@ -709,7 +709,7 @@ else
print '<tr><td>'.$langs->trans("Date").'</td>';
print '<td colspan="3">'.dol_print_date($expedition->date,"daytext")."</td>\n";
print '</tr>';
// Date delivery planned
print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>';
print '<td colspan="3">'.dol_print_date($expedition->date_delivery,'daytext')."</td>\n";
@ -948,7 +948,7 @@ else
//$genallowed=1;
//$delallowed=0;
$somethingshown=$formfile->show_documents('expedition',$expeditionref,$filedir,$urlsource,$genallowed,$delallowed,$expedition->modelpdf,'',0,0,28,0,'','','',$soc->default_lang);
$somethingshown=$formfile->show_documents('expedition',$expeditionref,$filedir,$urlsource,$genallowed,$delallowed,$expedition->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
if ($genallowed && ! $somethingshown) $somethingshown=1;
}

View File

@ -759,7 +759,7 @@ if ($step == 4 && $datatoexport)
// Affiche liste des documents
// NB: La fonction show_documents rescanne les modules qd genallowed=1, sinon prend $liste
$formfile->show_documents('export','',$conf->export->dir_temp.'/'.$user->id,$_SERVER["PHP_SELF"].'?step=4&datatoexport='.$datatoexport,$liste,1,(! empty($_POST['model'])?$_POST['model']:'csv'),'',1);
$formfile->show_documents('export','',$conf->export->dir_temp.'/'.$user->id,$_SERVER["PHP_SELF"].'?step=4&datatoexport='.$datatoexport,$liste,1,(! empty($_POST['model'])?$_POST['model']:'csv'),1,1);
print '</td><td width="50%">&nbsp;</td></tr>';
print '</table>';

View File

@ -916,7 +916,7 @@ elseif ($fichinterid)
$var=true;
print "<br>\n";
$somethingshown=$formfile->show_documents('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$fichinter->modelpdf,'',0,0,28,0,'','','',$societe->default_lang);
$somethingshown=$formfile->show_documents('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$fichinter->modelpdf,1,0,0,28,0,'','','',$societe->default_lang);
print "</td><td>";
print "&nbsp;</td>";

View File

@ -129,7 +129,7 @@ class FormFile
* \param genallowed Generation is allowed (1/0 or array of formats)
* \param delallowed Remove is allowed (1/0)
* \param modelselected Model to preselect by default
* \param modelliste Array of possible models. Use '' to hide this combo select list.
* \param showwarning Show warning if no model activated
* \param forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined)
* \param iconPDF Show only PDF icon with link (1/0)
* \param maxfilenamelength Max length for filename shown
@ -140,7 +140,7 @@ class FormFile
* \param codelang Default language code to use on lang combo box if multilang is enabled
* \return int <0 if KO, number of shown files if OK
*/
function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$modelliste=array(),$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='')
function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$showwarning=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='')
{
// filedir = conf->...dir_ouput."/".get_exdir(id)
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
@ -153,7 +153,6 @@ class FormFile
$genallowed = '';
$delallowed = 0;
$modelselected = '';
$modelliste = '';
$forcenomultilang=0;
}
@ -340,7 +339,7 @@ class FormFile
// Language code (if multilang)
print '<td align="center">';
if($conf->global->MAIN_MULTILANGS && ! $forcenomultilang)
if (($showwarning || (is_array($modellist) && sizeof($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && ! $forcenomultilang)
{
include_once(DOL_DOCUMENT_ROOT.'/html.formadmin.class.php');
$formadmin=new FormAdmin($this->db);
@ -357,8 +356,10 @@ class FormFile
print '<td align="center" colspan="'.($delallowed?'2':'1').'">';
print '<input class="button" ';
//print ((is_array($modellist) && sizeof($modellist))?'':' disabled="true"') // Always allow button "Generate" (even if no model activated)
print ' type="submit" value="'.$buttonlabel.'">';
if (is_array($modellist) && ! sizeof($modellist))
print ' type="submit" value="'.$buttonlabel.'"';
if (! $showwarning && ! is_array($modellist) && empty($modellist)) print ' disabled="true"';
print '>';
if ($showwarning && ! is_array($modellist) && empty($modellist))
{
$langs->load("errors");
print ' '.img_warning($langs->trans("WarningNoDocumentModelActivated"));

View File

@ -1013,14 +1013,15 @@ function picto_from_langcode($codelang)
/**
* \brief Return list of activated modules usable for document generation.
* \param $db Database handler
* \param $type Type of models (company, invoice, ...)
* \return array array(key=>label). For modules that need directory scan, key is completed with ":filename".
* \param $db Database handler
* \param $type Type of models (company, invoice, ...)
* \return int or array 0 if no module is activated, or array(key=>label). For modules that need directory scan, key is completed with ":filename".
*/
function getListOfModels($db,$type)
{
global $conf;
$liste=array();
$found=0;
$dirtoscan='';
@ -1036,10 +1037,12 @@ function getListOfModels($db,$type)
$i = 0;
while ($i < $num)
{
$found=1;
$obj = $db->fetch_object($resql);
// If this generation module needs a directory scan, then description field is filled
// with constant that constains list of directories.
// with the constant that contains list of directories to scan.
if (! empty($obj->description))
{
$const=$obj->description;
@ -1079,5 +1082,6 @@ function getListOfModels($db,$type)
return -1;
}
return $liste;
if ($found) return $liste;
else return 0;
}

View File

@ -473,7 +473,7 @@ else
print '<tr><td>'.$langs->trans("Date").'</td>';
print '<td colspan="3">'.dol_print_date($delivery->date_creation,'daytext')."</td>\n";
print '</tr>';
// Date delivery planned
print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>';
print '<td colspan="3">'.dol_print_date($delivery->date_delivery,'daytext')."</td>\n";
@ -573,7 +573,7 @@ else
if ($user->societe_id == 0)
{
print '<div class="tabsAction">';
if ($delivery->statut == 0 && $user->rights->expedition->livraison->valider && $num_prod > 0)
{
print '<a class="butAction" href="fiche.php?id='.$delivery->id.'&amp;action=valid">'.$langs->trans("Validate").'</a>';
@ -608,7 +608,7 @@ else
$genallowed=$user->rights->expedition->livraison->creer;
$delallowed=$user->rights->expedition->livraison->supprimer;
$somethingshown=$formfile->show_documents('livraison',$deliveryref,$filedir,$urlsource,$genallowed,$delallowed,$delivery->modelpdf,'',0,0,28,0,'','','',$soc->default_lang);
$somethingshown=$formfile->show_documents('livraison',$deliveryref,$filedir,$urlsource,$genallowed,$delallowed,$delivery->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
if ($genallowed && ! $somethingshown) $somethingshown=1;
print '</td><td valign="top" width="50%">';

View File

@ -1451,7 +1451,7 @@ else
$var=true;
$somethingshown=$formfile->show_documents('company',$soc->id,$filedir,$urlsource,$genallowed,$delallowed,'','',0,0,28,0,'',0,'',$soc->default_lang);
$somethingshown=$formfile->show_documents('company',$soc->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$soc->default_lang);
print '</td>';
print '<td>';