mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 09:08:09 +01:00
Merge branch '5.0' of https://github.com/Dolibarr/dolibarr into 5.0
This commit is contained in:
@@ -353,10 +353,12 @@ begin
|
||||
begin
|
||||
// TODO Copy file or ask to install package ?
|
||||
//CustomMessage('YouWillInstallDoliWamp')+#13#13
|
||||
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://ccc">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
|
||||
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://www.microsoft.com/en-us/download/details.aspx?id=30679">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
|
||||
end;
|
||||
|
||||
|
||||
// Pb seems similar with msvcp110.dll
|
||||
//vcredist_x64.exe
|
||||
|
||||
|
||||
// If we have a new database version, we should only copy old my.ini file into new directory
|
||||
// and change only all basedir= strings to use new version. Like this, data dir is still correct.
|
||||
// Install of service and stop/start scripts are already rebuild by installer.
|
||||
|
||||
@@ -165,7 +165,7 @@ if (empty($reshook))
|
||||
{
|
||||
// Selection of new fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
@@ -208,51 +208,51 @@ if (empty($reshook))
|
||||
|
||||
|
||||
if ($massaction == 'confirm_createbills') {
|
||||
|
||||
|
||||
$orders = GETPOST('toselect');
|
||||
$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) {
|
||||
|
||||
|
||||
$db->begin();
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
|
||||
$sql.= "fk_source";
|
||||
@@ -274,17 +274,17 @@ if ($massaction == 'confirm_createbills') {
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
|
||||
|
||||
$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);
|
||||
@@ -373,43 +373,43 @@ if ($massaction == 'confirm_createbills') {
|
||||
$fk_parent_line = $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$cmd->classifyBilled($user);
|
||||
|
||||
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(!empty($validate_invoices)) {
|
||||
|
||||
|
||||
$massaction = $action = 'builddoc';
|
||||
|
||||
|
||||
foreach($TAllFact as &$object) {
|
||||
$object->validate($user);
|
||||
$toselect[] = $object->id; // For builddoc action
|
||||
|
||||
|
||||
// Fac builddoc
|
||||
$upload_dir = $conf->facture->dir_output;
|
||||
$permissioncreate=$user->rights->facture->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
}
|
||||
|
||||
|
||||
$objectclass='Facture';
|
||||
$objectlabel='Invoice';
|
||||
$permtoread = $user->rights->facture->lire;
|
||||
$permtodelete = $user->rights->facture->supprimer;
|
||||
$uploaddir = $conf->facture->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
@@ -424,7 +424,7 @@ if ($massaction == 'confirm_createbills') {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -602,9 +602,9 @@ if ($resql)
|
||||
$title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
@@ -636,7 +636,7 @@ if ($resql)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
@@ -659,11 +659,11 @@ if ($resql)
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
||||
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
$langs->load("mails");
|
||||
|
||||
|
||||
if (! GETPOST('cancel'))
|
||||
{
|
||||
$objecttmp=new Commande($db);
|
||||
@@ -682,17 +682,17 @@ if ($resql)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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, '', '');
|
||||
|
||||
|
||||
$topicmail="SendOrderRef";
|
||||
$modelmail="order_send";
|
||||
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
@@ -745,23 +745,23 @@ if ($resql)
|
||||
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
|
||||
$formmail->substit['__PERSONALIZED__']='';
|
||||
$formmail->substit['__CONTACTCIVNAME__']='';
|
||||
|
||||
|
||||
// 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;
|
||||
|
||||
|
||||
print $formmail->get_form();
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
elseif ($massaction == 'createbills')
|
||||
{
|
||||
//var_dump($_REQUEST);
|
||||
print '<input type="hidden" name="massaction" value="confirm_createbills">';
|
||||
|
||||
|
||||
print '<table class="border" width="100%" >';
|
||||
print '<tr>';
|
||||
print '<td class="titlefieldmiddle">';
|
||||
@@ -788,22 +788,22 @@ if ($resql)
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('CreateInvoiceForThisCustomer').'"> ';
|
||||
print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
||||
}
|
||||
|
||||
|
||||
$moreforfilter='';
|
||||
|
||||
// If the user can view prospects other than his'
|
||||
@@ -830,14 +830,14 @@ if ($resql)
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
|
||||
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
|
||||
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
|
||||
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
@@ -847,7 +847,7 @@ if ($resql)
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
@@ -869,9 +869,9 @@ if ($resql)
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
||||
@@ -891,21 +891,21 @@ if ($resql)
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
// Ref
|
||||
if (! empty($arrayfields['c.ref']['checked']))
|
||||
if (! empty($arrayfields['c.ref']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Ref customer
|
||||
if (! empty($arrayfields['c.ref_client']['checked']))
|
||||
if (! empty($arrayfields['c.ref_client']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="6" name="search_ref_customer" value="'.$search_ref_customer.'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Thirpdarty
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_company" value="'.$search_company.'">';
|
||||
@@ -945,7 +945,7 @@ if ($resql)
|
||||
$formother->select_year($orderyear?$orderyear:-1,'orderyear',1, 20, 5);
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['c.date_delivery']['checked']))
|
||||
if (! empty($arrayfields['c.date_delivery']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="deliveryday" value="'.$deliveryday.'">';
|
||||
@@ -1018,10 +1018,10 @@ if ($resql)
|
||||
{
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="right">';
|
||||
$liststatus=array(
|
||||
Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraftShort"),
|
||||
Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"),
|
||||
Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSentShort"),
|
||||
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
|
||||
Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraftShort"),
|
||||
Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"),
|
||||
Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSentShort"),
|
||||
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
|
||||
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
|
||||
);
|
||||
print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4);
|
||||
@@ -1039,16 +1039,16 @@ if ($resql)
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$total=0;
|
||||
$subtotal=0;
|
||||
$productstat_cache=array();
|
||||
|
||||
|
||||
$generic_commande = new Commande($db);
|
||||
$generic_product = new Product($db);
|
||||
|
||||
|
||||
$i=0;
|
||||
$var=true;
|
||||
$totalarray=array();
|
||||
@@ -1063,7 +1063,7 @@ if ($resql)
|
||||
$text_info='';
|
||||
$text_warning='';
|
||||
$nbprod=0;
|
||||
|
||||
|
||||
// Ref
|
||||
if (! empty($arrayfields['c.ref']['checked']))
|
||||
{
|
||||
@@ -1079,12 +1079,12 @@ if ($resql)
|
||||
$generic_commande->total_ttc = $obj->total_ttc;
|
||||
$generic_commande->lines=array();
|
||||
$generic_commande->getLinesArray();
|
||||
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
print $generic_commande->getNomUrl(1,($viewstatut != 2?0:$obj->fk_statut));
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Show shippable Icon (create subloop, so may be slow)
|
||||
if ($conf->stock->enabled)
|
||||
{
|
||||
@@ -1092,7 +1092,7 @@ if ($resql)
|
||||
if (($obj->fk_statut > 0) && ($obj->fk_statut < 3))
|
||||
{
|
||||
$numlines = count($generic_commande->lines); // Loop on each line of order
|
||||
for ($lig=0; $lig < $numlines; $lig++)
|
||||
for ($lig=0; $lig < $numlines; $lig++)
|
||||
{
|
||||
if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) // If line is a product and not a service
|
||||
{
|
||||
@@ -1116,8 +1116,8 @@ if ($resql)
|
||||
$text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel;
|
||||
$text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique;
|
||||
$text_info .= '<br>';
|
||||
|
||||
if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel)
|
||||
|
||||
if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel)
|
||||
{
|
||||
$notshippable++;
|
||||
}
|
||||
@@ -1177,7 +1177,7 @@ if ($resql)
|
||||
$text_info = $langs->trans('NonShippable').'<br>'.$text_info;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '<td>';
|
||||
if ($nbprod)
|
||||
{
|
||||
@@ -1188,7 +1188,7 @@ if ($resql)
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
// Warning late icon and note
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
if ($generic_commande->hasDelay()) {
|
||||
@@ -1201,7 +1201,7 @@ if ($resql)
|
||||
print '</span>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
@@ -1209,11 +1209,11 @@ if ($resql)
|
||||
print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
|
||||
print '</td>';
|
||||
print '</tr></table>';
|
||||
|
||||
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Ref customer
|
||||
if (! empty($arrayfields['c.ref_client']['checked']))
|
||||
{
|
||||
@@ -1231,7 +1231,7 @@ if ($resql)
|
||||
{
|
||||
print '<td>';
|
||||
print $companystatic->getNomUrl(1,'customer');
|
||||
|
||||
|
||||
// If module invoices enabled and user with invoice creation permissions
|
||||
if (! empty($conf->facture->enabled) && ! empty($conf->global->ORDER_BILLING_ALL_CUSTOMER))
|
||||
{
|
||||
@@ -1287,7 +1287,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Order date
|
||||
if (! empty($arrayfields['c.date_commande']['checked']))
|
||||
{
|
||||
@@ -1328,7 +1328,7 @@ if ($resql)
|
||||
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalttc'] += $obj->total_ttc;
|
||||
}
|
||||
|
||||
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@@ -1379,7 +1379,7 @@ if ($resql)
|
||||
print '<td align="center">'.yn($obj->billed).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Action column
|
||||
print '<td class="nowrap" align="center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
@@ -1390,9 +1390,9 @@ if ($resql)
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$total+=$obj->total_ht;
|
||||
$subtotal+=$obj->total_ht;
|
||||
$i++;
|
||||
@@ -1425,18 +1425,18 @@ if ($resql)
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
//print '<br>'.img_help(1,'').' '.$langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")).'<br>';
|
||||
|
||||
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
|
||||
{
|
||||
/*
|
||||
@@ -1444,18 +1444,18 @@ if ($resql)
|
||||
*/
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
$urlsource.=str_replace('&','&',$param);
|
||||
|
||||
|
||||
$filedir=$diroutputmassaction;
|
||||
$genallowed=$user->rights->commande->lire;
|
||||
$delallowed=$user->rights->commande->lire;
|
||||
|
||||
|
||||
print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2971,8 +2971,9 @@ else if ($id > 0 || ! empty($ref))
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherBills").'</a>)';
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
|
||||
@@ -621,7 +621,7 @@ if ($resql)
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
|
||||
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
|
||||
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
$parameters=array();
|
||||
|
||||
@@ -305,14 +305,14 @@ if ($resql)
|
||||
$i = 0;
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
|
||||
if ($socid > 0)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
if (empty($search_name)) $search_name = $soc->name;
|
||||
}
|
||||
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
@@ -330,7 +330,7 @@ if ($resql)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
@@ -339,7 +339,7 @@ if ($resql)
|
||||
if ($user->rights->contrat->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@@ -355,9 +355,9 @@ if ($resql)
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
||||
}
|
||||
|
||||
|
||||
$moreforfilter='';
|
||||
|
||||
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
@@ -382,15 +382,15 @@ if ($resql)
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
|
||||
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
|
||||
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
|
||||
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
@@ -400,7 +400,7 @@ if ($resql)
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
@@ -418,9 +418,9 @@ if ($resql)
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
||||
@@ -493,7 +493,7 @@ if ($resql)
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
|
||||
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
if (! empty($arrayfields['sale_representative']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre"></td>';
|
||||
@@ -548,7 +548,7 @@ if ($resql)
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['status']['checked']))
|
||||
{
|
||||
@@ -564,12 +564,12 @@ if ($resql)
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
$contracttmp->ref=$obj->ref;
|
||||
$contracttmp->id=$obj->rowid;
|
||||
$contracttmp->ref_customer=$obj->ref_customer;
|
||||
$contracttmp->ref_supplier=$obj->ref_supplier;
|
||||
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
if (! empty($arrayfields['c.ref']['checked']))
|
||||
@@ -585,15 +585,15 @@ if ($resql)
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['c.ref_customer']['checked']))
|
||||
if (! empty($arrayfields['c.ref_customer']['checked']))
|
||||
{
|
||||
print '<td>'.$obj->ref_customer.'</td>';
|
||||
}
|
||||
if (! empty($arrayfields['c.ref_supplier']['checked']))
|
||||
if (! empty($arrayfields['c.ref_supplier']['checked']))
|
||||
{
|
||||
print '<td>'.$obj->ref_supplier.'</td>';
|
||||
}
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td><a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>';
|
||||
}
|
||||
@@ -636,7 +636,7 @@ if ($resql)
|
||||
print $typenArray[$obj->typent_code];
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
if (! empty($arrayfields['sale_representative']['checked']))
|
||||
{
|
||||
// Sales representatives
|
||||
@@ -720,7 +720,7 @@ if ($resql)
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['status']['checked']))
|
||||
if (! empty($arrayfields['status']['checked']))
|
||||
{
|
||||
print '<td align="center">'.($obj->nb_initial>0?$obj->nb_initial:'').'</td>';
|
||||
print '<td align="center">'.($obj->nb_running>0?$obj->nb_running:'').'</td>';
|
||||
@@ -737,7 +737,7 @@ if ($resql)
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
@@ -745,7 +745,7 @@ if ($resql)
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
|
||||
@@ -331,7 +331,7 @@ if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights-
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
|
||||
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
|
||||
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
|
||||
@@ -515,23 +515,23 @@ $var=True; $i=0;
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
$contractstatic->id=$obj->cid;
|
||||
$contractstatic->ref=$obj->ref?$obj->ref:$obj->cid;
|
||||
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
|
||||
// Ref
|
||||
if (! empty($arrayfields['c.ref']['checked']))
|
||||
if (! empty($arrayfields['c.ref']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $contractstatic->getNomUrl(1,16);
|
||||
print '</td>';
|
||||
}
|
||||
// Service
|
||||
if (! empty($arrayfields['p.description']['checked']))
|
||||
if (! empty($arrayfields['p.description']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
if ($obj->pid)
|
||||
@@ -551,9 +551,9 @@ while ($i < min($num,$limit))
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
// Third party
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
$companystatic->id=$obj->socid;
|
||||
@@ -562,9 +562,9 @@ while ($i < min($num,$limit))
|
||||
print $companystatic->getNomUrl(1,'customer',28);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
// Start date
|
||||
if (! empty($arrayfields['cd.date_ouverture_prevue']['checked']))
|
||||
if (! empty($arrayfields['cd.date_ouverture_prevue']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print ($obj->date_ouverture_prevue?dol_print_date($db->jdate($obj->date_ouverture_prevue)):' ');
|
||||
@@ -573,15 +573,15 @@ while ($i < min($num,$limit))
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['cd.date_ouverture']['checked']))
|
||||
if (! empty($arrayfields['cd.date_ouverture']['checked']))
|
||||
{
|
||||
print '<td align="center">'.($obj->date_ouverture?dol_print_date($db->jdate($obj->date_ouverture)):' ').'</td>';
|
||||
}
|
||||
// End date
|
||||
if (! empty($arrayfields['cd.date_fin_validite']['checked']))
|
||||
if (! empty($arrayfields['cd.date_fin_validite']['checked']))
|
||||
{
|
||||
print '<td align="center">'.($obj->date_fin_validite?dol_print_date($db->jdate($obj->date_fin_validite)):' ');
|
||||
if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5)
|
||||
if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5)
|
||||
{
|
||||
$warning_delay=$conf->contrat->services->expires->warning_delay / 3600 / 24;
|
||||
$textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days");
|
||||
@@ -590,7 +590,7 @@ while ($i < min($num,$limit))
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['cd.date_cloture']['checked']))
|
||||
if (! empty($arrayfields['cd.date_cloture']['checked']))
|
||||
{
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->date_cloture)).'</td>';
|
||||
}
|
||||
@@ -657,7 +657,7 @@ while ($i < min($num,$limit))
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@@ -599,7 +599,7 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
$datecreate = dol_now();
|
||||
|
||||
|
||||
// Socpeople must have already been added by some a trigger, then we have to check it to avoid DB_ERROR_RECORD_ALREADY_EXISTS error
|
||||
$TListeContacts=$this->liste_contact(-1, $source);
|
||||
$already_added=false;
|
||||
@@ -611,11 +611,11 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!$already_added) {
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
// Insertion dans la base
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact";
|
||||
$sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) ";
|
||||
@@ -623,7 +623,7 @@ abstract class CommonObject
|
||||
$sql.= "'".$this->db->idate($datecreate)."'";
|
||||
$sql.= ", 4, ". $id_type_contact;
|
||||
$sql.= ")";
|
||||
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -636,7 +636,7 @@ abstract class CommonObject
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
@@ -3947,7 +3947,7 @@ abstract class CommonObject
|
||||
|
||||
// Now we add first model found in directories scanned
|
||||
$listofdir=explode(',',$dirtoscan);
|
||||
foreach($listofdir as $key=>$tmpdir)
|
||||
foreach($listofdir as $key => $tmpdir)
|
||||
{
|
||||
$tmpdir=trim($tmpdir);
|
||||
$tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir);
|
||||
|
||||
@@ -323,6 +323,7 @@ function dol_dir_is_emtpy($folder)
|
||||
*
|
||||
* @param string $file Filename
|
||||
* @return int <0 if KO, Number of lines in files if OK
|
||||
* @see dol_nboflines
|
||||
*/
|
||||
function dol_count_nb_of_line($file)
|
||||
{
|
||||
|
||||
@@ -2325,7 +2325,7 @@ function img_picto($titlealt, $picto, $morealt = '', $pictoisfullpath = false, $
|
||||
if ($pictoisfullpath)
|
||||
{
|
||||
// Clean parameters
|
||||
if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto .= '.png';
|
||||
if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) $picto .= '.png';
|
||||
$fullpathpicto = $picto;
|
||||
}
|
||||
else
|
||||
@@ -2346,7 +2346,7 @@ function img_picto($titlealt, $picto, $morealt = '', $pictoisfullpath = false, $
|
||||
$path = $regs[2]; // $path is $mymodule
|
||||
}
|
||||
// Clean parameters
|
||||
if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto .= '.png';
|
||||
if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) $picto .= '.png';
|
||||
// If alt path are defined, define url where img file is, according to physical path
|
||||
foreach ($conf->file->dol_document_root as $type => $dirroot) // ex: array(["main"]=>"/home/maindir/htdocs", ["alt0"]=>"/home/moddir0/htdocs", ...)
|
||||
{
|
||||
@@ -4488,22 +4488,57 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8')
|
||||
* Return first line of text. Cut will depends if content is HTML or not.
|
||||
*
|
||||
* @param string $text Input text
|
||||
* @param int $nboflines Nb of lines to get (default is 1 = first line only)
|
||||
* @return string Output text
|
||||
* @see dol_nboflines_bis, dol_string_nohtmltag, dol_escape_htmltag
|
||||
*/
|
||||
function dolGetFirstLineOfText($text)
|
||||
function dolGetFirstLineOfText($text, $nboflines=1)
|
||||
{
|
||||
if (dol_textishtml($text))
|
||||
if ($nboflines == 1)
|
||||
{
|
||||
$firstline=preg_replace('/<br[^>]*>.*$/s','',$text); // The s pattern modifier means the . can match newline characters
|
||||
$firstline=preg_replace('/<div[^>]*>.*$/s','',$firstline); // The s pattern modifier means the . can match newline characters
|
||||
if (dol_textishtml($text))
|
||||
{
|
||||
$firstline=preg_replace('/<br[^>]*>.*$/s','',$text); // The s pattern modifier means the . can match newline characters
|
||||
$firstline=preg_replace('/<div[^>]*>.*$/s','',$firstline); // The s pattern modifier means the . can match newline characters
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$firstline=preg_replace('/[\n\r].*/','',$text);
|
||||
}
|
||||
return $firstline.((strlen($firstline) != strlen($text))?'...':'');
|
||||
}
|
||||
else
|
||||
{
|
||||
$firstline=preg_replace('/[\n\r].*/','',$text);
|
||||
$ishtml=0;
|
||||
if (dol_textishtml($text))
|
||||
{
|
||||
$text=preg_replace('/\n/','',$text);
|
||||
$ishtml=1;
|
||||
$repTable = array("\t" => " ", "\n" => " ", "\r" => " ", "\0" => " ", "\x0B" => " ");
|
||||
}
|
||||
else
|
||||
{
|
||||
$repTable = array("\t" => " ", "\n" => "<br>", "\r" => " ", "\0" => " ", "\x0B" => " ");
|
||||
}
|
||||
|
||||
$text = strtr($text, $repTable);
|
||||
if ($charset == 'UTF-8') { $pattern = '/(<br[^>]*>)/Uu'; } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support
|
||||
else $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag.
|
||||
$a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
$firstline='';
|
||||
$i=0;
|
||||
$nba = count($a); // 2x nb of lines in $a because $a contains also a line for each new line separator
|
||||
while (($i < $nba) && ($i < ($nboflines * 2)))
|
||||
{
|
||||
if ($i % 2 == 0) $firstline .= $a[$i];
|
||||
elseif (($i < (($nboflines * 2) - 1)) && ($i < ($nba - 1))) $firstline .= ($ishtml?"<br>\n":"\n");
|
||||
$i++;
|
||||
}
|
||||
unset($a);
|
||||
return $firstline.(($i < $nba)?'...':'');
|
||||
}
|
||||
return $firstline.((strlen($firstline) != strlen($text))?'...':'');
|
||||
}
|
||||
|
||||
|
||||
@@ -4665,7 +4700,7 @@ function dol_nboflines($s,$maxchar=0)
|
||||
|
||||
|
||||
/**
|
||||
* Return nb of lines of a formated text with \n and <br> (we can't have both \n and br)
|
||||
* Return nb of lines of a formated text with \n and <br> (WARNING: string must not have mixed \n and br separators)
|
||||
*
|
||||
* @param string $text Text
|
||||
* @param int $maxlinesize Largeur de ligne en caracteres (ou 0 si pas de limite - defaut)
|
||||
@@ -4701,6 +4736,8 @@ function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($a);
|
||||
return $nblines;
|
||||
}
|
||||
|
||||
|
||||
@@ -1255,55 +1255,55 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
*
|
||||
* @return int Error count (0 if ok)
|
||||
*/
|
||||
function insert_tabs()
|
||||
{
|
||||
global $conf;
|
||||
function insert_tabs()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$err=0;
|
||||
$err=0;
|
||||
|
||||
if (! empty($this->tabs))
|
||||
{
|
||||
$i=0;
|
||||
foreach ($this->tabs as $key => $value)
|
||||
{
|
||||
if (is_array($value) && count($value) == 0) continue; // Discard empty arrays
|
||||
if (! empty($this->tabs))
|
||||
{
|
||||
$i=0;
|
||||
foreach ($this->tabs as $key => $value)
|
||||
{
|
||||
if (is_array($value) && count($value) == 0) continue; // Discard empty arrays
|
||||
|
||||
$entity=$conf->entity;
|
||||
$newvalue = $value;
|
||||
$entity=$conf->entity;
|
||||
$newvalue = $value;
|
||||
|
||||
if (is_array($value))
|
||||
{
|
||||
$newvalue = $value['data'];
|
||||
if (isset($value['entity'])) $entity = $value['entity'];
|
||||
}
|
||||
if (is_array($value))
|
||||
{
|
||||
$newvalue = $value['data'];
|
||||
if (isset($value['entity'])) $entity = $value['entity'];
|
||||
}
|
||||
|
||||
if ($newvalue)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (";
|
||||
$sql.= "name";
|
||||
$sql.= ", type";
|
||||
$sql.= ", value";
|
||||
$sql.= ", note";
|
||||
$sql.= ", visible";
|
||||
$sql.= ", entity";
|
||||
$sql.= ")";
|
||||
$sql.= " VALUES (";
|
||||
$sql.= $this->db->encrypt($this->const_name."_TABS_".$i,1);
|
||||
$sql.= ", 'chaine'";
|
||||
$sql.= ", ".$this->db->encrypt($value,1);
|
||||
$sql.= ", null";
|
||||
$sql.= ", '0'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
if ($newvalue)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (";
|
||||
$sql.= "name";
|
||||
$sql.= ", type";
|
||||
$sql.= ", value";
|
||||
$sql.= ", note";
|
||||
$sql.= ", visible";
|
||||
$sql.= ", entity";
|
||||
$sql.= ")";
|
||||
$sql.= " VALUES (";
|
||||
$sql.= $this->db->encrypt($this->const_name."_TABS_".$i,1);
|
||||
$sql.= ", 'chaine'";
|
||||
$sql.= ", ".$this->db->encrypt($newvalue,1);
|
||||
$sql.= ", null";
|
||||
$sql.= ", '0'";
|
||||
$sql.= ", ".$entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG);
|
||||
$this->db->query($sql);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
return $err;
|
||||
}
|
||||
dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG);
|
||||
$this->db->query($sql);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
return $err;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds constants
|
||||
|
||||
@@ -475,7 +475,7 @@ if ($resql)
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
|
||||
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
|
||||
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
$parameters=array();
|
||||
@@ -719,7 +719,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['cf.ref']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
// Picto + Ref
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
@@ -734,7 +734,7 @@ if ($resql)
|
||||
$filedir=$conf->fournisseur->dir_output.'/commande' . '/' . dol_sanitizeFileName($obj->ref);
|
||||
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
print '</td>'."\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ if (empty($reshook))
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@@ -389,7 +389,7 @@ if ($resql)
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
|
||||
if ($socid)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
@@ -424,9 +424,9 @@ if ($resql)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
|
||||
$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
|
||||
|
||||
|
||||
$i = 0;
|
||||
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@@ -439,13 +439,13 @@ if ($resql)
|
||||
print '<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
|
||||
print_barre_liste($langs->trans("BillsSuppliers").($socid?" - $soc->name":""), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
|
||||
|
||||
if ($search_all)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall);
|
||||
}
|
||||
|
||||
|
||||
// If the user can view prospects other than his'
|
||||
$moreforfilter='';
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
@@ -471,7 +471,7 @@ if ($resql)
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
|
||||
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
|
||||
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
$parameters=array();
|
||||
@@ -488,7 +488,7 @@ if ($resql)
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
@@ -694,7 +694,7 @@ if ($resql)
|
||||
$facturestatic=new FactureFournisseur($db);
|
||||
$supplierstatic=new Fournisseur($db);
|
||||
$projectstatic=new Project($db);
|
||||
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$i=0;
|
||||
@@ -705,14 +705,14 @@ if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
|
||||
$datelimit=$db->jdate($obj->datelimite);
|
||||
$facturestatic->id=$obj->facid;
|
||||
$facturestatic->ref=$obj->ref;
|
||||
$facturestatic->ref_supplier=$obj->ref_supplier;
|
||||
$facturestatic->date_echeance = $db->jdate($obj->datelimite);
|
||||
$facturestatic->statut = $obj->fk_statut;
|
||||
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
if (! empty($arrayfields['f.ref']['checked']))
|
||||
{
|
||||
@@ -733,11 +733,11 @@ if ($resql)
|
||||
$subdir = get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref);
|
||||
print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Customer ref
|
||||
if (! empty($arrayfields['f.ref_supplier']['checked']))
|
||||
{
|
||||
@@ -746,7 +746,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Label
|
||||
if (! empty($arrayfields['f.label']['checked']))
|
||||
{
|
||||
@@ -755,7 +755,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Date
|
||||
if (! empty($arrayfields['f.datef']['checked']))
|
||||
{
|
||||
@@ -764,7 +764,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Date limit
|
||||
if (! empty($arrayfields['f.date_lim_reglement']['checked']))
|
||||
{
|
||||
@@ -776,7 +776,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Project
|
||||
if (! empty($arrayfields['p.ref']['checked']))
|
||||
{
|
||||
@@ -790,7 +790,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Third party
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
@@ -844,7 +844,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Payment mode
|
||||
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
|
||||
{
|
||||
@@ -853,7 +853,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Amount HT
|
||||
if (! empty($arrayfields['f.total_ht']['checked']))
|
||||
{
|
||||
@@ -894,7 +894,7 @@ if ($resql)
|
||||
if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalrtp'] += $remaintopay;
|
||||
}
|
||||
|
||||
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@@ -942,7 +942,7 @@ if ($resql)
|
||||
print "</td>";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Action column
|
||||
print '<td class="nowrap" align="center">';
|
||||
$selected=0;
|
||||
@@ -950,12 +950,12 @@ if ($resql)
|
||||
//print '<input id="cb'.$obj->facid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.'"'.($selected?' checked="checked"':'').'>';
|
||||
print '</td>' ;
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['totalhtfield'])
|
||||
|| isset($totalarray['totalvatfield'])
|
||||
@@ -982,16 +982,16 @@ if ($resql)
|
||||
else print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
print "</form>\n";
|
||||
|
||||
@@ -611,3 +611,7 @@ INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (14
|
||||
-- VMYSQL4.1 ALTER TABLE llx_c_type_resource CHANGE COLUMN rowid rowid integer NOT NULL AUTO_INCREMENT;
|
||||
|
||||
ALTER TABLE llx_import_model MODIFY COLUMN type varchar(50);
|
||||
|
||||
-- Negative buying prices
|
||||
|
||||
UPDATE llx_facturedet SET buy_price_ht = ABS(buy_price_ht)
|
||||
|
||||
@@ -67,6 +67,7 @@ NoPredefinedProductToDispatch=No predefined products for this object. So no disp
|
||||
DispatchVerb=Dispatch
|
||||
StockLimitShort=Limit for alert
|
||||
StockLimit=Stock limit for alert
|
||||
StockLimitDesc="" (empty) default value means no alert. <br>"0" can be used with 'Stock can be negative' configuration.
|
||||
PhysicalStock=Physical stock
|
||||
RealStock=Real Stock
|
||||
RealStockDesc=Physical or real stock is the stock you currently have into your internal warehouses/emplacements.
|
||||
@@ -142,4 +143,4 @@ OptionMULTIPRICESIsOn=Option "several prices per segment" is on. It means a prod
|
||||
ProductStockWarehouseCreated=Stock limit for alert and desired optimal stock correctly created
|
||||
ProductStockWarehouseUpdated=Stock limit for alert and desired optimal stock correctly updated
|
||||
ProductStockWarehouseDeleted=Stock limit for alert and desired optimal stock correctly deleted
|
||||
AddNewProductStockWarehouse=Set new limit for alert and desired optimal stock
|
||||
AddNewProductStockWarehouse=Set new limit for alert and desired optimal stock
|
||||
|
||||
@@ -120,10 +120,75 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* testDolGetFirstLineOfText
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testDolGetFirstLineOfText()
|
||||
{
|
||||
// Nb of line is same than entry text
|
||||
|
||||
$input="aaaa";
|
||||
$result=dolGetFirstLineOfText($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa", $result);
|
||||
|
||||
$input="aaaa\nbbbbbbbbbbbb\n";
|
||||
$result=dolGetFirstLineOfText($input, 2);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa\nbbbbbbbbbbbb", $result);
|
||||
|
||||
$input="aaaa<br>bbbbbbbbbbbb<br>";
|
||||
$result=dolGetFirstLineOfText($input, 2);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb", $result);
|
||||
|
||||
// Nb of line is lower
|
||||
|
||||
$input="aaaa\nbbbbbbbbbbbb\ncccccc\n";
|
||||
$result=dolGetFirstLineOfText($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa...", $result);
|
||||
|
||||
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>";
|
||||
$result=dolGetFirstLineOfText($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa...", $result);
|
||||
|
||||
$input="aaaa\nbbbbbbbbbbbb\ncccccc\n";
|
||||
$result=dolGetFirstLineOfText($input, 2);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa\nbbbbbbbbbbbb...", $result);
|
||||
|
||||
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>";
|
||||
$result=dolGetFirstLineOfText($input, 2);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb...", $result);
|
||||
|
||||
// Nb of line is higher
|
||||
|
||||
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc";
|
||||
$result=dolGetFirstLineOfText($input, 100);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb<br>\ncccccc", $result, 'dolGetFirstLineOfText with nb 100 a');
|
||||
|
||||
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>";
|
||||
$result=dolGetFirstLineOfText($input, 100);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb<br>\ncccccc", $result, 'dolGetFirstLineOfText with nb 100 b');
|
||||
|
||||
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>\n";
|
||||
$result=dolGetFirstLineOfText($input, 100);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb<br>\ncccccc", $result, 'dolGetFirstLineOfText with nb 100 c');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* testDolBuildPath
|
||||
*
|
||||
* @return boolean
|
||||
* @return void
|
||||
*/
|
||||
public function testDolBuildPath()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user