mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop-api
This commit is contained in:
commit
d2a67e152b
|
|
@ -77,11 +77,6 @@ $model_option = array (
|
|||
'label' => 'ACCOUNTING_EXPORT_DATE',
|
||||
'param' => '',
|
||||
),
|
||||
//'ACCOUNTING_EXPORT_PIECE',
|
||||
//'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT',
|
||||
//'ACCOUNTING_EXPORT_LABEL',
|
||||
//'ACCOUNTING_EXPORT_AMOUNT',
|
||||
//'ACCOUNTING_EXPORT_DEVISE',
|
||||
);
|
||||
|
||||
/*
|
||||
|
|
@ -143,7 +138,6 @@ $form = new Form($db);
|
|||
// $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
||||
|
||||
$head = admin_accounting_prepare_head();
|
||||
|
||||
print "\n".'<script type="text/javascript" language="javascript">'."\n";
|
||||
print 'jQuery(document).ready(function () {'."\n";
|
||||
|
|
@ -193,7 +187,6 @@ print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
|||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
dol_fiche_head($head, 'export', $langs->trans("Configuration"), -1, 'technic');
|
||||
|
||||
/*
|
||||
* Main Options
|
||||
|
|
|
|||
|
|
@ -648,7 +648,7 @@ if ($action == 'create')
|
|||
print "</tr>\n";
|
||||
}
|
||||
|
||||
if ($total_debit != $total_credit)
|
||||
if (price2num($total_debit) != price2num($total_credit))
|
||||
{
|
||||
setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit)), 'warnings');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -547,9 +547,9 @@ class AccountancyExport
|
|||
$tab = array();
|
||||
// export configurable
|
||||
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
$tab[] = $line->piece_num;
|
||||
$tab[] = $date;
|
||||
$tab[] = $line->doc_ref;
|
||||
$tab[] = $line->piece_num;
|
||||
$tab[] = $line->label_operation;
|
||||
$tab[] = length_accountg($line->numero_compte);
|
||||
$tab[] = length_accounta($line->subledger_account);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ class AccountingJournal extends CommonObject
|
|||
public $table_element='accounting_journal';
|
||||
public $fk_element = '';
|
||||
public $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
public $picto = 'generic';
|
||||
|
||||
var $rowid;
|
||||
|
||||
|
|
@ -187,9 +188,6 @@ class AccountingJournal extends CommonObject
|
|||
|
||||
$url = DOL_URL_ROOT . '/accountancy/admin/journals_list.php?id=35';
|
||||
|
||||
$picto = 'billr';
|
||||
$label='';
|
||||
|
||||
$label = '<u>' . $langs->trans("ShowAccountingJournal") . '</u>';
|
||||
if (! empty($this->code))
|
||||
$label .= '<br><b>'.$langs->trans('Code') . ':</b> ' . $this->code;
|
||||
|
|
@ -223,9 +221,11 @@ class AccountingJournal extends CommonObject
|
|||
$label_link = $this->code;
|
||||
if ($withlabel) $label_link .= ' - ' . $this->label;
|
||||
|
||||
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result .= ' ';
|
||||
if ($withpicto != 2) $result.=$linkstart . $label_link . $linkend;
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $label_link;
|
||||
$result .= $linkend;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ if ($result) {
|
|||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
//if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ if ($result) {
|
|||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
//if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ if ($result) {
|
|||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
//if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||
|
|
|
|||
|
|
@ -1969,7 +1969,7 @@ class Adherent extends CommonObject
|
|||
$this->fullname=$this->getFullName($langs);
|
||||
|
||||
// For avoid ldap error when firstname and lastname are empty
|
||||
if ($this->morphy == 'mor' && empty($this->fullname)) {
|
||||
if ($this->morphy == 'mor' && (empty($this->fullname) || $this->fullname == $this->societe)) {
|
||||
$this->fullname = $this->societe;
|
||||
$this->lastname = $this->societe;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -388,23 +388,24 @@ class AdherentType extends CommonObject
|
|||
*
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param int $maxlen length max label
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$maxlen=0)
|
||||
function getNomUrl($withpicto=0, $maxlen=0, $notooltip=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$label=$langs->trans("ShowTypeCard",$this->label);
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
$picto='group';
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= ($maxlen?dol_trunc($this->label,$maxlen):$this->label);
|
||||
$result .= $linkend;
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
$result.=$link.($maxlen?dol_trunc($this->label,$maxlen):$this->label).$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -249,12 +249,12 @@ foreach ($search_array_options as $key => $val)
|
|||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
$mode_search=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
|
|
@ -355,9 +355,8 @@ $arrayofmassactions = array(
|
|||
// 'presend'=>$langs->trans("SendByMail"),
|
||||
// 'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
if ($user->rights->adherent->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
//if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
|
|
|||
|
|
@ -177,9 +177,8 @@ if ($result)
|
|||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
if ($user->rights->adherent->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
//if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
|
|
|||
|
|
@ -204,10 +204,10 @@ if ($action == 'confirm_delete' && $user->rights->adherent->configurer)
|
|||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("MembersTypeSetup"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans("MembersTypeSetup"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
|
||||
|
||||
// List of members type
|
||||
if (! $rowid && $action != 'create' && $action != 'edit')
|
||||
|
|
@ -252,11 +252,21 @@ if (! $rowid && $action != 'create' && $action != 'edit')
|
|||
print '<th> </th>';
|
||||
print "</tr>\n";
|
||||
|
||||
$membertype = new AdherentType($db);
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$membertype->id = $objp->rowid;
|
||||
$membertype->ref = $objp->rowid;
|
||||
$membertype->label = $objp->rowid;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a></td>';
|
||||
print '<td>';
|
||||
print $membertype->getNomUrl(1);
|
||||
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
|
||||
print '</td>';
|
||||
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
|
||||
print '<td align="center">'.yn($objp->subscription).'</td>';
|
||||
print '<td align="center">'.yn($objp->vote).'</td>';
|
||||
|
|
@ -440,11 +450,11 @@ if ($rowid > 0)
|
|||
}
|
||||
if ($status != '')
|
||||
{
|
||||
$sql.= " AND d.statut IN (".$db->escape($status).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
|
||||
$sql.= natural_search('d.statut', $status, 2);
|
||||
}
|
||||
if ($action == 'search')
|
||||
{
|
||||
if (GETPOST('search'))
|
||||
if (GETPOST('search','alpha'))
|
||||
{
|
||||
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,9 +158,10 @@ $head=agenda_prepare_head();
|
|||
dol_fiche_head($head, 'autoactions', $langs->trans("Agenda"), -1, 'action');
|
||||
|
||||
print $langs->trans("AgendaAutoActionDesc")."<br>\n";
|
||||
print $langs->trans("OnlyActiveElementsAreShown").'<br>';
|
||||
print $langs->trans("OnlyActiveElementsAreShown", 'modules.php').'<br>';
|
||||
print "<br>\n";
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" name="search_event" value="'.dol_escape_htmltag($search_event).'"></td>';
|
||||
|
|
@ -172,9 +173,9 @@ print $searchpicto;
|
|||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th class="liste_titre">'.$langs->trans("ActionsEvents").'</th>';
|
||||
print '<th class="liste_titre"></th>';
|
||||
print '<th class="liste_titre" colspan="2">'.$langs->trans("ActionsEvents").'</th>';
|
||||
print '<th class="liste_titre"><a href="'.$_SERVER["PHP_SELF"].'?action=selectall'.($param?$param:'').'">'.$langs->trans("All").'</a>/<a href="'.$_SERVER["PHP_SELF"].'?action=selectnone'.($param?$param:'').'">'.$langs->trans("None").'</a></th>';
|
||||
print '</tr>'."\n";
|
||||
// Show each trigger (list is in c_action_trigger)
|
||||
|
|
@ -211,6 +212,7 @@ if (! empty($triggers))
|
|||
}
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ $pageprev = $page - 1;
|
|||
$pagenext = $page + 1;
|
||||
|
||||
$search_country_id = GETPOST('search_country_id','int');
|
||||
if($search_country_id == '') $search_country_id = $mysoc->country_id;
|
||||
$search_code = GETPOST('search_code','alpha');
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
|
|
|
|||
|
|
@ -221,8 +221,8 @@ foreach ($search_array_options as $key => $val)
|
|||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode_search=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
|
|
@ -318,7 +318,7 @@ $arrayofmassactions = array(
|
|||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->monmodule->delete) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
|
|
|||
|
|
@ -771,9 +771,9 @@ if ($action == 'create')
|
|||
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
|
||||
//For external user force the company to user company
|
||||
if (!empty($user->societe_id)) {
|
||||
print $form->select_company($user->societe_id, 'socid', '', 1, 1, 0, $events);
|
||||
print $form->select_company($user->societe_id, 'socid', '', 1, 1, 0, $events, 0, 'minwidth300');
|
||||
} else {
|
||||
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, $events);
|
||||
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, $events, 0, 'minwidth300');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -781,7 +781,7 @@ if ($action == 'create')
|
|||
|
||||
// Related contact
|
||||
print '<tr><td class="nowrap">'.$langs->trans("ActionOnContact").'</td><td>';
|
||||
$form->selectcontacts(GETPOST('socid','int'), GETPOST('contactid'), 'contactid', 1, '', '', 0, 'minwidth200');
|
||||
print $form->selectcontacts(GETPOST('socid','int'), GETPOST('contactid'), 'contactid', 1, '', '', 0, 'minwidth300');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
|
|
@ -985,7 +985,7 @@ if ($id > 0)
|
|||
else $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
|
||||
print '</td></tr>';
|
||||
|
||||
$userepeatevent=0; // Dev in progress
|
||||
$userepeatevent=($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0); // Dev in progress
|
||||
if ($userepeatevent)
|
||||
{
|
||||
// Repeat
|
||||
|
|
|
|||
|
|
@ -170,15 +170,15 @@ if ($resql)
|
|||
$out='';
|
||||
|
||||
// Show file name with link to download
|
||||
$tmp = $formfile->showPreview($filearray,$modulepart,$relativepath,0,$param);
|
||||
$out.= ($tmp?$tmp.' ':'');
|
||||
$out.= '<a href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($relativepath).($param?'&'.$param:'').'"';
|
||||
$mime=dol_mimetype($relativepath,'',0);
|
||||
if (preg_match('/text/',$mime)) $out.= ' target="_blank"';
|
||||
$out.= ' target="_blank">';
|
||||
$out.= img_mime($filearray["name"],$langs->trans("File").': '.$filearray["name"]).' '.$filearray["name"];
|
||||
$out.= img_mime($filearray["name"],$langs->trans("File").': '.$filearray["name"]);
|
||||
$out.= $filearray["name"];
|
||||
$out.= '</a>'."\n";
|
||||
print $out;
|
||||
$out.= $formfile->showPreview($filearray,$modulepart,$relativepath,0,$param);
|
||||
print $out;
|
||||
|
||||
print '</td>';
|
||||
print '<td align="center">'.dol_print_date(dol_filemtime($file),'dayhour').'</td>';
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
|
|||
{
|
||||
$listofsearchfields['search_contract']=array('text'=>'Contract');
|
||||
}
|
||||
|
||||
|
||||
if (count($listofsearchfields))
|
||||
{
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
|
||||
|
|
@ -125,7 +125,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
|
|||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
}
|
||||
|
|
@ -155,7 +155,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
|||
{
|
||||
$total = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="3">'.$langs->trans("ProposalsDraft").($num?' <span class="badge">'.$num.'</span>':'').'</th></tr>';
|
||||
|
|
@ -167,7 +167,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
|||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td class="nowrap">';
|
||||
$propalstatic->id=$obj->rowid;
|
||||
$propalstatic->ref=$obj->ref;
|
||||
|
|
@ -192,13 +192,13 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
|||
}
|
||||
if ($total>0)
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoProposal").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
|
|
@ -236,7 +236,7 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos
|
|||
{
|
||||
$total = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="3">'.$langs->trans("SupplierProposalsDraft").($num?' <span class="badge">'.$num.'</span>':'').'</th></tr>';
|
||||
|
|
@ -248,7 +248,7 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos
|
|||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td class="nowrap">';
|
||||
$supplierproposalstatic->id=$obj->rowid;
|
||||
$supplierproposalstatic->ref=$obj->ref;
|
||||
|
|
@ -272,13 +272,13 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos
|
|||
}
|
||||
if ($total>0)
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoProposal").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
|
|
@ -315,7 +315,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
|||
{
|
||||
$total = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="3">'.$langs->trans("DraftOrders").($num?' <span class="badge">'.$num.'</span>':'').'</th></tr>';
|
||||
|
|
@ -326,7 +326,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
|||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr class="oddeven"><td class="nowrap">';
|
||||
$orderstatic->id=$obj->rowid;
|
||||
|
|
@ -352,13 +352,13 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
|||
}
|
||||
if ($total>0)
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoOrder").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
|
|
@ -407,7 +407,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande
|
|||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr class="oddeven"><td class="nowrap">';
|
||||
$supplierorderstatic->id=$obj->rowid;
|
||||
|
|
@ -433,13 +433,13 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande
|
|||
}
|
||||
if ($total>0)
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoSupplierOrder").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
|
|
@ -489,7 +489,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
|
|||
else if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects",$max);
|
||||
else print $langs->trans("BoxTitleLastModifiedCustomers",$max);
|
||||
print '</th>';
|
||||
print '<th align="right">'.$langs->trans("DateModificationShort").'</th>';
|
||||
print '<th align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/societe/list.php?type=p,c">'.$langs->trans("FullList").'</a></th>';
|
||||
print '</tr>';
|
||||
if ($num)
|
||||
{
|
||||
|
|
@ -510,7 +510,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
|
|||
print '<td align="right" nowrap>'.dol_print_date($db->jdate($objp->tms),'day')."</td>";
|
||||
print '</tr>';
|
||||
$i++;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -547,8 +547,9 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire)
|
|||
$i = 0;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><th>'.$langs->trans("BoxTitleLastModifiedSuppliers",min($max,$num)).'</th>';
|
||||
print '<th align="right">'.$langs->trans("DateModificationShort").'</th>';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("BoxTitleLastModifiedSuppliers",min($max,$num)).'</th>';
|
||||
print '<th align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/societe/list.php?type=f">'.$langs->trans("FullList").'</a></th>';
|
||||
print '</tr>';
|
||||
if ($num)
|
||||
{
|
||||
|
|
@ -564,7 +565,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire)
|
|||
print '<td class="nowrap">'.$companystatic->getNomUrl(1,'supplier',44).'</td>';
|
||||
print '<td align="right">'.dol_print_date($db->jdate($objp->dm),'day').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
|
@ -644,7 +645,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO
|
|||
print $companystatic->getNomUrl(1,'customer',44);
|
||||
print '</td>'."\n";
|
||||
print "<td align=\"right\">".$staticcontrat->LibStatut($obj->statut,3)."</td></tr>\n";
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
print "</table><br>";
|
||||
|
|
@ -690,7 +691,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
|||
while ($i < $nbofloop)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
|
|
@ -787,7 +788,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
|||
while ($i < $nbofloop)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
|
|
|
|||
|
|
@ -320,12 +320,12 @@ foreach ($search_array_options as $key => $val)
|
|||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
$mode_search=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
|
|
@ -401,7 +401,7 @@ if ($resql)
|
|||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->propal->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
// Lignes des champs de filtre
|
||||
|
|
@ -417,15 +417,11 @@ if ($resql)
|
|||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
$topicmail="SendSupplierProposalRef";
|
||||
$modelmail="supplier_proposal_send";
|
||||
$objecttmp=new Propal($db);
|
||||
$trackid='ord'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
|
||||
}
|
||||
$topicmail="SendSupplierProposalRef";
|
||||
$modelmail="supplier_proposal_send";
|
||||
$objecttmp=new Propal($db);
|
||||
$trackid='ord'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -209,224 +209,6 @@ if (empty($reshook))
|
|||
$uploaddir = $conf->commande->dir_output;
|
||||
$trigger_name='ORDER_SENTBYMAIL';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
// TODO Move this into mass action include
|
||||
if ($massaction == 'confirm_createbills') {
|
||||
|
||||
$orders = GETPOST('toselect','array');
|
||||
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
|
||||
$validate_invoices = GETPOST('valdate_invoices', 'int');
|
||||
|
||||
$TFact = array();
|
||||
$TFactThird = array();
|
||||
|
||||
$nb_bills_created = 0;
|
||||
|
||||
$db->begin();
|
||||
|
||||
foreach($orders as $id_order)
|
||||
{
|
||||
$cmd = new Commande($db);
|
||||
if ($cmd->fetch($id_order) <= 0) continue;
|
||||
|
||||
$object = new Facture($db);
|
||||
if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $object = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order.
|
||||
else {
|
||||
|
||||
$object->socid = $cmd->socid;
|
||||
$object->type = Facture::TYPE_STANDARD;
|
||||
$object->cond_reglement_id = $cmd->cond_reglement_id;
|
||||
$object->mode_reglement_id = $cmd->mode_reglement_id;
|
||||
$object->fk_project = $cmd->fk_project;
|
||||
|
||||
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
if (empty($datefacture))
|
||||
{
|
||||
$datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y"));
|
||||
}
|
||||
|
||||
$object->date = $datefacture;
|
||||
$object->origin = 'commande';
|
||||
$object->origin_id = $id_order;
|
||||
|
||||
$res = $object->create($user);
|
||||
|
||||
if($res > 0) $nb_bills_created++;
|
||||
}
|
||||
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
|
||||
$sql.= "fk_source";
|
||||
$sql.= ", sourcetype";
|
||||
$sql.= ", fk_target";
|
||||
$sql.= ", targettype";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= $id_order;
|
||||
$sql.= ", '".$object->origin."'";
|
||||
$sql.= ", ".$object->id;
|
||||
$sql.= ", '".$object->element."'";
|
||||
$sql.= ")";
|
||||
|
||||
if (! $db->query($sql))
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$lines = $cmd->lines;
|
||||
if (empty($lines) && method_exists($cmd, 'fetch_lines'))
|
||||
{
|
||||
$cmd->fetch_lines();
|
||||
$lines = $cmd->lines;
|
||||
}
|
||||
|
||||
$fk_parent_line=0;
|
||||
$num=count($lines);
|
||||
|
||||
for ($i=0;$i<$num;$i++)
|
||||
{
|
||||
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
|
||||
if ($lines[$i]->subprice < 0)
|
||||
{
|
||||
// Negative line, we create a discount line
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$discount->fk_soc=$object->socid;
|
||||
$discount->amount_ht=abs($lines[$i]->total_ht);
|
||||
$discount->amount_tva=abs($lines[$i]->total_tva);
|
||||
$discount->amount_ttc=abs($lines[$i]->total_ttc);
|
||||
$discount->tva_tx=$lines[$i]->tva_tx;
|
||||
$discount->fk_user=$user->id;
|
||||
$discount->description=$desc;
|
||||
$discountid=$discount->create($user);
|
||||
if ($discountid > 0)
|
||||
{
|
||||
$result=$object->insert_discount($discountid);
|
||||
//$result=$discount->link_to_invoice($lineid,$id);
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($discount->error, $discount->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Positive line
|
||||
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
|
||||
// Date start
|
||||
$date_start=false;
|
||||
if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue;
|
||||
if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
|
||||
if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
|
||||
//Date end
|
||||
$date_end=false;
|
||||
if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue;
|
||||
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
|
||||
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
|
||||
// Reset fk_parent_line for no child products and special product
|
||||
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9)
|
||||
{
|
||||
$fk_parent_line = 0;
|
||||
}
|
||||
$result = $object->addline(
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
$lines[$i]->qty,
|
||||
$lines[$i]->tva_tx,
|
||||
$lines[$i]->localtax1_tx,
|
||||
$lines[$i]->localtax2_tx,
|
||||
$lines[$i]->fk_product,
|
||||
$lines[$i]->remise_percent,
|
||||
$date_start,
|
||||
$date_end,
|
||||
0,
|
||||
$lines[$i]->info_bits,
|
||||
$lines[$i]->fk_remise_except,
|
||||
'HT',
|
||||
0,
|
||||
$product_type,
|
||||
$ii,
|
||||
$lines[$i]->special_code,
|
||||
$object->origin,
|
||||
$lines[$i]->rowid,
|
||||
$fk_parent_line,
|
||||
$lines[$i]->fk_fournprice,
|
||||
$lines[$i]->pa_ht,
|
||||
$lines[$i]->label
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
$lineid=$result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$lineid=0;
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
// Defined the new fk_parent_line
|
||||
if ($result > 0 && $lines[$i]->product_type == 9)
|
||||
{
|
||||
$fk_parent_line = $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module.
|
||||
|
||||
if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object;
|
||||
else $TFact[$object->id] = $object;
|
||||
}
|
||||
|
||||
// Build doc with all invoices
|
||||
$TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
|
||||
$toselect = array();
|
||||
|
||||
if (! $error && $validate_invoices)
|
||||
{
|
||||
$massaction = $action = 'builddoc';
|
||||
foreach($TAllFact as &$object)
|
||||
{
|
||||
$result = $object->validate($user);
|
||||
if ($result <= 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
break;
|
||||
}
|
||||
|
||||
$id = $object->id; // For builddoc action
|
||||
|
||||
// Fac builddoc
|
||||
$donotredirect = 1;
|
||||
$upload_dir = $conf->facture->dir_output;
|
||||
$permissioncreate=$user->rights->facture->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
}
|
||||
|
||||
$massaction = $action = 'confirm_createbills';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('BillCreated', $nb_bills_created));
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
$action='create';
|
||||
$_GET["origin"]=$_POST["origin"];
|
||||
$_GET["originid"]=$_POST["originid"];
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -552,12 +334,12 @@ foreach ($search_array_options as $key => $val)
|
|||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
$mode_search=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
|
|
@ -652,7 +434,7 @@ if ($resql)
|
|||
);
|
||||
if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
if ($user->rights->commande->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
|
||||
if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
// Lines of title fields
|
||||
|
|
@ -669,15 +451,11 @@ if ($resql)
|
|||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
$topicmail="SendOrderRef";
|
||||
$modelmail="order_send";
|
||||
$objecttmp=new Commande($db);
|
||||
$trackid='ord'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
|
||||
}
|
||||
$topicmail="SendOrderRef";
|
||||
$modelmail="order_send";
|
||||
$objecttmp=new Commande($db);
|
||||
$trackid='ord'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($massaction == 'createbills')
|
||||
{
|
||||
|
|
@ -686,7 +464,7 @@ if ($resql)
|
|||
|
||||
print '<table class="noborder" width="100%" >';
|
||||
print '<tr>';
|
||||
print '<td class="titlefieldmiddle">';
|
||||
print '<td class="titlefield">';
|
||||
print $langs->trans('DateInvoice');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
|
|
@ -715,6 +493,8 @@ if ($resql)
|
|||
{
|
||||
print $form->selectyesno('valdate_invoices', 0, 1);
|
||||
}
|
||||
if (! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) print ' <span class="opacitymedium">'.$langs->trans("IfValidateInvoiceIsNoOrderStayUnbilled").'</span>';
|
||||
else print ' <span class="opacitymedium">'.$langs->trans("OptionToSetOrderBilledNotEnabled").'</span>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
|
|
|||
|
|
@ -507,13 +507,13 @@ foreach ($search_array_options as $key => $val)
|
|||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
$mode_search=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
|
|
@ -574,7 +574,7 @@ if ($resql)
|
|||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->bank->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
// Confirmation delete
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ if ($action == 'add')
|
|||
$object->owner_address = trim($_POST["owner_address"]);
|
||||
|
||||
$account_number = GETPOST('account_number','alpha');
|
||||
if ($account_number <= 0) { $object->account_number = ''; } else { $object->account_number = $account_number; }
|
||||
if (empty($account_number) || $account_number == '-1') { $object->account_number = ''; } else { $object->account_number = $account_number; }
|
||||
$fk_accountancy_journal = GETPOST('fk_accountancy_journal','int');
|
||||
if ($fk_accountancy_journal <= 0) { $object->fk_accountancy_journal = ''; } else { $object->fk_accountancy_journal = $fk_accountancy_journal; }
|
||||
|
||||
|
|
@ -627,7 +627,7 @@ else
|
|||
print '<td>';
|
||||
if (! empty($conf->accounting->enabled)) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch('',$object->account_number);
|
||||
$accountingaccount->fetch('',$object->account_number, 1);
|
||||
|
||||
print $accountingaccount->getNomUrl(0,1,1,'',1);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -164,13 +164,13 @@ foreach ($search_array_options as $key => $val)
|
|||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
$mode_search=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
|
|
@ -239,7 +239,7 @@ $arrayofmassactions = array(
|
|||
// 'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->banque->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$newcardbutton='';
|
||||
|
|
|
|||
|
|
@ -1132,6 +1132,7 @@ if (empty($reshook))
|
|||
$TTotalByTva = array();
|
||||
foreach ($srcobject->lines as &$line)
|
||||
{
|
||||
if(! empty($line->special_code)) continue;
|
||||
$TTotalByTva[$line->tva_tx] += $line->total_ttc ;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -653,7 +653,9 @@ class Invoices extends DolibarrApi
|
|||
|
||||
|
||||
/**
|
||||
* Add a discount line into an invoice (as an invoice line) using an existing absolute discount (Consume the discount)
|
||||
* Add a discount line into an invoice (as an invoice line) using an existing absolute discount
|
||||
*
|
||||
* Note that this consume the discount.
|
||||
*
|
||||
* @param int $id Id of invoice
|
||||
* @param int $discountid Id of discount
|
||||
|
|
@ -696,7 +698,9 @@ class Invoices extends DolibarrApi
|
|||
}
|
||||
|
||||
/**
|
||||
* Add an available credit note discount to payments of an existing invoice (Consume the credit note)
|
||||
* Add an available credit note discount to payments of an existing invoice.
|
||||
*
|
||||
* Note that this consume the credit note.
|
||||
*
|
||||
* @param int $id Id of invoice
|
||||
* @param int $discountid Id of a discount coming from a credit note
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -107,7 +108,8 @@ class FactureRec extends CommonInvoice
|
|||
$this->nb_gen_done=0;
|
||||
$this->nb_gen_max=empty($this->nb_gen_max)?0:$this->nb_gen_max;
|
||||
$this->auto_validate=empty($this->auto_validate)?0:$this->auto_validate;
|
||||
|
||||
$this->generate_pdf = empty($this->generate_pdf)?0:$this->generate_pdf;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Charge facture modele
|
||||
|
|
@ -127,6 +129,7 @@ class FactureRec extends CommonInvoice
|
|||
$sql.= ", remise";
|
||||
$sql.= ", note_private";
|
||||
$sql.= ", note_public";
|
||||
$sql.= ", modelpdf";
|
||||
$sql.= ", fk_user_author";
|
||||
$sql.= ", fk_projet";
|
||||
$sql.= ", fk_account";
|
||||
|
|
@ -140,6 +143,7 @@ class FactureRec extends CommonInvoice
|
|||
$sql.= ", nb_gen_done";
|
||||
$sql.= ", nb_gen_max";
|
||||
$sql.= ", auto_validate";
|
||||
$sql.= ", generate_pdf";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".$this->db->escape($this->titre)."'";
|
||||
$sql.= ", ".$facsrc->socid;
|
||||
|
|
@ -149,6 +153,7 @@ class FactureRec extends CommonInvoice
|
|||
$sql.= ", ".(!empty($facsrc->remise)?$this->remise:'0');
|
||||
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
|
||||
$sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
|
||||
$sql.= ", ".(!empty($this->modelpdf)?("'".$this->db->escape($this->modelpdf)."'"):"NULL");
|
||||
$sql.= ", '".$this->db->escape($user->id)."'";
|
||||
$sql.= ", ".(! empty($facsrc->fk_project)?"'".$facsrc->fk_project."'":"null");
|
||||
$sql.= ", ".(! empty($facsrc->fk_account)?"'".$facsrc->fk_account."'":"null");
|
||||
|
|
@ -162,6 +167,7 @@ class FactureRec extends CommonInvoice
|
|||
$sql.= ", ".$this->nb_gen_done;
|
||||
$sql.= ", ".$this->nb_gen_max;
|
||||
$sql.= ", ".$this->auto_validate;
|
||||
$sql.= ", ".$this->generate_pdf;
|
||||
$sql.= ")";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
|
|
@ -276,9 +282,11 @@ class FactureRec extends CommonInvoice
|
|||
$sql.= ', f.remise_percent, f.remise_absolue, f.remise';
|
||||
$sql.= ', f.date_lim_reglement as dlr';
|
||||
$sql.= ', f.note_private, f.note_public, f.fk_user_author';
|
||||
$sql.= ', f.modelpdf';
|
||||
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet';
|
||||
$sql.= ', f.fk_account';
|
||||
$sql.= ', f.frequency, f.unit_frequency, f.date_when, f.date_last_gen, f.nb_gen_done, f.nb_gen_max, f.usenewprice, f.auto_validate';
|
||||
$sql.= ', f.generate_pdf';
|
||||
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
||||
$sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc';
|
||||
//$sql.= ', el.fk_source';
|
||||
|
|
@ -336,7 +344,7 @@ class FactureRec extends CommonInvoice
|
|||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->user_author = $obj->fk_user_author;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->modelpdf = $obj->modelpdf;
|
||||
$this->rang = $obj->rang;
|
||||
$this->special_code = $obj->special_code;
|
||||
$this->frequency = $obj->frequency;
|
||||
|
|
@ -347,7 +355,8 @@ class FactureRec extends CommonInvoice
|
|||
$this->nb_gen_max = $obj->nb_gen_max;
|
||||
$this->usenewprice = $obj->usenewprice;
|
||||
$this->auto_validate = $obj->auto_validate;
|
||||
|
||||
$this->generate_pdf = $obj->generate_pdf;
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
|
||||
|
||||
// Retreive all extrafield for thirdparty
|
||||
|
|
@ -948,8 +957,18 @@ class FactureRec extends CommonInvoice
|
|||
$this->errors = $facture->errors;
|
||||
$this->error = $facture->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! $error && $facturerec->generate_pdf)
|
||||
{
|
||||
$result = $facture->generateDocument($facturerec->modelpdf, $langs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
$this->errors = $facture->errors;
|
||||
$this->error = $facture->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error && $invoiceidgenerated >= 0)
|
||||
{
|
||||
|
|
@ -1391,6 +1410,68 @@ class FactureRec extends CommonInvoice
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the auto generate documents
|
||||
*
|
||||
* @param int $validate 0 no document, 1 to generate document
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function setGeneratePdf($validate)
|
||||
{
|
||||
if (! $this->table_element)
|
||||
{
|
||||
dol_syslog(get_class($this)."::setGeneratePdf was called on objet with property table_element not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= ' SET generate_pdf = '.$validate;
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::setGeneratePdf", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->generate_pdf = $validate;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the model for documents
|
||||
*
|
||||
* @param string $model model of document generator
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function setModelPdf($model)
|
||||
{
|
||||
if (! $this->table_element)
|
||||
{
|
||||
dol_syslog(get_class($this)."::setModelPdf was called on objet with property table_element not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= ' SET modelpdf = "' . $model . '"';
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::setModelPdf", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->modelpdf = $model;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
|
||||
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -210,14 +211,15 @@ if (empty($reshook))
|
|||
{
|
||||
$object->titre = GETPOST('titre', 'alpha');
|
||||
$object->note_private = GETPOST('note_private','none');
|
||||
$object->note_public = GETPOST('note_public','none');
|
||||
$object->note_public = GETPOST('note_public','none');
|
||||
$object->modelpdf = GETPOST('modelpdf', 'alpha');
|
||||
$object->usenewprice = GETPOST('usenewprice');
|
||||
|
||||
$object->frequency = $frequency;
|
||||
$object->unit_frequency = GETPOST('unit_frequency', 'alpha');
|
||||
$object->nb_gen_max = $nb_gen_max;
|
||||
$object->auto_validate = GETPOST('auto_validate', 'int');
|
||||
|
||||
$object->generate_pdf = GETPOST('generate_pdf', 'int');
|
||||
$object->fk_project = $projectid;
|
||||
|
||||
$date_next_execution = dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear);
|
||||
|
|
@ -345,6 +347,16 @@ if (empty($reshook))
|
|||
elseif ($action == 'setauto_validate' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->setAutoValidate(GETPOST('auto_validate', 'int'));
|
||||
}
|
||||
// Set generate pdf
|
||||
elseif ($action == 'setgenerate_pdf' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->setGeneratepdf(GETPOST('generate_pdf', 'int'));
|
||||
}
|
||||
// Set model pdf
|
||||
elseif ($action == 'setmodelpdf' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->setModelpdf(GETPOST('modelpdf', 'alpha'));
|
||||
}
|
||||
|
||||
// Delete line
|
||||
|
|
@ -1040,6 +1052,13 @@ if ($action == 'create')
|
|||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Model pdf
|
||||
print "<tr><td>".$langs->trans('Model')."</td><td>";
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
|
||||
$list = ModelePDFFactures::liste_modeles($db);
|
||||
print $form->selectarray('modelpdf', $list, $conf->global->FACTURE_ADDON_PDF);
|
||||
print "</td></tr>";
|
||||
|
||||
print "</table>";
|
||||
|
||||
dol_fiche_end();
|
||||
|
|
@ -1075,6 +1094,12 @@ if ($action == 'create')
|
|||
print $form->selectarray('auto_validate', $select, GETPOST('auto_validate'));
|
||||
print "</td></tr>";
|
||||
|
||||
// Auto generate document
|
||||
print "<tr><td>".$langs->trans("StatusOfGeneratedDocuments")."</td><td>";
|
||||
$select = array('0'=>$langs->trans('DoNotGenerateDoc'),'1'=>$langs->trans('AutoGenerateDoc'));
|
||||
print $form->selectarray('generate_pdf', $select, GETPOST('generate_pdf'));
|
||||
print "</td></tr>";
|
||||
|
||||
print "</table>";
|
||||
|
||||
dol_fiche_end();
|
||||
|
|
@ -1345,6 +1370,34 @@ else
|
|||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Model pdf
|
||||
$langs->load('banks');
|
||||
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('Model');
|
||||
print '<td>';
|
||||
if (($action != 'editmodelpdf') && $user->rights->facture->creer && ! empty($object->brouillon))
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmodelpdf&id='.$object->id.'">'.img_edit($langs->trans('SetModel'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editmodelpdf')
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
|
||||
$list = array();
|
||||
$models = ModelePDFFactures::liste_modeles($db);
|
||||
foreach ($models as $model) {
|
||||
$list[] = $model . ':' . $model;
|
||||
}
|
||||
$select = 'select;'.implode(',', $list);
|
||||
print $form->editfieldval($langs->trans("Model"), 'modelpdf', $object->modelpdf, $object, $user->rights->facture->creer, $select);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $object->modelpdf;
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Other attributes
|
||||
$cols = 2;
|
||||
|
|
@ -1449,12 +1502,25 @@ else
|
|||
else
|
||||
print $langs->trans("StatusOfGeneratedInvoices");
|
||||
print '</td><td>';
|
||||
$select = 'select;0:'.$langs->trans('BillStatusDraft').',1:'.$langs->trans('BillStatusValidated');
|
||||
$select = 'select;0:'.$langs->trans('BillStatusDraft').',1:'.$langs->trans('BillStatusValidated');
|
||||
if ($action == 'auto_validate' || $object->frequency > 0)
|
||||
{
|
||||
print $form->editfieldval($langs->trans("StatusOfGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $user->rights->facture->creer, $select);
|
||||
}
|
||||
print '</td>';
|
||||
// Auto generate documents
|
||||
print '<tr><td>';
|
||||
if ($action == 'generate_pdf' || $object->frequency > 0)
|
||||
print $form->editfieldkey($langs->trans("StatusOfGeneratedDocuments"), 'generate_pdf', $object->generate_pdf, $object, $user->rights->facture->creer);
|
||||
else
|
||||
print $langs->trans("StatusOfGeneratedDocuments");
|
||||
print '</td><td>';
|
||||
$select = 'select;0:'.$langs->trans('DoNotGenerateDoc').',1:'.$langs->trans('AutogenerateDoc');
|
||||
if ($action == 'generate_pdf' || $object->frequency > 0)
|
||||
{
|
||||
print $form->editfieldval($langs->trans("StatusOfGeneratedDocuments"), 'generate_pdf', $object->generate_pdf, $object, $user->rights->facture->creer, $select);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
|
|
|||
|
|
@ -476,12 +476,12 @@ foreach ($search_array_options as $key => $val)
|
|||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
$mode_search=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
|
|
@ -595,7 +595,7 @@ if ($resql)
|
|||
$arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
}
|
||||
}
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$i = 0;
|
||||
|
|
@ -613,15 +613,11 @@ if ($resql)
|
|||
|
||||
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit);
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
$topicmail="SendBillRef";
|
||||
$modelmail="facture_send";
|
||||
$objecttmp=new Facture($db);
|
||||
$trackid='inv'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
|
||||
}
|
||||
$topicmail="SendBillRef";
|
||||
$modelmail="facture_send";
|
||||
$objecttmp=new Facture($db);
|
||||
$trackid='inv'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
|
|||
$langs->load("donations");
|
||||
$listofsearchfields['search_donation']=array('text'=>'Donation');
|
||||
}
|
||||
|
||||
|
||||
if (count($listofsearchfields))
|
||||
{
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
|
||||
|
|
@ -123,7 +123,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
|
|||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
}
|
||||
|
|
@ -194,7 +194,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
|||
print '</tr>';
|
||||
$tot_ttc+=$obj->total_ttc;
|
||||
$i++;
|
||||
|
||||
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td align="left">'.$langs->trans("Total").'</td>';
|
||||
|
|
@ -382,7 +382,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
|||
$total_ttc += $obj->total_ttc;
|
||||
$total += $obj->total_ht;
|
||||
$totalam += $obj->am;
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
|
@ -499,7 +499,7 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire)
|
|||
|
||||
$sql = "SELECT d.rowid, d.lastname, d.firstname, d.societe, d.datedon as date, d.tms as dm, d.amount, d.fk_statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
|
||||
$sql.= " WHERE d.entity = ".$conf->entity;
|
||||
$sql.= " WHERE d.entity IN (".getEntity('donation').")";
|
||||
$sql.= $db->order("d.tms","DESC");
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
|
|
@ -514,8 +514,9 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire)
|
|||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("BoxTitleLastModifiedDonations",$max).'</th>';
|
||||
print '<th></th>';
|
||||
print '<th align="right">'.$langs->trans("AmountTTC").'</th>';
|
||||
print '<th align="right">'.$langs->trans("DateModificationShort").'</th>';
|
||||
print '<th align="right">'.$langs->trans("DateModificationShort").'</th>';
|
||||
print '<th width="16"> </th>';
|
||||
print '</tr>';
|
||||
if ($num)
|
||||
|
|
@ -527,16 +528,19 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire)
|
|||
while ($i < $num && $i < $max)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
$donationstatic->id=$objp->rowid;
|
||||
$donationstatic->ref=$objp->rowid;
|
||||
$donationstatic->lastname=$objp->lastname;
|
||||
$donationstatic->firstname=$objp->firstname;
|
||||
|
||||
$label=$donationstatic->getFullName($langs);
|
||||
if ($objp->societe) $label.=($label?' - ':'').$objp->societe;
|
||||
$donationstatic->ref=$label;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$donationstatic->getNomUrl(1).'</td>';
|
||||
print '<td align="right">'.price($objp->amount).'</td>';
|
||||
print '<td>'.$label.'</td>';
|
||||
print '<td align="right">'.price($objp->amount).'</td>';
|
||||
print '<td align="right">'.dol_print_date($db->jdate($objp->dm),'day').'</td>';
|
||||
print '<td>'.$donationstatic->LibStatut($objp->fk_statut,3).'</td>';
|
||||
print '</tr>';
|
||||
|
|
@ -594,11 +598,13 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
|||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
$chargestatic->id=$obj->rowid;
|
||||
$chargestatic->ref=$obj->libelle;
|
||||
$chargestatic->lib=$obj->libelle;
|
||||
$chargestatic->paye=$obj->paye;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$chargestatic->getNomUrl(1).'</td>';
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->date_ech),'day').'</td>';
|
||||
print '<td align="right">'.price($obj->amount).'</td>';
|
||||
|
|
@ -719,7 +725,7 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
|
|||
//print "x".$tot_ttc."z".$obj->tot_fttc;
|
||||
$tot_tobill += ($obj->total_ttc-$obj->tot_fttc);
|
||||
$i++;
|
||||
|
||||
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").' <font style="font-weight: normal">('.$langs->trans("RemainderToBill").': '.price($tot_tobill).')</font> </td>';
|
||||
|
|
@ -831,7 +837,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
|||
$total_ttc += $obj->total_ttc;
|
||||
$total += $obj->total_ht;
|
||||
$totalam += $obj->am;
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
|
@ -972,7 +978,7 @@ if ($resql)
|
|||
while ($i < $db->num_rows($resql))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
|
||||
print "<tr ".$bc[$var]."><td>".dol_print_date($db->jdate($obj->da),"day")."</td>";
|
||||
print '<td><a href="action/card.php">'.$obj->libelle.' '.$obj->label.'</a></td></tr>';
|
||||
|
|
|
|||
|
|
@ -907,7 +907,7 @@ else
|
|||
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity = " . getEntity('c_paiement');
|
||||
$sql.= " WHERE p.entity = ".getEntity('donation');
|
||||
$sql.= " WHERE p.entity IN (".getEntity('donation').")";
|
||||
$sql.= " AND fk_statut >= 2";
|
||||
}
|
||||
if (! empty($date_start) && ! empty($date_end))
|
||||
|
|
|
|||
|
|
@ -762,7 +762,7 @@ if (! empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco
|
|||
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity = " . getEntity('c_paiement');
|
||||
$sql.= " WHERE p.entity = ".getEntity('donation');
|
||||
$sql.= " WHERE p.entity IN (".getEntity('donation').")";
|
||||
$sql.= " AND fk_statut >= 2";
|
||||
if (! empty($date_start) && ! empty($date_end))
|
||||
$sql.= " AND pe.datep >= '".$db->idate($date_start)."' AND pe.datep <= '".$db->idate($date_end)."'";
|
||||
|
|
|
|||
|
|
@ -451,13 +451,14 @@ class ChargeSociales extends CommonObject
|
|||
|
||||
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param int $maxlen Longueur max libelle
|
||||
* @return string Chaine avec URL
|
||||
* Return a link to the object card (with optionaly the picto)
|
||||
*
|
||||
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
|
||||
* @param int $maxlen Max length of label
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @return string String with link
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$maxlen=0)
|
||||
function getNomUrl($withpicto=0, $maxlen=0, $notooltip=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
|
@ -466,12 +467,14 @@ class ChargeSociales extends CommonObject
|
|||
if (empty($this->ref)) $this->ref=$this->lib;
|
||||
$label = $langs->trans("ShowSocialContribution").': '.$this->ref;
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($label, 'bill', 'class="classfortooltip"').$linkend.' ');
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$link.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$linkend;
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= ($maxlen?dol_trunc($this->ref,$maxlen):$this->ref);
|
||||
$result .= $linkend;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -327,12 +327,12 @@ foreach ($search_array_options as $key => $val)
|
|||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
$mode_search=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
|
|
@ -420,8 +420,8 @@ $arrayofmassactions = array(
|
|||
// 'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
if ($user->rights->societe->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">';
|
||||
|
|
@ -435,6 +435,12 @@ print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
|
|||
|
||||
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies.png', 0, '', '', $limit);
|
||||
|
||||
$topicmail="Information";
|
||||
$modelmail="contact";
|
||||
$objecttmp=new Contact($db);
|
||||
$trackid='ctc'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
|
|
|
|||
|
|
@ -273,12 +273,12 @@ foreach ($search_array_options as $key => $val)
|
|||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
$mode_search=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
|
|
@ -366,7 +366,7 @@ if ($resql)
|
|||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->contrat->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
|
|
@ -380,15 +380,11 @@ if ($resql)
|
|||
|
||||
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, '', '', $limit);
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
$topicmail="SendContractRef";
|
||||
$modelmail="contract";
|
||||
$objecttmp=new Contrat($db);
|
||||
$trackid='con'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
|
||||
}
|
||||
$topicmail="SendContractRef";
|
||||
$modelmail="contract";
|
||||
$objecttmp=new Contrat($db);
|
||||
$trackid='con'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -253,9 +253,9 @@ foreach ($search_array_options as $key => $val)
|
|||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode_search=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
}
|
||||
|
|
@ -324,7 +324,7 @@ $arrayofmassactions = array(
|
|||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->contrat->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
//if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" action="'. $_SERVER["PHP_SELF"] .'">';
|
||||
|
|
|
|||
|
|
@ -481,6 +481,223 @@ if (! $error && $massaction == 'confirm_presend')
|
|||
}
|
||||
}
|
||||
|
||||
if ($massaction == 'confirm_createbills')
|
||||
{
|
||||
$orders = GETPOST('toselect','array');
|
||||
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
|
||||
$validate_invoices = GETPOST('valdate_invoices', 'int');
|
||||
|
||||
$TFact = array();
|
||||
$TFactThird = array();
|
||||
|
||||
$nb_bills_created = 0;
|
||||
|
||||
$db->begin();
|
||||
|
||||
foreach($orders as $id_order)
|
||||
{
|
||||
$cmd = new Commande($db);
|
||||
if ($cmd->fetch($id_order) <= 0) continue;
|
||||
|
||||
$object = new Facture($db);
|
||||
if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $object = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order.
|
||||
else {
|
||||
|
||||
$object->socid = $cmd->socid;
|
||||
$object->type = Facture::TYPE_STANDARD;
|
||||
$object->cond_reglement_id = $cmd->cond_reglement_id;
|
||||
$object->mode_reglement_id = $cmd->mode_reglement_id;
|
||||
$object->fk_project = $cmd->fk_project;
|
||||
|
||||
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
if (empty($datefacture))
|
||||
{
|
||||
$datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y"));
|
||||
}
|
||||
|
||||
$object->date = $datefacture;
|
||||
$object->origin = 'commande';
|
||||
$object->origin_id = $id_order;
|
||||
|
||||
$res = $object->create($user);
|
||||
|
||||
if($res > 0) $nb_bills_created++;
|
||||
}
|
||||
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
|
||||
$sql.= "fk_source";
|
||||
$sql.= ", sourcetype";
|
||||
$sql.= ", fk_target";
|
||||
$sql.= ", targettype";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= $id_order;
|
||||
$sql.= ", '".$object->origin."'";
|
||||
$sql.= ", ".$object->id;
|
||||
$sql.= ", '".$object->element."'";
|
||||
$sql.= ")";
|
||||
|
||||
if (! $db->query($sql))
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$lines = $cmd->lines;
|
||||
if (empty($lines) && method_exists($cmd, 'fetch_lines'))
|
||||
{
|
||||
$cmd->fetch_lines();
|
||||
$lines = $cmd->lines;
|
||||
}
|
||||
|
||||
$fk_parent_line=0;
|
||||
$num=count($lines);
|
||||
|
||||
for ($i=0;$i<$num;$i++)
|
||||
{
|
||||
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
|
||||
if ($lines[$i]->subprice < 0)
|
||||
{
|
||||
// Negative line, we create a discount line
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$discount->fk_soc=$object->socid;
|
||||
$discount->amount_ht=abs($lines[$i]->total_ht);
|
||||
$discount->amount_tva=abs($lines[$i]->total_tva);
|
||||
$discount->amount_ttc=abs($lines[$i]->total_ttc);
|
||||
$discount->tva_tx=$lines[$i]->tva_tx;
|
||||
$discount->fk_user=$user->id;
|
||||
$discount->description=$desc;
|
||||
$discountid=$discount->create($user);
|
||||
if ($discountid > 0)
|
||||
{
|
||||
$result=$object->insert_discount($discountid);
|
||||
//$result=$discount->link_to_invoice($lineid,$id);
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($discount->error, $discount->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Positive line
|
||||
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
|
||||
// Date start
|
||||
$date_start=false;
|
||||
if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue;
|
||||
if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
|
||||
if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
|
||||
//Date end
|
||||
$date_end=false;
|
||||
if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue;
|
||||
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
|
||||
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
|
||||
// Reset fk_parent_line for no child products and special product
|
||||
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9)
|
||||
{
|
||||
$fk_parent_line = 0;
|
||||
}
|
||||
$result = $object->addline(
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
$lines[$i]->qty,
|
||||
$lines[$i]->tva_tx,
|
||||
$lines[$i]->localtax1_tx,
|
||||
$lines[$i]->localtax2_tx,
|
||||
$lines[$i]->fk_product,
|
||||
$lines[$i]->remise_percent,
|
||||
$date_start,
|
||||
$date_end,
|
||||
0,
|
||||
$lines[$i]->info_bits,
|
||||
$lines[$i]->fk_remise_except,
|
||||
'HT',
|
||||
0,
|
||||
$product_type,
|
||||
$ii,
|
||||
$lines[$i]->special_code,
|
||||
$object->origin,
|
||||
$lines[$i]->rowid,
|
||||
$fk_parent_line,
|
||||
$lines[$i]->fk_fournprice,
|
||||
$lines[$i]->pa_ht,
|
||||
$lines[$i]->label
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
$lineid=$result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$lineid=0;
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
// Defined the new fk_parent_line
|
||||
if ($result > 0 && $lines[$i]->product_type == 9)
|
||||
{
|
||||
$fk_parent_line = $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module.
|
||||
|
||||
if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object;
|
||||
else $TFact[$object->id] = $object;
|
||||
}
|
||||
|
||||
// Build doc with all invoices
|
||||
$TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
|
||||
$toselect = array();
|
||||
|
||||
if (! $error && $validate_invoices)
|
||||
{
|
||||
$massaction = $action = 'builddoc';
|
||||
foreach($TAllFact as &$object)
|
||||
{
|
||||
$result = $object->validate($user);
|
||||
if ($result <= 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
break;
|
||||
}
|
||||
|
||||
$id = $object->id; // For builddoc action
|
||||
|
||||
// Fac builddoc
|
||||
$donotredirect = 1;
|
||||
$upload_dir = $conf->facture->dir_output;
|
||||
$permissioncreate=$user->rights->facture->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
}
|
||||
|
||||
$massaction = $action = 'confirm_createbills';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('BillCreated', $nb_bills_created));
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
$action='create';
|
||||
$_GET["origin"]=$_POST["origin"];
|
||||
$_GET["originid"]=$_POST["originid"];
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_search'))
|
||||
{
|
||||
if (empty($diroutputmassaction))
|
||||
|
|
@ -726,8 +943,8 @@ if (! $error && $massaction == 'validate' && $permtocreate)
|
|||
}
|
||||
}
|
||||
|
||||
// Delete records
|
||||
if (! $error && $massaction == 'delete' && $permtodelete)
|
||||
// Delete record from mass action (massaction = 'delete' for direct delete, action/confirm='delete'/'yes' with a confirmation step before)
|
||||
if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm == 'yes')) && $permtodelete)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,12 @@ else // For no ajax call
|
|||
$relativepath=$ecmdir->getRelativePath();
|
||||
$upload_dir = $rootdirfordoc.'/'.$relativepath;
|
||||
}
|
||||
if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php';
|
||||
|
||||
if (empty($url))
|
||||
{
|
||||
if (GETPOSTISSET('website')) $url=DOL_URL_ROOT.'/website/index.php';
|
||||
else $url=DOL_URL_ROOT.'/ecm/index.php';
|
||||
}
|
||||
|
||||
// Load traductions files
|
||||
$langs->loadLangs(array("ecm","companies","other"));
|
||||
|
|
@ -153,6 +158,8 @@ print '<!-- ajaxdirpreview type='.$type.' -->'."\n";
|
|||
//print '<!-- Page called with mode='.dol_escape_htmltag(isset($mode)?$mode:'').' type='.dol_escape_htmltag($type).' module='.dol_escape_htmltag($module).' url='.dol_escape_htmltag($url).' '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
|
||||
|
||||
$param=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'');
|
||||
if (! empty($website)) $param.='&website='.$website;
|
||||
if (! empty($pageid)) $param.='&pageid='.$pageid;
|
||||
|
||||
|
||||
// Dir scan
|
||||
|
|
@ -222,6 +229,12 @@ if ($type == 'directory')
|
|||
$relativepath=GETPOST('file','alpha');
|
||||
if ($relativepath && $relativepath!= '/') $relativepath.='/';
|
||||
$upload_dir = $dolibarr_main_data_root.'/'.$module.'/'.$relativepath;
|
||||
if (GETPOSTISSET('website'))
|
||||
{
|
||||
$param.='&file_manager=1';
|
||||
if (!preg_match('/website=/',$param)) $param.='&website='.urlencode(GETPOST('website','alpha'));
|
||||
if (!preg_match('/pageid=/',$param)) $param.='&pageid='.urlencode(GETPOST('pageid','int'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -255,28 +268,35 @@ if ($type == 'directory')
|
|||
|
||||
if ($module == 'medias')
|
||||
{
|
||||
$useinecm = 2;
|
||||
$modulepart='medias';
|
||||
$perm=($user->rights->websites->creer || $user->rights->emailing->creer);
|
||||
$perm=($user->rights->website->write || $user->rights->emailing->creer);
|
||||
$title='none';
|
||||
}
|
||||
else
|
||||
{
|
||||
$useinecm = 1;
|
||||
$modulepart='ecm';
|
||||
$perm=$user->rights->ecm->upload;
|
||||
$title=''; // Use default
|
||||
}
|
||||
|
||||
$formfile->list_of_documents($filearray,'',$modulepart,$param,1,$relativepath,$perm,1,$textifempty,$maxlengthname,'',$url);
|
||||
// When we show list of files for ECM files, $filearray contains file list, and directory is defined with modulepart + section into $param
|
||||
// When we show list of files for a directory, $filearray ciontains file list, and directory is defined with modulepart + $relativepath
|
||||
//var_dump("title=".$title." modulepart=".$modulepart." useinecm=".$useinecm." perm=".$perm." relativepath=".$relativepath." param=".$param." url=".$url);
|
||||
$formfile->list_of_documents($filearray, '', $modulepart, $param, 1, $relativepath, $perm, $useinecm, $textifempty, $maxlengthname, $title, $url, 0, $perm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($section)
|
||||
{
|
||||
//if ($section)
|
||||
//{
|
||||
$useajax=1;
|
||||
if (! empty($conf->dol_use_jmobile)) $useajax=0;
|
||||
if (empty($conf->use_javascript_ajax)) $useajax=0;
|
||||
if (! empty($conf->global->MAIN_ECM_DISABLE_JS)) $useajax=0;
|
||||
|
||||
$param.=($param?'?':'').(preg_replace('/^&/','',$param));
|
||||
//$param.=($param?'?':'').(preg_replace('/^&/','',$param));
|
||||
|
||||
if ($useajax || $action == 'delete')
|
||||
{
|
||||
|
|
@ -295,14 +315,14 @@ if ($section)
|
|||
|
||||
if ($useajax)
|
||||
{
|
||||
// Enable jquery handlers on new generated HTML objects
|
||||
// Enable jquery handlers button to delete files
|
||||
print '<script type="text/javascript">'."\n";
|
||||
print 'jQuery(document).ready(function() {'."\n";
|
||||
print 'jQuery(".deletefilelink").click(function(e) { jQuery("#urlfile").val(jQuery(this).attr("rel")); jQuery("#dialog-confirm-deletefile").dialog("open"); return false; });'."\n";
|
||||
print 'jQuery(".deletefilelink").click(function(e) { console.log("We click on button with class deletefilelink"); jQuery("#urlfile").val(jQuery(this).attr("rel")); jQuery("#dialog-confirm-deletefile").dialog("open"); return false; });'."\n";
|
||||
print '});'."\n";
|
||||
print '</script>'."\n";
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
// Close db if mode is not noajax
|
||||
if ((! isset($mode) || $mode != 'noajax') && is_object($db)) $db->close();
|
||||
|
|
|
|||
|
|
@ -231,24 +231,18 @@ if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE
|
|||
}
|
||||
|
||||
// Enable jquery handlers on new generated HTML objects
|
||||
print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
|
||||
// Because the content is reloaded by ajax call, we must also reenable some jquery hooks
|
||||
print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip (reload into ajaxdirtree) -->\n";
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
jQuery(".classfortooltip").tooltip({
|
||||
show: { collision: "flipfit", effect:\'toggle\', delay:50 },
|
||||
hide: { effect:\'toggle\', delay: 50 },
|
||||
hide: { delay: 50 }, /* If I enable effect:\'toggle\' here, a bug appears: the tooltip is shown when collpasing a new dir if it was shown before */
|
||||
tooltipClass: "mytooltip",
|
||||
content: function () {
|
||||
return $(this).prop(\'title\'); /* To force to get title as is */
|
||||
}
|
||||
});
|
||||
|
||||
/* TODO Remove this. Is replaced with function as 3rd parameter of fileTree */
|
||||
jQuery(".fmdirlia").click(function(e) {
|
||||
id=jQuery(this).attr(\'id\').substr(12);
|
||||
jQuery("#formuserfile_section_dir").val(jQuery(this).attr(\'rel\'));
|
||||
jQuery("#formuserfile_section_id").val(id);
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
|
|
|||
|
|
@ -63,9 +63,9 @@ if ((isset($_POST['roworder']) && ! empty($_POST['roworder'])) && (isset($_POST[
|
|||
$row->table_element_line = $table_element_line;
|
||||
$row->fk_element = $fk_element;
|
||||
$row->id = $element_id;
|
||||
$row->line_ajaxorder($newrowordertab);
|
||||
$row->line_ajaxorder($newrowordertab); // This update field rank or position in table table_element_line
|
||||
|
||||
// Reorder line to have position of chilren lines sharing same counter than parent lines
|
||||
// Reorder line to have position of children lines sharing same counter than parent lines
|
||||
// This should be useless because there is no need to have children sharing same counter than parent, but well, it's cleaner into database.
|
||||
if (in_array($fk_element,array('fk_facture','fk_propal','fk_commande')))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -188,6 +188,8 @@ class box_activity extends ModeleBoxes
|
|||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$commandestatic=new Commande($db);
|
||||
|
||||
$langs->load("orders");
|
||||
|
||||
$cachedir = DOL_DATA_ROOT.'/commande/temp';
|
||||
$filename = '/boxactivity-order'.$fileid;
|
||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class box_external_rss extends ModeleBoxes
|
|||
|
||||
$keyforparamurl="EXTERNAL_RSS_URLRSS_".$site;
|
||||
$keyforparamtitle="EXTERNAL_RSS_TITLE_".$site;
|
||||
|
||||
|
||||
// Get RSS feed
|
||||
$url=$conf->global->$keyforparamurl;
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ class box_external_rss extends ModeleBoxes
|
|||
'text' => $title,
|
||||
'sublink' => $link,
|
||||
'subtext'=>$langs->trans("LastRefreshDate").': '.($rssparser->getLastFetchDate()?dol_print_date($rssparser->getLastFetchDate(),"dayhourtext"):$langs->trans("Unknown")),
|
||||
'subpicto'=>'object_bookmark',
|
||||
'subpicto'=>'help',
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ class box_factures_fourn extends ModeleBoxes
|
|||
$datelimite=$db->jdate($objp->datelimite);
|
||||
$date=$db->jdate($objp->df);
|
||||
$datem=$db->jdate($objp->tms);
|
||||
|
||||
$facturestatic->id = $objp->facid;
|
||||
$facturestatic->ref = $objp->ref;
|
||||
$facturestatic->total_ht = $objp->total_ht;
|
||||
|
|
@ -124,6 +125,8 @@ class box_factures_fourn extends ModeleBoxes
|
|||
$facturestatic->total_ttc = $objp->total_ttc;
|
||||
$facturestatic->date_echeance = $datelimite;
|
||||
$facturestatic->statut = $objp->fk_statut;
|
||||
$facturestatic->ref_supplier = $objp->ref_supplier;
|
||||
|
||||
$thirdpartytmp->id = $objp->socid;
|
||||
$thirdpartytmp->name = $objp->name;
|
||||
$thirdpartytmp->fournisseur = 1;
|
||||
|
|
|
|||
|
|
@ -108,27 +108,25 @@ class box_ficheinter extends ModeleBoxes
|
|||
|
||||
$ficheinterstatic->statut=$objp->fk_statut;
|
||||
$ficheinterstatic->id=$objp->rowid;
|
||||
$ficheinterstatic->ref=$objp->ref;
|
||||
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'url' => DOL_URL_ROOT."/fichinter/card.php?id=".$objp->rowid);
|
||||
$this->info_box_contents[$i][] = array('td' => '',
|
||||
'text' => $ficheinterstatic->getNomUrl(1),
|
||||
'asis' => 1
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('td' => '',
|
||||
'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some interventions have no ref
|
||||
'url' => DOL_URL_ROOT."/fichinter/card.php?id=".$objp->rowid);
|
||||
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"',
|
||||
$this->info_box_contents[$i][] = array('td' => 'align="left" width="16"',
|
||||
'logo' => 'company',
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
|
||||
|
||||
$this->info_box_contents[$i][3] = array('td' => '',
|
||||
$this->info_box_contents[$i][] = array('td' => '',
|
||||
'text' => dol_trunc($objp->name,40),
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
|
||||
|
||||
$this->info_box_contents[$i][4] = array('td' => 'class="right"',
|
||||
$this->info_box_contents[$i][] = array('td' => 'class="right"',
|
||||
'text' => dol_print_date($datec,'day'));
|
||||
|
||||
$this->info_box_contents[$i][5] = array('td' => 'align="right" class="nowrap"',
|
||||
$this->info_box_contents[$i][] = array('td' => 'align="right" class="nowrap"',
|
||||
'text' => $ficheinterstatic->getLibStatut(6),
|
||||
'asis'=>1
|
||||
);
|
||||
|
|
@ -136,20 +134,20 @@ class box_ficheinter extends ModeleBoxes
|
|||
$i++;
|
||||
}
|
||||
|
||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInterventions"));
|
||||
if ($num==0) $this->info_box_contents[$i][] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInterventions"));
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->info_box_contents[0][0] = array( 'td' => '',
|
||||
$this->info_box_contents[0][] = array( 'td' => '',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->info_box_contents[0][0] = array(
|
||||
$this->info_box_contents[0][] = array(
|
||||
'td' => 'align="left" class="nohover opacitymedium"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed")
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
|
|
@ -109,6 +109,7 @@ class box_members extends ModeleBoxes
|
|||
$memberstatic->firstname=$objp->firstname;
|
||||
$memberstatic->id = $objp->rowid;
|
||||
$memberstatic->ref = $objp->rowid;
|
||||
$memberstatic->company = $objp->company;
|
||||
|
||||
if (! empty($objp->fk_soc)) {
|
||||
$memberstatic->socid = $objp->fk_soc;
|
||||
|
|
@ -126,7 +127,7 @@ class box_members extends ModeleBoxes
|
|||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => '',
|
||||
'text' => $memberstatic->getFullName($langs),
|
||||
'text' => $memberstatic->company,
|
||||
'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid,
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -110,22 +110,18 @@ class box_project extends ModeleBoxes
|
|||
while ($i < min($num, $max)) {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$tooltip = $langs->trans('Project') . ': ' . $objp->ref;
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => 'object_project'.($objp->public?'pub':''),
|
||||
'tooltip' => $tooltip,
|
||||
'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid,
|
||||
);
|
||||
$projectstatic->id = $objp->rowid;
|
||||
$projectstatic->ref = $objp->ref;
|
||||
$projectstatic->title = $objp->title;
|
||||
$projectstatic->public = $objp->public;
|
||||
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => '',
|
||||
'text' => $objp->ref,
|
||||
'tooltip' => $tooltip,
|
||||
'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid,
|
||||
'text' => $projectstatic->getNomUrl(1),
|
||||
'asis' => 1
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => '',
|
||||
'text' => $objp->title,
|
||||
);
|
||||
|
|
@ -137,28 +133,28 @@ class box_project extends ModeleBoxes
|
|||
$resultTask = $db->query($sql);
|
||||
if ($resultTask) {
|
||||
$objTask = $db->fetch_object($resultTask);
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $objTask->nb." ".$langs->trans("Tasks"),
|
||||
);
|
||||
if ($objTask->nb > 0)
|
||||
$this->info_box_contents[$i][4] = array(
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => round($objTask->totprogress/$objTask->nb, 0)."%",
|
||||
);
|
||||
else
|
||||
$this->info_box_contents[$i][4] = array('td' => 'class="right"', 'text' => "N/A ");
|
||||
$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A ");
|
||||
$totalnbTask += $objTask->nb;
|
||||
} else {
|
||||
$this->info_box_contents[$i][3] = array('td' => 'class="right"', 'text' => round(0));
|
||||
$this->info_box_contents[$i][4] = array('td' => 'class="right"', 'text' => "N/A ");
|
||||
$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => round(0));
|
||||
$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A ");
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
if ($max < $num)
|
||||
{
|
||||
$this->info_box_contents[$i][0] = array('td' => 'colspan="5"', 'text' => '...');
|
||||
$this->info_box_contents[$i][] = array('td' => 'colspan="5"', 'text' => '...');
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
|
@ -166,25 +162,20 @@ class box_project extends ModeleBoxes
|
|||
|
||||
|
||||
// Add the sum à the bottom of the boxes
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
'tr' => 'class="liste_total"',
|
||||
'td' => 'align="left" ',
|
||||
'text' => " ",
|
||||
);
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => '',
|
||||
'text' => $langs->trans("Total")." ".$textHead,
|
||||
'text' => " ",
|
||||
);
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'align="right" ',
|
||||
'text' => round($num, 0)." ".$langs->trans("Projects"),
|
||||
);
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'align="right" ',
|
||||
'text' => (($max < $num) ? '' : (round($totalnbTask, 0)." ".$langs->trans("Tasks"))),
|
||||
);
|
||||
$this->info_box_contents[$i][4] = array(
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => '',
|
||||
'text' => " ",
|
||||
);
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@ class box_services_expired extends ModeleBoxes
|
|||
|
||||
$this->max=$max;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxLastExpiredServices",$max));
|
||||
|
|
@ -77,7 +79,7 @@ class box_services_expired extends ModeleBoxes
|
|||
{
|
||||
// Select contracts with at least one expired service
|
||||
$sql = "SELECT ";
|
||||
$sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat,";
|
||||
$sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.ref_customer, c.ref_supplier,";
|
||||
$sql.= " s.nom as name, s.rowid as socid,";
|
||||
$sql.= " MIN(cd.date_fin_validite) as date_line, COUNT(cd.rowid) as nb_services";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe s, ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
|
|
@ -87,7 +89,7 @@ class box_services_expired extends ModeleBoxes
|
|||
$sql.= " AND c.fk_soc=s.rowid AND cd.fk_contrat=c.rowid AND c.statut > 0";
|
||||
if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id;
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$sql.= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, s.nom, s.rowid";
|
||||
$sql.= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, c.ref_customer, c.ref_supplier, s.nom, s.rowid";
|
||||
$sql.= " ORDER BY date_line ASC";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
|
|
@ -99,6 +101,7 @@ class box_services_expired extends ModeleBoxes
|
|||
$i = 0;
|
||||
|
||||
$thirdpartytmp = new Societe($this->db);
|
||||
$contract = new Contrat($this->db);
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
|
|
@ -106,30 +109,33 @@ class box_services_expired extends ModeleBoxes
|
|||
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$dateline=$db->jdate($objp->date_line);
|
||||
if (($dateline + $conf->contrat->services->expires->warning_delay) < $now) $late=img_warning($langs->trans("Late"));
|
||||
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('td' => '',
|
||||
'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref
|
||||
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid);
|
||||
|
||||
$thirdpartytmp->id = $objp->socid;
|
||||
$thirdpartytmp->name = $objp->name;
|
||||
|
||||
$this->info_box_contents[$i][2] = array('td' => 'class="tdoverflowmax100 maxwidth100onsmartphone" align="left"',
|
||||
$contract->id = $objp->rowid;
|
||||
$contract->ref = $objp->ref;
|
||||
$contract->statut = $objp->fk_statut;
|
||||
$contract->ref_customer = $objp->ref_customer;
|
||||
$contract->ref_supplier = $objp->ref_supplier;
|
||||
|
||||
$dateline=$db->jdate($objp->date_line);
|
||||
if (($dateline + $conf->contrat->services->expires->warning_delay) < $now) $late=img_warning($langs->trans("Late"));
|
||||
|
||||
$this->info_box_contents[$i][] = array('td' => '',
|
||||
'text' => $contract->getNomUrl(1),
|
||||
'asis' => 1
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][] = array('td' => 'class="tdoverflowmax100 maxwidth100onsmartphone" align="left"',
|
||||
'text' => $thirdpartytmp->getNomUrl(1, 'customer'),
|
||||
'asis' => 1
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][4] = array('td' => 'align="center"',
|
||||
$this->info_box_contents[$i][] = array('td' => 'align="center"',
|
||||
'text' => dol_print_date($dateline,'day'),
|
||||
'text2'=> $late);
|
||||
|
||||
$this->info_box_contents[$i][5] = array('td' => 'class="right"',
|
||||
$this->info_box_contents[$i][] = array('td' => 'class="right"',
|
||||
'text' => $objp->nb_services);
|
||||
|
||||
|
||||
|
|
@ -139,14 +145,14 @@ class box_services_expired extends ModeleBoxes
|
|||
if ($num==0)
|
||||
{
|
||||
$langs->load("contracts");
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoExpiredServices"));
|
||||
$this->info_box_contents[$i][] = array('td' => 'align="center"','text'=>$langs->trans("NoExpiredServices"));
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->info_box_contents[0][0] = array( 'td' => '',
|
||||
$this->info_box_contents[0][] = array( 'td' => '',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,28 +109,20 @@ class box_supplier_orders extends ModeleBoxes
|
|||
$objp = $db->fetch_object($result);
|
||||
$date=$db->jdate($objp->date_commande);
|
||||
$datem=$db->jdate($objp->tms);
|
||||
$thirdpartytmp->id = $objp->socid;
|
||||
|
||||
$supplierorderstatic->id = $objp->id;
|
||||
$supplierorderstatic->ref = $objp->ref;
|
||||
|
||||
$thirdpartytmp->id = $objp->socid;
|
||||
$thirdpartytmp->name = $objp->name;
|
||||
$thirdpartytmp->fournisseur = 1;
|
||||
$thirdpartytmp->code_fournisseur = $objp->code_fournisseur;
|
||||
$thirdpartytmp->logo = $objp->logo;
|
||||
|
||||
$urlo = DOL_URL_ROOT."/fourn/commande/card.php?id=".$objp->rowid;
|
||||
$urls = DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid;
|
||||
|
||||
$tooltip = $langs->trans('SupplierOrder') . ': ' . $objp->ref;
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'tooltip' => $tooltip,
|
||||
'url' => $urlo,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => '',
|
||||
'text' => $objp->ref,
|
||||
'tooltip' => $tooltip,
|
||||
'url' => $urlo,
|
||||
'text' => $supplierorderstatic->getNomUrl(1),
|
||||
'asis' => 1
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
|
@ -158,14 +150,14 @@ class box_supplier_orders extends ModeleBoxes
|
|||
}
|
||||
|
||||
if ($num == 0)
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="center"',
|
||||
'text' => $langs->trans("NoSupplierOrder"),
|
||||
);
|
||||
|
||||
$db->free($result);
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
$this->info_box_contents[0][] = array(
|
||||
'td' => '',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql),
|
||||
|
|
@ -174,7 +166,7 @@ class box_supplier_orders extends ModeleBoxes
|
|||
}
|
||||
else
|
||||
{
|
||||
$this->info_box_contents[0][0] = array(
|
||||
$this->info_box_contents[0][] = array(
|
||||
'td' => 'align="left" class="nohover opacitymedium"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed")
|
||||
);
|
||||
|
|
|
|||
|
|
@ -231,6 +231,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
|||
$nblines=count($contents);
|
||||
|
||||
$out.= "\n<!-- Box ".get_class($this)." start -->\n";
|
||||
//$out.= '<div class="div-table-responsive-no-min">'; // Does not work on home page. TODO Try to fix this.
|
||||
$out.= '<div class="box" id="boxto_'.$this->box_id.'">'."\n";
|
||||
|
||||
if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines)
|
||||
|
|
@ -360,6 +361,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
|||
if (empty($head['text']) && empty($head['sublink']) && empty($head['subpicto']) && ! $nblines) $out.= "<br>\n";
|
||||
|
||||
$out.= "</div>\n";
|
||||
//$out.= "</div>\n";
|
||||
$out.= "<!-- Box ".get_class($this)." end -->\n\n";
|
||||
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||
dol_filecache($cachedir, $filename, $out);
|
||||
|
|
|
|||
|
|
@ -3504,9 +3504,9 @@ abstract class CommonObject
|
|||
// Description
|
||||
print '<td class="linecoldescription">'.$langs->trans('Description').'</td>';
|
||||
|
||||
if ($this->element == 'supplier_proposal')
|
||||
if ($this->element == 'supplier_proposal' || $this->element == 'order_supplier' || $this->element == 'invoice_supplier')
|
||||
{
|
||||
print '<td class="linerefsupplier" align="right"><span id="title_fourn_ref">'.$langs->trans("SupplierProposalRefFourn").'</span></td>';
|
||||
print '<td class="linerefsupplier"><span id="title_fourn_ref">'.$langs->trans("SupplierProposalRefFourn").'</span></td>';
|
||||
}
|
||||
|
||||
// VAT
|
||||
|
|
@ -5620,7 +5620,7 @@ abstract class CommonObject
|
|||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
if (empty($extrafields->attribute_list[$key])) continue; // 0 = Never visible field
|
||||
if (($mode == 'create' || $mode == 'edit') && abs($extrafields->attribute_list[$key]) != 1) continue; // <> -1 and <> 1 = not visible on forms, only on list
|
||||
if (($mode == 'create' || $mode == 'edit') && abs($extrafields->attribute_list[$key]) != 1 && abs($extrafields->attribute_list[$key]) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
|
||||
|
||||
// Load language if required
|
||||
if (! empty($extrafields->attributes[$this->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]);
|
||||
|
|
@ -6173,15 +6173,23 @@ abstract class CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
if (! $error && ! $notrigger) {
|
||||
if (! $error)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
||||
}
|
||||
|
||||
if (!$notrigger) {
|
||||
// Call triggers
|
||||
$result=$this->call_trigger(strtoupper(get_class($this)).'_CREATE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call triggers
|
||||
$result=$this->call_trigger(strtoupper(get_class($this)).'_CREATE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
|
|
|
|||
|
|
@ -689,18 +689,19 @@ class Form
|
|||
if (empty($row['favorite']) && $atleastonefavorite)
|
||||
{
|
||||
$atleastonefavorite=0;
|
||||
$out.= '<option value="" disabled class="selectoptiondisabledwhite">----------------------</option>';
|
||||
$out.= '<option a value="" disabled class="selectoptiondisabledwhite">----------------------</option>';
|
||||
}
|
||||
if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label']) )
|
||||
{
|
||||
$foundselected=true;
|
||||
$out.= '<option value="'.($usecodeaskey?($usecodeaskey=='code2'?$row['code_iso']:$row['code_iso3']):$row['rowid']).'" selected>';
|
||||
$out.= '<option b value="'.($usecodeaskey?($usecodeaskey=='code2'?$row['code_iso']:$row['code_iso3']):$row['rowid']).'" selected>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= '<option value="'.($usecodeaskey?($usecodeaskey=='code2'?$row['code_iso']:$row['code_iso3']):$row['rowid']).'">';
|
||||
$out.= '<option c value="'.($usecodeaskey?($usecodeaskey=='code2'?$row['code_iso']:$row['code_iso3']):$row['rowid']).'">';
|
||||
}
|
||||
$out.= dol_trunc($row['label'],$maxlength,'middle');
|
||||
if ($row['label']) $out.= dol_trunc($row['label'],$maxlength,'middle');
|
||||
else $out.= ' ';
|
||||
if ($row['code_iso']) $out.= ' ('.$row['code_iso'] . ')';
|
||||
$out.= '</option>';
|
||||
}
|
||||
|
|
@ -1330,7 +1331,7 @@ class Form
|
|||
}
|
||||
|
||||
if ($htmlname != 'none' || $options_only) $out.= '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
if ($showempty == 1) $out.= '<option value="0"'.($selected=='0'?' selected':'').'></option>';
|
||||
if ($showempty == 1) $out.= '<option value="0"'.($selected=='0'?' selected':'').'> </option>';
|
||||
if ($showempty == 2) $out.= '<option value="0"'.($selected=='0'?' selected':'').'>'.$langs->trans("Internal").'</option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
|
@ -3551,9 +3552,10 @@ class Form
|
|||
* @param int $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx
|
||||
* @param int $height Force height of box
|
||||
* @param int $width Force width of box ('999' or '90%'). Ignored and forced to 90% on smartphones.
|
||||
* @param int $disableformtag 1=Disable form tag. Can be used if we are already inside a <form> section.
|
||||
* @return string HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form
|
||||
*/
|
||||
function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=200, $width=500)
|
||||
function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice='', $useajax=0, $height=200, $width=500, $disableformtag=0)
|
||||
{
|
||||
global $langs,$conf;
|
||||
global $useglobalvars;
|
||||
|
|
@ -3782,9 +3784,10 @@ class Form
|
|||
{
|
||||
$formconfirm.= "\n<!-- begin form_confirm page=".$page." -->\n";
|
||||
|
||||
$formconfirm.= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n";
|
||||
if (empty($disableformtag)) $formconfirm.= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n";
|
||||
|
||||
$formconfirm.= '<input type="hidden" name="action" value="'.$action.'">'."\n";
|
||||
$formconfirm.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
||||
if (empty($disableformtag)) $formconfirm.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
||||
|
||||
$formconfirm.= '<table width="100%" class="valid">'."\n";
|
||||
|
||||
|
|
@ -3810,7 +3813,7 @@ class Form
|
|||
|
||||
$formconfirm.= '</table>'."\n";
|
||||
|
||||
$formconfirm.= "</form>\n";
|
||||
if (empty($disableformtag)) $formconfirm.= "</form>\n";
|
||||
$formconfirm.= '<br>';
|
||||
|
||||
$formconfirm.= "<!-- end form_confirm -->\n";
|
||||
|
|
@ -5508,7 +5511,7 @@ class Form
|
|||
cache: true
|
||||
},
|
||||
language: select2arrayoflanguage,
|
||||
containerCssClass: \':all:\', /* Line to add class or origin SELECT propagated to the new <span class="select2-selection...> tag */
|
||||
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
||||
placeholder: "'.dol_escape_js($placeholder).'",
|
||||
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
|
||||
minimumInputLength: '.$minimumInputLength.',
|
||||
|
|
|
|||
|
|
@ -582,7 +582,6 @@ class FormCompany
|
|||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
$("#search_'.$htmlname.'").change(function() {
|
||||
console.log("Call runJsCodeForEvent'.$htmlname.'");
|
||||
var obj = '.json_encode($events).';
|
||||
$.each(obj, function(key,values) {
|
||||
if (values.method.length) {
|
||||
|
|
@ -599,6 +598,7 @@ class FormCompany
|
|||
var method = obj.method;
|
||||
var url = obj.url;
|
||||
var htmlname = obj.htmlname;
|
||||
console.log("Run runJsCodeForEvent-'.$htmlname.' from selectCompaniesForNewContact id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname);
|
||||
$.getJSON(url,
|
||||
{
|
||||
action: method,
|
||||
|
|
@ -608,6 +608,7 @@ class FormCompany
|
|||
function(response) {
|
||||
if (response != null)
|
||||
{
|
||||
console.log("Change select#"+htmlname+" with content "+response.value)
|
||||
$.each(obj.params, function(key,action) {
|
||||
if (key.length) {
|
||||
var num = response.num;
|
||||
|
|
@ -618,7 +619,6 @@ class FormCompany
|
|||
}
|
||||
}
|
||||
});
|
||||
/* console.log("Change select#"+htmlname+" with content "+response.value) */
|
||||
$("select#" + htmlname).html(response.value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -713,14 +713,14 @@ class FormFile
|
|||
|
||||
// Show file name with link to download
|
||||
$out.= '<td class="tdoverflowmax300">';
|
||||
$tmp = $this->showPreview($file,$modulepart,$relativepath,0,$param);
|
||||
$out.= ($tmp?$tmp.' ':'');
|
||||
$out.= '<a class="documentdownload" href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($relativepath).($param?'&'.$param:'').'"';
|
||||
$out.= '<a class="documentdownload paddingright" href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($relativepath).($param?'&'.$param:'').'"';
|
||||
$mime=dol_mimetype($relativepath,'',0);
|
||||
if (preg_match('/text/',$mime)) $out.= ' target="_blank"';
|
||||
$out.= ' target="_blank">';
|
||||
$out.= img_mime($file["name"],$langs->trans("File").': '.$file["name"]).' '.$file["name"];
|
||||
$out.= img_mime($file["name"],$langs->trans("File").': '.$file["name"]);
|
||||
$out.= $file["name"];
|
||||
$out.= '</a>'."\n";
|
||||
$out.= $this->showPreview($file,$modulepart,$relativepath,0,$param);
|
||||
$out.= '</td>';
|
||||
|
||||
// Show file size
|
||||
|
|
@ -741,12 +741,11 @@ class FormFile
|
|||
//$out.= '&modulepart='.$modulepart; // TODO obsolete ?
|
||||
//$out.= '&urlsource='.urlencode($urlsource); // TODO obsolete ?
|
||||
$out.= '">'.img_picto($langs->trans("Delete"), 'delete.png').'</a>';
|
||||
//$out.='</td>';
|
||||
}
|
||||
if ($printer)
|
||||
{
|
||||
//$out.= '<td align="right">';
|
||||
$out.= ' <a href="'.$urlsource.(strpos($urlsource,'?')?'&':'?').'action=print_file&printer='.$modulepart.'&file='.urlencode($relativepath);
|
||||
$out.= '<a class="paddingleft" href="'.$urlsource.(strpos($urlsource,'?')?'&':'?').'action=print_file&printer='.$modulepart.'&file='.urlencode($relativepath);
|
||||
$out.= ($param?'&'.$param:'');
|
||||
$out.= '">'.img_picto($langs->trans("PrintFile", $relativepath),'printer.png').'</a>';
|
||||
}
|
||||
|
|
@ -841,21 +840,24 @@ class FormFile
|
|||
|
||||
$file_list=dol_dir_list($filedir, 'files', 0, $filterforfilesearch, '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files)
|
||||
|
||||
//var_dump($file_list);
|
||||
// For ajax treatment
|
||||
$out.= '<!-- html.formfile::getDocumentsLink -->'."\n";
|
||||
if (! empty($file_list))
|
||||
{
|
||||
$out='<dl class="dropdown inline-block">
|
||||
<dt><a data-ajax="false" href="#" onClick="return false;">'.img_picto('', 'listlight').'</a></dt>
|
||||
<dt><a data-ajax="false" href="#" onClick="return false;">'.img_picto('', 'listlight', '', 0, 0, 0, '', 'valignbottom').'</a></dt>
|
||||
<dd><div class="multichoicedoc" style="position:absolute;left:100px;" ><ul class="ulselectedfields" style="display: none;">';
|
||||
$tmpout='';
|
||||
|
||||
// Loop on each file found
|
||||
$found=0;
|
||||
foreach($file_list as $file)
|
||||
{
|
||||
$i++;
|
||||
if ($filter && ! preg_match('/'.$filter.'/i', $file["name"])) continue; // Discard this. It does not match provided filter.
|
||||
|
||||
$found++;
|
||||
// Define relative path for download link (depends on module)
|
||||
$relativepath=$file["name"]; // Cas general
|
||||
if ($modulesubdir) $relativepath=$modulesubdir."/".$file["name"]; // Cas propal, facture...
|
||||
|
|
@ -877,21 +879,29 @@ class FormFile
|
|||
if (! empty($conf->use_javascript_ajax) && ($conf->browser->layout != 'phone'))
|
||||
{
|
||||
$tmparray = getAdvancedPreviewUrl($modulepart, $relativepath, 1, '&entity='.$entity);
|
||||
if ($tmparray && $tmparray['url']) $tmpout.= '<li><a href="'.$tmparray['url'].'"'.($tmparray['css']?' class="'.$tmparray['css'].'"':'').($tmparray['mime']?' mime="'.$tmparray['mime'].'"':'').($tmparray['target']?' target="'.$tmparray['target'].'"':'').'>'.img_picto('','detail').' '.$langs->trans("Preview").' '.$ext.'</a></li>';
|
||||
if ($tmparray && $tmparray['url'])
|
||||
{
|
||||
$tmpout.= '<li><a href="'.$tmparray['url'].'"'.($tmparray['css']?' class="'.$tmparray['css'].'"':'').($tmparray['mime']?' mime="'.$tmparray['mime'].'"':'').($tmparray['target']?' target="'.$tmparray['target'].'"':'').'>';
|
||||
//$tmpout.= img_picto('','detail');
|
||||
$tmpout.= '<i class="fa fa-search-plus paddingright" style="color: gray"></i>';
|
||||
$tmpout.= $langs->trans("Preview").' '.$ext.'</a></li>';
|
||||
}
|
||||
}
|
||||
|
||||
// Download
|
||||
$tmpout.= '<li><a class="pictopreview" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
||||
$tmpout.= '<li class="nowrap"><a class="pictopreview nowrap" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
||||
$mime=dol_mimetype($relativepath,'',0);
|
||||
if (preg_match('/text/',$mime)) $tmpout.= ' target="_blank"';
|
||||
$tmpout.= '>';
|
||||
$tmpout.=img_mime($relativepath, $file["name"]).' ';
|
||||
$tmpout.= img_mime($relativepath, $file["name"]);
|
||||
$tmpout.= $langs->trans("Download").' '.$ext;
|
||||
$tmpout.= '</a></li>'."\n";
|
||||
}
|
||||
$out.=$tmpout;
|
||||
$out.='</ul></div></dd>
|
||||
</dl>';
|
||||
|
||||
if (! $found) $out='';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -914,10 +924,13 @@ class FormFile
|
|||
* @param int $forcedownload Force to open dialog box "Save As" when clicking on file.
|
||||
* @param string $relativepath Relative path of docs (autodefined if not provided), relative to module dir, not to MAIN_DATA_ROOT.
|
||||
* @param int $permonobject Permission on object (so permission to delete or crop document)
|
||||
* @param int $useinecm Change output for use in ecm module
|
||||
* @param int $useinecm Change output for use in ecm module:
|
||||
* 0: Add a previw link. Show also rename and crop file
|
||||
* 1: Add link to edit ECM entry
|
||||
* 2: Add rename and crop file
|
||||
* @param string $textifempty Text to show if filearray is empty ('NoFileFound' if not defined)
|
||||
* @param int $maxlength Maximum length of file name shown.
|
||||
* @param string $title Title before list
|
||||
* @param string $title Title before list. Use 'none' to disable title.
|
||||
* @param string $url Full url to use for click links ('' = autodetect)
|
||||
* @param int $showrelpart 0=Show only filename (default), 1=Show first level 1 dir
|
||||
* @param int $permtoeditline Permission to edit document line (You must provide a value, -1 is deprecated and must not be used any more)
|
||||
|
|
@ -977,7 +990,9 @@ class FormFile
|
|||
}
|
||||
else
|
||||
{
|
||||
$param = (isset($object->id)?'&id='.$object->id:'').$param;
|
||||
if (! preg_match('/&id=/', $param) && isset($object->id)) $param.='&id='.$object->id;
|
||||
$relativepathwihtoutslashend=preg_replace('/\/$/', '', $relativepath);
|
||||
if ($relativepathwihtoutslashend) $param.= '&file='.urlencode($relativepathwihtoutslashend);
|
||||
|
||||
if ($permtoeditline < 0) // Old behaviour for backward compatibility. New feature should call method with value 0 or 1
|
||||
{
|
||||
|
|
@ -995,7 +1010,7 @@ class FormFile
|
|||
}
|
||||
|
||||
// Show list of existing files
|
||||
if (empty($useinecm)) print load_fiche_titre($title?$title:$langs->trans("AttachedFiles"));
|
||||
if (empty($useinecm) && $title != 'none') print load_fiche_titre($title?$title:$langs->trans("AttachedFiles"));
|
||||
if (empty($url)) $url=$_SERVER["PHP_SELF"];
|
||||
|
||||
print '<!-- html.formfile::list_of_documents -->'."\n";
|
||||
|
|
@ -1023,6 +1038,7 @@ class FormFile
|
|||
}
|
||||
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
//print $url.' sortfield='.$sortfield.' sortorder='.$sortorder;
|
||||
print_liste_field_titre('Documents2',$url,"name","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('Size',$url,"size","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('Date',$url,"date","",$param,'align="center"',$sortfield,$sortorder);
|
||||
|
|
@ -1036,10 +1052,10 @@ class FormFile
|
|||
{
|
||||
completeFileArrayWithDatabaseInfo($filearray, $relativedir);
|
||||
|
||||
/*var_dump($sortfield);
|
||||
var_dump($sortorder);*/
|
||||
if ($sortfield && $sortorder)
|
||||
//var_dump($sortfield.' - '.$sortorder);
|
||||
if ($sortfield && $sortorder) // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
|
||||
{
|
||||
//var_dump($sortfield);
|
||||
$filearray=dol_sort_array($filearray, $sortfield, $sortorder);
|
||||
}
|
||||
//var_dump($filearray);
|
||||
|
|
@ -1056,6 +1072,7 @@ class FormFile
|
|||
&& ! preg_match('/\.meta$/i',$file['name']))
|
||||
{
|
||||
if ($filearray[$key]['rowid'] > 0) $lastrowid = $filearray[$key]['rowid'];
|
||||
$filepath=$relativepath.$file['name'];
|
||||
|
||||
$editline=0;
|
||||
$nboflines++;
|
||||
|
|
@ -1065,18 +1082,14 @@ class FormFile
|
|||
print '<tr id="row-'.($filearray[$key]['rowid']>0?$filearray[$key]['rowid']:'-AFTER'.$lastrowid.'POS'.($i+1)).'" '.$bcdd[$var].'>';
|
||||
print '<td class="tdoverflowmax300">';
|
||||
|
||||
$filepath=$relativepath.$file['name'];
|
||||
|
||||
if (! $editline) print $this->showPreview($file,$modulepart,$filepath);
|
||||
|
||||
// Show file name with link to download
|
||||
//print "XX".$file['name']; //$file['name'] must be utf8
|
||||
print '<a class="paddingleft" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
|
||||
print '<a class="paddingright" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
|
||||
if ($forcedownload) print '&attachment=1';
|
||||
if (! empty($object->entity)) print '&entity='.$object->entity;
|
||||
print '&file='.urlencode($filepath);
|
||||
print '">';
|
||||
|
||||
print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' ';
|
||||
print img_mime($file['name'], $file['name'].' ('.dol_print_size($file['size'],0,0).')', 'inline-block valignbottom paddingright');
|
||||
if ($showrelpart == 1) print $relativepath;
|
||||
//print dol_trunc($file['name'],$maxlength,'middle');
|
||||
if (GETPOST('action','aZ09') == 'editfile' && $file['name'] == basename(GETPOST('urlfile')))
|
||||
|
|
@ -1091,6 +1104,7 @@ class FormFile
|
|||
print $file['name'];
|
||||
print '</a>';
|
||||
}
|
||||
if (! $editline) print $this->showPreview($file, $modulepart, $filepath);
|
||||
|
||||
print "</td>\n";
|
||||
|
||||
|
|
@ -1122,18 +1136,18 @@ class FormFile
|
|||
{
|
||||
// Delete or view link
|
||||
// ($param must start with &)
|
||||
print '<td class="valignmiddle right"><!-- action on files -->';
|
||||
if ($useinecm)
|
||||
print '<td class="valignmiddle right actionbuttons"><!-- action on files -->';
|
||||
if ($useinecm == 1)
|
||||
{
|
||||
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>';
|
||||
}
|
||||
else
|
||||
if (! $useinecm || $useinecm == 2)
|
||||
{
|
||||
$newmodulepart=$modulepart;
|
||||
if (in_array($modulepart, array('product','produit','service'))) $newmodulepart='produit|service';
|
||||
|
||||
$disablecrop=1;
|
||||
if (in_array($modulepart, array('product','produit','service','expensereport','holiday','project','user'))) $disablecrop=0;
|
||||
if (in_array($modulepart, array('societe','product','produit','service','expensereport','holiday','project','user'))) $disablecrop=0;
|
||||
|
||||
if (! $disablecrop && image_format_supported($file['name']) > 0)
|
||||
{
|
||||
|
|
@ -1146,7 +1160,7 @@ class FormFile
|
|||
|
||||
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 == 1)?'#':($url.'?action=editfile&urlfile='.urlencode($filepath).$param)).'" class="editfilelink" rel="'.$filepath.'">'.img_edit('default',0,'class="paddingrightonly"').'</a>';
|
||||
}
|
||||
}
|
||||
if ($permonobject)
|
||||
|
|
@ -1442,10 +1456,10 @@ class FormFile
|
|||
// File
|
||||
print '<td>';
|
||||
//print "XX".$file['name']; //$file['name'] must be utf8
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
|
||||
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
|
||||
if ($forcedownload) print '&attachment=1';
|
||||
print '&file='.urlencode($relativefile).'">';
|
||||
print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' ';
|
||||
print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')');
|
||||
print dol_trunc($file['name'],$maxlength,'middle');
|
||||
print '</a>';
|
||||
|
||||
|
|
@ -1672,7 +1686,11 @@ class FormFile
|
|||
{
|
||||
$out.= '<a class="pictopreview '.$urladvancedpreview['css'].'" href="'.$urladvancedpreview['url'].'"'.(empty($urladvancedpreview['mime'])?'':' mime="'.$urladvancedpreview['mime'].'"').' '.(empty($urladvancedpreview['target'])?'':' target="'.$urladvancedpreview['target'].'"').'>';
|
||||
//$out.= '<a class="pictopreview">';
|
||||
if (empty($ruleforpicto)) $out.= img_picto($langs->trans('Preview').' '.$file['name'], 'detail');
|
||||
if (empty($ruleforpicto))
|
||||
{
|
||||
//$out.= img_picto($langs->trans('Preview').' '.$file['name'], 'detail');
|
||||
$out.='<span class="fa fa-search-plus" style="color: gray"></span>';
|
||||
}
|
||||
else $out.= img_mime($relativepath, $langs->trans('Preview').' '.$file['name']);
|
||||
$out.= '</a>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,13 +52,17 @@ if (empty($conf->dol_no_mouse_hover))
|
|||
jQuery(document).ready(function () {
|
||||
jQuery(".classfortooltip").tooltip({
|
||||
show: { collision: "flipfit", effect:\'toggle\', delay:50 },
|
||||
hide: { effect:\'toggle\', delay: 50 },
|
||||
hide: { delay: 50 },
|
||||
tooltipClass: "mytooltip",
|
||||
content: function () {
|
||||
return $(this).prop(\'title\'); /* To force to get title as is */
|
||||
}
|
||||
});
|
||||
jQuery(".classfortooltiponclicktext").dialog({ closeOnEscape: true, classes: { "ui-dialog": "highlight" }, maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? 400 : 700).', autoOpen: false }).css("z-index: 5000");
|
||||
jQuery(".classfortooltiponclicktext").dialog(
|
||||
{ closeOnEscape: true, classes: { "ui-dialog": "highlight" },
|
||||
maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? 400 : 700).',
|
||||
modal: true,
|
||||
autoOpen: false }).css("z-index: 5000");
|
||||
jQuery(".classfortooltiponclick").click(function () {
|
||||
console.log("We click on tooltip for element with dolid="+$(this).attr(\'dolid\'));
|
||||
if ($(this).attr(\'dolid\'))
|
||||
|
|
|
|||
|
|
@ -393,8 +393,10 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
|
|||
{
|
||||
global $conf;
|
||||
|
||||
if (! empty($conf->browser->phone)) return ''; // select2 disabled for smartphones with standard browser (does not works, popup appears outside screen)
|
||||
//if (! empty($conf->dol_use_jmobile)) return ''; // select2 works with jmobile but it breaks the autosize feature of jmobile.
|
||||
// select2 disabled for smartphones with standard browser.
|
||||
// TODO With select2 v4, it seems ok, except that responsive style on table become crazy when scrolling at end of array)
|
||||
if (! empty($conf->browser->phone)) return '';
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return '';
|
||||
if (empty($conf->use_javascript_ajax)) return '';
|
||||
if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ! defined('REQUIRE_JQUERY_MULTISELECT')) return '';
|
||||
|
|
@ -405,19 +407,15 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
|
|||
$msg="\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
var query = {};
|
||||
$(\''.(preg_match('/^\./',$htmlname)?$htmlname:'#'.$htmlname).'\').'.$tmpplugin.'({
|
||||
dir: \'ltr\',
|
||||
width: \''.$widthTypeOfAutocomplete.'\', /* off or resolve */
|
||||
minimumInputLength: '.$minLengthToAutocomplete.',
|
||||
language: select2arrayoflanguage,
|
||||
containerCssClass: \':all:\', /* Line to add class or origin SELECT propagated to the new <span class="select2-selection...> tag */
|
||||
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
||||
templateResult: function (data, container) { /* Format visible output into combo list */
|
||||
/* Code to add class of origin OPTION propagated to the new select2 <li> tag */
|
||||
if (data.element) {
|
||||
$(container).addClass($(data.element).attr("class"));
|
||||
}
|
||||
|
||||
if (data.element) { $(container).addClass($(data.element).attr("class")); }
|
||||
//console.log(data.html);
|
||||
if ($(data.element).attr("html") != undefined) return htmlEntityDecodeJs($(data.element).attr("html")); // If property html set, we decode html entities and use this
|
||||
return data.text;
|
||||
|
|
@ -445,13 +443,13 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
|
|||
});
|
||||
|
||||
function runJsCodeForEvent'.$htmlname.'(obj) {
|
||||
console.log("Run runJsCodeForEvent'.$htmlname.'");
|
||||
var id = $("#'.$htmlname.'").val();
|
||||
var method = obj.method;
|
||||
var url = obj.url;
|
||||
var htmlname = obj.htmlname;
|
||||
var showempty = obj.showempty;
|
||||
$.getJSON(url,
|
||||
console.log("Run runJsCodeForEvent-'.$htmlname.' from ajax_combobox id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname);
|
||||
$.getJSON(url,
|
||||
{
|
||||
action: method,
|
||||
id: id,
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ function dol_basename($pathfile)
|
|||
* @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file',...)
|
||||
* @see dol_dir_list_indatabase
|
||||
*/
|
||||
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="")
|
||||
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="")
|
||||
{
|
||||
global $db, $hookmanager;
|
||||
global $object;
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port)
|
|||
* 'categorie', 'bank_account', 'bank_account', 'adherent', 'user',
|
||||
* 'commande', 'commande_fournisseur', 'expedition', 'intervention', 'survey',
|
||||
* 'contract', 'tax', 'expensereport', 'holiday', 'multicurrency', 'project',
|
||||
* 'email_template', 'event',
|
||||
* 'email_template', 'event', 'donation'
|
||||
* 'c_paiement', ...
|
||||
* @param int $shared 0=Return id of current entity only,
|
||||
* 1=Return id of current entity + shared entities (default)
|
||||
|
|
@ -1478,7 +1478,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
|||
if (! empty($object->label)) $morehtmlref.='<div class="refidno">'.$object->label.'</div>';
|
||||
}
|
||||
|
||||
if ($object->element != 'product' && $object->element != 'bookmark' && $object->element != 'ecm_directories')
|
||||
if (method_exists($object, 'getBannerAddress') && $object->element != 'product' && $object->element != 'bookmark' && $object->element != 'ecm_directories' && $object->element != 'ecm_files')
|
||||
{
|
||||
$morehtmlref.='<div class="refidno">';
|
||||
$morehtmlref.=$object->getBannerAddress('refaddress',$object);
|
||||
|
|
@ -1579,6 +1579,12 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='')
|
|||
$ret.="\n".$object->state;
|
||||
}
|
||||
}
|
||||
else if (in_array($object->country_code,array('IT'))) // IT: tile firstname name\n address lines \n zip (Code Departement) \n country
|
||||
{
|
||||
$ret .= ($ret ? $sep : '' ).$object->zip;
|
||||
$ret .= ($object->town?(($object->zip?' ':'').$object->town):'');
|
||||
$ret .= ($object->departement_id?(' ('.($object->departement_id).')'):'');
|
||||
}
|
||||
else // Other: title firstname name \n address lines \n zip town \n country
|
||||
{
|
||||
$ret .= $object->zip ? (($ret ? $sep : '' ).$object->zip) : '';
|
||||
|
|
@ -3216,18 +3222,21 @@ function img_allow($allow, $titlealt = 'default')
|
|||
*
|
||||
* @param string $file Filename
|
||||
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
||||
* @param string $morecss More css
|
||||
* @return string Return img tag
|
||||
*/
|
||||
function img_mime($file, $titlealt = '')
|
||||
function img_mime($file, $titlealt = '', $morecss='')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$mimetype = dol_mimetype($file, '', 1);
|
||||
$mimeimg = dol_mimetype($file, '', 2);
|
||||
$mimefa = dol_mimetype($file, '', 4);
|
||||
|
||||
if (empty($titlealt)) $titlealt = 'Mime type: '.$mimetype;
|
||||
|
||||
return img_picto_common($titlealt, 'mime/'.$mimeimg);
|
||||
//return img_picto_common($titlealt, 'mime/'.$mimeimg, 'class="'.$morecss.'"');
|
||||
return '<i class="fa fa-'.$mimefa.' paddingright"></i>';
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -6368,7 +6377,7 @@ function printCommonFooter($zone='private')
|
|||
if (empty($reshook))
|
||||
{
|
||||
if (! empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER."\n";
|
||||
|
||||
|
||||
print "\n";
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
|
|
@ -6385,7 +6394,7 @@ function printCommonFooter($zone='private')
|
|||
print " $('.login_block').toggle()\n";
|
||||
print '});'."\n";
|
||||
}
|
||||
|
||||
|
||||
// Google Analytics (need Google module)
|
||||
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID))
|
||||
{
|
||||
|
|
@ -6404,7 +6413,7 @@ function printCommonFooter($zone='private')
|
|||
print ' })();'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// End of tuning
|
||||
if (! empty($_SERVER['MAIN_SHOW_TUNING_INFO']) || ! empty($conf->global->MAIN_SHOW_TUNING_INFO))
|
||||
{
|
||||
|
|
@ -6434,7 +6443,7 @@ function printCommonFooter($zone='private')
|
|||
}
|
||||
print '");'."\n";
|
||||
}
|
||||
|
||||
|
||||
print "\n".'</script>'."\n";
|
||||
}
|
||||
|
||||
|
|
@ -6443,7 +6452,7 @@ function printCommonFooter($zone='private')
|
|||
{
|
||||
print_r(xdebug_get_code_coverage());
|
||||
}
|
||||
|
||||
|
||||
// If there is some logs in buffer to show
|
||||
if (count($conf->logbuffer))
|
||||
{
|
||||
|
|
@ -6736,92 +6745,93 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata=0, $param=''
|
|||
*
|
||||
* @param string $file Filename we looking for MIME type
|
||||
* @param string $default Default mime type if extension not found in known list
|
||||
* @param int $mode 0=Return full mime, 1=otherwise short mime string, 2=image for mime type, 3=source language
|
||||
* @param int $mode 0=Return full mime, 1=otherwise short mime string, 2=image for mime type, 3=source language, 4=css of font fa
|
||||
* @return string Return a mime type family (text/xxx, application/xxx, image/xxx, audio, video, archive)
|
||||
* @see image_format_supported (images.lib.php)
|
||||
*/
|
||||
function dol_mimetype($file,$default='application/octet-stream',$mode=0)
|
||||
function dol_mimetype($file, $default='application/octet-stream', $mode=0)
|
||||
{
|
||||
$mime=$default;
|
||||
$imgmime='other.png';
|
||||
$famime='file-o';
|
||||
$srclang='';
|
||||
|
||||
$tmpfile=preg_replace('/\.noexe$/','',$file);
|
||||
|
||||
// Text files
|
||||
if (preg_match('/\.txt$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; }
|
||||
if (preg_match('/\.rtx$/i',$tmpfile)) { $mime='text/richtext'; $imgmime='text.png'; }
|
||||
if (preg_match('/\.csv$/i',$tmpfile)) { $mime='text/csv'; $imgmime='text.png'; }
|
||||
if (preg_match('/\.tsv$/i',$tmpfile)) { $mime='text/tab-separated-values'; $imgmime='text.png'; }
|
||||
if (preg_match('/\.(cf|conf|log)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; }
|
||||
if (preg_match('/\.ini$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='ini'; }
|
||||
if (preg_match('/\.css$/i',$tmpfile)) { $mime='text/css'; $imgmime='css.png'; $srclang='css'; }
|
||||
if (preg_match('/\.txt$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $famime='file-text-o'; }
|
||||
if (preg_match('/\.rtx$/i',$tmpfile)) { $mime='text/richtext'; $imgmime='text.png'; $famime='file-text-o'; }
|
||||
if (preg_match('/\.csv$/i',$tmpfile)) { $mime='text/csv'; $imgmime='text.png'; $famime='file-text-o'; }
|
||||
if (preg_match('/\.tsv$/i',$tmpfile)) { $mime='text/tab-separated-values'; $imgmime='text.png'; $famime='file-text-o'; }
|
||||
if (preg_match('/\.(cf|conf|log)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $famime='file-text-o'; }
|
||||
if (preg_match('/\.ini$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='ini'; $famime='file-text-o'; }
|
||||
if (preg_match('/\.css$/i',$tmpfile)) { $mime='text/css'; $imgmime='css.png'; $srclang='css'; $famime='file-text-o'; }
|
||||
// Certificate files
|
||||
if (preg_match('/\.(crt|cer|key|pub)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; }
|
||||
if (preg_match('/\.(crt|cer|key|pub)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $famime='file-text-o'; }
|
||||
// HTML/XML
|
||||
if (preg_match('/\.(html|htm|shtml)$/i',$tmpfile)) { $mime='text/html'; $imgmime='html.png'; $srclang='html'; }
|
||||
if (preg_match('/\.(xml|xhtml)$/i',$tmpfile)) { $mime='text/xml'; $imgmime='other.png'; $srclang='xml'; }
|
||||
if (preg_match('/\.(html|htm|shtml)$/i',$tmpfile)) { $mime='text/html'; $imgmime='html.png'; $srclang='html'; $famime='file-text-o'; }
|
||||
if (preg_match('/\.(xml|xhtml)$/i',$tmpfile)) { $mime='text/xml'; $imgmime='other.png'; $srclang='xml'; $famime='file-text-o'; }
|
||||
// Languages
|
||||
if (preg_match('/\.bas$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='bas'; }
|
||||
if (preg_match('/\.(c)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='c'; }
|
||||
if (preg_match('/\.(cpp)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='cpp'; }
|
||||
if (preg_match('/\.(h)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='h'; }
|
||||
if (preg_match('/\.(java|jsp)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='java'; }
|
||||
if (preg_match('/\.php([0-9]{1})?$/i',$tmpfile)) { $mime='text/plain'; $imgmime='php.png'; $srclang='php'; }
|
||||
if (preg_match('/\.phtml$/i',$tmpfile)) { $mime='text/plain'; $imgmime='php.png'; $srclang='php'; }
|
||||
if (preg_match('/\.(pl|pm)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='pl.png'; $srclang='perl'; }
|
||||
if (preg_match('/\.sql$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='sql'; }
|
||||
if (preg_match('/\.js$/i',$tmpfile)) { $mime='text/x-javascript'; $imgmime='jscript.png'; $srclang='js'; }
|
||||
if (preg_match('/\.bas$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='bas'; $famime='file-code-o'; }
|
||||
if (preg_match('/\.(c)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='c'; $famime='file-code-o'; }
|
||||
if (preg_match('/\.(cpp)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='cpp'; $famime='file-code-o'; }
|
||||
if (preg_match('/\.(h)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='h'; $famime='file-code-o'; }
|
||||
if (preg_match('/\.(java|jsp)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='java'; $famime='file-code-o'; }
|
||||
if (preg_match('/\.php([0-9]{1})?$/i',$tmpfile)) { $mime='text/plain'; $imgmime='php.png'; $srclang='php'; $famime='file-code-o'; }
|
||||
if (preg_match('/\.phtml$/i',$tmpfile)) { $mime='text/plain'; $imgmime='php.png'; $srclang='php'; $famime='file-code-o'; }
|
||||
if (preg_match('/\.(pl|pm)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='pl.png'; $srclang='perl'; $famime='file-code-o'; }
|
||||
if (preg_match('/\.sql$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='sql'; $famime='file-code-o'; }
|
||||
if (preg_match('/\.js$/i',$tmpfile)) { $mime='text/x-javascript'; $imgmime='jscript.png'; $srclang='js'; $famime='file-code-o'; }
|
||||
// Open office
|
||||
if (preg_match('/\.odp$/i',$tmpfile)) { $mime='application/vnd.oasis.opendocument.presentation'; $imgmime='ooffice.png'; }
|
||||
if (preg_match('/\.ods$/i',$tmpfile)) { $mime='application/vnd.oasis.opendocument.spreadsheet'; $imgmime='ooffice.png'; }
|
||||
if (preg_match('/\.odt$/i',$tmpfile)) { $mime='application/vnd.oasis.opendocument.text'; $imgmime='ooffice.png'; }
|
||||
if (preg_match('/\.odp$/i',$tmpfile)) { $mime='application/vnd.oasis.opendocument.presentation'; $imgmime='ooffice.png'; $famime='file-powerpoint-o'; }
|
||||
if (preg_match('/\.ods$/i',$tmpfile)) { $mime='application/vnd.oasis.opendocument.spreadsheet'; $imgmime='ooffice.png'; $famime='file-excel-o'; }
|
||||
if (preg_match('/\.odt$/i',$tmpfile)) { $mime='application/vnd.oasis.opendocument.text'; $imgmime='ooffice.png'; $famime='file-word-o'; }
|
||||
// MS Office
|
||||
if (preg_match('/\.mdb$/i',$tmpfile)) { $mime='application/msaccess'; $imgmime='mdb.png'; }
|
||||
if (preg_match('/\.doc(x|m)?$/i',$tmpfile)) { $mime='application/msword'; $imgmime='doc.png'; }
|
||||
if (preg_match('/\.dot(x|m)?$/i',$tmpfile)) { $mime='application/msword'; $imgmime='doc.png'; }
|
||||
if (preg_match('/\.xlt(x)?$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; }
|
||||
if (preg_match('/\.xla(m)?$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; }
|
||||
if (preg_match('/\.xls$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; }
|
||||
if (preg_match('/\.xls(b|m|x)$/i',$tmpfile)) { $mime='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $imgmime='xls.png'; }
|
||||
if (preg_match('/\.pps(m|x)?$/i',$tmpfile)) { $mime='application/vnd.ms-powerpoint'; $imgmime='ppt.png'; }
|
||||
if (preg_match('/\.ppt(m|x)?$/i',$tmpfile)) { $mime='application/x-mspowerpoint'; $imgmime='ppt.png'; }
|
||||
if (preg_match('/\.mdb$/i',$tmpfile)) { $mime='application/msaccess'; $imgmime='mdb.png'; $famime='file-o'; }
|
||||
if (preg_match('/\.doc(x|m)?$/i',$tmpfile)) { $mime='application/msword'; $imgmime='doc.png'; $famime='file-word-o'; }
|
||||
if (preg_match('/\.dot(x|m)?$/i',$tmpfile)) { $mime='application/msword'; $imgmime='doc.png'; $famime='file-word-o'; }
|
||||
if (preg_match('/\.xlt(x)?$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; $famime='file-excel-o'; }
|
||||
if (preg_match('/\.xla(m)?$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; $famime='file-excel-o'; }
|
||||
if (preg_match('/\.xls$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; $famime='file-excel-o'; }
|
||||
if (preg_match('/\.xls(b|m|x)$/i',$tmpfile)) { $mime='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $imgmime='xls.png'; $famime='file-excel-o'; }
|
||||
if (preg_match('/\.pps(m|x)?$/i',$tmpfile)) { $mime='application/vnd.ms-powerpoint'; $imgmime='ppt.png'; $famime='file-powerpoint-o'; }
|
||||
if (preg_match('/\.ppt(m|x)?$/i',$tmpfile)) { $mime='application/x-mspowerpoint'; $imgmime='ppt.png'; $famime='file-powerpoint-o'; }
|
||||
// Other
|
||||
if (preg_match('/\.pdf$/i',$tmpfile)) { $mime='application/pdf'; $imgmime='pdf.png'; }
|
||||
if (preg_match('/\.pdf$/i',$tmpfile)) { $mime='application/pdf'; $imgmime='pdf.png'; $famime='file-pdf-o'; }
|
||||
// Scripts
|
||||
if (preg_match('/\.bat$/i',$tmpfile)) { $mime='text/x-bat'; $imgmime='script.png'; $srclang='dos'; }
|
||||
if (preg_match('/\.sh$/i',$tmpfile)) { $mime='text/x-sh'; $imgmime='script.png'; $srclang='bash'; }
|
||||
if (preg_match('/\.ksh$/i',$tmpfile)) { $mime='text/x-ksh'; $imgmime='script.png'; $srclang='bash'; }
|
||||
if (preg_match('/\.bash$/i',$tmpfile)) { $mime='text/x-bash'; $imgmime='script.png'; $srclang='bash'; }
|
||||
if (preg_match('/\.bat$/i',$tmpfile)) { $mime='text/x-bat'; $imgmime='script.png'; $srclang='dos'; $famime='file-code-o'; }
|
||||
if (preg_match('/\.sh$/i',$tmpfile)) { $mime='text/x-sh'; $imgmime='script.png'; $srclang='bash'; $famime='file-code-o'; }
|
||||
if (preg_match('/\.ksh$/i',$tmpfile)) { $mime='text/x-ksh'; $imgmime='script.png'; $srclang='bash'; $famime='file-code-o'; }
|
||||
if (preg_match('/\.bash$/i',$tmpfile)) { $mime='text/x-bash'; $imgmime='script.png'; $srclang='bash'; $famime='file-code-o'; }
|
||||
// Images
|
||||
if (preg_match('/\.ico$/i',$tmpfile)) { $mime='image/x-icon'; $imgmime='image.png'; }
|
||||
if (preg_match('/\.(jpg|jpeg)$/i',$tmpfile)) { $mime='image/jpeg'; $imgmime='image.png'; }
|
||||
if (preg_match('/\.png$/i',$tmpfile)) { $mime='image/png'; $imgmime='image.png'; }
|
||||
if (preg_match('/\.gif$/i',$tmpfile)) { $mime='image/gif'; $imgmime='image.png'; }
|
||||
if (preg_match('/\.bmp$/i',$tmpfile)) { $mime='image/bmp'; $imgmime='image.png'; }
|
||||
if (preg_match('/\.(tif|tiff)$/i',$tmpfile)) { $mime='image/tiff'; $imgmime='image.png'; }
|
||||
if (preg_match('/\.ico$/i',$tmpfile)) { $mime='image/x-icon'; $imgmime='image.png'; $famime='file-image-o'; }
|
||||
if (preg_match('/\.(jpg|jpeg)$/i',$tmpfile)) { $mime='image/jpeg'; $imgmime='image.png'; $famime='file-image-o'; }
|
||||
if (preg_match('/\.png$/i',$tmpfile)) { $mime='image/png'; $imgmime='image.png'; $famime='file-image-o'; }
|
||||
if (preg_match('/\.gif$/i',$tmpfile)) { $mime='image/gif'; $imgmime='image.png'; $famime='file-image-o'; }
|
||||
if (preg_match('/\.bmp$/i',$tmpfile)) { $mime='image/bmp'; $imgmime='image.png'; $famime='file-image-o'; }
|
||||
if (preg_match('/\.(tif|tiff)$/i',$tmpfile)) { $mime='image/tiff'; $imgmime='image.png'; $famime='file-image-o'; }
|
||||
// Calendar
|
||||
if (preg_match('/\.vcs$/i',$tmpfile)) { $mime='text/calendar'; $imgmime='other.png'; }
|
||||
if (preg_match('/\.ics$/i',$tmpfile)) { $mime='text/calendar'; $imgmime='other.png'; }
|
||||
if (preg_match('/\.vcs$/i',$tmpfile)) { $mime='text/calendar'; $imgmime='other.png'; $famime='file-text-o'; }
|
||||
if (preg_match('/\.ics$/i',$tmpfile)) { $mime='text/calendar'; $imgmime='other.png'; $famime='file-text-o'; }
|
||||
// Other
|
||||
if (preg_match('/\.torrent$/i',$tmpfile)) { $mime='application/x-bittorrent'; $imgmime='other.png'; }
|
||||
if (preg_match('/\.torrent$/i',$tmpfile)) { $mime='application/x-bittorrent'; $imgmime='other.png'; $famime='file-o'; }
|
||||
// Audio
|
||||
if (preg_match('/\.(mp3|ogg|au|wav|wma|mid)$/i',$tmpfile)) { $mime='audio'; $imgmime='audio.png'; }
|
||||
if (preg_match('/\.(mp3|ogg|au|wav|wma|mid)$/i',$tmpfile)) { $mime='audio'; $imgmime='audio.png'; $famime='file-audio-o'; }
|
||||
// Video
|
||||
if (preg_match('/\.ogv$/i',$tmpfile)) { $mime='video/ogg'; $imgmime='video.png'; }
|
||||
if (preg_match('/\.webm$/i',$tmpfile)) { $mime='video/webm'; $imgmime='video.png'; }
|
||||
if (preg_match('/\.avi$/i',$tmpfile)) { $mime='video/x-msvideo'; $imgmime='video.png'; }
|
||||
if (preg_match('/\.divx$/i',$tmpfile)) { $mime='video/divx'; $imgmime='video.png'; }
|
||||
if (preg_match('/\.xvid$/i',$tmpfile)) { $mime='video/xvid'; $imgmime='video.png'; }
|
||||
if (preg_match('/\.(wmv|mpg|mpeg)$/i',$tmpfile)) { $mime='video'; $imgmime='video.png'; }
|
||||
if (preg_match('/\.ogv$/i',$tmpfile)) { $mime='video/ogg'; $imgmime='video.png'; $famime='file-video-o'; }
|
||||
if (preg_match('/\.webm$/i',$tmpfile)) { $mime='video/webm'; $imgmime='video.png'; $famime='file-video-o'; }
|
||||
if (preg_match('/\.avi$/i',$tmpfile)) { $mime='video/x-msvideo'; $imgmime='video.png'; $famime='file-video-o'; }
|
||||
if (preg_match('/\.divx$/i',$tmpfile)) { $mime='video/divx'; $imgmime='video.png'; $famime='file-video-o'; }
|
||||
if (preg_match('/\.xvid$/i',$tmpfile)) { $mime='video/xvid'; $imgmime='video.png'; $famime='file-video-o'; }
|
||||
if (preg_match('/\.(wmv|mpg|mpeg)$/i',$tmpfile)) { $mime='video'; $imgmime='video.png'; $famime='file-video-o'; }
|
||||
// Archive
|
||||
if (preg_match('/\.(zip|rar|gz|tgz|z|cab|bz2|7z|tar|lzh)$/i',$tmpfile)) { $mime='archive'; $imgmime='archive.png'; } // application/xxx where zzz is zip, ...
|
||||
if (preg_match('/\.(zip|rar|gz|tgz|z|cab|bz2|7z|tar|lzh)$/i',$tmpfile)) { $mime='archive'; $imgmime='archive.png'; $famime='file-archive-o'; } // application/xxx where zzz is zip, ...
|
||||
// Exe
|
||||
if (preg_match('/\.(exe|com)$/i',$tmpfile)) { $mime='application/octet-stream'; $imgmime='other.png'; }
|
||||
if (preg_match('/\.(exe|com)$/i',$tmpfile)) { $mime='application/octet-stream'; $imgmime='other.png'; $famime='file-o'; }
|
||||
// Lib
|
||||
if (preg_match('/\.(dll|lib|o|so|a)$/i',$tmpfile)) { $mime='library'; $imgmime='library.png'; }
|
||||
if (preg_match('/\.(dll|lib|o|so|a)$/i',$tmpfile)) { $mime='library'; $imgmime='library.png'; $famime='file-o'; }
|
||||
// Err
|
||||
if (preg_match('/\.err$/i',$tmpfile)) { $mime='error'; $imgmime='error.png'; }
|
||||
if (preg_match('/\.err$/i',$tmpfile)) { $mime='error'; $imgmime='error.png'; $famime='file-text-o'; }
|
||||
|
||||
// Return string
|
||||
if ($mode == 1)
|
||||
|
|
@ -6837,7 +6847,10 @@ function dol_mimetype($file,$default='application/octet-stream',$mode=0)
|
|||
{
|
||||
return $srclang;
|
||||
}
|
||||
|
||||
if ($mode == 4)
|
||||
{
|
||||
return $famime;
|
||||
}
|
||||
return $mime;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -390,8 +390,10 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
|||
|
||||
if (! empty($sourcecompany->state_id) && empty($sourcecompany->departement)) $sourcecompany->departement=getState($sourcecompany->state_id); //TODO deprecated
|
||||
if (! empty($sourcecompany->state_id) && empty($sourcecompany->state)) $sourcecompany->state=getState($sourcecompany->state_id);
|
||||
if (! empty($sourcecompany->state_id) && !isset($sourcecompany->departement_id)) $sourcecompany->departement_id=getState($sourcecompany->state_id,'2');
|
||||
if (! empty($targetcompany->state_id) && empty($targetcompany->departement)) $targetcompany->departement=getState($targetcompany->state_id); //TODO deprecated
|
||||
if (! empty($targetcompany->state_id) && empty($targetcompany->state)) $targetcompany->state=getState($targetcompany->state_id);
|
||||
if (! empty($targetcompany->state_id) && !isset($targetcompany->departement_id)) $targetcompany->departement_id=getState($targetcompany->state_id,'2');
|
||||
|
||||
$reshook=0;
|
||||
$stringaddress = '';
|
||||
|
|
@ -1263,47 +1265,45 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
|
|||
}
|
||||
}
|
||||
|
||||
// If line linked to a product
|
||||
if ($idprod)
|
||||
// We add ref of product (and supplier ref if defined)
|
||||
$prefix_prodserv = "";
|
||||
$ref_prodserv = "";
|
||||
if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this
|
||||
{
|
||||
// We add ref
|
||||
if ($prodser->ref)
|
||||
if ($prodser->isService())
|
||||
{
|
||||
$prefix_prodserv = "";
|
||||
$ref_prodserv = "";
|
||||
if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this
|
||||
{
|
||||
if ($prodser->isService())
|
||||
{
|
||||
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product")." ";
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($hideref))
|
||||
{
|
||||
if ($issupplierline)
|
||||
{
|
||||
if ($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES == 1)
|
||||
$ref_prodserv = $ref_supplier;
|
||||
elseif ($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES == 2)
|
||||
$ref_prodserv = $ref_supplier. ' ('.$outputlangs->transnoentitiesnoconv("InternalRef").' '.$prodser->ref.')';
|
||||
else
|
||||
$ref_prodserv = $prodser->ref.' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')';
|
||||
}
|
||||
else
|
||||
$ref_prodserv = $prodser->ref; // Show local ref only
|
||||
|
||||
if (! empty($libelleproduitservice)) $ref_prodserv .= " - ";
|
||||
}
|
||||
|
||||
$libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice;
|
||||
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product")." ";
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($hideref))
|
||||
{
|
||||
if ($issupplierline)
|
||||
{
|
||||
if ($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES == 1)
|
||||
$ref_prodserv = $ref_supplier;
|
||||
elseif ($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES == 2)
|
||||
$ref_prodserv = $ref_supplier. ' ('.$outputlangs->transnoentitiesnoconv("InternalRef").' '.$prodser->ref.')';
|
||||
else // Common case
|
||||
{
|
||||
$ref_prodserv = $prodser->ref; // Show local ref
|
||||
if ($ref_supplier) $ref_prodserv.= ($prodser->ref?' (':'').$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.($prodser->ref?')':'');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$ref_prodserv = $prodser->ref; // Show local ref only
|
||||
}
|
||||
|
||||
if (! empty($libelleproduitservice) && ! empty($ref_prodserv)) $ref_prodserv .= " - ";
|
||||
}
|
||||
|
||||
$libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice;
|
||||
|
||||
// Add an additional description for the category products
|
||||
if (! empty($conf->global->CATEGORY_ADD_DESC_INTO_DOC) && $idprod && ! empty($conf->categorie->enabled))
|
||||
{
|
||||
|
|
@ -1842,10 +1842,14 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm
|
|||
if ($object->lines[$i]->special_code == 3) return '';
|
||||
if (empty($hidedetails) || $hidedetails > 1)
|
||||
{
|
||||
if($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF)
|
||||
if ($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF)
|
||||
{
|
||||
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
|
||||
$result = ( $object->lines[$i]->situation_percent - $prev_progress) . '%';
|
||||
$prev_progress = 0;
|
||||
if (method_exists($object, 'get_prev_progress'))
|
||||
{
|
||||
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
|
||||
}
|
||||
$result = ($object->lines[$i]->situation_percent - $prev_progress) . '%';
|
||||
}
|
||||
else
|
||||
$result = $object->lines[$i]->situation_percent . '%';
|
||||
|
|
@ -1892,12 +1896,17 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
|
|||
if (empty($hidedetails) || $hidedetails > 1)
|
||||
{
|
||||
$total_ht = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_total_ht : $object->lines[$i]->total_ht);
|
||||
if ($object->lines[$i]->situation_percent > 0 )
|
||||
if ($object->lines[$i]->situation_percent > 0)
|
||||
{
|
||||
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
|
||||
$progress = ( $object->lines[$i]->situation_percent - $prev_progress) /100;
|
||||
$result.=price($sign * ($total_ht/($object->lines[$i]->situation_percent/100)) * $progress, 0, $outputlangs);
|
||||
}
|
||||
$prev_progress = 0;
|
||||
$progress = 1;
|
||||
if (method_exists($object, 'get_prev_progress'))
|
||||
{
|
||||
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
|
||||
$progress = ($object->lines[$i]->situation_percent - $prev_progress) / 100;
|
||||
}
|
||||
$result.=price($sign * ($total_ht/($object->lines[$i]->situation_percent/100)) * $progress, 0, $outputlangs);
|
||||
}
|
||||
else
|
||||
$result.=price($sign * $total_ht, 0, $outputlangs);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -456,7 +456,7 @@ function getRandomPassword($generic=false)
|
|||
$randomCode = "";
|
||||
$nbofchar = round($length/3);
|
||||
$nbofcharlast = ($length - 2*$nbofchar);
|
||||
var_dump($nbofchar.'-'.$nbofcharlast);
|
||||
//var_dump($nbofchar.'-'.$nbofcharlast);
|
||||
if (function_exists('random_int')) // Cryptographic random
|
||||
{
|
||||
$max = strlen($lowercase) - 1;
|
||||
|
|
|
|||
|
|
@ -670,13 +670,13 @@ class pdf_einstein extends ModelePDFCommandes
|
|||
$pdf->SetFont('','B', $default_font_size - 2);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("PaymentConditions").':';
|
||||
$pdf->MultiCell(80, 4, $titre, 0, 'L');
|
||||
$pdf->MultiCell(43, 4, $titre, 0, 'L');
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc);
|
||||
$lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement);
|
||||
$pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L');
|
||||
$pdf->MultiCell(67, 4, $lib_condition_paiement,0,'L');
|
||||
|
||||
$posy=$pdf->GetY()+3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -897,13 +897,13 @@ class pdf_crabe extends ModelePDFFactures
|
|||
$pdf->SetFont('','B', $default_font_size - 2);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("PaymentConditions").':';
|
||||
$pdf->MultiCell(80, 4, $titre, 0, 'L');
|
||||
$pdf->MultiCell(43, 4, $titre, 0, 'L');
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc);
|
||||
$lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement);
|
||||
$pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L');
|
||||
$pdf->MultiCell(67, 4, $lib_condition_paiement,0,'L');
|
||||
|
||||
$posy=$pdf->GetY()+3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -858,13 +858,13 @@ class pdf_azur extends ModelePDFPropales
|
|||
$pdf->SetFont('','B', $default_font_size - 2);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("PaymentConditions").':';
|
||||
$pdf->MultiCell(80, 4, $titre, 0, 'L');
|
||||
$pdf->MultiCell(43, 4, $titre, 0, 'L');
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc);
|
||||
$lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement);
|
||||
$pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L');
|
||||
$pdf->MultiCell(67, 4, $lib_condition_paiement,0,'L');
|
||||
|
||||
$posy=$pdf->GetY()+3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,9 +67,15 @@ elseif ($modulepart == 'expensereport')
|
|||
}
|
||||
elseif ($modulepart == 'user')
|
||||
{
|
||||
$result=restrictedArea($user,'user',$id,'user');
|
||||
if (! $user->rights->user->user->lire) accessforbidden();
|
||||
$accessallowed=1;
|
||||
$result=restrictedArea($user,'user',$id,'user');
|
||||
if (! $user->rights->user->user->lire) accessforbidden();
|
||||
$accessallowed=1;
|
||||
}
|
||||
elseif ($modulepart == 'societe')
|
||||
{
|
||||
$result=restrictedArea($user,'societe',$id,'societe');
|
||||
if (! $user->rights->societe->lire) accessforbidden();
|
||||
$accessallowed=1;
|
||||
}
|
||||
|
||||
// Security:
|
||||
|
|
@ -115,6 +121,17 @@ elseif ($modulepart == 'holiday')
|
|||
$dir=$conf->holiday->dir_output; // By default
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'societe')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
$object = new Societe($db);
|
||||
if ($id > 0)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) dol_print_error($db,'Failed to load object');
|
||||
$dir=$conf->societe->dir_output;
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'user')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
|
|
@ -145,6 +162,7 @@ if (empty($backtourl))
|
|||
else if (in_array($modulepart, array('holiday'))) $backtourl=DOL_URL_ROOT."/holiday/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
else if (in_array($modulepart, array('project'))) $backtourl=DOL_URL_ROOT."/projet/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
else if (in_array($modulepart, array('user'))) $backtourl=DOL_URL_ROOT."/user/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
else if (in_array($modulepart, array('societe'))) $backtourl=DOL_URL_ROOT."/societe/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ $formfile->form_attach_new_file(
|
|||
);
|
||||
|
||||
$disablemove=1;
|
||||
if ($modulepart == 'product' || $modulepart == 'produit') $disablemove=0; // Drag and drop for up and down allowed on product
|
||||
if (in_array($modulepart, array('product', 'produit', 'societe', 'user'))) $disablemove=0; // Drag and drop for up and down allowed on product
|
||||
|
||||
// List of document
|
||||
$formfile->list_of_documents(
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element][
|
|||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label)
|
||||
{
|
||||
// Discard if extrafield is a hidden field on form
|
||||
if (abs($extrafields->attributes[$object->table_element]['list'][$key]) != 1) continue;
|
||||
if (empty($extrafields->attributes[$object->table_element]['list'][$key])) continue; // 0 = Never visible field
|
||||
if (abs($extrafields->attributes[$object->table_element]['list'][$key]) != 1 && abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
|
||||
|
||||
// Load language if required
|
||||
if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]);
|
||||
|
|
|
|||
|
|
@ -1,151 +0,0 @@
|
|||
<?php
|
||||
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
// Following var must be set:
|
||||
// $arrayofselected = array of id selected
|
||||
// $object
|
||||
// $objecttmp=new Propal($db);
|
||||
// $topicmail="SendSupplierProposalRef";
|
||||
// $modelmail="supplier_proposal_send";
|
||||
// $trackid='ord'.$object->id;
|
||||
|
||||
$langs->load("mails");
|
||||
|
||||
if (! GETPOST('cancel', 'alpha'))
|
||||
{
|
||||
$listofselectedid = array();
|
||||
$listofselectedthirdparties = array();
|
||||
$listofselectedref = array();
|
||||
foreach ($arrayofselected as $toselectid)
|
||||
{
|
||||
$result = $objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$listofselectedid[$toselectid] = $toselectid;
|
||||
$thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid);
|
||||
if ($objecttmp->element == 'societe')
|
||||
$thirdpartyid = $objecttmp->id;
|
||||
if ($objecttmp->element == 'expensereport')
|
||||
$thirdpartyid = $objecttmp->fk_user_author;
|
||||
$listofselectedthirdparties[$thirdpartyid] = $thirdpartyid;
|
||||
$listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '<input type="hidden" name="massaction" value="confirm_presend">';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
dol_fiche_head(null, '', '');
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->withform = -1;
|
||||
$formmail->fromtype = (GETPOST('fromtype') ? GETPOST('fromtype') : (! empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user'));
|
||||
|
||||
if ($formmail->fromtype === 'user')
|
||||
{
|
||||
$formmail->fromid = $user->id;
|
||||
}
|
||||
$formmail->trackid = $trackid;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
|
||||
$formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid);
|
||||
}
|
||||
$formmail->withfrom = 1;
|
||||
$liste = $langs->trans("AllRecipientSelected", count($arrayofselected));
|
||||
if (count($listofselectedthirdparties) == 1) // Only 1 different recipient selected, we can suggest contacts
|
||||
{
|
||||
$liste = array();
|
||||
$thirdpartyid = array_shift($listofselectedthirdparties);
|
||||
if ($objecttmp->element == 'expensereport')
|
||||
{
|
||||
$fuser = new User($db);
|
||||
$fuser->fetch($thirdpartyid);
|
||||
$liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">";
|
||||
}
|
||||
else
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($thirdpartyid);
|
||||
foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) {
|
||||
$liste[$key] = $value;
|
||||
}
|
||||
}
|
||||
$formmail->withtoreadonly = 0;
|
||||
} else {
|
||||
$formmail->withtoreadonly = 1;
|
||||
}
|
||||
|
||||
$formmail->withoptiononeemailperrecipient = empty($liste)?0:((GETPOST('oneemailperrecipient')=='on')?1:-1);
|
||||
$formmail->withto = empty($liste)?(GETPOST('sendto','alpha')?GETPOST('sendto','alpha'):array()):$liste;
|
||||
$formmail->withtofree = empty($liste)?1:0;
|
||||
$formmail->withtocc = 1;
|
||||
$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtopic = $langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
|
||||
$formmail->withfile = 1;
|
||||
// $formmail->withfile = 2; Not yet supported in mass action
|
||||
$formmail->withmaindocfile = 1; // Add a checkbox "Attach also main document"
|
||||
if ($objecttmp->element != 'societe') {
|
||||
$formmail->withfile = $langs->trans("OnlyPDFattachmentSupported");
|
||||
$formmail->withmaindocfile = - 1; // Add a checkbox "Attach also main document" but not checked by default
|
||||
}
|
||||
$formmail->withbody = 1;
|
||||
$formmail->withdeliveryreceipt = 1;
|
||||
$formmail->withcancel = 1;
|
||||
|
||||
// Make substitution in email content
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object);
|
||||
$substitutionarray['__EMAIL__'] = $sendto;
|
||||
$substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '<img src="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-read.php?tag=' . $object->thirdparty->tag . '&securitykey=' . urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) . '" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '';
|
||||
$substitutionarray['__PERSONALIZED__'] = ''; // deprecated
|
||||
$substitutionarray['__CONTACTCIVNAME__'] = '';
|
||||
|
||||
$parameters = array(
|
||||
'mode' => 'formemail'
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object, $parameters);
|
||||
|
||||
// Tableau des substitutions
|
||||
$formmail->substit = $substitutionarray;
|
||||
|
||||
// Tableau des parametres complementaires du post
|
||||
$formmail->param['action'] = $action;
|
||||
$formmail->param['models'] = $modelmail;
|
||||
$formmail->param['models_id'] = GETPOST('modelmailselected', 'int');
|
||||
$formmail->param['id'] = join(',', $arrayofselected);
|
||||
// $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedthirdparties) > $conf->global->MAILING_LIMIT_SENDBYWEB)
|
||||
{
|
||||
$langs->load("errors");
|
||||
print img_warning() . ' ' . $langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB);
|
||||
print ' - <a href="javascript: window.history.go(-1)">' . $langs->trans("GoBack") . '</a>';
|
||||
$arrayofmassactions = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
print $formmail->get_form();
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
160
htdocs/core/tpl/massactions_pre.tpl.php
Normal file
160
htdocs/core/tpl/massactions_pre.tpl.php
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
<?php
|
||||
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
// Following var must be set:
|
||||
// $arrayofselected = array of id selected
|
||||
// $object
|
||||
// $objecttmp=new Propal($db);
|
||||
// $topicmail="SendSupplierProposalRef";
|
||||
// $modelmail="supplier_proposal_send";
|
||||
// $trackid='ord'.$object->id;
|
||||
|
||||
|
||||
if ($massaction == 'predelete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1);
|
||||
}
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
$langs->load("mails");
|
||||
|
||||
if (! GETPOST('cancel', 'alpha'))
|
||||
{
|
||||
$listofselectedid = array();
|
||||
$listofselectedthirdparties = array();
|
||||
$listofselectedref = array();
|
||||
foreach ($arrayofselected as $toselectid)
|
||||
{
|
||||
$result = $objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$listofselectedid[$toselectid] = $toselectid;
|
||||
$thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid);
|
||||
if ($objecttmp->element == 'societe')
|
||||
$thirdpartyid = $objecttmp->id;
|
||||
if ($objecttmp->element == 'expensereport')
|
||||
$thirdpartyid = $objecttmp->fk_user_author;
|
||||
$listofselectedthirdparties[$thirdpartyid] = $thirdpartyid;
|
||||
$listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '<input type="hidden" name="massaction" value="confirm_presend">';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
dol_fiche_head(null, '', '');
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->withform = -1;
|
||||
$formmail->fromtype = (GETPOST('fromtype') ? GETPOST('fromtype') : (! empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user'));
|
||||
|
||||
if ($formmail->fromtype === 'user')
|
||||
{
|
||||
$formmail->fromid = $user->id;
|
||||
}
|
||||
$formmail->trackid = $trackid;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
|
||||
$formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid);
|
||||
}
|
||||
$formmail->withfrom = 1;
|
||||
$liste = $langs->trans("AllRecipientSelected", count($arrayofselected));
|
||||
if (count($listofselectedthirdparties) == 1) // Only 1 different recipient selected, we can suggest contacts
|
||||
{
|
||||
$liste = array();
|
||||
$thirdpartyid = array_shift($listofselectedthirdparties);
|
||||
if ($objecttmp->element == 'expensereport')
|
||||
{
|
||||
$fuser = new User($db);
|
||||
$fuser->fetch($thirdpartyid);
|
||||
$liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">";
|
||||
}
|
||||
else
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($thirdpartyid);
|
||||
foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) {
|
||||
$liste[$key] = $value;
|
||||
}
|
||||
}
|
||||
$formmail->withtoreadonly = 0;
|
||||
} else {
|
||||
$formmail->withtoreadonly = 1;
|
||||
}
|
||||
|
||||
$formmail->withoptiononeemailperrecipient = empty($liste)?0:((GETPOST('oneemailperrecipient')=='on')?1:-1);
|
||||
$formmail->withto = empty($liste)?(GETPOST('sendto','alpha')?GETPOST('sendto','alpha'):array()):$liste;
|
||||
$formmail->withtofree = empty($liste)?1:0;
|
||||
$formmail->withtocc = 1;
|
||||
$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtopic = $langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
|
||||
$formmail->withfile = 1;
|
||||
// $formmail->withfile = 2; Not yet supported in mass action
|
||||
$formmail->withmaindocfile = 1; // Add a checkbox "Attach also main document"
|
||||
if ($objecttmp->element != 'societe') {
|
||||
$formmail->withfile = $langs->trans("OnlyPDFattachmentSupported");
|
||||
$formmail->withmaindocfile = - 1; // Add a checkbox "Attach also main document" but not checked by default
|
||||
}
|
||||
$formmail->withbody = 1;
|
||||
$formmail->withdeliveryreceipt = 1;
|
||||
$formmail->withcancel = 1;
|
||||
|
||||
// Make substitution in email content
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object);
|
||||
$substitutionarray['__EMAIL__'] = $sendto;
|
||||
$substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '<img src="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-read.php?tag=' . $object->thirdparty->tag . '&securitykey=' . urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) . '" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '';
|
||||
$substitutionarray['__PERSONALIZED__'] = ''; // deprecated
|
||||
$substitutionarray['__CONTACTCIVNAME__'] = '';
|
||||
|
||||
$parameters = array(
|
||||
'mode' => 'formemail'
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object, $parameters);
|
||||
|
||||
// Tableau des substitutions
|
||||
$formmail->substit = $substitutionarray;
|
||||
|
||||
// Tableau des parametres complementaires du post
|
||||
$formmail->param['action'] = $action;
|
||||
$formmail->param['models'] = $modelmail;
|
||||
$formmail->param['models_id'] = GETPOST('modelmailselected', 'int');
|
||||
$formmail->param['id'] = join(',', $arrayofselected);
|
||||
// $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedthirdparties) > $conf->global->MAILING_LIMIT_SENDBYWEB)
|
||||
{
|
||||
$langs->load("errors");
|
||||
print img_warning() . ' ' . $langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB);
|
||||
print ' - <a href="javascript: window.history.go(-1)">' . $langs->trans("GoBack") . '</a>';
|
||||
$arrayofmassactions = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
print $formmail->get_form();
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
|
@ -65,7 +65,10 @@ if ($nolinesbefore) {
|
|||
<td class="linecoldescription minwidth500imp">
|
||||
<div id="add"></div><span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine'); ?></span><?php // echo $langs->trans("FreeZone"); ?>
|
||||
</td>
|
||||
<?php if ($object->element == 'supplier_proposal') { ?>
|
||||
<?php
|
||||
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
|
||||
{
|
||||
?>
|
||||
<td class="linecolrefsupplier" align="right"><span id="title_fourn_ref"><?php echo $langs->trans('SupplierProposalRefFourn'); ?></span></td>
|
||||
<?php } ?>
|
||||
<td class="linecolvat" align="right"><span id="title_vat"><?php echo $langs->trans('VAT'); ?></span></td>
|
||||
|
|
@ -270,8 +273,11 @@ else {
|
|||
?>
|
||||
</td>
|
||||
|
||||
<?php if ($object->element == 'supplier_proposal') { ?>
|
||||
<td class="nobottom linecolresupplier" align="right"><input id="fourn_ref" name="fourn_ref" class="flat" size="10" value=""></td>
|
||||
<?php
|
||||
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
|
||||
{
|
||||
?>
|
||||
<td class="nobottom linecolresupplier" align="right"><input id="fourn_ref" name="fourn_ref" class="flat" size="10" value="<?php echo (isset($_POST["fourn_ref"])?GETPOST("fourn_ref",'alpha',2):''); ?>"></td>
|
||||
<?php } ?>
|
||||
|
||||
<td class="nobottom linecolvat" align="right"><?php
|
||||
|
|
@ -728,9 +734,11 @@ function setforfree() {
|
|||
jQuery("#price_ht").show();
|
||||
jQuery("#multicurrency_price_ht").show();
|
||||
jQuery("#price_ttc").show(); // May no exists
|
||||
jQuery("#fourn_ref").show();
|
||||
jQuery("#tva_tx").show();
|
||||
jQuery("#buying_price").val('').show();
|
||||
jQuery("#fournprice_predef").hide();
|
||||
jQuery("#title_fourn_ref").show();
|
||||
jQuery("#title_vat").show();
|
||||
jQuery("#title_up_ht").show();
|
||||
jQuery("#title_up_ht_currency").show();
|
||||
|
|
@ -751,9 +759,10 @@ function setforpredef() {
|
|||
jQuery("#price_ht").val('').hide();
|
||||
jQuery("#multicurrency_price_ht").hide();
|
||||
jQuery("#price_ttc").hide(); // May no exists
|
||||
jQuery("#fourn_ref").hide();
|
||||
jQuery("#tva_tx").hide();
|
||||
jQuery("#buying_price").show();
|
||||
//jQuery("#fournprice_predef").show(); // management somewhere else
|
||||
jQuery("#title_fourn_ref").hide();
|
||||
jQuery("#title_vat").hide();
|
||||
jQuery("#title_up_ht").hide();
|
||||
jQuery("#title_up_ht_currency").hide();
|
||||
|
|
|
|||
|
|
@ -106,11 +106,14 @@ $coldisplay=-1; // We remove first td
|
|||
?>
|
||||
</td>
|
||||
|
||||
<?php if ($object->element == 'supplier_proposal') { ?>
|
||||
<td align="right"><input id="fourn_ref" name="fourn_ref" class="flat" value="<?php echo $line->ref_fourn; ?>" size="12"></td>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
|
||||
{
|
||||
?>
|
||||
<td align="right"><input id="fourn_ref" name="fourn_ref" class="flat" value="<?php echo $line->ref_fourn; ?>" size="12"></td>
|
||||
<?php
|
||||
}
|
||||
|
||||
$coldisplay++;
|
||||
if ($this->situation_counter == 1 || !$this->situation_cycle_ref) {
|
||||
print '<td align="right">' . $form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1) . '</td>';
|
||||
|
|
|
|||
|
|
@ -137,13 +137,18 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
|
|||
}
|
||||
?>
|
||||
</td>
|
||||
<?php if ($object->element == 'supplier_proposal') { ?>
|
||||
<td class="linecolrefsupplier" align="right"><?php echo $line->ref_fourn; ?></td>
|
||||
<?php }
|
||||
<?php
|
||||
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
|
||||
{
|
||||
?>
|
||||
<td class="linecolrefsupplier"><?php
|
||||
echo ($line->ref_fourn?$line->ref_fourn:$line->ref_supplier);
|
||||
?></td>
|
||||
<?php
|
||||
}
|
||||
// VAT Rate
|
||||
?>
|
||||
<td align="right" class="linecolvat nowrap"><?php $coldisplay++; ?><?php
|
||||
//var_dump($line);
|
||||
$positiverates='';
|
||||
if (price2num($line->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx);
|
||||
if (price2num($line->total_localtax1)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx);
|
||||
|
|
|
|||
|
|
@ -210,13 +210,13 @@ foreach ($search_array_options as $key => $val)
|
|||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
$mode_search=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
|
|
|
|||
|
|
@ -818,7 +818,7 @@ class Don extends CommonObject
|
|||
$sql = "SELECT count(d.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
|
||||
$sql.= " WHERE d.fk_statut > 0";
|
||||
$sql.= " AND d.entity IN (".getEntity('don').")";
|
||||
$sql.= " AND d.entity IN (".getEntity('donation').")";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
|
|
@ -851,15 +851,14 @@ class Don extends CommonObject
|
|||
$result='';
|
||||
$label=$langs->trans("ShowDonation").': '.$this->id;
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/don/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/don/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
$picto='generic';
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $this->ref;
|
||||
$result .= $linkend;
|
||||
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$link.$this->id.$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ $sql = "SELECT d.rowid, d.datedon, d.firstname, d.lastname, d.societe,";
|
|||
$sql.= " d.amount, d.fk_statut as statut, ";
|
||||
$sql.= " p.rowid as pid, p.ref, p.title, p.public";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
|
||||
$sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('don').")";
|
||||
$sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")";
|
||||
if ($statut != '' && $statut != '-1')
|
||||
{
|
||||
$sql .= " AND d.fk_statut IN (".$db->escape($statut).")";
|
||||
|
|
|
|||
|
|
@ -411,31 +411,33 @@ class EcmDirectory // extends CommonObject
|
|||
* @param string $option Sur quoi pointe le lien
|
||||
* @param int $max Max length
|
||||
* @param string $more Add more param on a link
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='',$max=0,$more='')
|
||||
function getNomUrl($withpicto=0, $option='', $max=0, $more='', $notooltip=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
//$newref=str_replace('_',' ',$this->ref);
|
||||
$newref=$this->ref;
|
||||
$newlabel=$langs->trans("ShowECMSection").': '.$newref;
|
||||
$linkclose='"'.($more?' '.$more:'').' title="'.dol_escape_htmltag($newlabel, 1).'" class="classfortooltip">';
|
||||
$label=$langs->trans("ShowECMSection").': '.$newref;
|
||||
$linkclose='"'.($more?' '.$more:'').' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/ecm/docmine.php?section='.$this->id.$linkclose;
|
||||
if ($option == 'index') $link = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&sectionexpand=true'.$linkclose;
|
||||
if ($option == 'indexexpanded') $link = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&sectionexpand=false'.$linkclose;
|
||||
if ($option == 'indexnotexpanded') $link = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&sectionexpand=true'.$linkclose;
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/docmine.php?section='.$this->id.$linkclose;
|
||||
if ($option == 'index') $linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&sectionexpand=true'.$linkclose;
|
||||
if ($option == 'indexexpanded') $linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&sectionexpand=false'.$linkclose;
|
||||
if ($option == 'indexnotexpanded') $linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&sectionexpand=true'.$linkclose;
|
||||
$linkend='</a>';
|
||||
|
||||
//$picto=DOL_URL_ROOT.'/theme/common/treemenu/folder.gif';
|
||||
$picto='dir';
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= ($max?dol_trunc($newref,$max,'middle'):$newref);
|
||||
$result .= $linkend;
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($newlabel, $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$link.($max?dol_trunc($newref,$max,'middle'):$newref).$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ class EcmFiles //extends CommonObject
|
|||
* @var string Name of table without prefix where object is stored
|
||||
*/
|
||||
public $table_element = 'ecm_files';
|
||||
public $picto = 'generic';
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
@ -752,43 +753,7 @@ class EcmFiles //extends CommonObject
|
|||
static function LibStatut($status,$mode=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
$prefix='';
|
||||
if ($status == 1) return $langs->trans('Enabled');
|
||||
if ($status == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled');
|
||||
if ($status == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4');
|
||||
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
||||
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||
}
|
||||
if ($mode == 6)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
||||
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -45,26 +45,36 @@ class FormEcm
|
|||
|
||||
|
||||
/**
|
||||
* Retourne la liste des categories du type choisi
|
||||
* Return list of sections
|
||||
*
|
||||
* @param int $selected Id categorie preselectionnee
|
||||
* @param string $select_name Nom formulaire HTML
|
||||
* @param int $selected Id of preselected section
|
||||
* @param string $select_name Name of HTML select component
|
||||
* @param string $module Module ('ecm', 'medias', ...)
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
function select_all_sections($selected=0,$select_name='')
|
||||
function select_all_sections($selected=0, $select_name='', $module='ecm')
|
||||
{
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
$langs->load("ecm");
|
||||
|
||||
if ($select_name=="") $select_name="catParent";
|
||||
if ($select_name=='') $select_name="catParent";
|
||||
|
||||
$cat = new EcmDirectory($this->db);
|
||||
$cate_arbo = $cat->get_full_arbo();
|
||||
if ($module == 'ecm')
|
||||
{
|
||||
$cat = new EcmDirectory($this->db);
|
||||
$cate_arbo = $cat->get_full_arbo();
|
||||
}
|
||||
if ($module == 'medias')
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$path = $conf->medias->multidir_output[$conf->entity];
|
||||
$cate_arbo = dol_dir_list($path, 'directories', 1, '', array('(\.meta|_preview.*\.png)$','^\.'), 'relativename', SORT_ASC);
|
||||
}
|
||||
|
||||
$output = '<select class="flat" name="'.$select_name.'">';
|
||||
$output = '<select class="flat minwidth100 maxwidth500" id="'.$select_name.'" name="'.$select_name.'">';
|
||||
if (is_array($cate_arbo))
|
||||
{
|
||||
if (! count($cate_arbo)) $output.= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>';
|
||||
if (! count($cate_arbo)) $output.= '<option value="-1" disabled>'.$langs->trans("NoDirectoriesFound").'</option>';
|
||||
else
|
||||
{
|
||||
$output.= '<option value="-1"> </option>';
|
||||
|
|
@ -78,11 +88,12 @@ class FormEcm
|
|||
{
|
||||
$add = '';
|
||||
}
|
||||
$output.= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'">'.$cate_arbo[$key]['fulllabel'].'</option>';
|
||||
$output.= '<option '.$add.'value="'.dol_escape_htmltag(empty($cate_arbo[$key]['id']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['id']).'">'.(empty($cate_arbo[$key]['fulllabel']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['fulllabel']).'</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$output.= '</select>';
|
||||
$output.=ajax_combobox($select_name);
|
||||
$output.= "\n";
|
||||
return $output;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,10 +42,16 @@ $langs->load("categories");
|
|||
if (! $user->rights->ecm->setup) accessforbidden();
|
||||
|
||||
// Get parameters
|
||||
$socid = GETPOST('socid','int');
|
||||
$action=GETPOST('action','alpha');
|
||||
$socid = GETPOST('socid','int');
|
||||
$action = GETPOST('action','alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
|
||||
$module = GETPOST('module', 'alpha');
|
||||
$website = GETPOST('website', 'alpha');
|
||||
$pageid = GETPOST('pageid', 'int');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
|
|
@ -53,9 +59,17 @@ if ($user->societe_id > 0)
|
|||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
$section=$urlsection=GETPOST('section');
|
||||
$section=$urlsection=GETPOST('section','alpha');
|
||||
if (empty($urlsection)) $urlsection='misc';
|
||||
$upload_dir = $conf->ecm->dir_output.'/'.$urlsection;
|
||||
|
||||
if ($module == 'ecm')
|
||||
{
|
||||
$upload_dir = $conf->ecm->dir_output.'/'.$urlsection;
|
||||
}
|
||||
if ($module == 'medias')
|
||||
{
|
||||
$upload_dir = $conf->medias->multidir_output[$conf->entity];
|
||||
}
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
|
|
@ -86,11 +100,20 @@ if (! empty($section))
|
|||
// Action ajout d'un produit ou service
|
||||
if ($action == 'add' && $user->rights->ecm->setup)
|
||||
{
|
||||
if (! empty($_POST["cancel"]))
|
||||
if ($cancel)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager');
|
||||
exit;
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$ecmdir->ref = trim($_POST["ref"]);
|
||||
$ecmdir->label = trim($_POST["label"]);
|
||||
$ecmdir->description = trim($_POST["desc"]);
|
||||
|
|
@ -150,27 +173,33 @@ if ($action == 'create')
|
|||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
if ($website) print '<input type="hidden" name="website" value="'.$website.'">';
|
||||
if ($pageid) print '<input type="hidden" name="pageid" value="'.$pageid.'">';
|
||||
|
||||
$title=$langs->trans("ECMNewSection");
|
||||
print load_fiche_titre($title);
|
||||
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Label
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="40" maxlength="32" value="'.$ecmdir->label.'"></td></tr>'."\n";
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" class="minwidth100" maxlength="32" value="'.$ecmdir->label.'"></td></tr>'."\n";
|
||||
|
||||
print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
|
||||
print $formecm->select_all_sections(! empty($_GET["catParent"])?$_GET["catParent"]:$ecmdir->fk_parent,'catParent');
|
||||
print $formecm->select_all_sections(! empty($_GET["catParent"]) ? $_GET["catParent"] : $ecmdir->fk_parent, 'catParent', $module);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Description
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
print '<textarea name="desc" rows="4" cols="90">';
|
||||
print $ecmdir->description;
|
||||
print '</textarea>';
|
||||
print '</td></tr>'."\n";
|
||||
if ($module == 'ecm')
|
||||
{
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
print '<textarea name="desc" rows="4" class="quatrevingtpercent">';
|
||||
print $ecmdir->description;
|
||||
print '</textarea>';
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
|
@ -206,7 +235,7 @@ if (empty($action) || $action == 'delete_section')
|
|||
if ($action == 'delete_section')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection');
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Construit fiche rubrique
|
||||
|
|
|
|||
|
|
@ -247,10 +247,9 @@ if ($action == 'edit')
|
|||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
}
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("File"), 0, 'generic');
|
||||
dol_fiche_head($head, 'card', $langs->trans("File"), -1, 'generic');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
|
||||
$s='';
|
||||
$tmpecmdir=new EcmDirectory($db); // Need to create a new one
|
||||
$tmpecmdir->fetch($ecmdir->id);
|
||||
|
|
@ -259,7 +258,7 @@ $i=0;
|
|||
while ($tmpecmdir && $result > 0)
|
||||
{
|
||||
$tmpecmdir->ref=$tmpecmdir->label;
|
||||
$s=$tmpecmdir->getNomUrl(1).$s;
|
||||
$s=$tmpecmdir->getNomUrl(1).$s;
|
||||
if ($tmpecmdir->fk_parent)
|
||||
{
|
||||
$s=' -> '.$s;
|
||||
|
|
@ -272,28 +271,18 @@ while ($tmpecmdir && $result > 0)
|
|||
$i++;
|
||||
}
|
||||
|
||||
print img_picto('','object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> ';
|
||||
print $s;
|
||||
print ' -> ';
|
||||
if ($action == 'edit') print '<input type="text" name="label" class="quatrevingtpercent" value="'.$urlfile.'">';
|
||||
else print $urlfile;
|
||||
print '</td></tr>';
|
||||
/*print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<textarea class="flat" name="description" cols="80">';
|
||||
print $ecmdir->description;
|
||||
print '</textarea>';
|
||||
}
|
||||
else print dol_nl2br($ecmdir->description);
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("ECMCreationUser").'</td><td>';
|
||||
$userecm=new User($db);
|
||||
$userecm->fetch($ecmdir->fk_user_c);
|
||||
print $userecm->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
*/
|
||||
print '<tr><td>'.$langs->trans("ECMCreationDate").'</td><td>';
|
||||
$s = img_picto('','object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> '.$s.' -> ';
|
||||
if ($action == 'edit') $s .= '<input type="text" name="label" class="quatrevingtpercent" value="'.$urlfile.'">';
|
||||
else $s .= $urlfile;
|
||||
|
||||
$object->ref=''; // Force to hide ref
|
||||
dol_banner_tab($object, '', $morehtml, 0, '', '', $s);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ECMCreationDate").'</td><td>';
|
||||
print dol_print_date(dol_filemtime($fullpath),'dayhour');
|
||||
print '</td></tr>';
|
||||
/*print '<tr><td>'.$langs->trans("ECMDirectoryForFiles").'</td><td>';
|
||||
|
|
@ -385,6 +374,7 @@ else
|
|||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print ajax_autoselect('downloadinternallink');
|
||||
print ajax_autoselect('downloadlink');
|
||||
|
|
|
|||
|
|
@ -337,165 +337,6 @@ dol_fiche_head($head, 'index', $langs->trans("ECMArea").' - '.$langs->trans("ECM
|
|||
$module='ecm';
|
||||
include DOL_DOCUMENT_ROOT.'/ecm/tpl/filemanager.tpl.php';
|
||||
|
||||
|
||||
/*
|
||||
// Start container of all panels
|
||||
?>
|
||||
<!-- Begin div id="containerlayout" -->
|
||||
<div id="containerlayout">
|
||||
<div id="ecm-layout-north" class="toolbar largebutton">
|
||||
<?php
|
||||
|
||||
// Start top panel, toolbar
|
||||
print '<div class="inline-block toolbarbutton centpercent">';
|
||||
|
||||
// Toolbar
|
||||
if ($user->rights->ecm->setup)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ECMAddSection')).'">';
|
||||
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
|
||||
print '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="#" class="inline-block valignmiddle toolbarbutton" title="'.$langs->trans("NotAllowed").'">';
|
||||
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
|
||||
print '</a>';
|
||||
}
|
||||
$url=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:'')));
|
||||
print '<a href="'.$url.'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ReSyncListOfDir')).'">';
|
||||
print '<img id="refreshbutton" class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">';
|
||||
print '</a>';
|
||||
|
||||
|
||||
// Start Add new file area
|
||||
$nameforformuserfile = 'formuserfileecm';
|
||||
|
||||
print '<div class="inline-block valignmiddle floatright">';
|
||||
|
||||
// To attach new file
|
||||
if ((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) || ! empty($section))
|
||||
{
|
||||
if ((empty($section) || $section == -1) && ($module != 'medias'))
|
||||
{
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#<?php echo $nameforformuserfile ?>').hide();
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
$formfile=new FormFile($db);
|
||||
$formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48, null, '', 0, '', 0, $nameforformuserfile);
|
||||
}
|
||||
else print ' ';
|
||||
|
||||
print '</div>';
|
||||
// End Add new file area
|
||||
|
||||
|
||||
print '</div>';
|
||||
// End top panel, toolbar
|
||||
|
||||
?>
|
||||
</div>
|
||||
<div id="ecm-layout-west" class="inline-block">
|
||||
<?php
|
||||
// Start left area
|
||||
|
||||
|
||||
// Confirmation de la suppression d'une ligne categorie
|
||||
if ($action == 'delete_section')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection','','',1);
|
||||
}
|
||||
// End confirm
|
||||
|
||||
|
||||
if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete')
|
||||
{
|
||||
print '<table width="100%" class="liste noborderbottom">'."\n";
|
||||
|
||||
print '<!-- Title for manual directories -->'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print '<th class="liste_titre" align="left" colspan="6">';
|
||||
print ' '.$langs->trans("ECMSections");
|
||||
print '</th></tr>';
|
||||
|
||||
$showonrightsize='';
|
||||
|
||||
// Manual section
|
||||
$htmltooltip=$langs->trans("ECMAreaDesc2");
|
||||
|
||||
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))
|
||||
{
|
||||
print '<tr><td colspan="6">';
|
||||
|
||||
// Show filemanager tree (will be filled by call of ajax enablefiletreeajax.tpl.php that execute ajaxdirtree.php)
|
||||
print '<div id="filetree" class="ecmfiletree"></div>';
|
||||
|
||||
if ($action == 'deletefile') print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile');
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="6" style="padding-left: 20px">';
|
||||
|
||||
if (empty($module)) $module='ecm';
|
||||
|
||||
$_POST['modulepart'] = $module;
|
||||
$_POST['openeddir'] = GETPOST('openeddir');
|
||||
$_POST['dir'] = empty($_POST['dir'])?'/':$_POST['dir'];
|
||||
|
||||
// Show filemanager tree (will be filled by direct include of ajaxdirtree.php in mode noajax, this will return all dir - all levels - to show)
|
||||
print '<div id="filetree" class="ecmfiletree">';
|
||||
|
||||
$mode='noajax';
|
||||
$url=DOL_URL_ROOT.'/ecm/index.php';
|
||||
include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirtree.php';
|
||||
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
|
||||
// End left panel
|
||||
?>
|
||||
</div>
|
||||
<div id="ecm-layout-center" class="inline-block">
|
||||
<div class="pane-in ecm-in-layout-center">
|
||||
<div id="ecmfileview" class="ecmfileview">
|
||||
<?php
|
||||
// Start right panel
|
||||
|
||||
|
||||
$mode='noajax';
|
||||
$url=DOL_URL_ROOT.'/ecm/index.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
|
||||
|
||||
|
||||
// End right panel
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div> <!-- End div id="containerlayout" -->
|
||||
<?php
|
||||
|
||||
|
||||
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) {
|
||||
include DOL_DOCUMENT_ROOT.'/ecm/tpl/enablefiletreeajax.tpl.php';
|
||||
}
|
||||
*/
|
||||
|
||||
// End of page
|
||||
dol_fiche_end();
|
||||
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ $(document).ready(function() {
|
|||
|
||||
$('#filetree').fileTree({
|
||||
root: '<?php print dol_escape_js($openeddir); ?>',
|
||||
// Ajax called if we click to expand a dir (not a file). Parameter 'dir' is provided as a POST parameter by fileTree code.
|
||||
script: '<?php echo DOL_URL_ROOT.'/core/ajax/ajaxdirtree.php?modulepart='.$module.'&openeddir='.urlencode($openeddir); ?>',
|
||||
// Ajax called if we click to expand a dir (not a file). Parameter 'dir' is provided as a POST parameter by fileTree code to this following URL.
|
||||
script: '<?php echo DOL_URL_ROOT.'/core/ajax/ajaxdirtree.php?modulepart='.$module.'&openeddir='.urlencode($openeddir).(empty($param)?'':$param); ?>',
|
||||
folderEvent: 'click', // 'dblclick'
|
||||
multiFolder: false },
|
||||
// Called if we click on a file (not a dir)
|
||||
|
|
@ -46,7 +46,7 @@ $(document).ready(function() {
|
|||
function(elem) {
|
||||
id=elem.attr('id').substr(12); // We get id that is 'fmdirlia_id_xxx' (id we want is xxx)
|
||||
jQuery("#<?php echo $nameforformuserfile ?>_section_dir").val(elem.attr('rel'));
|
||||
jQuery("#<?php echo $nameforformuserfile ?>_section_id").val(id);
|
||||
jQuery("#<?php echo $nameforformuserfile ?>_section_id").val(id);
|
||||
jQuery('#<?php echo $nameforformuserfile ?>').show();
|
||||
}
|
||||
);
|
||||
|
|
@ -73,7 +73,7 @@ function loadandshowpreview(filedirname,section)
|
|||
|
||||
$('#ecmfileview').empty();
|
||||
|
||||
var url = '<?php echo dol_buildpath('/core/ajax/ajaxdirpreview.php',1); ?>?action=preview&module=<?php echo $module; ?>§ion='+section+'&file='+urlencode(filedirname);
|
||||
var url = '<?php echo dol_buildpath('/core/ajax/ajaxdirpreview.php',1); ?>?action=preview&module=<?php echo $module; ?>§ion='+section+'&file='+urlencode(filedirname)<?php echo (empty($param)?'':"+'".$param."'"); ?>;
|
||||
$.get(url, function(data) {
|
||||
//alert('Load of url '+url+' was performed : '+data);
|
||||
pos=data.indexOf("TYPE=directory",0);
|
||||
|
|
|
|||
|
|
@ -23,8 +23,25 @@
|
|||
<!-- Doc of fileTree plugin at http://www.abeautifulsite.net/blog/2008/03/jquery-file-tree/ -->
|
||||
|
||||
<?php
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
|
||||
|
||||
if (empty($module)) $module='ecm';
|
||||
|
||||
$permtoadd = 0;
|
||||
$permtoupload = 1;
|
||||
if ($module == 'ecm')
|
||||
{
|
||||
$permtoadd = $user->rights->ecm->setup;
|
||||
$permtoupload = $user->rights->ecm->upload;
|
||||
}
|
||||
if ($module == 'medias')
|
||||
{
|
||||
$permtoadd = ($user->rights->mailing->creer || $user->rights->website->setup);
|
||||
$permtoupload = ($user->rights->mailing->creer || $user->rights->website->setup);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Confirm remove file (for non javascript users)
|
||||
if (($action == 'delete' || $action == 'file_manager_delete') && empty($conf->use_javascript_ajax))
|
||||
|
|
@ -43,25 +60,29 @@ if (($action == 'delete' || $action == 'file_manager_delete') && empty($conf->us
|
|||
print '<div class="inline-block toolbarbutton centpercent">';
|
||||
|
||||
// Toolbar
|
||||
if ($user->rights->ecm->setup)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ECMAddSection')).'">';
|
||||
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
|
||||
print '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="#" class="inline-block valignmiddle toolbarbutton" title="'.$langs->trans("NotAllowed").'">';
|
||||
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
|
||||
print '</a>';
|
||||
}
|
||||
if ($module == 'ecm')
|
||||
{
|
||||
$url=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:'')));
|
||||
print '<a href="'.$url.'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ReSyncListOfDir')).'">';
|
||||
print '<img id="refreshbutton" class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">';
|
||||
print '</a>';
|
||||
}
|
||||
//if (preg_match('/\/ecm/', $_SERVER['PHP_SELF'])) {
|
||||
//if ($module == 'ecm') {
|
||||
|
||||
if ($permtoadd)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create&module='.urlencode($module).($website?'&website='.$website:'').($pageid?'&pageid='.$pageid:'').'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$website.'&pageid='.$pageid).'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ECMAddSection')).'">';
|
||||
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
|
||||
print '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="#" class="inline-block valignmiddle toolbarbutton" title="'.$langs->trans("NotAllowed").'">';
|
||||
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
|
||||
print '</a>';
|
||||
}
|
||||
if ($module == 'ecm')
|
||||
{
|
||||
$tmpurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:'')));
|
||||
print '<a href="'.$tmpurl.'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ReSyncListOfDir')).'">';
|
||||
print '<img id="refreshbutton" class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">';
|
||||
print '</a>';
|
||||
}
|
||||
//}
|
||||
|
||||
// Start "Add new file" area
|
||||
$nameforformuserfile = 'formuserfileecm';
|
||||
|
|
@ -84,7 +105,7 @@ if ((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABL
|
|||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
$formfile=new FormFile($db);
|
||||
$formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48, null, '', 0, '', 0, $nameforformuserfile);
|
||||
$formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section?$section:-1), $permtoupload, 48, null, '', 0, '', 0, $nameforformuserfile);
|
||||
}
|
||||
else print ' ';
|
||||
|
||||
|
|
@ -140,8 +161,6 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
|
|||
{
|
||||
print '<tr><td colspan="6" style="padding-left: 20px">';
|
||||
|
||||
if (empty($module)) $module='ecm';
|
||||
|
||||
$_POST['modulepart'] = $module;
|
||||
$_POST['openeddir'] = GETPOST('openeddir');
|
||||
$_POST['dir'] = empty($_POST['dir'])?'/':$_POST['dir'];
|
||||
|
|
@ -150,7 +169,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
|
|||
print '<div id="filetree" class="ecmfiletree">';
|
||||
|
||||
$mode='noajax';
|
||||
$url=DOL_URL_ROOT.'/ecm/index.php';
|
||||
if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php';
|
||||
include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirtree.php';
|
||||
|
||||
print '</div>';
|
||||
|
|
@ -173,7 +192,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
|
|||
|
||||
|
||||
$mode='noajax';
|
||||
$url=DOL_URL_ROOT.'/ecm/index.php';
|
||||
if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -233,12 +233,12 @@ foreach ($search_array_options as $key => $val)
|
|||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
$mode_search=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
|
|
|
|||
|
|
@ -234,8 +234,12 @@ if (empty($reshook))
|
|||
$db->begin();
|
||||
|
||||
$id = $object->create($user);
|
||||
if ($id <= 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($id > 0)
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||
|
|
|
|||
|
|
@ -215,7 +215,8 @@ class ExpenseReport extends CommonObject
|
|||
$resql=$this->db->query($sql);
|
||||
if (!$resql) $error++;
|
||||
|
||||
if (is_array($this->lines) && count($this->lines)>0) {
|
||||
if (is_array($this->lines) && count($this->lines)>0)
|
||||
{
|
||||
foreach ($this->lines as $i => $val)
|
||||
{
|
||||
$newndfline=new ExpenseReportLine($this->db);
|
||||
|
|
@ -233,6 +234,12 @@ class ExpenseReport extends CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result=$this->update_price();
|
||||
|
|
|
|||
|
|
@ -324,13 +324,13 @@ foreach ($search_array_options as $key => $val)
|
|||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
$mode_search=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
|
|
@ -380,7 +380,7 @@ if ($resql)
|
|||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->expensereport->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
// Lines of title fields
|
||||
|
|
@ -486,15 +486,11 @@ if ($resql)
|
|||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
||||
}
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
$topicmail="SendExpenseReport";
|
||||
$modelmail="expensereport";
|
||||
$objecttmp=new ExpenseReport($db);
|
||||
$trackid='int'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
|
||||
}
|
||||
$topicmail="SendExpenseReport";
|
||||
$modelmail="expensereport";
|
||||
$objecttmp=new ExpenseReport($db);
|
||||
$trackid='int'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -222,12 +222,12 @@ foreach ($search_array_options as $key => $val)
|
|||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
$mode_search=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
|
|
@ -285,9 +285,8 @@ if ($resql)
|
|||
//'presend'=>$langs->trans("SendByMail"),
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
if ($user->rights->ficheinter->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
//if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
// Lines of title fields
|
||||
|
|
|
|||
|
|
@ -1392,7 +1392,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
* @param float $txlocaltax2 Localtax2 tax
|
||||
* @param int $fk_product Id product
|
||||
* @param int $fk_prod_fourn_price Id supplier price
|
||||
* @param string $fourn_ref Supplier reference price
|
||||
* @param string $ref_supplier Supplier reference price
|
||||
* @param float $remise_percent Remise
|
||||
* @param string $price_base_type HT or TTC
|
||||
* @param float $pu_ttc Unit price TTC
|
||||
|
|
@ -1408,13 +1408,13 @@ class CommandeFournisseur extends CommonOrder
|
|||
* @param int $origin_id Id of origin object
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null, $pu_ht_devise=0, $origin='', $origin_id=0)
|
||||
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $ref_supplier='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null, $pu_ht_devise=0, $origin='', $origin_id=0)
|
||||
{
|
||||
global $langs,$mysoc,$conf;
|
||||
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $fk_prod_fourn_price, $fourn_ref, $remise_percent, $price_base_type, $pu_ttc, $type, $fk_unit");
|
||||
dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $fk_prod_fourn_price, $ref_supplier, $remise_percent, $price_base_type, $pu_ttc, $type, $fk_unit");
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Clean parameters
|
||||
|
|
@ -1441,7 +1441,6 @@ class CommandeFournisseur extends CommonOrder
|
|||
$pu=$pu_ttc;
|
||||
}
|
||||
$desc=trim($desc);
|
||||
$ref_supplier=''; // Ref of supplier price when we add line
|
||||
|
||||
// Check parameters
|
||||
if ($qty < 1 && ! $fk_product)
|
||||
|
|
@ -1460,16 +1459,16 @@ class CommandeFournisseur extends CommonOrder
|
|||
if (empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
|
||||
{
|
||||
// Check quantity is enough
|
||||
dol_syslog(get_class($this)."::addline we check supplier prices fk_product=".$fk_product." fk_prod_fourn_price=".$fk_prod_fourn_price." qty=".$qty." fourn_ref=".$fourn_ref);
|
||||
dol_syslog(get_class($this)."::addline we check supplier prices fk_product=".$fk_product." fk_prod_fourn_price=".$fk_prod_fourn_price." qty=".$qty." ref_supplier=".$ref_supplier);
|
||||
$prod = new Product($this->db, $fk_product);
|
||||
if ($prod->fetch($fk_product) > 0)
|
||||
{
|
||||
$product_type = $prod->type;
|
||||
$label = $prod->label;
|
||||
|
||||
// We use 'none' instead of $fourn_ref, because fourn_ref may not exists anymore. So we will take the first supplier price ok.
|
||||
// We use 'none' instead of $ref_supplier, because fourn_ref may not exists anymore. So we will take the first supplier price ok.
|
||||
// If we want a dedicated supplier price, we must provide $fk_prod_fourn_price.
|
||||
$result=$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc?$this->fk_soc:$this->socid)); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$fourn_ref/$this->fk_soc
|
||||
$result=$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc?$this->fk_soc:$this->socid)); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$ref_supplier/$this->fk_soc
|
||||
if ($result > 0)
|
||||
{
|
||||
$pu = $prod->fourn_pu; // Unit price supplier price set by get_buyprice
|
||||
|
|
@ -2335,8 +2334,8 @@ class CommandeFournisseur extends CommonOrder
|
|||
* @param string $desc Description de la ligne
|
||||
* @param double $pu Prix unitaire
|
||||
* @param double $qty Quantity
|
||||
* @param double $remise_percent Pourcentage de remise de la ligne
|
||||
* @param double $txtva Taux TVA
|
||||
* @param double $remise_percent Percent discount on line
|
||||
* @param double $txtva VAT rate
|
||||
* @param double $txlocaltax1 Localtax1 tax
|
||||
* @param double $txlocaltax2 Localtax2 tax
|
||||
* @param double $price_base_type Type of price base
|
||||
|
|
@ -2348,9 +2347,10 @@ class CommandeFournisseur extends CommonOrder
|
|||
* @param array $array_options Extrafields array
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param double $pu_ht_devise Unit price in currency
|
||||
* @param string $ref_supplier Supplier ref
|
||||
* @return int < 0 if error, > 0 if ok
|
||||
*/
|
||||
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $notrigger=false, $date_start='', $date_end='', $array_options=0, $fk_unit=null, $pu_ht_devise = 0)
|
||||
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $notrigger=false, $date_start='', $date_end='', $array_options=0, $fk_unit=null, $pu_ht_devise=0, $ref_supplier='')
|
||||
{
|
||||
global $mysoc, $conf;
|
||||
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type, $fk_unit");
|
||||
|
|
@ -2430,6 +2430,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
//$this->line->label=$label;
|
||||
$this->line->desc=$desc;
|
||||
$this->line->qty=$qty;
|
||||
$this->line->ref_supplier=$ref_supplier;
|
||||
|
||||
$this->line->vat_src_code = $vat_src_code;
|
||||
$this->line->tva_tx = $txtva;
|
||||
|
|
@ -3277,6 +3278,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
|||
// Mise a jour ligne en base
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
|
||||
$sql.= " description='".$this->db->escape($this->desc)."'";
|
||||
$sql.= ", ref='".$this->db->escape($this->ref_supplier)."'";
|
||||
$sql.= ", subprice='".price2num($this->subprice)."'";
|
||||
//$sql.= ",remise='".price2num($remise)."'";
|
||||
$sql.= ", remise_percent='".price2num($this->remise_percent)."'";
|
||||
|
|
|
|||
|
|
@ -1372,11 +1372,12 @@ class FactureFournisseur extends CommonInvoice
|
|||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param int $origin_id id origin document
|
||||
* @param double $pu_ht_devise Amount in currency
|
||||
* @param string $ref_supplier Supplier ref
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*
|
||||
* FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order.
|
||||
*/
|
||||
public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0, $pu_ht_devise=0)
|
||||
public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0, $pu_ht_devise=0, $ref_supplier='')
|
||||
{
|
||||
dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type,$fk_unit", LOG_DEBUG);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
|
@ -1435,6 +1436,7 @@ class FactureFournisseur extends CommonInvoice
|
|||
//$this->line->label=$label; // deprecated
|
||||
$this->line->desc=$desc;
|
||||
$this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
|
||||
$this->line->ref_supplier=$ref_supplier;
|
||||
|
||||
$this->line->vat_src_code=$vat_src_code;
|
||||
$this->line->tva_tx=$txtva;
|
||||
|
|
@ -2615,7 +2617,8 @@ class SupplierInvoiceLine extends CommonObjectLine
|
|||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET";
|
||||
$sql.= " description ='".$this->db->escape($this->description)."'";
|
||||
$sql.= " description ='".$this->db->escape($this->description)."'";
|
||||
$sql.= ", ref ='".$this->db->escape($this->ref)."'";
|
||||
$sql.= ", pu_ht = ".price2num($this->pu_ht);
|
||||
$sql.= ", pu_ttc = ".price2num($this->pu_ttc);
|
||||
$sql.= ", qty = ".price2num($this->qty);
|
||||
|
|
@ -2743,7 +2746,7 @@ class SupplierInvoiceLine extends CommonObjectLine
|
|||
|
||||
// Insertion dans base de la ligne
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= ' (fk_facture_fourn, fk_parent_line, label, description, qty,';
|
||||
$sql.= ' (fk_facture_fourn, fk_parent_line, label, description, ref, qty,';
|
||||
$sql.= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
|
||||
$sql.= ' fk_product, product_type, remise_percent, pu_ht, pu_ttc,';
|
||||
$sql.= ' date_start, date_end, fk_code_ventilation, rang, special_code,';
|
||||
|
|
@ -2754,6 +2757,7 @@ class SupplierInvoiceLine extends CommonObjectLine
|
|||
$sql.= " ".($this->fk_parent_line>0?"'".$this->db->escape($this->fk_parent_line)."'":"null").",";
|
||||
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
||||
$sql.= " '".$this->db->escape($this->desc)."',";
|
||||
$sql.= " '".$this->db->escape($this->ref_supplier)."',";
|
||||
$sql.= " ".price2num($this->qty).",";
|
||||
|
||||
$sql.= " ".(empty($this->vat_src_code)?"''":"'".$this->db->escape($this->vat_src_code)."'").",";
|
||||
|
|
|
|||
|
|
@ -432,7 +432,7 @@ class ProductFournisseur extends Product
|
|||
if (empty($ignore_expression) && !empty($this->fk_supplier_price_expression))
|
||||
{
|
||||
$priceparser = new PriceParser($this->db);
|
||||
$price_result = $priceparser->parseProductSupplier($this->fk_product, $this->fk_supplier_price_expression, $this->fourn_qty, $this->fourn_tva_tx);
|
||||
$price_result = $priceparser->parseProductSupplier($this);
|
||||
if ($price_result >= 0) {
|
||||
$this->fourn_price = $price_result;
|
||||
//recalculation of unitprice, as probably the price changed...
|
||||
|
|
|
|||
|
|
@ -446,6 +446,7 @@ if (empty($reshook))
|
|||
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
|
||||
$desc = $product_desc;
|
||||
$type = GETPOST('type');
|
||||
$ref_supplier = GETPOST('fourn_ref','alpha');
|
||||
|
||||
$fk_unit= GETPOST('units', 'alpha');
|
||||
|
||||
|
|
@ -470,7 +471,7 @@ if (empty($reshook))
|
|||
|
||||
$pu_ht_devise = price2num($price_ht_devise, 'MU');
|
||||
|
||||
$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, $pu_ht_devise);
|
||||
$result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, $ref_supplier, $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end, $array_options, $fk_unit, $pu_ht_devise);
|
||||
}
|
||||
|
||||
//print "xx".$tva_tx; exit;
|
||||
|
|
@ -507,6 +508,7 @@ if (empty($reshook))
|
|||
unset($_POST['price_ht']);
|
||||
unset($_POST['multicurrency_price_ht']);
|
||||
unset($_POST['price_ttc']);
|
||||
unset($_POST['fourn_ref']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['label']);
|
||||
unset($localtax1_tx);
|
||||
|
|
@ -547,23 +549,23 @@ if (empty($reshook))
|
|||
|
||||
if ($lineid)
|
||||
{
|
||||
$line = new CommandeFournisseurLigne($db);
|
||||
$res = $line->fetch($lineid);
|
||||
if (!$res) dol_print_error($db);
|
||||
$line = new CommandeFournisseurLigne($db);
|
||||
$res = $line->fetch($lineid);
|
||||
if (!$res) dol_print_error($db);
|
||||
}
|
||||
|
||||
$productsupplier = new ProductFournisseur($db);
|
||||
if ($productsupplier->get_buyprice(0, price2num($_POST['qty']), $line->fk_product, 'none', GETPOST('socid','int')) < 0 )
|
||||
if ($line->fk_product > 0 && $productsupplier->get_buyprice(0, price2num($_POST['qty']), $line->fk_product, 'none', GETPOST('socid','int')) < 0 )
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'warnings');
|
||||
}
|
||||
|
||||
$date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
|
||||
$date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
||||
$date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
|
||||
$date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
||||
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
if (preg_match('/\*/', $vat_rate))
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
if (preg_match('/\*/', $vat_rate))
|
||||
$info_bits |= 0x01;
|
||||
|
||||
// Define vat_rate
|
||||
|
|
@ -604,23 +606,24 @@ if (empty($reshook))
|
|||
}
|
||||
|
||||
$result = $object->updateline(
|
||||
$lineid,
|
||||
$_POST['product_desc'],
|
||||
$ht,
|
||||
$_POST['qty'],
|
||||
$_POST['remise_percent'],
|
||||
$vat_rate,
|
||||
$localtax1_rate,
|
||||
$localtax2_rate,
|
||||
$price_base_type,
|
||||
0,
|
||||
isset($_POST["type"])?$_POST["type"]:$line->product_type,
|
||||
false,
|
||||
$date_start,
|
||||
$date_end,
|
||||
$array_options,
|
||||
$lineid,
|
||||
$_POST['product_desc'],
|
||||
$ht,
|
||||
$_POST['qty'],
|
||||
$_POST['remise_percent'],
|
||||
$vat_rate,
|
||||
$localtax1_rate,
|
||||
$localtax2_rate,
|
||||
$price_base_type,
|
||||
0,
|
||||
isset($_POST["type"])?$_POST["type"]:$line->product_type,
|
||||
false,
|
||||
$date_start,
|
||||
$date_end,
|
||||
$array_options,
|
||||
$_POST['units'],
|
||||
$pu_ht_devise
|
||||
$pu_ht_devise,
|
||||
GETPOST('fourn_ref','alpha')
|
||||
);
|
||||
unset($_POST['qty']);
|
||||
unset($_POST['type']);
|
||||
|
|
@ -629,6 +632,7 @@ if (empty($reshook))
|
|||
unset($_POST['dp_desc']);
|
||||
unset($_POST['np_desc']);
|
||||
unset($_POST['pu']);
|
||||
unset($_POST['fourn_ref']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['date_start']);
|
||||
unset($_POST['date_end']);
|
||||
|
|
|
|||
|
|
@ -426,8 +426,8 @@ if ($id > 0 || ! empty($ref)) {
|
|||
}
|
||||
}
|
||||
|
||||
// Auteur
|
||||
print '<tr><td>' . $langs->trans("AuthorRequest") . '</td>';
|
||||
// Author
|
||||
print '<tr><td class="titlefield">' . $langs->trans("AuthorRequest") . '</td>';
|
||||
print '<td>' . $author->getNomUrl(1, '', 0, 0, 0) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
|
@ -443,11 +443,13 @@ if ($id > 0 || ! empty($ref)) {
|
|||
$disabled = 0;
|
||||
|
||||
// Line of orders
|
||||
if ($object->statut <= 2 || $object->statut >= 6) {
|
||||
print $langs->trans("OrderStatusNotReadyToDispatch");
|
||||
if ($object->statut <= CommandeFournisseur::STATUS_ACCEPTED || $object->statut >= CommandeFournisseur::STATUS_CANCELED) {
|
||||
print '<span class="opacitymedium">'.$langs->trans("OrderStatusNotReadyToDispatch").'</span>';
|
||||
}
|
||||
|
||||
if ($object->statut == 3 || $object->statut == 4 || $object->statut == 5) {
|
||||
if ($object->statut == CommandeFournisseur::STATUS_ORDERSENT
|
||||
|| $object->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY
|
||||
|| $object->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) {
|
||||
$entrepot = new Entrepot($db);
|
||||
$listwarehouses = $entrepot->list_array(1);
|
||||
|
||||
|
|
|
|||
|
|
@ -580,12 +580,12 @@ foreach ($search_array_options as $key => $val)
|
|||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
$mode_search=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
|
|
@ -661,7 +661,7 @@ if ($resql)
|
|||
);
|
||||
//if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
if ($user->rights->fournisseur->commande->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
|
||||
if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
// Lignes des champs de filtre
|
||||
|
|
@ -678,15 +678,11 @@ if ($resql)
|
|||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
$topicmail="SendOrderRef";
|
||||
$modelmail="order_supplier_send";
|
||||
$objecttmp=new CommandeFournisseur($db);
|
||||
$trackid='sord'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
|
||||
}
|
||||
$topicmail="SendOrderRef";
|
||||
$modelmail="order_supplier_send";
|
||||
$objecttmp=new CommandeFournisseur($db);
|
||||
$trackid='sord'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($massaction == 'createbills')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -845,7 +845,8 @@ if (empty($reshook))
|
|||
if ($result >= 0)
|
||||
{
|
||||
unset($_POST['label']);
|
||||
unset($_POST['date_starthour']);
|
||||
unset($_POST['fourn_ref']);
|
||||
unset($_POST['date_starthour']);
|
||||
unset($_POST['date_startmin']);
|
||||
unset($_POST['date_startsec']);
|
||||
unset($_POST['date_startday']);
|
||||
|
|
@ -998,7 +999,6 @@ if (empty($reshook))
|
|||
$type = $productsupplier->type;
|
||||
$price_base_type = 'HT';
|
||||
|
||||
// TODO Save the product supplier ref into database (like done for supplier propal and order) into field ref_supplier (must rename field ref into ref_supplier first)
|
||||
$result=$object->addline(
|
||||
$desc,
|
||||
$productsupplier->fourn_pu,
|
||||
|
|
@ -1017,7 +1017,8 @@ if (empty($reshook))
|
|||
-1,
|
||||
0,
|
||||
$array_options,
|
||||
$productsupplier->fk_unit
|
||||
$productsupplier->fk_unit,
|
||||
$productsupplier->fourn_ref
|
||||
);
|
||||
}
|
||||
if ($idprod == -99 || $idprod == 0)
|
||||
|
|
@ -1042,6 +1043,7 @@ if (empty($reshook))
|
|||
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
|
||||
$desc = $product_desc;
|
||||
$type = GETPOST('type');
|
||||
$ref_supplier = GETPOST('fourn_ref','alpha');
|
||||
|
||||
$fk_unit= GETPOST('units', 'alpha');
|
||||
|
||||
|
|
@ -1063,7 +1065,7 @@ if (empty($reshook))
|
|||
$price_base_type = 'HT';
|
||||
$pu_ht_devise = price2num($price_ht_devise, 'MU');
|
||||
|
||||
$result=$object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit, 0, $pu_ht_devise);
|
||||
$result=$object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit, 0, $pu_ht_devise, $ref_supplier);
|
||||
}
|
||||
|
||||
//print "xx".$tva_tx; exit;
|
||||
|
|
@ -1098,6 +1100,7 @@ if (empty($reshook))
|
|||
unset($_POST['price_ht']);
|
||||
unset($_POST['multicurrency_price_ht']);
|
||||
unset($_POST['price_ttc']);
|
||||
unset($_POST['fourn_ref']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['label']);
|
||||
unset($localtax1_tx);
|
||||
|
|
|
|||
|
|
@ -372,12 +372,12 @@ foreach ($search_array_options as $key => $val)
|
|||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
$mode_search=0;
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
|
|
@ -472,7 +472,7 @@ if ($resql)
|
|||
);
|
||||
//if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
if ($user->rights->fournisseur->facture->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
|
||||
if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$i = 0;
|
||||
|
|
@ -489,15 +489,11 @@ if ($resql)
|
|||
|
||||
print_barre_liste($langs->trans("BillsSuppliers").($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
$topicmail="SendBillRef";
|
||||
$modelmail="supplier_invoice_send";
|
||||
$objecttmp=new FactureFournisseur($db);
|
||||
$trackid='sinv'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
|
||||
}
|
||||
$topicmail="SendBillRef";
|
||||
$modelmail="supplier_invoice_send";
|
||||
$objecttmp=new FactureFournisseur($db);
|
||||
$trackid='sinv'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($massaction == 'createbills')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ $arrayofmassactions = array(
|
|||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ $arrayofmassactions = array(
|
|||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->holiday->delete) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
//if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ print load_fiche_titre($langs->trans("HRMArea"),'', 'title_hrm.png');
|
|||
|
||||
|
||||
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
|
||||
if ( empty($setupcompanynotcomplete))
|
||||
if (! empty($setupcompanynotcomplete))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"));
|
||||
|
|
@ -165,7 +165,7 @@ $langs->load("boxes");
|
|||
// Latest leave requests
|
||||
if (! empty($conf->holiday->enabled) && $user->rights->holiday->read)
|
||||
{
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.photo, u.statut, x.rowid, x.rowid as ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status";
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.photo, u.statut, x.rowid, x.rowid as ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE u.rowid = x.fk_user";
|
||||
$sql.= " AND x.entity = ".$conf->entity;
|
||||
|
|
@ -203,14 +203,18 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read)
|
|||
while ($i < $num && $i < $max)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$holidaystatic->id=$obj->rowid;
|
||||
$holidaystatic->ref=$obj->ref;
|
||||
|
||||
$userstatic->id=$obj->uid;
|
||||
$userstatic->lastname=$obj->lastname;
|
||||
$userstatic->firstname=$obj->firstname;
|
||||
$userstatic->login=$obj->login;
|
||||
$userstatic->photo=$obj->photo;
|
||||
$userstatic->email=$obj->email;
|
||||
$userstatic->statut=$obj->statut;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$holidaystatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.$userstatic->getNomUrl(-1, 'leave').'</td>';
|
||||
|
|
@ -242,7 +246,7 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read)
|
|||
// Last expense report (old module)
|
||||
if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
|
||||
{
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.statut, u.photo, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut";
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE u.rowid = d.fk_user";
|
||||
|
|
@ -277,14 +281,18 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
|
|||
while ($i < $num && $i < $max)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$deplacementstatic->ref=$obj->rowid;
|
||||
$deplacementstatic->id=$obj->rowid;
|
||||
|
||||
$userstatic->id=$obj->uid;
|
||||
$userstatic->lastname=$obj->lastname;
|
||||
$userstatic->firstname=$obj->firstname;
|
||||
$userstatic->login=$obj->login;
|
||||
$userstatic->email=$obj->email;
|
||||
$userstatic->statut=$obj->statut;
|
||||
$userstatic->photo=$obj->photo;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$deplacementstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.$userstatic->getNomUrl(-1).'</td>';
|
||||
|
|
@ -309,7 +317,7 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
|
|||
// Last expense report (new module)
|
||||
if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
|
||||
{
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.statut, u.photo, x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status";
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as x, ".MAIN_DB_PREFIX."user as u";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE u.rowid = x.fk_user_author";
|
||||
|
|
@ -344,14 +352,18 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire
|
|||
while ($i < $num && $i < $max)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$expensereportstatic->id=$obj->rowid;
|
||||
$expensereportstatic->ref=$obj->ref;
|
||||
|
||||
$userstatic->id=$obj->uid;
|
||||
$userstatic->lastname=$obj->lastname;
|
||||
$userstatic->firstname=$obj->firstname;
|
||||
$userstatic->email=$obj->email;
|
||||
$userstatic->login=$obj->login;
|
||||
$userstatic->statut=$obj->statut;
|
||||
$userstatic->photo=$obj->photo;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$expensereportstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.$userstatic->getNomUrl(-1).'</td>';
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ $langs->load("contracts");
|
|||
if (empty($user->societe_id))
|
||||
{
|
||||
$boxstat.='<div class="box">';
|
||||
$boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable nohover" width="100%">';
|
||||
$boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom nohover" width="100%">';
|
||||
$boxstat.='<tr class="liste_titre">';
|
||||
$boxstat.='<th class="liste_titre">'.$langs->trans("DolibarrStateBoard").'</th>';
|
||||
$boxstat.='</tr>';
|
||||
|
|
@ -525,7 +525,7 @@ if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $totallate = round($to
|
|||
//var_dump($totallate);
|
||||
$boxwork='';
|
||||
$boxwork.='<div class="box">';
|
||||
$boxwork.='<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable" width="100%">'."\n";
|
||||
$boxwork.='<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable boxtablenobottom" width="100%">'."\n";
|
||||
$boxwork.='<tr class="liste_titre">';
|
||||
$boxwork.='<th class="liste_titre">'.$langs->trans("DolibarrWorkBoard").'</th>';
|
||||
$boxwork.='</tr>'."\n";
|
||||
|
|
|
|||
|
|
@ -528,6 +528,9 @@ ALTER TABLE llx_resource ADD UNIQUE INDEX uk_resource_ref (ref, entity);
|
|||
ALTER TABLE llx_product ADD COLUMN accountancy_code_sell_intra varchar(32) AFTER accountancy_code_sell;
|
||||
ALTER TABLE llx_product ADD COLUMN accountancy_code_sell_export varchar(32) AFTER accountancy_code_sell_intra;
|
||||
|
||||
ALTER TABLE llx_facture_rec ADD COLUMN modelpdf varchar(255) AFTER note_public;
|
||||
ALTER TABLE llx_facture_rec ADD COLUMN generate_pdf integer DEFAULT 0 AFTER auto_validate;
|
||||
|
||||
-- SPEC : use database type 'double' to store monetary values
|
||||
ALTER TABLE llx_blockedlog MODIFY COLUMN amounts double(24,8);
|
||||
ALTER TABLE llx_chargessociales MODIFY COLUMN amount double(24,8);
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ create table llx_facture_rec
|
|||
fk_account integer, -- bank account id
|
||||
note_private text,
|
||||
note_public text,
|
||||
modelpdf varchar(255),
|
||||
|
||||
fk_multicurrency integer,
|
||||
multicurrency_code varchar(255),
|
||||
|
|
@ -70,5 +71,6 @@ create table llx_facture_rec
|
|||
date_last_gen datetime DEFAULT NULL, -- date for last gen (date with last successfull generation of invoice)
|
||||
nb_gen_done integer DEFAULT NULL, -- nb of generation done (when an invoice is generated, this field must incremented)
|
||||
nb_gen_max integer DEFAULT NULL, -- maximum number of generation
|
||||
auto_validate integer DEFAULT 0 -- 0 to create in draft, 1 to create and validate the new invoice
|
||||
auto_validate integer DEFAULT 0, -- 0 to create in draft, 1 to create and validate the new invoice
|
||||
generate_pdf integer DEFAULT 0 -- 0 disable pdf, 1 to generate pdf
|
||||
)ENGINE=innodb;
|
||||
|
|
|
|||
|
|
@ -512,3 +512,5 @@ DeleteRepeatableInvoice=Delete template invoice
|
|||
ConfirmDeleteRepeatableInvoice=Are your sure you want to delete the template invoice?
|
||||
CreateOneBillByThird=Create one invoice per third party (otherwise, one invoice per order)
|
||||
BillCreated=%s bill(s) created
|
||||
StatusOfGeneratedDocuments=Status of document generation
|
||||
AutogenerateDoc=Auto generate document
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user