This commit is contained in:
Maxime Kohlhaas
2017-07-27 10:05:00 +02:00
15 changed files with 335 additions and 224 deletions

View File

@@ -353,10 +353,12 @@ begin
begin begin
// TODO Copy file or ask to install package ? // TODO Copy file or ask to install package ?
//CustomMessage('YouWillInstallDoliWamp')+#13#13 //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; 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 // 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. // 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. // Install of service and stop/start scripts are already rebuild by installer.

View File

@@ -165,7 +165,7 @@ if (empty($reshook))
{ {
// Selection of new fields // Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria // 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 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') { if ($massaction == 'confirm_createbills') {
$orders = GETPOST('toselect'); $orders = GETPOST('toselect');
$createbills_onebythird = GETPOST('createbills_onebythird', 'int'); $createbills_onebythird = GETPOST('createbills_onebythird', 'int');
$validate_invoices = GETPOST('valdate_invoices', 'int'); $validate_invoices = GETPOST('valdate_invoices', 'int');
$TFact = array(); $TFact = array();
$TFactThird = array(); $TFactThird = array();
$nb_bills_created = 0; $nb_bills_created = 0;
$db->begin(); $db->begin();
foreach($orders as $id_order) { foreach($orders as $id_order) {
$cmd = new Commande($db); $cmd = new Commande($db);
if($cmd->fetch($id_order) <= 0) continue; if($cmd->fetch($id_order) <= 0) continue;
$object = new Facture($db); $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. 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 { else {
$object->socid = $cmd->socid; $object->socid = $cmd->socid;
$object->type = Facture::TYPE_STANDARD; $object->type = Facture::TYPE_STANDARD;
$object->cond_reglement_id = $cmd->cond_reglement_id; $object->cond_reglement_id = $cmd->cond_reglement_id;
$object->mode_reglement_id = $cmd->mode_reglement_id; $object->mode_reglement_id = $cmd->mode_reglement_id;
$object->fk_project = $cmd->fk_project; $object->fk_project = $cmd->fk_project;
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture)) if (empty($datefacture))
{ {
$datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y")); $datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y"));
} }
$object->date = $datefacture; $object->date = $datefacture;
$object->origin = 'commande'; $object->origin = 'commande';
$object->origin_id = $id_order; $object->origin_id = $id_order;
$res = $object->create($user); $res = $object->create($user);
if($res > 0) $nb_bills_created++; if($res > 0) $nb_bills_created++;
} }
if($object->id > 0) { if($object->id > 0) {
$db->begin(); $db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
$sql.= "fk_source"; $sql.= "fk_source";
@@ -274,17 +274,17 @@ if ($massaction == 'confirm_createbills') {
{ {
$db->rollback(); $db->rollback();
} }
$lines = $cmd->lines; $lines = $cmd->lines;
if (empty($lines) && method_exists($cmd, 'fetch_lines')) if (empty($lines) && method_exists($cmd, 'fetch_lines'))
{ {
$cmd->fetch_lines(); $cmd->fetch_lines();
$lines = $cmd->lines; $lines = $cmd->lines;
} }
$fk_parent_line=0; $fk_parent_line=0;
$num=count($lines); $num=count($lines);
for ($i=0;$i<$num;$i++) for ($i=0;$i<$num;$i++)
{ {
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
@@ -373,43 +373,43 @@ if ($massaction == 'confirm_createbills') {
$fk_parent_line = $result; $fk_parent_line = $result;
} }
} }
} }
} }
$cmd->classifyBilled($user); $cmd->classifyBilled($user);
if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object; if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object;
else $TFact[$object->id] = $object; else $TFact[$object->id] = $object;
} }
// Build doc with all invoices // Build doc with all invoices
$TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird; $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
$toselect = array(); $toselect = array();
if(!empty($validate_invoices)) { if(!empty($validate_invoices)) {
$massaction = $action = 'builddoc'; $massaction = $action = 'builddoc';
foreach($TAllFact as &$object) { foreach($TAllFact as &$object) {
$object->validate($user); $object->validate($user);
$toselect[] = $object->id; // For builddoc action $toselect[] = $object->id; // For builddoc action
// Fac builddoc // Fac builddoc
$upload_dir = $conf->facture->dir_output; $upload_dir = $conf->facture->dir_output;
$permissioncreate=$user->rights->facture->creer; $permissioncreate=$user->rights->facture->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
} }
$objectclass='Facture'; $objectclass='Facture';
$objectlabel='Invoice'; $objectlabel='Invoice';
$permtoread = $user->rights->facture->lire; $permtoread = $user->rights->facture->lire;
$permtodelete = $user->rights->facture->supprimer; $permtodelete = $user->rights->facture->supprimer;
$uploaddir = $conf->facture->dir_output; $uploaddir = $conf->facture->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
} }
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
@@ -424,7 +424,7 @@ if ($massaction == 'confirm_createbills') {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$error++; $error++;
} }
} }
@@ -602,9 +602,9 @@ if ($resql)
$title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill'); $title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
@@ -636,7 +636,7 @@ if ($resql)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
} }
// List of mass actions available // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(
'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
@@ -659,11 +659,11 @@ if ($resql)
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">'; 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); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
if ($massaction == 'presend') if ($massaction == 'presend')
{ {
$langs->load("mails"); $langs->load("mails");
if (! GETPOST('cancel')) if (! GETPOST('cancel'))
{ {
$objecttmp=new Commande($db); $objecttmp=new Commande($db);
@@ -682,17 +682,17 @@ if ($resql)
} }
} }
} }
print '<input type="hidden" name="massaction" value="confirm_presend">'; print '<input type="hidden" name="massaction" value="confirm_presend">';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db); $formmail = new FormMail($db);
dol_fiche_head(null, '', ''); dol_fiche_head(null, '', '');
$topicmail="SendOrderRef"; $topicmail="SendOrderRef";
$modelmail="order_send"; $modelmail="order_send";
// Cree l'objet formulaire mail // Cree l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db); $formmail = new FormMail($db);
@@ -745,23 +745,23 @@ if ($resql)
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag $formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
$formmail->substit['__PERSONALIZED__']=''; $formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']=''; $formmail->substit['__CONTACTCIVNAME__']='';
// Tableau des parametres complementaires du post // Tableau des parametres complementaires du post
$formmail->param['action']=$action; $formmail->param['action']=$action;
$formmail->param['models']=$modelmail; $formmail->param['models']=$modelmail;
$formmail->param['models_id']=GETPOST('modelmailselected','int'); $formmail->param['models_id']=GETPOST('modelmailselected','int');
$formmail->param['id']=join(',',$arrayofselected); $formmail->param['id']=join(',',$arrayofselected);
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; //$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
print $formmail->get_form(); print $formmail->get_form();
dol_fiche_end(); dol_fiche_end();
} }
elseif ($massaction == 'createbills') elseif ($massaction == 'createbills')
{ {
//var_dump($_REQUEST); //var_dump($_REQUEST);
print '<input type="hidden" name="massaction" value="confirm_createbills">'; print '<input type="hidden" name="massaction" value="confirm_createbills">';
print '<table class="border" width="100%" >'; print '<table class="border" width="100%" >';
print '<tr>'; print '<tr>';
print '<td class="titlefieldmiddle">'; print '<td class="titlefieldmiddle">';
@@ -788,22 +788,22 @@ if ($resql)
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print '<br>'; print '<br>';
print '<div class="center">'; 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="createbills" name="createbills" value="'.$langs->trans('CreateInvoiceForThisCustomer').'"> ';
print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">'; print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">';
print '</div>'; print '</div>';
print '<br>'; print '<br>';
} }
if ($sall) if ($sall)
{ {
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
} }
$moreforfilter=''; $moreforfilter='';
// If the user can view prospects other than his' // If the user can view prospects other than his'
@@ -830,14 +830,14 @@ if ($resql)
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $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>'; $moreforfilter.='</div>';
} }
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint; else $moreforfilter = $hookmanager->resPrint;
if (! empty($moreforfilter)) if (! empty($moreforfilter))
{ {
print '<div class="liste_titre liste_titre_bydiv centpercent">'; print '<div class="liste_titre liste_titre_bydiv centpercent">';
@@ -847,7 +847,7 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
@@ -869,9 +869,9 @@ if ($resql)
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) 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); $align=$extrafields->getAlignFlag($key);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); 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">'; print '<tr class="liste_titre">';
// Ref // Ref
if (! empty($arrayfields['c.ref']['checked'])) if (! empty($arrayfields['c.ref']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">'; print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
print '</td>'; print '</td>';
} }
// Ref customer // Ref customer
if (! empty($arrayfields['c.ref_client']['checked'])) if (! empty($arrayfields['c.ref_client']['checked']))
{ {
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="6" name="search_ref_customer" value="'.$search_ref_customer.'">'; print '<input class="flat" type="text" size="6" name="search_ref_customer" value="'.$search_ref_customer.'">';
print '</td>'; print '</td>';
} }
// Thirpdarty // Thirpdarty
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_company" value="'.$search_company.'">'; 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); $formother->select_year($orderyear?$orderyear:-1,'orderyear',1, 20, 5);
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['c.date_delivery']['checked'])) if (! empty($arrayfields['c.date_delivery']['checked']))
{ {
print '<td class="liste_titre" align="center">'; 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.'">'; 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">'; print '<td class="liste_titre maxwidthonsmartphone" align="right">';
$liststatus=array( $liststatus=array(
Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraftShort"), Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraftShort"),
Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"), Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"),
Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSentShort"), Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSentShort"),
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"), Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort") Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
); );
print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4); print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4);
@@ -1039,16 +1039,16 @@ if ($resql)
$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
print $searchpitco; print $searchpitco;
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
$total=0; $total=0;
$subtotal=0; $subtotal=0;
$productstat_cache=array(); $productstat_cache=array();
$generic_commande = new Commande($db); $generic_commande = new Commande($db);
$generic_product = new Product($db); $generic_product = new Product($db);
$i=0; $i=0;
$var=true; $var=true;
$totalarray=array(); $totalarray=array();
@@ -1063,7 +1063,7 @@ if ($resql)
$text_info=''; $text_info='';
$text_warning=''; $text_warning='';
$nbprod=0; $nbprod=0;
// Ref // Ref
if (! empty($arrayfields['c.ref']['checked'])) if (! empty($arrayfields['c.ref']['checked']))
{ {
@@ -1079,12 +1079,12 @@ if ($resql)
$generic_commande->total_ttc = $obj->total_ttc; $generic_commande->total_ttc = $obj->total_ttc;
$generic_commande->lines=array(); $generic_commande->lines=array();
$generic_commande->getLinesArray(); $generic_commande->getLinesArray();
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">'; print '<td class="nobordernopadding nowrap">';
print $generic_commande->getNomUrl(1,($viewstatut != 2?0:$obj->fk_statut)); print $generic_commande->getNomUrl(1,($viewstatut != 2?0:$obj->fk_statut));
print '</td>'; print '</td>';
// Show shippable Icon (create subloop, so may be slow) // Show shippable Icon (create subloop, so may be slow)
if ($conf->stock->enabled) if ($conf->stock->enabled)
{ {
@@ -1092,7 +1092,7 @@ if ($resql)
if (($obj->fk_statut > 0) && ($obj->fk_statut < 3)) if (($obj->fk_statut > 0) && ($obj->fk_statut < 3))
{ {
$numlines = count($generic_commande->lines); // Loop on each line of order $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 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("Stock").': '.$generic_product->stock_reel;
$text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique; $text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique;
$text_info .= '<br>'; $text_info .= '<br>';
if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel) if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel)
{ {
$notshippable++; $notshippable++;
} }
@@ -1177,7 +1177,7 @@ if ($resql)
$text_info = $langs->trans('NonShippable').'<br>'.$text_info; $text_info = $langs->trans('NonShippable').'<br>'.$text_info;
} }
} }
print '<td>'; print '<td>';
if ($nbprod) if ($nbprod)
{ {
@@ -1188,7 +1188,7 @@ if ($resql)
} }
print '</td>'; print '</td>';
} }
// Warning late icon and note // Warning late icon and note
print '<td class="nobordernopadding nowrap">'; print '<td class="nobordernopadding nowrap">';
if ($generic_commande->hasDelay()) { if ($generic_commande->hasDelay()) {
@@ -1201,7 +1201,7 @@ if ($resql)
print '</span>'; print '</span>';
} }
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">'; print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
$filename=dol_sanitizeFileName($obj->ref); $filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . 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 $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
print '</td>'; print '</td>';
print '</tr></table>'; print '</tr></table>';
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Ref customer // Ref customer
if (! empty($arrayfields['c.ref_client']['checked'])) if (! empty($arrayfields['c.ref_client']['checked']))
{ {
@@ -1231,7 +1231,7 @@ if ($resql)
{ {
print '<td>'; print '<td>';
print $companystatic->getNomUrl(1,'customer'); print $companystatic->getNomUrl(1,'customer');
// If module invoices enabled and user with invoice creation permissions // If module invoices enabled and user with invoice creation permissions
if (! empty($conf->facture->enabled) && ! empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) if (! empty($conf->facture->enabled) && ! empty($conf->global->ORDER_BILLING_ALL_CUSTOMER))
{ {
@@ -1287,7 +1287,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Order date // Order date
if (! empty($arrayfields['c.date_commande']['checked'])) if (! empty($arrayfields['c.date_commande']['checked']))
{ {
@@ -1328,7 +1328,7 @@ if ($resql)
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
$totalarray['totalttc'] += $obj->total_ttc; $totalarray['totalttc'] += $obj->total_ttc;
} }
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
@@ -1379,7 +1379,7 @@ if ($resql)
print '<td align="center">'.yn($obj->billed).'</td>'; print '<td align="center">'.yn($obj->billed).'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Action column // Action column
print '<td class="nowrap" align="center">'; 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 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>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
print "</tr>\n"; print "</tr>\n";
$total+=$obj->total_ht; $total+=$obj->total_ht;
$subtotal+=$obj->total_ht; $subtotal+=$obj->total_ht;
$i++; $i++;
@@ -1425,18 +1425,18 @@ if ($resql)
} }
$db->free($resql); $db->free($resql);
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
print '</table>'."\n"; print '</table>'."\n";
print '</div>'; print '</div>';
print '</form>'."\n"; print '</form>'."\n";
//print '<br>'.img_help(1,'').' '.$langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")).'<br>'; //print '<br>'.img_help(1,'').' '.$langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")).'<br>';
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
{ {
/* /*
@@ -1444,18 +1444,18 @@ if ($resql)
*/ */
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction; $filedir=$diroutputmassaction;
$genallowed=$user->rights->commande->lire; $genallowed=$user->rights->commande->lire;
$delallowed=$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,''); print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
} }
else else
{ {
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>'; print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
} }
} }
else else
{ {

View File

@@ -2971,8 +2971,9 @@ else if ($id > 0 || ! empty($ref))
// Ref customer // Ref customer
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', 0, 1); $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); $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); $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 // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {

View File

@@ -621,7 +621,7 @@ if ($resql)
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $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>'; $moreforfilter.='</div>';
} }
$parameters=array(); $parameters=array();

View File

@@ -305,14 +305,14 @@ if ($resql)
$i = 0; $i = 0;
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
if ($socid > 0) if ($socid > 0)
{ {
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($socid); $soc->fetch($socid);
if (empty($search_name)) $search_name = $soc->name; if (empty($search_name)) $search_name = $soc->name;
} }
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
@@ -330,7 +330,7 @@ if ($resql)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
} }
// List of mass actions available // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
@@ -339,7 +339,7 @@ if ($resql)
if ($user->rights->contrat->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); if ($user->rights->contrat->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
if ($massaction == 'presend') $arrayofmassactions=array(); if ($massaction == 'presend') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">'; print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; 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); foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
} }
$moreforfilter=''; $moreforfilter='';
// If the user can view prospects other than his' // If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid) if ($user->rights->societe->client->voir || $socid)
{ {
@@ -382,15 +382,15 @@ if ($resql)
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $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>'; $moreforfilter.='</div>';
} }
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint; else $moreforfilter = $hookmanager->resPrint;
if (! empty($moreforfilter)) if (! empty($moreforfilter))
{ {
print '<div class="liste_titre liste_titre_bydiv centpercent">'; print '<div class="liste_titre liste_titre_bydiv centpercent">';
@@ -400,7 +400,7 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@@ -418,9 +418,9 @@ if ($resql)
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) 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); $align=$extrafields->getAlignFlag($key);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); 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 '<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 $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>'; print '</td>';
} }
if (! empty($arrayfields['sale_representative']['checked'])) if (! empty($arrayfields['sale_representative']['checked']))
{ {
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
@@ -548,7 +548,7 @@ if ($resql)
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '</td>'; print '</td>';
} }
// Status // Status
if (! empty($arrayfields['status']['checked'])) if (! empty($arrayfields['status']['checked']))
{ {
@@ -564,12 +564,12 @@ if ($resql)
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$contracttmp->ref=$obj->ref; $contracttmp->ref=$obj->ref;
$contracttmp->id=$obj->rowid; $contracttmp->id=$obj->rowid;
$contracttmp->ref_customer=$obj->ref_customer; $contracttmp->ref_customer=$obj->ref_customer;
$contracttmp->ref_supplier=$obj->ref_supplier; $contracttmp->ref_supplier=$obj->ref_supplier;
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
if (! empty($arrayfields['c.ref']['checked'])) if (! empty($arrayfields['c.ref']['checked']))
@@ -585,15 +585,15 @@ if ($resql)
} }
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['c.ref_customer']['checked'])) if (! empty($arrayfields['c.ref_customer']['checked']))
{ {
print '<td>'.$obj->ref_customer.'</td>'; 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>'; 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>'; 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 $typenArray[$obj->typent_code];
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
if (! empty($arrayfields['sale_representative']['checked'])) if (! empty($arrayfields['sale_representative']['checked']))
{ {
// Sales representatives // Sales representatives
@@ -720,7 +720,7 @@ if ($resql)
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Status // 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_initial>0?$obj->nb_initial:'').'</td>';
print '<td align="center">'.($obj->nb_running>0?$obj->nb_running:'').'</td>'; print '<td align="center">'.($obj->nb_running>0?$obj->nb_running:'').'</td>';
@@ -737,7 +737,7 @@ if ($resql)
} }
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }
@@ -745,7 +745,7 @@ if ($resql)
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} }
else else

View File

@@ -331,7 +331,7 @@ if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights-
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $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>'; $moreforfilter.='</div>';
} }
@@ -515,23 +515,23 @@ $var=True; $i=0;
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$contractstatic->id=$obj->cid; $contractstatic->id=$obj->cid;
$contractstatic->ref=$obj->ref?$obj->ref:$obj->cid; $contractstatic->ref=$obj->ref?$obj->ref:$obj->cid;
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
// Ref // Ref
if (! empty($arrayfields['c.ref']['checked'])) if (! empty($arrayfields['c.ref']['checked']))
{ {
print '<td>'; print '<td>';
print $contractstatic->getNomUrl(1,16); print $contractstatic->getNomUrl(1,16);
print '</td>'; print '</td>';
} }
// Service // Service
if (! empty($arrayfields['p.description']['checked'])) if (! empty($arrayfields['p.description']['checked']))
{ {
print '<td>'; print '<td>';
if ($obj->pid) if ($obj->pid)
@@ -551,9 +551,9 @@ while ($i < min($num,$limit))
} }
print '</td>'; print '</td>';
} }
// Third party // Third party
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
print '<td>'; print '<td>';
$companystatic->id=$obj->socid; $companystatic->id=$obj->socid;
@@ -562,9 +562,9 @@ while ($i < min($num,$limit))
print $companystatic->getNomUrl(1,'customer',28); print $companystatic->getNomUrl(1,'customer',28);
print '</td>'; print '</td>';
} }
// Start date // Start date
if (! empty($arrayfields['cd.date_ouverture_prevue']['checked'])) if (! empty($arrayfields['cd.date_ouverture_prevue']['checked']))
{ {
print '<td align="center">'; print '<td align="center">';
print ($obj->date_ouverture_prevue?dol_print_date($db->jdate($obj->date_ouverture_prevue)):'&nbsp;'); print ($obj->date_ouverture_prevue?dol_print_date($db->jdate($obj->date_ouverture_prevue)):'&nbsp;');
@@ -573,15 +573,15 @@ while ($i < min($num,$limit))
else print '&nbsp;&nbsp;&nbsp;&nbsp;'; else print '&nbsp;&nbsp;&nbsp;&nbsp;';
print '</td>'; 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)):'&nbsp;').'</td>'; print '<td align="center">'.($obj->date_ouverture?dol_print_date($db->jdate($obj->date_ouverture)):'&nbsp;').'</td>';
} }
// End date // 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)):'&nbsp;'); print '<td align="center">'.($obj->date_fin_validite?dol_print_date($db->jdate($obj->date_fin_validite)):'&nbsp;');
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; $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"); $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 '&nbsp;&nbsp;&nbsp;&nbsp;'; else print '&nbsp;&nbsp;&nbsp;&nbsp;';
print '</td>'; 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>'; print '<td align="center">'.dol_print_date($db->jdate($obj->date_cloture)).'</td>';
} }
@@ -657,7 +657,7 @@ while ($i < min($num,$limit))
} }
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }

View File

@@ -599,7 +599,7 @@ abstract class CommonObject
} }
$datecreate = dol_now(); $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 // 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); $TListeContacts=$this->liste_contact(-1, $source);
$already_added=false; $already_added=false;
@@ -611,11 +611,11 @@ abstract class CommonObject
} }
} }
} }
if(!$already_added) { if(!$already_added) {
$this->db->begin(); $this->db->begin();
// Insertion dans la base // Insertion dans la base
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact";
$sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_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.= "'".$this->db->idate($datecreate)."'";
$sql.= ", 4, ". $id_type_contact; $sql.= ", 4, ". $id_type_contact;
$sql.= ")"; $sql.= ")";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@@ -636,7 +636,7 @@ abstract class CommonObject
return -1; return -1;
} }
} }
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
@@ -3947,7 +3947,7 @@ abstract class CommonObject
// Now we add first model found in directories scanned // Now we add first model found in directories scanned
$listofdir=explode(',',$dirtoscan); $listofdir=explode(',',$dirtoscan);
foreach($listofdir as $key=>$tmpdir) foreach($listofdir as $key => $tmpdir)
{ {
$tmpdir=trim($tmpdir); $tmpdir=trim($tmpdir);
$tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir); $tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir);

View File

@@ -323,6 +323,7 @@ function dol_dir_is_emtpy($folder)
* *
* @param string $file Filename * @param string $file Filename
* @return int <0 if KO, Number of lines in files if OK * @return int <0 if KO, Number of lines in files if OK
* @see dol_nboflines
*/ */
function dol_count_nb_of_line($file) function dol_count_nb_of_line($file)
{ {

View File

@@ -2325,7 +2325,7 @@ function img_picto($titlealt, $picto, $morealt = '', $pictoisfullpath = false, $
if ($pictoisfullpath) if ($pictoisfullpath)
{ {
// Clean parameters // Clean parameters
if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto .= '.png'; if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) $picto .= '.png';
$fullpathpicto = $picto; $fullpathpicto = $picto;
} }
else else
@@ -2346,7 +2346,7 @@ function img_picto($titlealt, $picto, $morealt = '', $pictoisfullpath = false, $
$path = $regs[2]; // $path is $mymodule $path = $regs[2]; // $path is $mymodule
} }
// Clean parameters // 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 // 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", ...) 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. * Return first line of text. Cut will depends if content is HTML or not.
* *
* @param string $text Input text * @param string $text Input text
* @param int $nboflines Nb of lines to get (default is 1 = first line only)
* @return string Output text * @return string Output text
* @see dol_nboflines_bis, dol_string_nohtmltag, dol_escape_htmltag * @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 if (dol_textishtml($text))
$firstline=preg_replace('/<div[^>]*>.*$/s','',$firstline); // The s pattern modifier means the . can match newline characters {
$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 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 string $text Text
* @param int $maxlinesize Largeur de ligne en caracteres (ou 0 si pas de limite - defaut) * @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; return $nblines;
} }

View File

@@ -1255,55 +1255,55 @@ class DolibarrModules // Can not be abstract, because we need to insta
* *
* @return int Error count (0 if ok) * @return int Error count (0 if ok)
*/ */
function insert_tabs() function insert_tabs()
{ {
global $conf; global $conf;
$err=0; $err=0;
if (! empty($this->tabs)) if (! empty($this->tabs))
{ {
$i=0; $i=0;
foreach ($this->tabs as $key => $value) foreach ($this->tabs as $key => $value)
{ {
if (is_array($value) && count($value) == 0) continue; // Discard empty arrays if (is_array($value) && count($value) == 0) continue; // Discard empty arrays
$entity=$conf->entity; $entity=$conf->entity;
$newvalue = $value; $newvalue = $value;
if (is_array($value)) if (is_array($value))
{ {
$newvalue = $value['data']; $newvalue = $value['data'];
if (isset($value['entity'])) $entity = $value['entity']; if (isset($value['entity'])) $entity = $value['entity'];
} }
if ($newvalue) if ($newvalue)
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (";
$sql.= "name"; $sql.= "name";
$sql.= ", type"; $sql.= ", type";
$sql.= ", value"; $sql.= ", value";
$sql.= ", note"; $sql.= ", note";
$sql.= ", visible"; $sql.= ", visible";
$sql.= ", entity"; $sql.= ", entity";
$sql.= ")"; $sql.= ")";
$sql.= " VALUES ("; $sql.= " VALUES (";
$sql.= $this->db->encrypt($this->const_name."_TABS_".$i,1); $sql.= $this->db->encrypt($this->const_name."_TABS_".$i,1);
$sql.= ", 'chaine'"; $sql.= ", 'chaine'";
$sql.= ", ".$this->db->encrypt($value,1); $sql.= ", ".$this->db->encrypt($newvalue,1);
$sql.= ", null"; $sql.= ", null";
$sql.= ", '0'"; $sql.= ", '0'";
$sql.= ", ".$conf->entity; $sql.= ", ".$entity;
$sql.= ")"; $sql.= ")";
dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG); dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG);
$this->db->query($sql); $this->db->query($sql);
} }
$i++; $i++;
} }
} }
return $err; return $err;
} }
/** /**
* Adds constants * Adds constants

View File

@@ -475,7 +475,7 @@ if ($resql)
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $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>'; $moreforfilter.='</div>';
} }
$parameters=array(); $parameters=array();
@@ -719,7 +719,7 @@ if ($resql)
if (! empty($arrayfields['cf.ref']['checked'])) if (! empty($arrayfields['cf.ref']['checked']))
{ {
print '<td class="nowrap">'; print '<td class="nowrap">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
// Picto + Ref // Picto + Ref
print '<td class="nobordernopadding nowrap">'; print '<td class="nobordernopadding nowrap">';
@@ -734,7 +734,7 @@ if ($resql)
$filedir=$conf->fournisseur->dir_output.'/commande' . '/' . dol_sanitizeFileName($obj->ref); $filedir=$conf->fournisseur->dir_output.'/commande' . '/' . dol_sanitizeFileName($obj->ref);
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
print '</td></tr></table>'; print '</td></tr></table>';
print '</td>'."\n"; print '</td>'."\n";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }

View File

@@ -232,7 +232,7 @@ if (empty($reshook))
} }
/* /*
* View * View
*/ */
@@ -389,7 +389,7 @@ if ($resql)
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
if ($socid) if ($socid)
{ {
$soc = new Societe($db); $soc = new Societe($db);
@@ -424,9 +424,9 @@ if ($resql)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
} }
$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); $massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
$i = 0; $i = 0;
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; 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 '<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); 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) if ($search_all)
{ {
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall);
} }
// If the user can view prospects other than his' // If the user can view prospects other than his'
$moreforfilter=''; $moreforfilter='';
if ($user->rights->societe->client->voir || $socid) if ($user->rights->societe->client->voir || $socid)
@@ -471,7 +471,7 @@ if ($resql)
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $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>'; $moreforfilter.='</div>';
} }
$parameters=array(); $parameters=array();
@@ -488,7 +488,7 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@@ -694,7 +694,7 @@ if ($resql)
$facturestatic=new FactureFournisseur($db); $facturestatic=new FactureFournisseur($db);
$supplierstatic=new Fournisseur($db); $supplierstatic=new Fournisseur($db);
$projectstatic=new Project($db); $projectstatic=new Project($db);
if ($num > 0) if ($num > 0)
{ {
$i=0; $i=0;
@@ -705,14 +705,14 @@ if ($resql)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$var=!$var; $var=!$var;
$datelimit=$db->jdate($obj->datelimite); $datelimit=$db->jdate($obj->datelimite);
$facturestatic->id=$obj->facid; $facturestatic->id=$obj->facid;
$facturestatic->ref=$obj->ref; $facturestatic->ref=$obj->ref;
$facturestatic->ref_supplier=$obj->ref_supplier; $facturestatic->ref_supplier=$obj->ref_supplier;
$facturestatic->date_echeance = $db->jdate($obj->datelimite); $facturestatic->date_echeance = $db->jdate($obj->datelimite);
$facturestatic->statut = $obj->fk_statut; $facturestatic->statut = $obj->fk_statut;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
if (! empty($arrayfields['f.ref']['checked'])) 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); $subdir = get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref);
print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir); print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir);
print '</td></tr></table>'; print '</td></tr></table>';
print "</td>\n"; print "</td>\n";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Customer ref // Customer ref
if (! empty($arrayfields['f.ref_supplier']['checked'])) if (! empty($arrayfields['f.ref_supplier']['checked']))
{ {
@@ -746,7 +746,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Label // Label
if (! empty($arrayfields['f.label']['checked'])) if (! empty($arrayfields['f.label']['checked']))
{ {
@@ -755,7 +755,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Date // Date
if (! empty($arrayfields['f.datef']['checked'])) if (! empty($arrayfields['f.datef']['checked']))
{ {
@@ -764,7 +764,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Date limit // Date limit
if (! empty($arrayfields['f.date_lim_reglement']['checked'])) if (! empty($arrayfields['f.date_lim_reglement']['checked']))
{ {
@@ -776,7 +776,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Project // Project
if (! empty($arrayfields['p.ref']['checked'])) if (! empty($arrayfields['p.ref']['checked']))
{ {
@@ -790,7 +790,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Third party // Third party
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
@@ -844,7 +844,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Payment mode // Payment mode
if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
{ {
@@ -853,7 +853,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Amount HT // Amount HT
if (! empty($arrayfields['f.total_ht']['checked'])) if (! empty($arrayfields['f.total_ht']['checked']))
{ {
@@ -894,7 +894,7 @@ if ($resql)
if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield']; if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield'];
$totalarray['totalrtp'] += $remaintopay; $totalarray['totalrtp'] += $remaintopay;
} }
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
@@ -942,7 +942,7 @@ if ($resql)
print "</td>"; print "</td>";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Action column // Action column
print '<td class="nowrap" align="center">'; print '<td class="nowrap" align="center">';
$selected=0; $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 '<input id="cb'.$obj->facid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.'"'.($selected?' checked="checked"':'').'>';
print '</td>' ; print '</td>' ;
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }
// Show total line // Show total line
if (isset($totalarray['totalhtfield']) if (isset($totalarray['totalhtfield'])
|| isset($totalarray['totalvatfield']) || isset($totalarray['totalvatfield'])
@@ -982,16 +982,16 @@ if ($resql)
else print '<td></td>'; else print '<td></td>';
} }
print '</tr>'; print '</tr>';
} }
} }
$db->free($resql); $db->free($resql);
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
print "</table>\n"; print "</table>\n";
print '</div>'; print '</div>';
print "</form>\n"; print "</form>\n";

View File

@@ -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; -- 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); ALTER TABLE llx_import_model MODIFY COLUMN type varchar(50);
-- Negative buying prices
UPDATE llx_facturedet SET buy_price_ht = ABS(buy_price_ht)

View File

@@ -67,6 +67,7 @@ NoPredefinedProductToDispatch=No predefined products for this object. So no disp
DispatchVerb=Dispatch DispatchVerb=Dispatch
StockLimitShort=Limit for alert StockLimitShort=Limit for alert
StockLimit=Stock 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 PhysicalStock=Physical stock
RealStock=Real Stock RealStock=Real Stock
RealStockDesc=Physical or real stock is the stock you currently have into your internal warehouses/emplacements. 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 ProductStockWarehouseCreated=Stock limit for alert and desired optimal stock correctly created
ProductStockWarehouseUpdated=Stock limit for alert and desired optimal stock correctly updated ProductStockWarehouseUpdated=Stock limit for alert and desired optimal stock correctly updated
ProductStockWarehouseDeleted=Stock limit for alert and desired optimal stock correctly deleted 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

View File

@@ -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 * testDolBuildPath
* *
* @return boolean * @return void
*/ */
public function testDolBuildPath() public function testDolBuildPath()
{ {