diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index af11824e91a..4a9625972b8 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -77,11 +77,6 @@ $model_option = array ( 'label' => 'ACCOUNTING_EXPORT_DATE', 'param' => '', ), - //'ACCOUNTING_EXPORT_PIECE', - //'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT', - //'ACCOUNTING_EXPORT_LABEL', - //'ACCOUNTING_EXPORT_AMOUNT', - //'ACCOUNTING_EXPORT_DEVISE', ); /* @@ -143,7 +138,6 @@ $form = new Form($db); // $linkback = '' . $langs->trans("BackToModuleList") . ''; print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup'); -$head = admin_accounting_prepare_head(); print "\n".''."\n"; } -} +//} // Close db if mode is not noajax if ((! isset($mode) || $mode != 'noajax') && is_object($db)) $db->close(); diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index 9d0908953c6..ae2f349a644 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -231,24 +231,18 @@ if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE } // Enable jquery handlers on new generated HTML objects - print "\n\n"; + // Because the content is reloaded by ajax call, we must also reenable some jquery hooks + print "\n\n"; print ''; diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php index 6e358bdbd88..71a5a0aac88 100644 --- a/htdocs/core/ajax/row.php +++ b/htdocs/core/ajax/row.php @@ -63,9 +63,9 @@ if ((isset($_POST['roworder']) && ! empty($_POST['roworder'])) && (isset($_POST[ $row->table_element_line = $table_element_line; $row->fk_element = $fk_element; $row->id = $element_id; - $row->line_ajaxorder($newrowordertab); + $row->line_ajaxorder($newrowordertab); // This update field rank or position in table table_element_line - // Reorder line to have position of chilren lines sharing same counter than parent lines + // Reorder line to have position of children lines sharing same counter than parent lines // This should be useless because there is no need to have children sharing same counter than parent, but well, it's cleaner into database. if (in_array($fk_element,array('fk_facture','fk_propal','fk_commande'))) { diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index d3059daba53..cbb866d6f20 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -188,6 +188,8 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $commandestatic=new Commande($db); + $langs->load("orders"); + $cachedir = DOL_DATA_ROOT.'/commande/temp'; $filename = '/boxactivity-order'.$fileid; $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index 264f05b1f03..01eb4ac8893 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -82,7 +82,7 @@ class box_external_rss extends ModeleBoxes $keyforparamurl="EXTERNAL_RSS_URLRSS_".$site; $keyforparamtitle="EXTERNAL_RSS_TITLE_".$site; - + // Get RSS feed $url=$conf->global->$keyforparamurl; @@ -106,7 +106,7 @@ class box_external_rss extends ModeleBoxes 'text' => $title, 'sublink' => $link, 'subtext'=>$langs->trans("LastRefreshDate").': '.($rssparser->getLastFetchDate()?dol_print_date($rssparser->getLastFetchDate(),"dayhourtext"):$langs->trans("Unknown")), - 'subpicto'=>'object_bookmark', + 'subpicto'=>'help', ); } diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 0dd0ceb22ba..bae9aef5953 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -117,6 +117,7 @@ class box_factures_fourn extends ModeleBoxes $datelimite=$db->jdate($objp->datelimite); $date=$db->jdate($objp->df); $datem=$db->jdate($objp->tms); + $facturestatic->id = $objp->facid; $facturestatic->ref = $objp->ref; $facturestatic->total_ht = $objp->total_ht; @@ -124,6 +125,8 @@ class box_factures_fourn extends ModeleBoxes $facturestatic->total_ttc = $objp->total_ttc; $facturestatic->date_echeance = $datelimite; $facturestatic->statut = $objp->fk_statut; + $facturestatic->ref_supplier = $objp->ref_supplier; + $thirdpartytmp->id = $objp->socid; $thirdpartytmp->name = $objp->name; $thirdpartytmp->fournisseur = 1; diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index c96fb37afe7..ef7ba62c15c 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -108,27 +108,25 @@ class box_ficheinter extends ModeleBoxes $ficheinterstatic->statut=$objp->fk_statut; $ficheinterstatic->id=$objp->rowid; + $ficheinterstatic->ref=$objp->ref; - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/fichinter/card.php?id=".$objp->rowid); + $this->info_box_contents[$i][] = array('td' => '', + 'text' => $ficheinterstatic->getNomUrl(1), + 'asis' => 1 + ); - $this->info_box_contents[$i][1] = array('td' => '', - 'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some interventions have no ref - 'url' => DOL_URL_ROOT."/fichinter/card.php?id=".$objp->rowid); - - $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', + $this->info_box_contents[$i][] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); - $this->info_box_contents[$i][3] = array('td' => '', + $this->info_box_contents[$i][] = array('td' => '', 'text' => dol_trunc($objp->name,40), 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); - $this->info_box_contents[$i][4] = array('td' => 'class="right"', + $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => dol_print_date($datec,'day')); - $this->info_box_contents[$i][5] = array('td' => 'align="right" class="nowrap"', + $this->info_box_contents[$i][] = array('td' => 'align="right" class="nowrap"', 'text' => $ficheinterstatic->getLibStatut(6), 'asis'=>1 ); @@ -136,20 +134,20 @@ class box_ficheinter extends ModeleBoxes $i++; } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInterventions")); + if ($num==0) $this->info_box_contents[$i][] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInterventions")); $db->free($resql); } else { - $this->info_box_contents[0][0] = array( 'td' => '', + $this->info_box_contents[0][] = array( 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql)); } } else { - $this->info_box_contents[0][0] = array( + $this->info_box_contents[0][] = array( 'td' => 'align="left" class="nohover opacitymedium"', 'text' => $langs->trans("ReadPermissionNotAllowed") ); diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index bbf7cd8ad48..25fa257d098 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Frederic France * @@ -109,6 +109,7 @@ class box_members extends ModeleBoxes $memberstatic->firstname=$objp->firstname; $memberstatic->id = $objp->rowid; $memberstatic->ref = $objp->rowid; + $memberstatic->company = $objp->company; if (! empty($objp->fk_soc)) { $memberstatic->socid = $objp->fk_soc; @@ -126,7 +127,7 @@ class box_members extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => '', - 'text' => $memberstatic->getFullName($langs), + 'text' => $memberstatic->company, 'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid, ); diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 9422f228530..976cbf1766c 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -110,22 +110,18 @@ class box_project extends ModeleBoxes while ($i < min($num, $max)) { $objp = $db->fetch_object($result); - $tooltip = $langs->trans('Project') . ': ' . $objp->ref; - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => 'object_project'.($objp->public?'pub':''), - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid, - ); + $projectstatic->id = $objp->rowid; + $projectstatic->ref = $objp->ref; + $projectstatic->title = $objp->title; + $projectstatic->public = $objp->public; - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => '', - 'text' => $objp->ref, - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid, + 'text' => $projectstatic->getNomUrl(1), + 'asis' => 1 ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$i][] = array( 'td' => '', 'text' => $objp->title, ); @@ -137,28 +133,28 @@ class box_project extends ModeleBoxes $resultTask = $db->query($sql); if ($resultTask) { $objTask = $db->fetch_object($resultTask); - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$i][] = array( 'td' => 'class="right"', 'text' => $objTask->nb." ".$langs->trans("Tasks"), ); if ($objTask->nb > 0) - $this->info_box_contents[$i][4] = array( + $this->info_box_contents[$i][] = array( 'td' => 'class="right"', 'text' => round($objTask->totprogress/$objTask->nb, 0)."%", ); else - $this->info_box_contents[$i][4] = array('td' => 'class="right"', 'text' => "N/A "); + $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A "); $totalnbTask += $objTask->nb; } else { - $this->info_box_contents[$i][3] = array('td' => 'class="right"', 'text' => round(0)); - $this->info_box_contents[$i][4] = array('td' => 'class="right"', 'text' => "N/A "); + $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => round(0)); + $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A "); } $i++; } if ($max < $num) { - $this->info_box_contents[$i][0] = array('td' => 'colspan="5"', 'text' => '...'); + $this->info_box_contents[$i][] = array('td' => 'colspan="5"', 'text' => '...'); $i++; } } @@ -166,25 +162,20 @@ class box_project extends ModeleBoxes // Add the sum à the bottom of the boxes - $this->info_box_contents[$i][0] = array( - 'tr' => 'class="liste_total"', - 'td' => 'align="left" ', - 'text' => " ", - ); - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => '', 'text' => $langs->trans("Total")." ".$textHead, 'text' => " ", ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right" ', 'text' => round($num, 0)." ".$langs->trans("Projects"), ); - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right" ', 'text' => (($max < $num) ? '' : (round($totalnbTask, 0)." ".$langs->trans("Tasks"))), ); - $this->info_box_contents[$i][4] = array( + $this->info_box_contents[$i][] = array( 'td' => '', 'text' => " ", ); diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index 4f3a2817549..f1d14c0df70 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -69,6 +69,8 @@ class box_services_expired extends ModeleBoxes $this->max=$max; + include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; + $now=dol_now(); $this->info_box_head = array('text' => $langs->trans("BoxLastExpiredServices",$max)); @@ -77,7 +79,7 @@ class box_services_expired extends ModeleBoxes { // Select contracts with at least one expired service $sql = "SELECT "; - $sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat,"; + $sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.ref_customer, c.ref_supplier,"; $sql.= " s.nom as name, s.rowid as socid,"; $sql.= " MIN(cd.date_fin_validite) as date_line, COUNT(cd.rowid) as nb_services"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe s, ".MAIN_DB_PREFIX."contratdet as cd"; @@ -87,7 +89,7 @@ class box_services_expired extends ModeleBoxes $sql.= " AND c.fk_soc=s.rowid AND cd.fk_contrat=c.rowid AND c.statut > 0"; if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - $sql.= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, s.nom, s.rowid"; + $sql.= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, c.ref_customer, c.ref_supplier, s.nom, s.rowid"; $sql.= " ORDER BY date_line ASC"; $sql.= $db->plimit($max, 0); @@ -99,6 +101,7 @@ class box_services_expired extends ModeleBoxes $i = 0; $thirdpartytmp = new Societe($this->db); + $contract = new Contrat($this->db); while ($i < $num) { @@ -106,30 +109,33 @@ class box_services_expired extends ModeleBoxes $objp = $db->fetch_object($resql); - $dateline=$db->jdate($objp->date_line); - if (($dateline + $conf->contrat->services->expires->warning_delay) < $now) $late=img_warning($langs->trans("Late")); - - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid); - - $this->info_box_contents[$i][1] = array('td' => '', - 'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref - 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid); - $thirdpartytmp->id = $objp->socid; $thirdpartytmp->name = $objp->name; - $this->info_box_contents[$i][2] = array('td' => 'class="tdoverflowmax100 maxwidth100onsmartphone" align="left"', + $contract->id = $objp->rowid; + $contract->ref = $objp->ref; + $contract->statut = $objp->fk_statut; + $contract->ref_customer = $objp->ref_customer; + $contract->ref_supplier = $objp->ref_supplier; + + $dateline=$db->jdate($objp->date_line); + if (($dateline + $conf->contrat->services->expires->warning_delay) < $now) $late=img_warning($langs->trans("Late")); + + $this->info_box_contents[$i][] = array('td' => '', + 'text' => $contract->getNomUrl(1), + 'asis' => 1 + ); + + $this->info_box_contents[$i][] = array('td' => 'class="tdoverflowmax100 maxwidth100onsmartphone" align="left"', 'text' => $thirdpartytmp->getNomUrl(1, 'customer'), 'asis' => 1 ); - $this->info_box_contents[$i][4] = array('td' => 'align="center"', + $this->info_box_contents[$i][] = array('td' => 'align="center"', 'text' => dol_print_date($dateline,'day'), 'text2'=> $late); - $this->info_box_contents[$i][5] = array('td' => 'class="right"', + $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => $objp->nb_services); @@ -139,14 +145,14 @@ class box_services_expired extends ModeleBoxes if ($num==0) { $langs->load("contracts"); - $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoExpiredServices")); + $this->info_box_contents[$i][] = array('td' => 'align="center"','text'=>$langs->trans("NoExpiredServices")); } $db->free($resql); } else { - $this->info_box_contents[0][0] = array( 'td' => '', + $this->info_box_contents[0][] = array( 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql)); } diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 34734d9dd5a..dc20e9b9665 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -109,28 +109,20 @@ class box_supplier_orders extends ModeleBoxes $objp = $db->fetch_object($result); $date=$db->jdate($objp->date_commande); $datem=$db->jdate($objp->tms); - $thirdpartytmp->id = $objp->socid; + + $supplierorderstatic->id = $objp->id; + $supplierorderstatic->ref = $objp->ref; + + $thirdpartytmp->id = $objp->socid; $thirdpartytmp->name = $objp->name; $thirdpartytmp->fournisseur = 1; $thirdpartytmp->code_fournisseur = $objp->code_fournisseur; $thirdpartytmp->logo = $objp->logo; - $urlo = DOL_URL_ROOT."/fourn/commande/card.php?id=".$objp->rowid; - $urls = DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid; - - $tooltip = $langs->trans('SupplierOrder') . ': ' . $objp->ref; - $this->info_box_contents[$line][] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $tooltip, - 'url' => $urlo, - ); - $this->info_box_contents[$line][] = array( 'td' => '', - 'text' => $objp->ref, - 'tooltip' => $tooltip, - 'url' => $urlo, + 'text' => $supplierorderstatic->getNomUrl(1), + 'asis' => 1 ); $this->info_box_contents[$line][] = array( @@ -158,14 +150,14 @@ class box_supplier_orders extends ModeleBoxes } if ($num == 0) - $this->info_box_contents[$line][0] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="center"', 'text' => $langs->trans("NoSupplierOrder"), ); $db->free($result); } else { - $this->info_box_contents[0][0] = array( + $this->info_box_contents[0][] = array( 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), @@ -174,7 +166,7 @@ class box_supplier_orders extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array( + $this->info_box_contents[0][] = array( 'td' => 'align="left" class="nohover opacitymedium"', 'text' => $langs->trans("ReadPermissionNotAllowed") ); diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index fe919b1fcba..790fe29fbcf 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -231,6 +231,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" $nblines=count($contents); $out.= "\n\n"; + //$out.= '
'; // Does not work on home page. TODO Try to fix this. $out.= '
'."\n"; if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines) @@ -360,6 +361,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" if (empty($head['text']) && empty($head['sublink']) && empty($head['subpicto']) && ! $nblines) $out.= "
\n"; $out.= "
\n"; + //$out.= "
\n"; $out.= "\n\n"; if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { dol_filecache($cachedir, $filename, $out); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7f73630f7f6..1553c9f3e53 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3504,9 +3504,9 @@ abstract class CommonObject // Description print ''.$langs->trans('Description').''; - if ($this->element == 'supplier_proposal') + if ($this->element == 'supplier_proposal' || $this->element == 'order_supplier' || $this->element == 'invoice_supplier') { - print ''.$langs->trans("SupplierProposalRefFourn").''; + print ''.$langs->trans("SupplierProposalRefFourn").''; } // VAT @@ -5620,7 +5620,7 @@ abstract class CommonObject foreach($extrafields->attribute_label as $key=>$label) { if (empty($extrafields->attribute_list[$key])) continue; // 0 = Never visible field - if (($mode == 'create' || $mode == 'edit') && abs($extrafields->attribute_list[$key]) != 1) continue; // <> -1 and <> 1 = not visible on forms, only on list + if (($mode == 'create' || $mode == 'edit') && abs($extrafields->attribute_list[$key]) != 1 && abs($extrafields->attribute_list[$key]) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list // Load language if required if (! empty($extrafields->attributes[$this->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]); @@ -6173,15 +6173,23 @@ abstract class CommonObject } } - if (! $error && ! $notrigger) { + if (! $error) + { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); + } - if (!$notrigger) { - // Call triggers - $result=$this->call_trigger(strtoupper(get_class($this)).'_CREATE',$user); - if ($result < 0) { $error++; } - // End call triggers - } + if (! $error) + { + $result=$this->insertExtraFields(); + if ($result < 0) $error++; + } + + if (! $error && ! $notrigger) + { + // Call triggers + $result=$this->call_trigger(strtoupper(get_class($this)).'_CREATE',$user); + if ($result < 0) { $error++; } + // End call triggers } // Commit or rollback diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2274701644f..74b1416ec08 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -689,18 +689,19 @@ class Form if (empty($row['favorite']) && $atleastonefavorite) { $atleastonefavorite=0; - $out.= ''; + $out.= ''; } if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label']) ) { $foundselected=true; - $out.= ''; } @@ -1330,7 +1331,7 @@ class Form } if ($htmlname != 'none' || $options_only) $out.= ''."\n"; - $formconfirm.= ''."\n"; + if (empty($disableformtag)) $formconfirm.= ''."\n"; $formconfirm.= ''."\n"; @@ -3810,7 +3813,7 @@ class Form $formconfirm.= '
'."\n"; - $formconfirm.= "\n"; + if (empty($disableformtag)) $formconfirm.= "\n"; $formconfirm.= '
'; $formconfirm.= "\n"; @@ -5508,7 +5511,7 @@ class Form cache: true }, language: select2arrayoflanguage, - containerCssClass: \':all:\', /* Line to add class or origin SELECT propagated to the new tag */ placeholder: "'.dol_escape_js($placeholder).'", escapeMarkup: function (markup) { return markup; }, // let our custom formatter work minimumInputLength: '.$minimumInputLength.', diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 6389733f72c..c434202ba2e 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -582,7 +582,6 @@ class FormCompany print ''."\n"; } @@ -6443,7 +6452,7 @@ function printCommonFooter($zone='private') { print_r(xdebug_get_code_coverage()); } - + // If there is some logs in buffer to show if (count($conf->logbuffer)) { @@ -6736,92 +6745,93 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata=0, $param='' * * @param string $file Filename we looking for MIME type * @param string $default Default mime type if extension not found in known list - * @param int $mode 0=Return full mime, 1=otherwise short mime string, 2=image for mime type, 3=source language + * @param int $mode 0=Return full mime, 1=otherwise short mime string, 2=image for mime type, 3=source language, 4=css of font fa * @return string Return a mime type family (text/xxx, application/xxx, image/xxx, audio, video, archive) * @see image_format_supported (images.lib.php) */ -function dol_mimetype($file,$default='application/octet-stream',$mode=0) +function dol_mimetype($file, $default='application/octet-stream', $mode=0) { $mime=$default; $imgmime='other.png'; + $famime='file-o'; $srclang=''; $tmpfile=preg_replace('/\.noexe$/','',$file); // Text files - if (preg_match('/\.txt$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; } - if (preg_match('/\.rtx$/i',$tmpfile)) { $mime='text/richtext'; $imgmime='text.png'; } - if (preg_match('/\.csv$/i',$tmpfile)) { $mime='text/csv'; $imgmime='text.png'; } - if (preg_match('/\.tsv$/i',$tmpfile)) { $mime='text/tab-separated-values'; $imgmime='text.png'; } - if (preg_match('/\.(cf|conf|log)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; } - if (preg_match('/\.ini$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='ini'; } - if (preg_match('/\.css$/i',$tmpfile)) { $mime='text/css'; $imgmime='css.png'; $srclang='css'; } + if (preg_match('/\.txt$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $famime='file-text-o'; } + if (preg_match('/\.rtx$/i',$tmpfile)) { $mime='text/richtext'; $imgmime='text.png'; $famime='file-text-o'; } + if (preg_match('/\.csv$/i',$tmpfile)) { $mime='text/csv'; $imgmime='text.png'; $famime='file-text-o'; } + if (preg_match('/\.tsv$/i',$tmpfile)) { $mime='text/tab-separated-values'; $imgmime='text.png'; $famime='file-text-o'; } + if (preg_match('/\.(cf|conf|log)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $famime='file-text-o'; } + if (preg_match('/\.ini$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='ini'; $famime='file-text-o'; } + if (preg_match('/\.css$/i',$tmpfile)) { $mime='text/css'; $imgmime='css.png'; $srclang='css'; $famime='file-text-o'; } // Certificate files - if (preg_match('/\.(crt|cer|key|pub)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; } + if (preg_match('/\.(crt|cer|key|pub)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $famime='file-text-o'; } // HTML/XML - if (preg_match('/\.(html|htm|shtml)$/i',$tmpfile)) { $mime='text/html'; $imgmime='html.png'; $srclang='html'; } - if (preg_match('/\.(xml|xhtml)$/i',$tmpfile)) { $mime='text/xml'; $imgmime='other.png'; $srclang='xml'; } + if (preg_match('/\.(html|htm|shtml)$/i',$tmpfile)) { $mime='text/html'; $imgmime='html.png'; $srclang='html'; $famime='file-text-o'; } + if (preg_match('/\.(xml|xhtml)$/i',$tmpfile)) { $mime='text/xml'; $imgmime='other.png'; $srclang='xml'; $famime='file-text-o'; } // Languages - if (preg_match('/\.bas$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='bas'; } - if (preg_match('/\.(c)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='c'; } - if (preg_match('/\.(cpp)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='cpp'; } - if (preg_match('/\.(h)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='h'; } - if (preg_match('/\.(java|jsp)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='java'; } - if (preg_match('/\.php([0-9]{1})?$/i',$tmpfile)) { $mime='text/plain'; $imgmime='php.png'; $srclang='php'; } - if (preg_match('/\.phtml$/i',$tmpfile)) { $mime='text/plain'; $imgmime='php.png'; $srclang='php'; } - if (preg_match('/\.(pl|pm)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='pl.png'; $srclang='perl'; } - if (preg_match('/\.sql$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='sql'; } - if (preg_match('/\.js$/i',$tmpfile)) { $mime='text/x-javascript'; $imgmime='jscript.png'; $srclang='js'; } + if (preg_match('/\.bas$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='bas'; $famime='file-code-o'; } + if (preg_match('/\.(c)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='c'; $famime='file-code-o'; } + if (preg_match('/\.(cpp)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='cpp'; $famime='file-code-o'; } + if (preg_match('/\.(h)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='h'; $famime='file-code-o'; } + if (preg_match('/\.(java|jsp)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='java'; $famime='file-code-o'; } + if (preg_match('/\.php([0-9]{1})?$/i',$tmpfile)) { $mime='text/plain'; $imgmime='php.png'; $srclang='php'; $famime='file-code-o'; } + if (preg_match('/\.phtml$/i',$tmpfile)) { $mime='text/plain'; $imgmime='php.png'; $srclang='php'; $famime='file-code-o'; } + if (preg_match('/\.(pl|pm)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='pl.png'; $srclang='perl'; $famime='file-code-o'; } + if (preg_match('/\.sql$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='sql'; $famime='file-code-o'; } + if (preg_match('/\.js$/i',$tmpfile)) { $mime='text/x-javascript'; $imgmime='jscript.png'; $srclang='js'; $famime='file-code-o'; } // Open office - if (preg_match('/\.odp$/i',$tmpfile)) { $mime='application/vnd.oasis.opendocument.presentation'; $imgmime='ooffice.png'; } - if (preg_match('/\.ods$/i',$tmpfile)) { $mime='application/vnd.oasis.opendocument.spreadsheet'; $imgmime='ooffice.png'; } - if (preg_match('/\.odt$/i',$tmpfile)) { $mime='application/vnd.oasis.opendocument.text'; $imgmime='ooffice.png'; } + if (preg_match('/\.odp$/i',$tmpfile)) { $mime='application/vnd.oasis.opendocument.presentation'; $imgmime='ooffice.png'; $famime='file-powerpoint-o'; } + if (preg_match('/\.ods$/i',$tmpfile)) { $mime='application/vnd.oasis.opendocument.spreadsheet'; $imgmime='ooffice.png'; $famime='file-excel-o'; } + if (preg_match('/\.odt$/i',$tmpfile)) { $mime='application/vnd.oasis.opendocument.text'; $imgmime='ooffice.png'; $famime='file-word-o'; } // MS Office - if (preg_match('/\.mdb$/i',$tmpfile)) { $mime='application/msaccess'; $imgmime='mdb.png'; } - if (preg_match('/\.doc(x|m)?$/i',$tmpfile)) { $mime='application/msword'; $imgmime='doc.png'; } - if (preg_match('/\.dot(x|m)?$/i',$tmpfile)) { $mime='application/msword'; $imgmime='doc.png'; } - if (preg_match('/\.xlt(x)?$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; } - if (preg_match('/\.xla(m)?$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; } - if (preg_match('/\.xls$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; } - if (preg_match('/\.xls(b|m|x)$/i',$tmpfile)) { $mime='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $imgmime='xls.png'; } - if (preg_match('/\.pps(m|x)?$/i',$tmpfile)) { $mime='application/vnd.ms-powerpoint'; $imgmime='ppt.png'; } - if (preg_match('/\.ppt(m|x)?$/i',$tmpfile)) { $mime='application/x-mspowerpoint'; $imgmime='ppt.png'; } + if (preg_match('/\.mdb$/i',$tmpfile)) { $mime='application/msaccess'; $imgmime='mdb.png'; $famime='file-o'; } + if (preg_match('/\.doc(x|m)?$/i',$tmpfile)) { $mime='application/msword'; $imgmime='doc.png'; $famime='file-word-o'; } + if (preg_match('/\.dot(x|m)?$/i',$tmpfile)) { $mime='application/msword'; $imgmime='doc.png'; $famime='file-word-o'; } + if (preg_match('/\.xlt(x)?$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; $famime='file-excel-o'; } + if (preg_match('/\.xla(m)?$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; $famime='file-excel-o'; } + if (preg_match('/\.xls$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; $famime='file-excel-o'; } + if (preg_match('/\.xls(b|m|x)$/i',$tmpfile)) { $mime='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $imgmime='xls.png'; $famime='file-excel-o'; } + if (preg_match('/\.pps(m|x)?$/i',$tmpfile)) { $mime='application/vnd.ms-powerpoint'; $imgmime='ppt.png'; $famime='file-powerpoint-o'; } + if (preg_match('/\.ppt(m|x)?$/i',$tmpfile)) { $mime='application/x-mspowerpoint'; $imgmime='ppt.png'; $famime='file-powerpoint-o'; } // Other - if (preg_match('/\.pdf$/i',$tmpfile)) { $mime='application/pdf'; $imgmime='pdf.png'; } + if (preg_match('/\.pdf$/i',$tmpfile)) { $mime='application/pdf'; $imgmime='pdf.png'; $famime='file-pdf-o'; } // Scripts - if (preg_match('/\.bat$/i',$tmpfile)) { $mime='text/x-bat'; $imgmime='script.png'; $srclang='dos'; } - if (preg_match('/\.sh$/i',$tmpfile)) { $mime='text/x-sh'; $imgmime='script.png'; $srclang='bash'; } - if (preg_match('/\.ksh$/i',$tmpfile)) { $mime='text/x-ksh'; $imgmime='script.png'; $srclang='bash'; } - if (preg_match('/\.bash$/i',$tmpfile)) { $mime='text/x-bash'; $imgmime='script.png'; $srclang='bash'; } + if (preg_match('/\.bat$/i',$tmpfile)) { $mime='text/x-bat'; $imgmime='script.png'; $srclang='dos'; $famime='file-code-o'; } + if (preg_match('/\.sh$/i',$tmpfile)) { $mime='text/x-sh'; $imgmime='script.png'; $srclang='bash'; $famime='file-code-o'; } + if (preg_match('/\.ksh$/i',$tmpfile)) { $mime='text/x-ksh'; $imgmime='script.png'; $srclang='bash'; $famime='file-code-o'; } + if (preg_match('/\.bash$/i',$tmpfile)) { $mime='text/x-bash'; $imgmime='script.png'; $srclang='bash'; $famime='file-code-o'; } // Images - if (preg_match('/\.ico$/i',$tmpfile)) { $mime='image/x-icon'; $imgmime='image.png'; } - if (preg_match('/\.(jpg|jpeg)$/i',$tmpfile)) { $mime='image/jpeg'; $imgmime='image.png'; } - if (preg_match('/\.png$/i',$tmpfile)) { $mime='image/png'; $imgmime='image.png'; } - if (preg_match('/\.gif$/i',$tmpfile)) { $mime='image/gif'; $imgmime='image.png'; } - if (preg_match('/\.bmp$/i',$tmpfile)) { $mime='image/bmp'; $imgmime='image.png'; } - if (preg_match('/\.(tif|tiff)$/i',$tmpfile)) { $mime='image/tiff'; $imgmime='image.png'; } + if (preg_match('/\.ico$/i',$tmpfile)) { $mime='image/x-icon'; $imgmime='image.png'; $famime='file-image-o'; } + if (preg_match('/\.(jpg|jpeg)$/i',$tmpfile)) { $mime='image/jpeg'; $imgmime='image.png'; $famime='file-image-o'; } + if (preg_match('/\.png$/i',$tmpfile)) { $mime='image/png'; $imgmime='image.png'; $famime='file-image-o'; } + if (preg_match('/\.gif$/i',$tmpfile)) { $mime='image/gif'; $imgmime='image.png'; $famime='file-image-o'; } + if (preg_match('/\.bmp$/i',$tmpfile)) { $mime='image/bmp'; $imgmime='image.png'; $famime='file-image-o'; } + if (preg_match('/\.(tif|tiff)$/i',$tmpfile)) { $mime='image/tiff'; $imgmime='image.png'; $famime='file-image-o'; } // Calendar - if (preg_match('/\.vcs$/i',$tmpfile)) { $mime='text/calendar'; $imgmime='other.png'; } - if (preg_match('/\.ics$/i',$tmpfile)) { $mime='text/calendar'; $imgmime='other.png'; } + if (preg_match('/\.vcs$/i',$tmpfile)) { $mime='text/calendar'; $imgmime='other.png'; $famime='file-text-o'; } + if (preg_match('/\.ics$/i',$tmpfile)) { $mime='text/calendar'; $imgmime='other.png'; $famime='file-text-o'; } // Other - if (preg_match('/\.torrent$/i',$tmpfile)) { $mime='application/x-bittorrent'; $imgmime='other.png'; } + if (preg_match('/\.torrent$/i',$tmpfile)) { $mime='application/x-bittorrent'; $imgmime='other.png'; $famime='file-o'; } // Audio - if (preg_match('/\.(mp3|ogg|au|wav|wma|mid)$/i',$tmpfile)) { $mime='audio'; $imgmime='audio.png'; } + if (preg_match('/\.(mp3|ogg|au|wav|wma|mid)$/i',$tmpfile)) { $mime='audio'; $imgmime='audio.png'; $famime='file-audio-o'; } // Video - if (preg_match('/\.ogv$/i',$tmpfile)) { $mime='video/ogg'; $imgmime='video.png'; } - if (preg_match('/\.webm$/i',$tmpfile)) { $mime='video/webm'; $imgmime='video.png'; } - if (preg_match('/\.avi$/i',$tmpfile)) { $mime='video/x-msvideo'; $imgmime='video.png'; } - if (preg_match('/\.divx$/i',$tmpfile)) { $mime='video/divx'; $imgmime='video.png'; } - if (preg_match('/\.xvid$/i',$tmpfile)) { $mime='video/xvid'; $imgmime='video.png'; } - if (preg_match('/\.(wmv|mpg|mpeg)$/i',$tmpfile)) { $mime='video'; $imgmime='video.png'; } + if (preg_match('/\.ogv$/i',$tmpfile)) { $mime='video/ogg'; $imgmime='video.png'; $famime='file-video-o'; } + if (preg_match('/\.webm$/i',$tmpfile)) { $mime='video/webm'; $imgmime='video.png'; $famime='file-video-o'; } + if (preg_match('/\.avi$/i',$tmpfile)) { $mime='video/x-msvideo'; $imgmime='video.png'; $famime='file-video-o'; } + if (preg_match('/\.divx$/i',$tmpfile)) { $mime='video/divx'; $imgmime='video.png'; $famime='file-video-o'; } + if (preg_match('/\.xvid$/i',$tmpfile)) { $mime='video/xvid'; $imgmime='video.png'; $famime='file-video-o'; } + if (preg_match('/\.(wmv|mpg|mpeg)$/i',$tmpfile)) { $mime='video'; $imgmime='video.png'; $famime='file-video-o'; } // Archive - if (preg_match('/\.(zip|rar|gz|tgz|z|cab|bz2|7z|tar|lzh)$/i',$tmpfile)) { $mime='archive'; $imgmime='archive.png'; } // application/xxx where zzz is zip, ... + if (preg_match('/\.(zip|rar|gz|tgz|z|cab|bz2|7z|tar|lzh)$/i',$tmpfile)) { $mime='archive'; $imgmime='archive.png'; $famime='file-archive-o'; } // application/xxx where zzz is zip, ... // Exe - if (preg_match('/\.(exe|com)$/i',$tmpfile)) { $mime='application/octet-stream'; $imgmime='other.png'; } + if (preg_match('/\.(exe|com)$/i',$tmpfile)) { $mime='application/octet-stream'; $imgmime='other.png'; $famime='file-o'; } // Lib - if (preg_match('/\.(dll|lib|o|so|a)$/i',$tmpfile)) { $mime='library'; $imgmime='library.png'; } + if (preg_match('/\.(dll|lib|o|so|a)$/i',$tmpfile)) { $mime='library'; $imgmime='library.png'; $famime='file-o'; } // Err - if (preg_match('/\.err$/i',$tmpfile)) { $mime='error'; $imgmime='error.png'; } + if (preg_match('/\.err$/i',$tmpfile)) { $mime='error'; $imgmime='error.png'; $famime='file-text-o'; } // Return string if ($mode == 1) @@ -6837,7 +6847,10 @@ function dol_mimetype($file,$default='application/octet-stream',$mode=0) { return $srclang; } - + if ($mode == 4) + { + return $famime; + } return $mime; } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 73df708ca27..377f2215b6d 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -390,8 +390,10 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target if (! empty($sourcecompany->state_id) && empty($sourcecompany->departement)) $sourcecompany->departement=getState($sourcecompany->state_id); //TODO deprecated if (! empty($sourcecompany->state_id) && empty($sourcecompany->state)) $sourcecompany->state=getState($sourcecompany->state_id); + if (! empty($sourcecompany->state_id) && !isset($sourcecompany->departement_id)) $sourcecompany->departement_id=getState($sourcecompany->state_id,'2'); if (! empty($targetcompany->state_id) && empty($targetcompany->departement)) $targetcompany->departement=getState($targetcompany->state_id); //TODO deprecated if (! empty($targetcompany->state_id) && empty($targetcompany->state)) $targetcompany->state=getState($targetcompany->state_id); + if (! empty($targetcompany->state_id) && !isset($targetcompany->departement_id)) $targetcompany->departement_id=getState($targetcompany->state_id,'2'); $reshook=0; $stringaddress = ''; @@ -1263,47 +1265,45 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl } } - // If line linked to a product - if ($idprod) + // We add ref of product (and supplier ref if defined) + $prefix_prodserv = ""; + $ref_prodserv = ""; + if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this { - // We add ref - if ($prodser->ref) + if ($prodser->isService()) { - $prefix_prodserv = ""; - $ref_prodserv = ""; - if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this - { - if ($prodser->isService()) - { - $prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." "; - } - else - { - $prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product")." "; - } - } - - if (empty($hideref)) - { - if ($issupplierline) - { - if ($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES == 1) - $ref_prodserv = $ref_supplier; - elseif ($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES == 2) - $ref_prodserv = $ref_supplier. ' ('.$outputlangs->transnoentitiesnoconv("InternalRef").' '.$prodser->ref.')'; - else - $ref_prodserv = $prodser->ref.' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')'; - } - else - $ref_prodserv = $prodser->ref; // Show local ref only - - if (! empty($libelleproduitservice)) $ref_prodserv .= " - "; - } - - $libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice; + $prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." "; + } + else + { + $prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product")." "; } } + if (empty($hideref)) + { + if ($issupplierline) + { + if ($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES == 1) + $ref_prodserv = $ref_supplier; + elseif ($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES == 2) + $ref_prodserv = $ref_supplier. ' ('.$outputlangs->transnoentitiesnoconv("InternalRef").' '.$prodser->ref.')'; + else // Common case + { + $ref_prodserv = $prodser->ref; // Show local ref + if ($ref_supplier) $ref_prodserv.= ($prodser->ref?' (':'').$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.($prodser->ref?')':''); + } + } + else + { + $ref_prodserv = $prodser->ref; // Show local ref only + } + + if (! empty($libelleproduitservice) && ! empty($ref_prodserv)) $ref_prodserv .= " - "; + } + + $libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice; + // Add an additional description for the category products if (! empty($conf->global->CATEGORY_ADD_DESC_INTO_DOC) && $idprod && ! empty($conf->categorie->enabled)) { @@ -1842,10 +1842,14 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm if ($object->lines[$i]->special_code == 3) return ''; if (empty($hidedetails) || $hidedetails > 1) { - if($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF) + if ($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF) { - $prev_progress = $object->lines[$i]->get_prev_progress($object->id); - $result = ( $object->lines[$i]->situation_percent - $prev_progress) . '%'; + $prev_progress = 0; + if (method_exists($object, 'get_prev_progress')) + { + $prev_progress = $object->lines[$i]->get_prev_progress($object->id); + } + $result = ($object->lines[$i]->situation_percent - $prev_progress) . '%'; } else $result = $object->lines[$i]->situation_percent . '%'; @@ -1892,12 +1896,17 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0) if (empty($hidedetails) || $hidedetails > 1) { $total_ht = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_total_ht : $object->lines[$i]->total_ht); - if ($object->lines[$i]->situation_percent > 0 ) + if ($object->lines[$i]->situation_percent > 0) { - $prev_progress = $object->lines[$i]->get_prev_progress($object->id); - $progress = ( $object->lines[$i]->situation_percent - $prev_progress) /100; - $result.=price($sign * ($total_ht/($object->lines[$i]->situation_percent/100)) * $progress, 0, $outputlangs); - } + $prev_progress = 0; + $progress = 1; + if (method_exists($object, 'get_prev_progress')) + { + $prev_progress = $object->lines[$i]->get_prev_progress($object->id); + $progress = ($object->lines[$i]->situation_percent - $prev_progress) / 100; + } + $result.=price($sign * ($total_ht/($object->lines[$i]->situation_percent/100)) * $progress, 0, $outputlangs); + } else $result.=price($sign * $total_ht, 0, $outputlangs); } diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index e953a8018cb..7d305ded7d4 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -456,7 +456,7 @@ function getRandomPassword($generic=false) $randomCode = ""; $nbofchar = round($length/3); $nbofcharlast = ($length - 2*$nbofchar); - var_dump($nbofchar.'-'.$nbofcharlast); + //var_dump($nbofchar.'-'.$nbofcharlast); if (function_exists('random_int')) // Cryptographic random { $max = strlen($lowercase) - 1; diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 45568f5eadf..f5797e0fb2e 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -670,13 +670,13 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetFont('','B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; - $pdf->MultiCell(80, 4, $titre, 0, 'L'); + $pdf->MultiCell(43, 4, $titre, 0, 'L'); $pdf->SetFont('','', $default_font_size - 2); $pdf->SetXY($posxval, $posy); $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc); $lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement); - $pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L'); + $pdf->MultiCell(67, 4, $lib_condition_paiement,0,'L'); $posy=$pdf->GetY()+3; } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index f5d6ec70f04..d1285085014 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -897,13 +897,13 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetFont('','B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; - $pdf->MultiCell(80, 4, $titre, 0, 'L'); + $pdf->MultiCell(43, 4, $titre, 0, 'L'); $pdf->SetFont('','', $default_font_size - 2); $pdf->SetXY($posxval, $posy); $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc); $lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement); - $pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L'); + $pdf->MultiCell(67, 4, $lib_condition_paiement,0,'L'); $posy=$pdf->GetY()+3; } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 3e7a0130a04..76ab2ae7655 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -858,13 +858,13 @@ class pdf_azur extends ModelePDFPropales $pdf->SetFont('','B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; - $pdf->MultiCell(80, 4, $titre, 0, 'L'); + $pdf->MultiCell(43, 4, $titre, 0, 'L'); $pdf->SetFont('','', $default_font_size - 2); $pdf->SetXY($posxval, $posy); $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc); $lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement); - $pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L'); + $pdf->MultiCell(67, 4, $lib_condition_paiement,0,'L'); $posy=$pdf->GetY()+3; } diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index fcedc2a4e11..9a11523f39b 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -67,9 +67,15 @@ elseif ($modulepart == 'expensereport') } elseif ($modulepart == 'user') { - $result=restrictedArea($user,'user',$id,'user'); - if (! $user->rights->user->user->lire) accessforbidden(); - $accessallowed=1; + $result=restrictedArea($user,'user',$id,'user'); + if (! $user->rights->user->user->lire) accessforbidden(); + $accessallowed=1; +} +elseif ($modulepart == 'societe') +{ + $result=restrictedArea($user,'societe',$id,'societe'); + if (! $user->rights->societe->lire) accessforbidden(); + $accessallowed=1; } // Security: @@ -115,6 +121,17 @@ elseif ($modulepart == 'holiday') $dir=$conf->holiday->dir_output; // By default } } +elseif ($modulepart == 'societe') +{ + require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; + $object = new Societe($db); + if ($id > 0) + { + $result = $object->fetch($id); + if ($result <= 0) dol_print_error($db,'Failed to load object'); + $dir=$conf->societe->dir_output; + } +} elseif ($modulepart == 'user') { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -145,6 +162,7 @@ if (empty($backtourl)) else if (in_array($modulepart, array('holiday'))) $backtourl=DOL_URL_ROOT."/holiday/document.php?id=".$id.'&file='.urldecode($_POST["file"]); else if (in_array($modulepart, array('project'))) $backtourl=DOL_URL_ROOT."/projet/document.php?id=".$id.'&file='.urldecode($_POST["file"]); else if (in_array($modulepart, array('user'))) $backtourl=DOL_URL_ROOT."/user/document.php?id=".$id.'&file='.urldecode($_POST["file"]); + else if (in_array($modulepart, array('societe'))) $backtourl=DOL_URL_ROOT."/societe/document.php?id=".$id.'&file='.urldecode($_POST["file"]); } diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index da1cb9658a0..10650364543 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -79,7 +79,7 @@ $formfile->form_attach_new_file( ); $disablemove=1; -if ($modulepart == 'product' || $modulepart == 'produit') $disablemove=0; // Drag and drop for up and down allowed on product +if (in_array($modulepart, array('product', 'produit', 'societe', 'user'))) $disablemove=0; // Drag and drop for up and down allowed on product // List of document $formfile->list_of_documents( diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index b57025e3dd6..589a7b56e0e 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -43,7 +43,8 @@ if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element][ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) { // Discard if extrafield is a hidden field on form - if (abs($extrafields->attributes[$object->table_element]['list'][$key]) != 1) continue; + if (empty($extrafields->attributes[$object->table_element]['list'][$key])) continue; // 0 = Never visible field + if (abs($extrafields->attributes[$object->table_element]['list'][$key]) != 1 && abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list // Load language if required if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]); diff --git a/htdocs/core/tpl/massactions_form.tpl.php b/htdocs/core/tpl/massactions_form.tpl.php deleted file mode 100644 index 4087d988c3b..00000000000 --- a/htdocs/core/tpl/massactions_form.tpl.php +++ /dev/null @@ -1,151 +0,0 @@ - - * Copyright (C) 2013-2014 Laurent Destailleur - * Copyright (C) 2015 Marcos García - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * or see http://www.gnu.org/ - */ - -// Following var must be set: -// $arrayofselected = array of id selected -// $object -// $objecttmp=new Propal($db); -// $topicmail="SendSupplierProposalRef"; -// $modelmail="supplier_proposal_send"; -// $trackid='ord'.$object->id; - -$langs->load("mails"); - -if (! GETPOST('cancel', 'alpha')) -{ - $listofselectedid = array(); - $listofselectedthirdparties = array(); - $listofselectedref = array(); - foreach ($arrayofselected as $toselectid) - { - $result = $objecttmp->fetch($toselectid); - if ($result > 0) - { - $listofselectedid[$toselectid] = $toselectid; - $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid); - if ($objecttmp->element == 'societe') - $thirdpartyid = $objecttmp->id; - if ($objecttmp->element == 'expensereport') - $thirdpartyid = $objecttmp->fk_user_author; - $listofselectedthirdparties[$thirdpartyid] = $thirdpartyid; - $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref; - } - } -} - -print ''; - -include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; -$formmail = new FormMail($db); - -dol_fiche_head(null, '', ''); - -// Cree l'objet formulaire mail -include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; -$formmail = new FormMail($db); -$formmail->withform = -1; -$formmail->fromtype = (GETPOST('fromtype') ? GETPOST('fromtype') : (! empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user')); - -if ($formmail->fromtype === 'user') -{ - $formmail->fromid = $user->id; -} -$formmail->trackid = $trackid; -if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set -{ - include DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; - $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); -} -$formmail->withfrom = 1; -$liste = $langs->trans("AllRecipientSelected", count($arrayofselected)); -if (count($listofselectedthirdparties) == 1) // Only 1 different recipient selected, we can suggest contacts -{ - $liste = array(); - $thirdpartyid = array_shift($listofselectedthirdparties); - if ($objecttmp->element == 'expensereport') - { - $fuser = new User($db); - $fuser->fetch($thirdpartyid); - $liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">"; - } - else - { - $soc = new Societe($db); - $soc->fetch($thirdpartyid); - foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) { - $liste[$key] = $value; - } - } - $formmail->withtoreadonly = 0; -} else { - $formmail->withtoreadonly = 1; -} - -$formmail->withoptiononeemailperrecipient = empty($liste)?0:((GETPOST('oneemailperrecipient')=='on')?1:-1); -$formmail->withto = empty($liste)?(GETPOST('sendto','alpha')?GETPOST('sendto','alpha'):array()):$liste; -$formmail->withtofree = empty($liste)?1:0; -$formmail->withtocc = 1; -$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; -$formmail->withtopic = $langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__'); -$formmail->withfile = 1; -// $formmail->withfile = 2; Not yet supported in mass action -$formmail->withmaindocfile = 1; // Add a checkbox "Attach also main document" -if ($objecttmp->element != 'societe') { - $formmail->withfile = $langs->trans("OnlyPDFattachmentSupported"); - $formmail->withmaindocfile = - 1; // Add a checkbox "Attach also main document" but not checked by default -} -$formmail->withbody = 1; -$formmail->withdeliveryreceipt = 1; -$formmail->withcancel = 1; - -// Make substitution in email content -$substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object); -$substitutionarray['__EMAIL__'] = $sendto; -$substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : ''; -$substitutionarray['__PERSONALIZED__'] = ''; // deprecated -$substitutionarray['__CONTACTCIVNAME__'] = ''; - -$parameters = array( - 'mode' => 'formemail' -); -complete_substitutions_array($substitutionarray, $langs, $object, $parameters); - -// Tableau des substitutions -$formmail->substit = $substitutionarray; - -// Tableau des parametres complementaires du post -$formmail->param['action'] = $action; -$formmail->param['models'] = $modelmail; -$formmail->param['models_id'] = GETPOST('modelmailselected', 'int'); -$formmail->param['id'] = join(',', $arrayofselected); -// $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; -if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedthirdparties) > $conf->global->MAILING_LIMIT_SENDBYWEB) -{ - $langs->load("errors"); - print img_warning() . ' ' . $langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB); - print ' - ' . $langs->trans("GoBack") . ''; - $arrayofmassactions = array(); -} -else -{ - print $formmail->get_form(); -} - -dol_fiche_end(); diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php new file mode 100644 index 00000000000..2095399dace --- /dev/null +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -0,0 +1,160 @@ + + * Copyright (C) 2013-2014 Laurent Destailleur + * Copyright (C) 2015 Marcos García + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +// Following var must be set: +// $arrayofselected = array of id selected +// $object +// $objecttmp=new Propal($db); +// $topicmail="SendSupplierProposalRef"; +// $modelmail="supplier_proposal_send"; +// $trackid='ord'.$object->id; + + +if ($massaction == 'predelete') +{ + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1); +} + +if ($massaction == 'presend') +{ + $langs->load("mails"); + + if (! GETPOST('cancel', 'alpha')) + { + $listofselectedid = array(); + $listofselectedthirdparties = array(); + $listofselectedref = array(); + foreach ($arrayofselected as $toselectid) + { + $result = $objecttmp->fetch($toselectid); + if ($result > 0) + { + $listofselectedid[$toselectid] = $toselectid; + $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid); + if ($objecttmp->element == 'societe') + $thirdpartyid = $objecttmp->id; + if ($objecttmp->element == 'expensereport') + $thirdpartyid = $objecttmp->fk_user_author; + $listofselectedthirdparties[$thirdpartyid] = $thirdpartyid; + $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref; + } + } + } + + print ''; + + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + + dol_fiche_head(null, '', ''); + + // Cree l'objet formulaire mail + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + $formmail->withform = -1; + $formmail->fromtype = (GETPOST('fromtype') ? GETPOST('fromtype') : (! empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user')); + + if ($formmail->fromtype === 'user') + { + $formmail->fromid = $user->id; + } + $formmail->trackid = $trackid; + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set + { + include DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; + $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); + } + $formmail->withfrom = 1; + $liste = $langs->trans("AllRecipientSelected", count($arrayofselected)); + if (count($listofselectedthirdparties) == 1) // Only 1 different recipient selected, we can suggest contacts + { + $liste = array(); + $thirdpartyid = array_shift($listofselectedthirdparties); + if ($objecttmp->element == 'expensereport') + { + $fuser = new User($db); + $fuser->fetch($thirdpartyid); + $liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">"; + } + else + { + $soc = new Societe($db); + $soc->fetch($thirdpartyid); + foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) { + $liste[$key] = $value; + } + } + $formmail->withtoreadonly = 0; + } else { + $formmail->withtoreadonly = 1; + } + + $formmail->withoptiononeemailperrecipient = empty($liste)?0:((GETPOST('oneemailperrecipient')=='on')?1:-1); + $formmail->withto = empty($liste)?(GETPOST('sendto','alpha')?GETPOST('sendto','alpha'):array()):$liste; + $formmail->withtofree = empty($liste)?1:0; + $formmail->withtocc = 1; + $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; + $formmail->withtopic = $langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__'); + $formmail->withfile = 1; + // $formmail->withfile = 2; Not yet supported in mass action + $formmail->withmaindocfile = 1; // Add a checkbox "Attach also main document" + if ($objecttmp->element != 'societe') { + $formmail->withfile = $langs->trans("OnlyPDFattachmentSupported"); + $formmail->withmaindocfile = - 1; // Add a checkbox "Attach also main document" but not checked by default + } + $formmail->withbody = 1; + $formmail->withdeliveryreceipt = 1; + $formmail->withcancel = 1; + + // Make substitution in email content + $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object); + $substitutionarray['__EMAIL__'] = $sendto; + $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : ''; + $substitutionarray['__PERSONALIZED__'] = ''; // deprecated + $substitutionarray['__CONTACTCIVNAME__'] = ''; + + $parameters = array( + 'mode' => 'formemail' + ); + complete_substitutions_array($substitutionarray, $langs, $object, $parameters); + + // Tableau des substitutions + $formmail->substit = $substitutionarray; + + // Tableau des parametres complementaires du post + $formmail->param['action'] = $action; + $formmail->param['models'] = $modelmail; + $formmail->param['models_id'] = GETPOST('modelmailselected', 'int'); + $formmail->param['id'] = join(',', $arrayofselected); + // $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; + if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedthirdparties) > $conf->global->MAILING_LIMIT_SENDBYWEB) + { + $langs->load("errors"); + print img_warning() . ' ' . $langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB); + print ' - ' . $langs->trans("GoBack") . ''; + $arrayofmassactions = array(); + } + else + { + print $formmail->get_form(); + } + + dol_fiche_end(); +} diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 84b2413f396..27f5aa715d8 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -65,7 +65,10 @@ if ($nolinesbefore) {
trans('AddNewLine'); ?>trans("FreeZone"); ?> - element == 'supplier_proposal') { ?> + element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines + { + ?> trans('SupplierProposalRefFourn'); ?> trans('VAT'); ?> @@ -270,8 +273,11 @@ else { ?> - element == 'supplier_proposal') { ?> - + element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines + { + ?> + "> - element == 'supplier_proposal') { ?> - - - element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines + { + ?> + + situation_counter == 1 || !$this->situation_cycle_ref) { print '' . $form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1) . ''; diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 94c05fd9ffe..04452f6214a 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -137,13 +137,18 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; } ?> - element == 'supplier_proposal') { ?> - ref_fourn; ?> - element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines + { + ?> + ref_fourn?$line->ref_fourn:$line->ref_supplier); + ?> + tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx); if (price2num($line->total_localtax1)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx); diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index b701c689050..b08ec473028 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -210,13 +210,13 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) - { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); - } + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) + { + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); + } } // Add where from hooks $parameters=array(); diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 6bd44d7f385..dd0243a632b 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -818,7 +818,7 @@ class Don extends CommonObject $sql = "SELECT count(d.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d"; $sql.= " WHERE d.fk_statut > 0"; - $sql.= " AND d.entity IN (".getEntity('don').")"; + $sql.= " AND d.entity IN (".getEntity('donation').")"; $resql=$this->db->query($sql); if ($resql) @@ -851,15 +851,14 @@ class Don extends CommonObject $result=''; $label=$langs->trans("ShowDonation").': '.$this->id; - $link = ''; + $linkstart = ''; $linkend=''; - $picto='generic'; + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; - - if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); - if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$link.$this->id.$linkend; return $result; } diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 1da2274e394..cb5ab766ae9 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -89,7 +89,7 @@ $sql = "SELECT d.rowid, d.datedon, d.firstname, d.lastname, d.societe,"; $sql.= " d.amount, d.fk_statut as statut, "; $sql.= " p.rowid as pid, p.ref, p.title, p.public"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p"; -$sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('don').")"; +$sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")"; if ($statut != '' && $statut != '-1') { $sql .= " AND d.fk_statut IN (".$db->escape($statut).")"; diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 07c8b0aff00..bbb80f52cba 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -411,31 +411,33 @@ class EcmDirectory // extends CommonObject * @param string $option Sur quoi pointe le lien * @param int $max Max length * @param string $more Add more param on a link + * @param int $notooltip 1=Disable tooltip * @return string Chaine avec URL */ - function getNomUrl($withpicto=0,$option='',$max=0,$more='') + function getNomUrl($withpicto=0, $option='', $max=0, $more='', $notooltip=0) { global $langs; $result=''; //$newref=str_replace('_',' ',$this->ref); $newref=$this->ref; - $newlabel=$langs->trans("ShowECMSection").': '.$newref; - $linkclose='"'.($more?' '.$more:'').' title="'.dol_escape_htmltag($newlabel, 1).'" class="classfortooltip">'; + $label=$langs->trans("ShowECMSection").': '.$newref; + $linkclose='"'.($more?' '.$more:'').' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; - $link = 'picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= ($max?dol_trunc($newref,$max,'middle'):$newref); + $result .= $linkend; - if ($withpicto) $result.=($link.img_object($newlabel, $picto, 'class="classfortooltip"').$linkend); - if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$link.($max?dol_trunc($newref,$max,'middle'):$newref).$linkend; return $result; } diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index a329adfd116..ae16ad85eaf 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -43,6 +43,7 @@ class EcmFiles //extends CommonObject * @var string Name of table without prefix where object is stored */ public $table_element = 'ecm_files'; + public $picto = 'generic'; /** */ @@ -752,43 +753,7 @@ class EcmFiles //extends CommonObject static function LibStatut($status,$mode=0) { global $langs; - - if ($mode == 0) - { - $prefix=''; - if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); - } - if ($mode == 1) - { - if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); - } - if ($mode == 2) - { - if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); - } - if ($mode == 3) - { - if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); - } - if ($mode == 4) - { - if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); - } - if ($mode == 5) - { - if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); - } - if ($mode == 6) - { - if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); - } + return ''; } diff --git a/htdocs/ecm/class/htmlecm.form.class.php b/htdocs/ecm/class/htmlecm.form.class.php index a3ffc8a37ad..9b3384a71dc 100644 --- a/htdocs/ecm/class/htmlecm.form.class.php +++ b/htdocs/ecm/class/htmlecm.form.class.php @@ -45,26 +45,36 @@ class FormEcm /** - * Retourne la liste des categories du type choisi + * Return list of sections * - * @param int $selected Id categorie preselectionnee - * @param string $select_name Nom formulaire HTML + * @param int $selected Id of preselected section + * @param string $select_name Name of HTML select component + * @param string $module Module ('ecm', 'medias', ...) * @return string String with HTML select */ - function select_all_sections($selected=0,$select_name='') + function select_all_sections($selected=0, $select_name='', $module='ecm') { - global $langs; + global $conf, $langs; $langs->load("ecm"); - if ($select_name=="") $select_name="catParent"; + if ($select_name=='') $select_name="catParent"; - $cat = new EcmDirectory($this->db); - $cate_arbo = $cat->get_full_arbo(); + if ($module == 'ecm') + { + $cat = new EcmDirectory($this->db); + $cate_arbo = $cat->get_full_arbo(); + } + if ($module == 'medias') + { + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $path = $conf->medias->multidir_output[$conf->entity]; + $cate_arbo = dol_dir_list($path, 'directories', 1, '', array('(\.meta|_preview.*\.png)$','^\.'), 'relativename', SORT_ASC); + } - $output = ''; if (is_array($cate_arbo)) { - if (! count($cate_arbo)) $output.= ''; + if (! count($cate_arbo)) $output.= ''; else { $output.= ''; @@ -78,11 +88,12 @@ class FormEcm { $add = ''; } - $output.= ''; + $output.= ''; } } } $output.= ''; + $output.=ajax_combobox($select_name); $output.= "\n"; return $output; } diff --git a/htdocs/ecm/docdir.php b/htdocs/ecm/docdir.php index b3b9fa528e0..145da2aa7bd 100644 --- a/htdocs/ecm/docdir.php +++ b/htdocs/ecm/docdir.php @@ -42,10 +42,16 @@ $langs->load("categories"); if (! $user->rights->ecm->setup) accessforbidden(); // Get parameters -$socid = GETPOST('socid','int'); -$action=GETPOST('action','alpha'); +$socid = GETPOST('socid','int'); +$action = GETPOST('action','alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$backtopage = GETPOST('backtopage', 'alpha'); $confirm=GETPOST('confirm','alpha'); +$module = GETPOST('module', 'alpha'); +$website = GETPOST('website', 'alpha'); +$pageid = GETPOST('pageid', 'int'); + // Security check if ($user->societe_id > 0) { @@ -53,9 +59,17 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } -$section=$urlsection=GETPOST('section'); +$section=$urlsection=GETPOST('section','alpha'); if (empty($urlsection)) $urlsection='misc'; -$upload_dir = $conf->ecm->dir_output.'/'.$urlsection; + +if ($module == 'ecm') +{ + $upload_dir = $conf->ecm->dir_output.'/'.$urlsection; +} +if ($module == 'medias') +{ + $upload_dir = $conf->medias->multidir_output[$conf->entity]; +} $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -86,11 +100,20 @@ if (! empty($section)) // Action ajout d'un produit ou service if ($action == 'add' && $user->rights->ecm->setup) { - if (! empty($_POST["cancel"])) + if ($cancel) { - header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager'); - exit; + if (! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } + else + { + header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager'); + exit; + } } + $ecmdir->ref = trim($_POST["ref"]); $ecmdir->label = trim($_POST["label"]); $ecmdir->description = trim($_POST["desc"]); @@ -150,27 +173,33 @@ if ($action == 'create') print '
'; print ''; print ''; + print ''; + if ($website) print ''; + if ($pageid) print ''; $title=$langs->trans("ECMNewSection"); print load_fiche_titre($title); - + dol_fiche_head(); print ''; // Label - print ''."\n"; + print ''."\n"; print ''."\n"; // Description - print ''."\n"; + if ($module == 'ecm') + { + print ''."\n"; + } print '
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'.$langs->trans("AddIn").''; - print $formecm->select_all_sections(! empty($_GET["catParent"])?$_GET["catParent"]:$ecmdir->fk_parent,'catParent'); + print $formecm->select_all_sections(! empty($_GET["catParent"]) ? $_GET["catParent"] : $ecmdir->fk_parent, 'catParent', $module); print '
'.$langs->trans("Description").''; - print ''; - print '
'.$langs->trans("Description").''; + print ''; + print '
'; @@ -206,7 +235,7 @@ if (empty($action) || $action == 'delete_section') if ($action == 'delete_section') { print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection'); - + } // Construit fiche rubrique diff --git a/htdocs/ecm/docfile.php b/htdocs/ecm/docfile.php index 339df01b88a..5a14b95291f 100644 --- a/htdocs/ecm/docfile.php +++ b/htdocs/ecm/docfile.php @@ -247,10 +247,9 @@ if ($action == 'edit') print ''; } -dol_fiche_head($head, 'card', $langs->trans("File"), 0, 'generic'); +dol_fiche_head($head, 'card', $langs->trans("File"), -1, 'generic'); + -print ''; -print ''; -/*print ''; -print ''; -*/ -print ''; + // Author + print ''; print ''; print ''; @@ -443,11 +443,13 @@ if ($id > 0 || ! empty($ref)) { $disabled = 0; // Line of orders - if ($object->statut <= 2 || $object->statut >= 6) { - print $langs->trans("OrderStatusNotReadyToDispatch"); + if ($object->statut <= CommandeFournisseur::STATUS_ACCEPTED || $object->statut >= CommandeFournisseur::STATUS_CANCELED) { + print ''.$langs->trans("OrderStatusNotReadyToDispatch").''; } - if ($object->statut == 3 || $object->statut == 4 || $object->statut == 5) { + if ($object->statut == CommandeFournisseur::STATUS_ORDERSENT + || $object->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY + || $object->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) { $entrepot = new Entrepot($db); $listwarehouses = $entrepot->list_array(1); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 5194d6296bb..db947f4011f 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -580,12 +580,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks @@ -661,7 +661,7 @@ if ($resql) ); //if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); if ($user->rights->fournisseur->commande->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); // Lignes des champs de filtre @@ -678,15 +678,11 @@ if ($resql) print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); - if ($massaction == 'presend') - { - $topicmail="SendOrderRef"; - $modelmail="order_supplier_send"; - $objecttmp=new CommandeFournisseur($db); - $trackid='sord'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php'; - } + $topicmail="SendOrderRef"; + $modelmail="order_supplier_send"; + $objecttmp=new CommandeFournisseur($db); + $trackid='sord'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($massaction == 'createbills') { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index de05d2f1a6e..59f15ea155b 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -845,7 +845,8 @@ if (empty($reshook)) if ($result >= 0) { unset($_POST['label']); - unset($_POST['date_starthour']); + unset($_POST['fourn_ref']); + unset($_POST['date_starthour']); unset($_POST['date_startmin']); unset($_POST['date_startsec']); unset($_POST['date_startday']); @@ -998,7 +999,6 @@ if (empty($reshook)) $type = $productsupplier->type; $price_base_type = 'HT'; - // TODO Save the product supplier ref into database (like done for supplier propal and order) into field ref_supplier (must rename field ref into ref_supplier first) $result=$object->addline( $desc, $productsupplier->fourn_pu, @@ -1017,7 +1017,8 @@ if (empty($reshook)) -1, 0, $array_options, - $productsupplier->fk_unit + $productsupplier->fk_unit, + $productsupplier->fourn_ref ); } if ($idprod == -99 || $idprod == 0) @@ -1042,6 +1043,7 @@ if (empty($reshook)) $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); $desc = $product_desc; $type = GETPOST('type'); + $ref_supplier = GETPOST('fourn_ref','alpha'); $fk_unit= GETPOST('units', 'alpha'); @@ -1063,7 +1065,7 @@ if (empty($reshook)) $price_base_type = 'HT'; $pu_ht_devise = price2num($price_ht_devise, 'MU'); - $result=$object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit, 0, $pu_ht_devise); + $result=$object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit, 0, $pu_ht_devise, $ref_supplier); } //print "xx".$tva_tx; exit; @@ -1098,6 +1100,7 @@ if (empty($reshook)) unset($_POST['price_ht']); unset($_POST['multicurrency_price_ht']); unset($_POST['price_ttc']); + unset($_POST['fourn_ref']); unset($_POST['tva_tx']); unset($_POST['label']); unset($localtax1_tx); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 508a9e28117..bdf9349763b 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -372,12 +372,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks @@ -472,7 +472,7 @@ if ($resql) ); //if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); if ($user->rights->fournisseur->facture->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $i = 0; @@ -489,15 +489,11 @@ if ($resql) print_barre_liste($langs->trans("BillsSuppliers").($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); - if ($massaction == 'presend') - { - $topicmail="SendBillRef"; - $modelmail="supplier_invoice_send"; - $objecttmp=new FactureFournisseur($db); - $trackid='sinv'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php'; - } + $topicmail="SendBillRef"; + $modelmail="supplier_invoice_send"; + $objecttmp=new FactureFournisseur($db); + $trackid='sinv'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($massaction == 'createbills') { diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index c6a8f24f98f..c5b39a87681 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -119,7 +119,7 @@ $arrayofmassactions = array( 'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); -if ($massaction == 'presend') $arrayofmassactions=array(); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index efe1c87820e..1d89bbbdd94 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -299,7 +299,7 @@ $arrayofmassactions = array( //'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->holiday->delete) $arrayofmassactions['delete']=$langs->trans("Delete"); -//if ($massaction == 'presend') $arrayofmassactions=array(); +//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index bcf2c7d99ec..e21db6a1dd1 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -77,7 +77,7 @@ print load_fiche_titre($langs->trans("HRMArea"),'', 'title_hrm.png'); if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1; -if ( empty($setupcompanynotcomplete)) +if (! empty($setupcompanynotcomplete)) { $langs->load("errors"); $warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete")); @@ -165,7 +165,7 @@ $langs->load("boxes"); // Latest leave requests if (! empty($conf->holiday->enabled) && $user->rights->holiday->read) { - $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.photo, u.statut, x.rowid, x.rowid as ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status"; + $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.photo, u.statut, x.rowid, x.rowid as ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE u.rowid = x.fk_user"; $sql.= " AND x.entity = ".$conf->entity; @@ -203,14 +203,18 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read) while ($i < $num && $i < $max) { $obj = $db->fetch_object($result); + $holidaystatic->id=$obj->rowid; $holidaystatic->ref=$obj->ref; + $userstatic->id=$obj->uid; $userstatic->lastname=$obj->lastname; $userstatic->firstname=$obj->firstname; $userstatic->login=$obj->login; $userstatic->photo=$obj->photo; + $userstatic->email=$obj->email; $userstatic->statut=$obj->statut; + print ''; print ''; print ''; @@ -242,7 +246,7 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read) // Last expense report (old module) if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) { - $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.statut, u.photo, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut"; + $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut"; $sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE u.rowid = d.fk_user"; @@ -277,14 +281,18 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) while ($i < $num && $i < $max) { $obj = $db->fetch_object($result); + $deplacementstatic->ref=$obj->rowid; $deplacementstatic->id=$obj->rowid; + $userstatic->id=$obj->uid; $userstatic->lastname=$obj->lastname; $userstatic->firstname=$obj->firstname; $userstatic->login=$obj->login; + $userstatic->email=$obj->email; $userstatic->statut=$obj->statut; $userstatic->photo=$obj->photo; + print ''; print ''; print ''; @@ -309,7 +317,7 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) // Last expense report (new module) if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) { - $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.statut, u.photo, x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status"; + $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as x, ".MAIN_DB_PREFIX."user as u"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE u.rowid = x.fk_user_author"; @@ -344,14 +352,18 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire while ($i < $num && $i < $max) { $obj = $db->fetch_object($result); + $expensereportstatic->id=$obj->rowid; $expensereportstatic->ref=$obj->ref; + $userstatic->id=$obj->uid; $userstatic->lastname=$obj->lastname; $userstatic->firstname=$obj->firstname; + $userstatic->email=$obj->email; $userstatic->login=$obj->login; $userstatic->statut=$obj->statut; $userstatic->photo=$obj->photo; + print ''; print ''; print ''; diff --git a/htdocs/index.php b/htdocs/index.php index 0cba7291e9b..8c2a45d0edd 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -118,7 +118,7 @@ $langs->load("contracts"); if (empty($user->societe_id)) { $boxstat.='
'; - $boxstat.='
'.$langs->trans("Ref").''; $s=''; $tmpecmdir=new EcmDirectory($db); // Need to create a new one $tmpecmdir->fetch($ecmdir->id); @@ -259,7 +258,7 @@ $i=0; while ($tmpecmdir && $result > 0) { $tmpecmdir->ref=$tmpecmdir->label; - $s=$tmpecmdir->getNomUrl(1).$s; + $s=$tmpecmdir->getNomUrl(1).$s; if ($tmpecmdir->fk_parent) { $s=' -> '.$s; @@ -272,28 +271,18 @@ while ($tmpecmdir && $result > 0) $i++; } -print img_picto('','object_dir').' '.$langs->trans("ECMRoot").' -> '; -print $s; -print ' -> '; -if ($action == 'edit') print ''; -else print $urlfile; -print '
'.$langs->trans("Description").''; -if ($action == 'edit') -{ - print ''; -} -else print dol_nl2br($ecmdir->description); -print '
'.$langs->trans("ECMCreationUser").''; -$userecm=new User($db); -$userecm->fetch($ecmdir->fk_user_c); -print $userecm->getNomUrl(1); -print '
'.$langs->trans("ECMCreationDate").''; +$s = img_picto('','object_dir').' '.$langs->trans("ECMRoot").' -> '.$s.' -> '; +if ($action == 'edit') $s .= ''; +else $s .= $urlfile; + +$object->ref=''; // Force to hide ref +dol_banner_tab($object, '', $morehtml, 0, '', '', $s); + +print '
'; + +print '
'; +print ''; +print ''; /*print ''; print '
'.$langs->trans("ECMCreationDate").''; print dol_print_date(dol_filemtime($fullpath),'dayhour'); print '
'.$langs->trans("ECMDirectoryForFiles").''; @@ -385,6 +374,7 @@ else print '
'; +print '
'; print ajax_autoselect('downloadinternallink'); print ajax_autoselect('downloadlink'); diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 56f9b692e94..8841778ce26 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -337,165 +337,6 @@ dol_fiche_head($head, 'index', $langs->trans("ECMArea").' - '.$langs->trans("ECM $module='ecm'; include DOL_DOCUMENT_ROOT.'/ecm/tpl/filemanager.tpl.php'; - -/* -// Start container of all panels -?> - -
-
-'; - -// Toolbar -if ($user->rights->ecm->setup) -{ - print ''; - print ''; - print ''; -} -else -{ - print ''; - print ''; - print ''; -} -$url=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:''))); -print ''; -print ''; -print ''; - - -// Start Add new file area -$nameforformuserfile = 'formuserfileecm'; - -print '
'; - -// To attach new file -if ((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) || ! empty($section)) -{ - if ((empty($section) || $section == -1) && ($module != 'medias')) - { - ?> - - form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48, null, '', 0, '', 0, $nameforformuserfile); -} -else print ' '; - -print '
'; -// End Add new file area - - -print '
'; -// End top panel, toolbar - -?> -
-
-formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection','','',1); -} -// End confirm - - -if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete') -{ - print ''."\n"; - - print ''."\n"; - print ''."\n"; - print ''; - - $showonrightsize=''; - - // Manual section - $htmltooltip=$langs->trans("ECMAreaDesc2"); - - if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) - { - print ''; - } - else - { - print ''; - } - - - print "
'; - print ' '.$langs->trans("ECMSections"); - print '
'; - - // Show filemanager tree (will be filled by call of ajax enablefiletreeajax.tpl.php that execute ajaxdirtree.php) - print '
'; - - if ($action == 'deletefile') print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile'); - - print '
'; - - if (empty($module)) $module='ecm'; - - $_POST['modulepart'] = $module; - $_POST['openeddir'] = GETPOST('openeddir'); - $_POST['dir'] = empty($_POST['dir'])?'/':$_POST['dir']; - - // Show filemanager tree (will be filled by direct include of ajaxdirtree.php in mode noajax, this will return all dir - all levels - to show) - print '
'; - - $mode='noajax'; - $url=DOL_URL_ROOT.'/ecm/index.php'; - include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirtree.php'; - - print '
'; - print '
"; -} - - -// End left panel -?> -
-
-
-
- -
-
- -
- -use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { - include DOL_DOCUMENT_ROOT.'/ecm/tpl/enablefiletreeajax.tpl.php'; -} -*/ - // End of page dol_fiche_end(); diff --git a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php index 4be1bf1979a..3e77c0acd92 100644 --- a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php +++ b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php @@ -33,8 +33,8 @@ $(document).ready(function() { $('#filetree').fileTree({ root: '', - // Ajax called if we click to expand a dir (not a file). Parameter 'dir' is provided as a POST parameter by fileTree code. - script: '', + // Ajax called if we click to expand a dir (not a file). Parameter 'dir' is provided as a POST parameter by fileTree code to this following URL. + script: '', folderEvent: 'click', // 'dblclick' multiFolder: false }, // Called if we click on a file (not a dir) @@ -46,7 +46,7 @@ $(document).ready(function() { function(elem) { id=elem.attr('id').substr(12); // We get id that is 'fmdirlia_id_xxx' (id we want is xxx) jQuery("#_section_dir").val(elem.attr('rel')); - jQuery("#_section_id").val(id); + jQuery("#_section_id").val(id); jQuery('#').show(); } ); @@ -73,7 +73,7 @@ function loadandshowpreview(filedirname,section) $('#ecmfileview').empty(); - var url = '?action=preview&module=§ion='+section+'&file='+urlencode(filedirname); + var url = '?action=preview&module=§ion='+section+'&file='+urlencode(filedirname); $.get(url, function(data) { //alert('Load of url '+url+' was performed : '+data); pos=data.indexOf("TYPE=directory",0); diff --git a/htdocs/ecm/tpl/filemanager.tpl.php b/htdocs/ecm/tpl/filemanager.tpl.php index e80e9fd3e83..26299cbf104 100644 --- a/htdocs/ecm/tpl/filemanager.tpl.php +++ b/htdocs/ecm/tpl/filemanager.tpl.php @@ -23,8 +23,25 @@ rights->ecm->setup; + $permtoupload = $user->rights->ecm->upload; +} +if ($module == 'medias') +{ + $permtoadd = ($user->rights->mailing->creer || $user->rights->website->setup); + $permtoupload = ($user->rights->mailing->creer || $user->rights->website->setup); +} + + // Confirm remove file (for non javascript users) if (($action == 'delete' || $action == 'file_manager_delete') && empty($conf->use_javascript_ajax)) @@ -43,25 +60,29 @@ if (($action == 'delete' || $action == 'file_manager_delete') && empty($conf->us print '
'; // Toolbar -if ($user->rights->ecm->setup) -{ - print ''; - print ''; - print ''; -} -else -{ - print ''; - print ''; - print ''; -} -if ($module == 'ecm') -{ - $url=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:''))); - print ''; - print ''; - print ''; -} +//if (preg_match('/\/ecm/', $_SERVER['PHP_SELF'])) { +//if ($module == 'ecm') { + + if ($permtoadd) + { + print ''; + print ''; + print ''; + } + else + { + print ''; + print ''; + print ''; + } + if ($module == 'ecm') + { + $tmpurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:''))); + print ''; + print ''; + print ''; + } +//} // Start "Add new file" area $nameforformuserfile = 'formuserfileecm'; @@ -84,7 +105,7 @@ if ((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABL include_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; $formfile=new FormFile($db); - $formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48, null, '', 0, '', 0, $nameforformuserfile); + $formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section?$section:-1), $permtoupload, 48, null, '', 0, '', 0, $nameforformuserfile); } else print ' '; @@ -140,8 +161,6 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti { print '
'; - if (empty($module)) $module='ecm'; - $_POST['modulepart'] = $module; $_POST['openeddir'] = GETPOST('openeddir'); $_POST['dir'] = empty($_POST['dir'])?'/':$_POST['dir']; @@ -150,7 +169,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti print '
'; $mode='noajax'; - $url=DOL_URL_ROOT.'/ecm/index.php'; + if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php'; include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirtree.php'; print '
'; @@ -173,7 +192,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti $mode='noajax'; -$url=DOL_URL_ROOT.'/ecm/index.php'; +if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php'; include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php'; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 6cada0b16a9..5c7bf296485 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -233,12 +233,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 29a058f2d33..dc2c0a22f66 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -234,8 +234,12 @@ if (empty($reshook)) $db->begin(); $id = $object->create($user); + if ($id <= 0) + { + $error++; + } - if ($id > 0) + if (! $error) { $db->commit(); Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 437114ab7df..b2d6f052a2a 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -215,7 +215,8 @@ class ExpenseReport extends CommonObject $resql=$this->db->query($sql); if (!$resql) $error++; - if (is_array($this->lines) && count($this->lines)>0) { + if (is_array($this->lines) && count($this->lines)>0) + { foreach ($this->lines as $i => $val) { $newndfline=new ExpenseReportLine($this->db); @@ -233,6 +234,12 @@ class ExpenseReport extends CommonObject } } + if (! $error) + { + $result=$this->insertExtraFields(); + if ($result < 0) $error++; + } + if (! $error) { $result=$this->update_price(); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 30d5eea98d6..a9f1e0ecde4 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -324,13 +324,13 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) - { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); - } + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) + { + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); + } } // Add where from hooks $parameters=array(); @@ -380,7 +380,7 @@ if ($resql) 'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->expensereport->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); // Lines of title fields @@ -486,15 +486,11 @@ if ($resql) print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); } - if ($massaction == 'presend') - { - $topicmail="SendExpenseReport"; - $modelmail="expensereport"; - $objecttmp=new ExpenseReport($db); - $trackid='int'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php'; - } + $topicmail="SendExpenseReport"; + $modelmail="expensereport"; + $objecttmp=new ExpenseReport($db); + $trackid='int'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 3b4aca20951..baf90355249 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -222,12 +222,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks @@ -285,9 +285,8 @@ if ($resql) //'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); - //if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); if ($user->rights->ficheinter->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - //if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); + //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); // Lines of title fields diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 7f002bc40c0..437732b71d0 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1392,7 +1392,7 @@ class CommandeFournisseur extends CommonOrder * @param float $txlocaltax2 Localtax2 tax * @param int $fk_product Id product * @param int $fk_prod_fourn_price Id supplier price - * @param string $fourn_ref Supplier reference price + * @param string $ref_supplier Supplier reference price * @param float $remise_percent Remise * @param string $price_base_type HT or TTC * @param float $pu_ttc Unit price TTC @@ -1408,13 +1408,13 @@ class CommandeFournisseur extends CommonOrder * @param int $origin_id Id of origin object * @return int <=0 if KO, >0 if OK */ - public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null, $pu_ht_devise=0, $origin='', $origin_id=0) + public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $ref_supplier='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null, $pu_ht_devise=0, $origin='', $origin_id=0) { global $langs,$mysoc,$conf; $error = 0; - dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $fk_prod_fourn_price, $fourn_ref, $remise_percent, $price_base_type, $pu_ttc, $type, $fk_unit"); + dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $fk_prod_fourn_price, $ref_supplier, $remise_percent, $price_base_type, $pu_ttc, $type, $fk_unit"); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; // Clean parameters @@ -1441,7 +1441,6 @@ class CommandeFournisseur extends CommonOrder $pu=$pu_ttc; } $desc=trim($desc); - $ref_supplier=''; // Ref of supplier price when we add line // Check parameters if ($qty < 1 && ! $fk_product) @@ -1460,16 +1459,16 @@ class CommandeFournisseur extends CommonOrder if (empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED)) { // Check quantity is enough - dol_syslog(get_class($this)."::addline we check supplier prices fk_product=".$fk_product." fk_prod_fourn_price=".$fk_prod_fourn_price." qty=".$qty." fourn_ref=".$fourn_ref); + dol_syslog(get_class($this)."::addline we check supplier prices fk_product=".$fk_product." fk_prod_fourn_price=".$fk_prod_fourn_price." qty=".$qty." ref_supplier=".$ref_supplier); $prod = new Product($this->db, $fk_product); if ($prod->fetch($fk_product) > 0) { $product_type = $prod->type; $label = $prod->label; - // We use 'none' instead of $fourn_ref, because fourn_ref may not exists anymore. So we will take the first supplier price ok. + // We use 'none' instead of $ref_supplier, because fourn_ref may not exists anymore. So we will take the first supplier price ok. // If we want a dedicated supplier price, we must provide $fk_prod_fourn_price. - $result=$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc?$this->fk_soc:$this->socid)); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$fourn_ref/$this->fk_soc + $result=$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc?$this->fk_soc:$this->socid)); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$ref_supplier/$this->fk_soc if ($result > 0) { $pu = $prod->fourn_pu; // Unit price supplier price set by get_buyprice @@ -2335,8 +2334,8 @@ class CommandeFournisseur extends CommonOrder * @param string $desc Description de la ligne * @param double $pu Prix unitaire * @param double $qty Quantity - * @param double $remise_percent Pourcentage de remise de la ligne - * @param double $txtva Taux TVA + * @param double $remise_percent Percent discount on line + * @param double $txtva VAT rate * @param double $txlocaltax1 Localtax1 tax * @param double $txlocaltax2 Localtax2 tax * @param double $price_base_type Type of price base @@ -2348,9 +2347,10 @@ class CommandeFournisseur extends CommonOrder * @param array $array_options Extrafields array * @param string $fk_unit Code of the unit to use. Null to use the default one * @param double $pu_ht_devise Unit price in currency + * @param string $ref_supplier Supplier ref * @return int < 0 if error, > 0 if ok */ - public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $notrigger=false, $date_start='', $date_end='', $array_options=0, $fk_unit=null, $pu_ht_devise = 0) + public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $notrigger=false, $date_start='', $date_end='', $array_options=0, $fk_unit=null, $pu_ht_devise=0, $ref_supplier='') { global $mysoc, $conf; dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type, $fk_unit"); @@ -2430,6 +2430,7 @@ class CommandeFournisseur extends CommonOrder //$this->line->label=$label; $this->line->desc=$desc; $this->line->qty=$qty; + $this->line->ref_supplier=$ref_supplier; $this->line->vat_src_code = $vat_src_code; $this->line->tva_tx = $txtva; @@ -3277,6 +3278,7 @@ class CommandeFournisseurLigne extends CommonOrderLine // Mise a jour ligne en base $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; $sql.= " description='".$this->db->escape($this->desc)."'"; + $sql.= ", ref='".$this->db->escape($this->ref_supplier)."'"; $sql.= ", subprice='".price2num($this->subprice)."'"; //$sql.= ",remise='".price2num($remise)."'"; $sql.= ", remise_percent='".price2num($this->remise_percent)."'"; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 15bd4366a29..249fda336f1 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1372,11 +1372,12 @@ class FactureFournisseur extends CommonInvoice * @param string $fk_unit Code of the unit to use. Null to use the default one * @param int $origin_id id origin document * @param double $pu_ht_devise Amount in currency + * @param string $ref_supplier Supplier ref * @return int >0 if OK, <0 if KO * * FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order. */ - public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0, $pu_ht_devise=0) + public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0, $pu_ht_devise=0, $ref_supplier='') { dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type,$fk_unit", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1435,6 +1436,7 @@ class FactureFournisseur extends CommonInvoice //$this->line->label=$label; // deprecated $this->line->desc=$desc; $this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative + $this->line->ref_supplier=$ref_supplier; $this->line->vat_src_code=$vat_src_code; $this->line->tva_tx=$txtva; @@ -2615,7 +2617,8 @@ class SupplierInvoiceLine extends CommonObjectLine } $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET"; - $sql.= " description ='".$this->db->escape($this->description)."'"; + $sql.= " description ='".$this->db->escape($this->description)."'"; + $sql.= ", ref ='".$this->db->escape($this->ref)."'"; $sql.= ", pu_ht = ".price2num($this->pu_ht); $sql.= ", pu_ttc = ".price2num($this->pu_ttc); $sql.= ", qty = ".price2num($this->qty); @@ -2743,7 +2746,7 @@ class SupplierInvoiceLine extends CommonObjectLine // Insertion dans base de la ligne $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element; - $sql.= ' (fk_facture_fourn, fk_parent_line, label, description, qty,'; + $sql.= ' (fk_facture_fourn, fk_parent_line, label, description, ref, qty,'; $sql.= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; $sql.= ' fk_product, product_type, remise_percent, pu_ht, pu_ttc,'; $sql.= ' date_start, date_end, fk_code_ventilation, rang, special_code,'; @@ -2754,6 +2757,7 @@ class SupplierInvoiceLine extends CommonObjectLine $sql.= " ".($this->fk_parent_line>0?"'".$this->db->escape($this->fk_parent_line)."'":"null").","; $sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").","; $sql.= " '".$this->db->escape($this->desc)."',"; + $sql.= " '".$this->db->escape($this->ref_supplier)."',"; $sql.= " ".price2num($this->qty).","; $sql.= " ".(empty($this->vat_src_code)?"''":"'".$this->db->escape($this->vat_src_code)."'").","; diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 504147adff3..1c6363644f9 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -432,7 +432,7 @@ class ProductFournisseur extends Product if (empty($ignore_expression) && !empty($this->fk_supplier_price_expression)) { $priceparser = new PriceParser($this->db); - $price_result = $priceparser->parseProductSupplier($this->fk_product, $this->fk_supplier_price_expression, $this->fourn_qty, $this->fourn_tva_tx); + $price_result = $priceparser->parseProductSupplier($this); if ($price_result >= 0) { $this->fourn_price = $price_result; //recalculation of unitprice, as probably the price changed... diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 6b4f1417100..c96c42e2297 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -446,6 +446,7 @@ if (empty($reshook)) $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); $desc = $product_desc; $type = GETPOST('type'); + $ref_supplier = GETPOST('fourn_ref','alpha'); $fk_unit= GETPOST('units', 'alpha'); @@ -470,7 +471,7 @@ if (empty($reshook)) $pu_ht_devise = price2num($price_ht_devise, 'MU'); - $result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end, $array_options, $fk_unit, $pu_ht_devise); + $result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, $ref_supplier, $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end, $array_options, $fk_unit, $pu_ht_devise); } //print "xx".$tva_tx; exit; @@ -507,6 +508,7 @@ if (empty($reshook)) unset($_POST['price_ht']); unset($_POST['multicurrency_price_ht']); unset($_POST['price_ttc']); + unset($_POST['fourn_ref']); unset($_POST['tva_tx']); unset($_POST['label']); unset($localtax1_tx); @@ -547,23 +549,23 @@ if (empty($reshook)) if ($lineid) { - $line = new CommandeFournisseurLigne($db); - $res = $line->fetch($lineid); - if (!$res) dol_print_error($db); + $line = new CommandeFournisseurLigne($db); + $res = $line->fetch($lineid); + if (!$res) dol_print_error($db); } $productsupplier = new ProductFournisseur($db); - if ($productsupplier->get_buyprice(0, price2num($_POST['qty']), $line->fk_product, 'none', GETPOST('socid','int')) < 0 ) + if ($line->fk_product > 0 && $productsupplier->get_buyprice(0, price2num($_POST['qty']), $line->fk_product, 'none', GETPOST('socid','int')) < 0 ) { setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'warnings'); } - $date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); - $date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); + $date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); + $date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); - // Define info_bits - $info_bits = 0; - if (preg_match('/\*/', $vat_rate)) + // Define info_bits + $info_bits = 0; + if (preg_match('/\*/', $vat_rate)) $info_bits |= 0x01; // Define vat_rate @@ -604,23 +606,24 @@ if (empty($reshook)) } $result = $object->updateline( - $lineid, - $_POST['product_desc'], - $ht, - $_POST['qty'], - $_POST['remise_percent'], - $vat_rate, - $localtax1_rate, - $localtax2_rate, - $price_base_type, - 0, - isset($_POST["type"])?$_POST["type"]:$line->product_type, - false, - $date_start, - $date_end, - $array_options, + $lineid, + $_POST['product_desc'], + $ht, + $_POST['qty'], + $_POST['remise_percent'], + $vat_rate, + $localtax1_rate, + $localtax2_rate, + $price_base_type, + 0, + isset($_POST["type"])?$_POST["type"]:$line->product_type, + false, + $date_start, + $date_end, + $array_options, $_POST['units'], - $pu_ht_devise + $pu_ht_devise, + GETPOST('fourn_ref','alpha') ); unset($_POST['qty']); unset($_POST['type']); @@ -629,6 +632,7 @@ if (empty($reshook)) unset($_POST['dp_desc']); unset($_POST['np_desc']); unset($_POST['pu']); + unset($_POST['fourn_ref']); unset($_POST['tva_tx']); unset($_POST['date_start']); unset($_POST['date_end']); diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 67b22c6767c..a7c528e11c2 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -426,8 +426,8 @@ if ($id > 0 || ! empty($ref)) { } } - // Auteur - print '
' . $langs->trans("AuthorRequest") . '
' . $langs->trans("AuthorRequest") . '' . $author->getNomUrl(1, '', 0, 0, 0) . '
'.$holidaystatic->getNomUrl(1).''.$userstatic->getNomUrl(-1, 'leave').'
'.$deplacementstatic->getNomUrl(1).''.$userstatic->getNomUrl(-1).'
'.$expensereportstatic->getNomUrl(1).''.$userstatic->getNomUrl(-1).'
'; + $boxstat.='
'; $boxstat.=''; $boxstat.=''; $boxstat.=''; @@ -525,7 +525,7 @@ if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $totallate = round($to //var_dump($totallate); $boxwork=''; $boxwork.='
'; -$boxwork.='
'.$langs->trans("DolibarrStateBoard").'
'."\n"; +$boxwork.='
'."\n"; $boxwork.=''; $boxwork.=''; $boxwork.=''."\n"; diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index 72ede0445de..c185d3c9afd 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -528,6 +528,9 @@ ALTER TABLE llx_resource ADD UNIQUE INDEX uk_resource_ref (ref, entity); ALTER TABLE llx_product ADD COLUMN accountancy_code_sell_intra varchar(32) AFTER accountancy_code_sell; ALTER TABLE llx_product ADD COLUMN accountancy_code_sell_export varchar(32) AFTER accountancy_code_sell_intra; +ALTER TABLE llx_facture_rec ADD COLUMN modelpdf varchar(255) AFTER note_public; +ALTER TABLE llx_facture_rec ADD COLUMN generate_pdf integer DEFAULT 0 AFTER auto_validate; + -- SPEC : use database type 'double' to store monetary values ALTER TABLE llx_blockedlog MODIFY COLUMN amounts double(24,8); ALTER TABLE llx_chargessociales MODIFY COLUMN amount double(24,8); diff --git a/htdocs/install/mysql/tables/llx_facture_rec.sql b/htdocs/install/mysql/tables/llx_facture_rec.sql index 941bc06627d..87bb56e7dbe 100644 --- a/htdocs/install/mysql/tables/llx_facture_rec.sql +++ b/htdocs/install/mysql/tables/llx_facture_rec.sql @@ -54,6 +54,7 @@ create table llx_facture_rec fk_account integer, -- bank account id note_private text, note_public text, + modelpdf varchar(255), fk_multicurrency integer, multicurrency_code varchar(255), @@ -70,5 +71,6 @@ create table llx_facture_rec date_last_gen datetime DEFAULT NULL, -- date for last gen (date with last successfull generation of invoice) nb_gen_done integer DEFAULT NULL, -- nb of generation done (when an invoice is generated, this field must incremented) nb_gen_max integer DEFAULT NULL, -- maximum number of generation - auto_validate integer DEFAULT 0 -- 0 to create in draft, 1 to create and validate the new invoice + auto_validate integer DEFAULT 0, -- 0 to create in draft, 1 to create and validate the new invoice + generate_pdf integer DEFAULT 0 -- 0 disable pdf, 1 to generate pdf )ENGINE=innodb; diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index b3f9c030d3e..07b5e6cc0a8 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -512,3 +512,5 @@ DeleteRepeatableInvoice=Delete template invoice ConfirmDeleteRepeatableInvoice=Are your sure you want to delete the template invoice? CreateOneBillByThird=Create one invoice per third party (otherwise, one invoice per order) BillCreated=%s bill(s) created +StatusOfGeneratedDocuments=Status of document generation +AutogenerateDoc=Auto generate document \ No newline at end of file diff --git a/htdocs/langs/en_US/contracts.lang b/htdocs/langs/en_US/contracts.lang index e0642b27c02..3768cfb9ff1 100644 --- a/htdocs/langs/en_US/contracts.lang +++ b/htdocs/langs/en_US/contracts.lang @@ -44,7 +44,6 @@ ConfirmActivateService=Are you sure you want to activate this service with date RefContract=Contract reference DateContract=Contract date DateServiceActivate=Service activation date -ShowContract=Show contract ListOfServices=List of services ListOfInactiveServices=List of not active services ListOfExpiredServices=List of expired active services diff --git a/htdocs/langs/en_US/ecm.lang b/htdocs/langs/en_US/ecm.lang index 0b199c15de1..85874930d25 100644 --- a/htdocs/langs/en_US/ecm.lang +++ b/htdocs/langs/en_US/ecm.lang @@ -45,4 +45,5 @@ DirNotSynchronizedSyncFirst=This directory seems to be created or modified outsi ReSyncListOfDir=Resync list of directories HashOfFileContent=Hash of file content FileNotYetIndexedInDatabase=File not yet indexed into database (try to re-upload it) -FileSharedViaALink=File shared via a link \ No newline at end of file +FileSharedViaALink=File shared via a link +NoDirectoriesFound=No directories found \ No newline at end of file diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 77a4ba76383..c36a3fad5ff 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -155,6 +155,7 @@ ErrorPriceExpression19=Expression not found ErrorPriceExpression20=Empty expression ErrorPriceExpression21=Empty result '%s' ErrorPriceExpression22=Negative result '%s' +ErrorPriceExpression23=Unknown or non set variable '%s' in %s ErrorPriceExpressionInternal=Internal error '%s' ErrorPriceExpressionUnknown=Unknown error '%s' ErrorSrcAndTargetWarehouseMustDiffers=Source and target warehouses must differs diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 15415a7fcd5..4c93eff9d0d 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -28,7 +28,6 @@ InterventionClassifyBilled=Classify "Billed" InterventionClassifyUnBilled=Classify "Unbilled" InterventionClassifyDone=Classify "Done" StatusInterInvoiced=Billed -ShowIntervention=Show intervention SendInterventionRef=Submission of intervention %s SendInterventionByMail=Send intervention by Email InterventionCreatedInDolibarr=Intervention %s created diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 7f89918e90a..43b8e3a6cbb 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -766,6 +766,8 @@ AddBox=Add box SelectElementAndClick=Select an element and click %s PrintFile=Print File %s ShowTransaction=Show entry on bank account +ShowIntervention=Show intervention +ShowContract=Show contract GoIntoSetupToChangeLogo=Go into Home - Setup - Company to change logo or go into Home - Setup - Display to hide. Deny=Deny Denied=Denied @@ -786,6 +788,8 @@ TooManyRecordForMassAction=Too many record selected for mass action. The action NoRecordSelected=No record selected MassFilesArea=Area for files built by mass actions ShowTempMassFilesArea=Show area of files built by mass actions +ConfirmMassDeletion=Bulk delete confirmation +ConfirmMassDeletionQuestion=Are you sure you want to delete the %s selected record ? RelatedObjects=Related Objects ClassifyBilled=Classify billed Progress=Progress diff --git a/htdocs/langs/en_US/opensurvey.lang b/htdocs/langs/en_US/opensurvey.lang index f42ea006eb6..1f8a90b5657 100644 --- a/htdocs/langs/en_US/opensurvey.lang +++ b/htdocs/langs/en_US/opensurvey.lang @@ -57,3 +57,4 @@ ErrorInsertingComment=There was an error while inserting your comment MoreChoices=Enter more choices for the voters SurveyExpiredInfo=The poll has been closed or voting delay has expired. EmailSomeoneVoted=%s has filled a line.\nYou can find your poll at the link: \n%s +ShowSurvey=Show survey \ No newline at end of file diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index c62d08412ce..8ab5b85b7e6 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -152,5 +152,7 @@ OrderCreated=Your orders have been created OrderFail=An error happened during your orders creation CreateOrders=Create orders ToBillSeveralOrderSelectCustomer=To create an invoice for several orders, click first onto customer, then choose "%s". +OptionToSetOrderBilledNotEnabled=Option (from module Workflow) to set order to 'Billed' automatically when invoice is validated is off, so you will have to set status of order to 'Billed' manually. +IfValidateInvoiceIsNoOrderStayUnbilled=If invoice validation is 'No', the order will remain to status 'Unbilled' until the invoice is validated. CloseReceivedSupplierOrdersAutomatically=Close order to "%s" automatically if all products are received. SetShippingMode=Set shipping mode \ No newline at end of file diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 9389d960171..1d049e670c9 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1858,7 +1858,7 @@ if (! function_exists("llxFooter")) global $delayedhtmlcontent; $ext='version='.urlencode(DOL_VERSION); - + // Global html output events ($mesgs, $errors, $warnings) dol_htmloutput_events($disabledoutputofmessages); @@ -1918,7 +1918,7 @@ if (! function_exists("llxFooter")) if (! empty($conf->use_javascript_ajax)) { print "\n".''."\n"; - print ''."\n"; + print ''."\n"; } // Wrapper to add log when clicking on download or preview diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 5716f88b4b1..37345e1356d 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -228,9 +228,9 @@ foreach ($search_array_options as $key => $val) $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; $mode_search=0; - if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } @@ -329,7 +329,7 @@ $arrayofmassactions = array( //'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->mymodule->delete) $arrayofmassactions['delete']=$langs->trans("Delete"); -if ($massaction == 'presend') $arrayofmassactions=array(); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; @@ -344,6 +344,13 @@ print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); +// Add code for pre mass action (confirmation or email presend form) +$topicmail="SendMyObjectRef"; +$modelmail="myobject"; +$objecttmp=new MyObject($db); +$trackid='xxx'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 95af2b130d5..a2b6096d77c 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -37,7 +37,7 @@ class Opensurveysondage extends CommonObject public $element='opensurvey_sondage'; //!< Id that identify managed objects public $table_element='opensurvey_sondage'; //!< Name of table without prefix where object is stored public $picto = 'opensurvey'; - + public $id_sondage; /** * @deprecated @@ -75,7 +75,7 @@ class Opensurveysondage extends CommonObject */ public $allow_spy; - + /** * Draft status (not used) */ @@ -88,9 +88,9 @@ class Opensurveysondage extends CommonObject * Closed */ const STATUS_CLOSED = 2; - - - + + + /** * Constructor * @@ -110,7 +110,7 @@ class Opensurveysondage extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, Id of created object if OK */ - function create($user, $notrigger=0) + function create(User $user, $notrigger=0) { $error=0; @@ -200,7 +200,7 @@ class Opensurveysondage extends CommonObject * @param string $numsurvey Ref of survey (admin or not) * @return int <0 if KO, >0 if OK */ - function fetch($id,$numsurvey='') + function fetch($id, $numsurvey='') { $sql = "SELECT"; $sql.= " t.id_sondage,"; @@ -275,7 +275,7 @@ class Opensurveysondage extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user, $notrigger=0) + function update(User $user, $notrigger=0) { global $conf, $langs; $error=0; @@ -348,7 +348,7 @@ class Opensurveysondage extends CommonObject * @param string $numsondage Num sondage admin to delete * @return int <0 if KO, >0 if OK */ - function delete($user, $notrigger, $numsondage) + function delete(User $user, $notrigger, $numsondage) { global $conf, $langs; $error=0; @@ -402,6 +402,63 @@ class Opensurveysondage extends CommonObject } } + /** + * Return a link to the object card (with optionaly the picto) + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL + */ + function getNomUrl($withpicto=0, $notooltip=0, $morecss='', $save_lastsearch_value=-1) + { + global $db, $conf, $langs; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; + + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + + $result = ''; + $companylink = ''; + + $label = '' . $langs->trans("ShowSurvey") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref.'
'; + $label.= '' . $langs->trans('Title') . ': ' . $this->title.'
'; + + $url = DOL_URL_ROOT.'/opensurvey/card.php?id='.$this->id; + + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowMyObject"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + } + else $linkclose = ($morecss?' class="'.$morecss.'"':''); + + $linkstart = ''; + $linkend=''; + + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; + + return $result; + } + /** * Return array of lines * @@ -544,8 +601,8 @@ class Opensurveysondage extends CommonObject $this->allow_spy = ($this->allow_spy ? 1 : 0); $this->sujet = trim($this->sujet); } - - + + /** * Return status label of Order * @@ -556,7 +613,7 @@ class Opensurveysondage extends CommonObject { return $this->LibStatut($this->status,$mode); } - + /** * Return label of status * @@ -567,7 +624,7 @@ class Opensurveysondage extends CommonObject function LibStatut($status,$mode) { global $langs, $conf; - + //print 'x'.$status.'-'.$billed; if ($mode == 0) { @@ -606,5 +663,5 @@ class Opensurveysondage extends CommonObject if ($status==self::STATUS_CLOSED) return ''.$langs->trans('Closed').' '.img_picto($langs->trans('Closed'),'statut6'); } } - + } diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index 8c3f43b03d3..0ca1819e7bc 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -171,12 +171,19 @@ while ($i < min($num,$limit)) else dol_print_error($db); $opensurvey_static->id=$obj->id_sondage; + $opensurvey_static->ref=$obj->id_sondage; + $opensurvey_static->title=$obj->titre; $opensurvey_static->status=$obj->status; print ''; + + // Ref print ''; + + // Title + print ''."\n"; print ''; print''."\n"; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 54b4ae33de8..ffefcc91d91 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1957,7 +1957,7 @@ if (($action == 'delete' && (empty($conf->use_javascript_ajax) || ! empty($conf- if (($action == 'clone' && (empty($conf->use_javascript_ajax) || ! empty($conf->dol_use_jmobile))) // Output when action = clone if jmobile or no js || (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) // Always output when not jmobile nor js { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneProduct'),$langs->trans('ConfirmCloneProduct',$object->ref),'confirm_clone',$formquestionclone,'yes','action-clone',250,600); + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneProduct'),$langs->trans('ConfirmCloneProduct',$object->ref),'confirm_clone',$formquestionclone,'yes','action-clone',260,600); } @@ -2160,6 +2160,13 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') print '
'; + $MAXEVENT = 10; + + // List of actions on element + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, 'product', 0, 1, '', $MAXEVENT); + print '
'; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index fef3859fa95..8703350c737 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3463,6 +3463,7 @@ class Product extends CommonObject if ($this->volume) $label.="
".$langs->trans("Volume").': '.$this->volume.' '.measuring_units_string($this->volume_units,'volume'); if (! empty($conf->productbatch->enabled)) { + $langs->load("productbatch"); $label.="
".$langs->trans("ManageLotSerial").': '.$this->getLibStatut(0,2); } } diff --git a/htdocs/product/dynamic_price/class/price_expression.class.php b/htdocs/product/dynamic_price/class/price_expression.class.php index cd5c8bb25de..5ce3068c144 100644 --- a/htdocs/product/dynamic_price/class/price_expression.class.php +++ b/htdocs/product/dynamic_price/class/price_expression.class.php @@ -74,7 +74,7 @@ class PriceExpression $this->db->begin(); - dol_syslog(get_class($this)."::create", LOG_DEBUG); + dol_syslog(__METHOD__, LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -121,11 +121,18 @@ class PriceExpression */ function fetch($id) { + // Check parameters + if (empty($id)) + { + $this->error='ErrorWrongParameters'; + return -1; + } + $sql = "SELECT title, expression"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE rowid = ".$id; - dol_syslog(get_class($this)."::fetch"); + dol_syslog(__METHOD__); $resql=$this->db->query($sql); if ($resql) { @@ -160,7 +167,7 @@ class PriceExpression $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " ORDER BY title"; - dol_syslog(get_class($this)."::list_price_expression"); + dol_syslog(__METHOD__, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -198,7 +205,7 @@ class PriceExpression $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE title = '".$this->db->escape($title)."'"; - dol_syslog(get_class($this)."::find_title"); + dol_syslog(__METHOD__, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -243,7 +250,7 @@ class PriceExpression $this->db->begin(); - dol_syslog(get_class($this)."::update"); + dol_syslog(__METHOD__); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -266,7 +273,7 @@ class PriceExpression { foreach($this->errors as $errmsg) { - dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); + dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); $this->error.=($this->error?', '.$errmsg:$errmsg); } $this->db->rollback(); @@ -314,7 +321,7 @@ class PriceExpression $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE rowid = ".$rowid; - dol_syslog(get_class($this)."::delete"); + dol_syslog(__METHOD__); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } } @@ -324,7 +331,7 @@ class PriceExpression { foreach($this->errors as $errmsg) { - dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); + dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); $this->error.=($this->error?', '.$errmsg:$errmsg); } $this->db->rollback(); diff --git a/htdocs/product/dynamic_price/class/price_global_variable.class.php b/htdocs/product/dynamic_price/class/price_global_variable.class.php index c65e694dfb9..97a3ee1f4e6 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable.class.php @@ -74,7 +74,7 @@ class PriceGlobalVariable $this->db->begin(); - dol_syslog(get_class($this)."::create", LOG_DEBUG); + dol_syslog(__METHOD__); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -125,7 +125,7 @@ class PriceGlobalVariable $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE rowid = ".$id; - dol_syslog(get_class($this)."::fetch"); + dol_syslog(__METHOD__); $resql=$this->db->query($sql); if ($resql) { @@ -173,7 +173,7 @@ class PriceGlobalVariable $this->db->begin(); - dol_syslog(get_class($this)."::update"); + dol_syslog(__METHOD__); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -196,7 +196,7 @@ class PriceGlobalVariable { foreach($this->errors as $errmsg) { - dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); + dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); $this->error.=($this->error?', '.$errmsg:$errmsg); } $this->db->rollback(); @@ -243,7 +243,7 @@ class PriceGlobalVariable $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE rowid = ".$rowid; - dol_syslog(get_class($this)."::delete"); + dol_syslog(__METHOD__); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } } @@ -253,7 +253,7 @@ class PriceGlobalVariable { foreach($this->errors as $errmsg) { - dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); + dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); $this->error.=($this->error?', '.$errmsg:$errmsg); } $this->db->rollback(); @@ -306,7 +306,7 @@ class PriceGlobalVariable $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " ORDER BY code"; - dol_syslog(get_class($this)."::listGlobalVariables"); + dol_syslog(__METHOD__, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php index 0948275ce2b..f4595062098 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php @@ -84,7 +84,7 @@ class PriceGlobalVariableUpdater $this->db->begin(); - dol_syslog(get_class($this)."::create", LOG_DEBUG); + dol_syslog(__METHOD__, LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -135,7 +135,7 @@ class PriceGlobalVariableUpdater $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE rowid = ".$id; - dol_syslog(get_class($this)."::fetch"); + dol_syslog(__METHOD__); $resql=$this->db->query($sql); if ($resql) { @@ -191,7 +191,7 @@ class PriceGlobalVariableUpdater $this->db->begin(); - dol_syslog(get_class($this)."::update"); + dol_syslog(__METHOD__); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -260,7 +260,7 @@ class PriceGlobalVariableUpdater $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE rowid = ".$rowid; - dol_syslog(get_class($this)."::delete"); + dol_syslog(__METHOD__); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } } @@ -270,7 +270,7 @@ class PriceGlobalVariableUpdater { foreach($this->errors as $errmsg) { - dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); + dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); $this->error.=($this->error?', '.$errmsg:$errmsg); } $this->db->rollback(); @@ -346,7 +346,7 @@ class PriceGlobalVariableUpdater $sql = "SELECT rowid, type, description, parameters, fk_variable, update_interval, next_update, last_status"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; - dol_syslog(get_class($this)."::listUpdaters"); + dol_syslog(__METHOD__, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -388,7 +388,7 @@ class PriceGlobalVariableUpdater $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE next_update < ".dol_now(); - dol_syslog(get_class($this)."::processUpdaters"); + dol_syslog(__METHOD__, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -428,6 +428,7 @@ class PriceGlobalVariableUpdater { global $langs, $user; $langs->load("errors"); + dol_syslog(__METHOD__, LOG_DEBUG); $this->error = null; $this->checkParameters(); @@ -551,7 +552,7 @@ class PriceGlobalVariableUpdater $this->db->begin(); - dol_syslog(get_class($this)."::update_next_update"); + dol_syslog(__METHOD__); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -560,7 +561,7 @@ class PriceGlobalVariableUpdater { foreach($this->errors as $errmsg) { - dol_syslog(get_class($this)."::update_next_update ".$errmsg, LOG_ERR); + dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); $this->error.=($this->error?', '.$errmsg:$errmsg); } $this->db->rollback(); @@ -595,7 +596,7 @@ class PriceGlobalVariableUpdater $this->db->begin(); - dol_syslog(get_class($this)."::update_status"); + dol_syslog(__METHOD__); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -604,7 +605,7 @@ class PriceGlobalVariableUpdater { foreach($this->errors as $errmsg) { - dol_syslog(get_class($this)."::update_status ".$errmsg, LOG_ERR); + dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); $this->error.=($this->error?', '.$errmsg:$errmsg); } $this->db->rollback(); diff --git a/htdocs/product/dynamic_price/class/price_parser.class.php b/htdocs/product/dynamic_price/class/price_parser.class.php index aba86bfd97e..088c15b02aa 100644 --- a/htdocs/product/dynamic_price/class/price_parser.class.php +++ b/htdocs/product/dynamic_price/class/price_parser.class.php @@ -85,6 +85,7 @@ class PriceParser -2 Args 6, wrong number of arguments (%s given, %s expected) + 23, unknown or non set variable '%s' after %s -internal errors 7, internal error @@ -178,19 +179,34 @@ class PriceParser $values["global_".$entry->code] = $entry->value; } + //Remove internal variables + unset($values["supplier_id"]); + //Prepare the lib, parameters and values $em = new EvalMath(); $em->suppress_errors = true; //Don't print errors on page $this->error_expr = null; $last_result = null; - //Iterate over each expression splitted by $separator_chr + //Fill each variable in expression from values $expression = str_replace("\n", $this->separator_chr, $expression); foreach ($values as $key => $value) { if ($value === null) $value = "NULL"; $expression = str_replace($this->special_chr.$key.$this->special_chr, strval($value), $expression); } + + //Check if there is unfilled variable + if (strpos($expression, $this->special_chr) !== false) + { + $data = explode($this->special_chr, $expression); + $variable = $this->special_chr.$data[1]; + if (isset($data[2])) $variable.= $this->special_chr; + $this->error_parser = array(23, array($variable, $expression)); + return -6; + } + + //Iterate over each expression splitted by $separator_chr $expressions = explode($this->separator_chr, $expression); $expressions = array_slice($expressions, 0, $this->limit); foreach ($expressions as $expr) { @@ -241,7 +257,7 @@ class PriceParser //Get the supplier min $productFournisseur = new ProductFournisseur($this->db); - $supplier_min_price = $productFournisseur->find_min_price_product_fournisseur($product->id); + $supplier_min_price = $productFournisseur->find_min_price_product_fournisseur($product->id, 0, 0); //Accessible values by expressions $extra_values = array_merge($extra_values, array( diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index 39be799db47..722844c619f 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -195,13 +195,13 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) - { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); - } + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) + { + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); + } } // Add where from hooks $parameters=array(); @@ -282,7 +282,7 @@ $arrayofmassactions = array( 'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->inventory->delete) $arrayofmassactions['delete']=$langs->trans("Delete"); -if ($massaction == 'presend') $arrayofmassactions=array(); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 31cf38cfe9a..2d14f3179fb 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -324,12 +324,12 @@ else $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks @@ -426,7 +426,7 @@ else //'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->produit->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 4b878c03260..63698319fdf 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -464,13 +464,13 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) - { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); - } + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) + { + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); + } } // Add where from hooks $parameters=array(); @@ -689,7 +689,7 @@ if ($resql) // 'builddoc'=>$langs->trans("PDFMerge"), ); //if ($user->rights->stock->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 920bbac8a9b..72048f4641b 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -243,12 +243,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks @@ -300,7 +300,7 @@ if ($resql) //'builddoc'=>$langs->trans("PDFMerge"), ); //if ($user->rights->stock->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 08c22f30a37..4bf6282e546 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -322,12 +322,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks @@ -407,7 +407,7 @@ $arrayofmassactions = array( ); //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); if ($user->rights->societe->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); -if ($massaction == 'presend') $arrayofmassactions=array(); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index d44dc3ec4b8..8014bba1c5d 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -320,12 +320,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks @@ -405,7 +405,7 @@ $arrayofmassactions = array( ); //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); if ($user->rights->societe->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); -if ($massaction == 'presend') $arrayofmassactions=array(); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 215a7ace2d0..132c33bcf9c 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -700,11 +700,10 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) //'builddoc'=>$langs->trans("PDFMerge"), ); //if ($user->rights->projet->creer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); - print ''; if ($optioncss != '') print ''; print ''; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 977c65d49a7..473461bd62c 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -722,7 +722,7 @@ if ($source == 'order') if ($directdownloadlink) { print '
'; - print img_mime($order->last_main_doc,'').' '; + print img_mime($order->last_main_doc,''); print $langs->trans("DownloadDocument").''; } print ''."\n"; @@ -840,7 +840,7 @@ if ($source == 'invoice') if ($directdownloadlink) { print '
'; - print img_mime($invoice->last_main_doc,'').' '; + print img_mime($invoice->last_main_doc,''); print $langs->trans("DownloadDocument").''; } print ''."\n"; @@ -1029,7 +1029,7 @@ if ($source == 'contractline') if ($directdownloadlink) { print '
'; - print img_mime($invoice->last_main_doc,'').' '; + print img_mime($contract->last_main_doc,''); print $langs->trans("DownloadDocument").''; } print ''."\n"; diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 10c7c2f9f85..1933d670cab 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -936,20 +936,21 @@ class Dolresource extends CommonObject $result=''; $label=$langs->trans("ShowResource").': '.$this->ref; + $linkstart = ''; + $linkend = ''; if ($option == '') { - $link = ''; + $linkstart = ''; $picto='resource'; $label=$langs->trans("ShowResource").': '.$this->ref; - + $linkend=''; } - $linkend=''; + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; - - if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); - if ($withpicto && $withpicto != 2) $result.=' '; - $result.=$link.$this->ref.$linkend; return $result; } diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 1b5c11df748..cb16ebcc807 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -75,12 +75,12 @@ foreach ($search_array_options as $key => $val) if ($val != '') { $param.='&search_options_'.$tmpkey.'='.urlencode($val); } - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $filter['ef.'.$tmpkey]=natural_search('ef.'.$tmpkey, $crit, $mode); + $filter['ef.'.$tmpkey] = natural_search('ef.'.$tmpkey, $crit, $mode_search); } } if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 652f66380d3..84442aaefac 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -96,7 +96,7 @@ class Contacts extends DolibarrApi * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number - * @param string $thirdparty_ids Thirdparty ids to filter projects of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i} + * @param string $thirdparty_ids Thirdparty ids to filter contacts of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @return array Array of contact objects * @@ -274,9 +274,9 @@ class Contacts extends DolibarrApi } /** - * Create useraccount object from contact + * Create an user account object from contact (external user) * - * @param int $id Id of contact + * @param int $id Id of contact * @param array $request_data Request datas * @return int ID of user * diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index fbfd931b69b..be549d6cac5 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -58,7 +58,7 @@ $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder="ASC"; -if (! $sortfield) $sortfield="name"; +if (! $sortfield) $sortfield="position_name"; $object = new Societe($db); if ($id > 0 || ! empty($ref)) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 974db015a2c..44e8e3b3cf5 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -472,12 +472,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } @@ -550,7 +550,6 @@ if ($search_idprof4 != '') $param.= '&search_idprof4='.urlencode($search_idprof4 if ($search_idprof5 != '') $param.= '&search_idprof5='.urlencode($search_idprof5); if ($search_idprof6 != '') $param.= '&search_idprof6='.urlencode($search_idprof6); if ($search_vat != '') $param.= '&search_vat='.urlencode($search_vat); -if ($search_country != '') $param.='&search_country='.urlencode($search_country); if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty); if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); if ($search_status != '') $param.='&search_status='.urlencode($search_status); @@ -579,8 +578,8 @@ $arrayofmassactions = array( // 'builddoc'=>$langs->trans("PDFMerge"), ); //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); -if ($user->rights->societe->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); -if ($massaction == 'presend') $arrayofmassactions=array(); +if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; @@ -606,15 +605,11 @@ foreach(array(1,2,3,4,5,6) as $key) } } -if ($massaction == 'presend') -{ - $topicmail="Information"; - $modelmail="thirdparty"; - $objecttmp=new Societe($db); - $trackid='thi'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php'; -} +$topicmail="Information"; +$modelmail="thirdparty"; +$objecttmp=new Societe($db); +$trackid='thi'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { @@ -631,7 +626,7 @@ if (empty($type) || $type == 'c' || $type == 'p') require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $moreforfilter.='
'; $moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort').': '; - $moreforfilter.=$formother->select_categories('customer',$search_categ_cus,'search_categ_cus',1); + $moreforfilter.=$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $langs->trans('CustomersProspectsCategoriesShort')); $moreforfilter.='
'; } } diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index c268f56922c..c0fdcc73219 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -273,9 +273,9 @@ foreach ($search_array_options as $key => $val) $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; $mode_search=0; - if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } @@ -328,7 +328,7 @@ $arrayofmassactions = array( //'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->mymodule->delete) $arrayofmassactions['delete']=$langs->trans("Delete"); -if ($massaction == 'presend') $arrayofmassactions=array(); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 75ea0cd12ed..2519deb48e2 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -362,7 +362,7 @@ if (empty($reshook)) $array_options = $lines[$i]->array_options; } - $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->ref_fourn, $lines[$i]->fk_unit); + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->ref_supplier, $lines[$i]->fk_unit); if ($result > 0) { $lineid = $result; @@ -523,10 +523,10 @@ if (empty($reshook)) // Set if we used free entry or predefined product $predef=''; - $ref_fourn = GETPOST('fourn_ref'); $product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):''); $date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); $date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); + $ref_supplier = GETPOST('fourn_ref','alpha'); if (GETPOST('prod_entry_mode') == 'free') { @@ -614,6 +614,7 @@ if (empty($reshook)) $label = $productsupplier->label; $desc = $productsupplier->description; if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc); + $ref_supplier = $productsupplier->ref_supplier; $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); @@ -641,7 +642,7 @@ if (empty($reshook)) $buyingprice, $label, $array_options, - $ref_fourn, + $ref_supplier, $fk_unit ); //var_dump($tva_tx);var_dump($productsupplier->fourn_pu);var_dump($price_base_type);exit; @@ -692,7 +693,7 @@ if (empty($reshook)) $price_base_type = 'HT'; } - $result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $ref_fourn, $fk_unit); + $result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $ref_supplier, $fk_unit); //$result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end, $array_options, $fk_unit); } @@ -829,9 +830,9 @@ if (empty($reshook)) if (! $error) { $db->begin(); - $ref_fourn = GETPOST('fourn_ref'); + $ref_supplier = GETPOST('fourn_ref','alpha'); $fk_unit = GETPOST('units'); - $result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $array_options, $ref_fourn, $fk_unit); + $result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $array_options, $ref_supplier, $fk_unit); if ($result >= 0) { $db->commit(); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 2b30b550f38..0fd0959e3cc 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2436,7 +2436,7 @@ class SupplierProposal extends CommonObject $sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,'; $sql.= ' pt.product_type, pt.rang, pt.fk_parent_line,'; $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,'; - $sql.= ' p.description as product_desc, pt.ref_fourn as ref_produit_fourn,'; + $sql.= ' p.description as product_desc, pt.ref_fourn as ref_supplier,'; $sql.= ' pt.fk_multicurrency, pt.multicurrency_code, pt.multicurrency_subprice, pt.multicurrency_total_ht, pt.multicurrency_total_tva, pt.multicurrency_total_ttc, pt.fk_unit'; $sql.= ' FROM '.MAIN_DB_PREFIX.'supplier_proposaldet as pt'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product=p.rowid'; @@ -2483,7 +2483,8 @@ class SupplierProposal extends CommonObject $this->lines[$i]->special_code = $obj->special_code; $this->lines[$i]->rang = $obj->rang; - $this->lines[$i]->ref_fourn = $obj->ref_produit_fourn; + $this->lines[$i]->ref_fourn = $obj->ref_supplier; // deprecated + $this->lines[$i]->ref_supplier = $obj->ref_supplier; // Multicurrency $this->lines[$i]->fk_multicurrency = $obj->fk_multicurrency; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index d3ce6ce6a27..16da59c1b93 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -323,12 +323,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks @@ -401,7 +401,7 @@ if ($resql) 'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->supplier_proposal->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); // Lignes des champs de filtre @@ -416,15 +416,11 @@ if ($resql) print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); - if ($massaction == 'presend') - { - $topicmail="SendSupplierProposalRef"; - $modelmail="supplier_proposal_send"; - $objecttmp=new SupplierProposal($db); - $trackid='spro'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php'; - } + $topicmail="SendSupplierProposalRef"; + $modelmail="supplier_proposal_send"; + $objecttmp=new SupplierProposal($db); + $trackid='spro'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 03825de4406..c57f19d676b 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -285,7 +285,6 @@ input, input.flat, form.flat select, select, select.flat, .dataTables_length lab ?> } input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { - font-size: px; font-family: ; outline: none; margin: 0px 0px 0px 0px; @@ -348,7 +347,7 @@ input.buttongen { vertical-align: middle; } input.buttonpayment { - min-width: 290px; + min-width: 300px; margin-bottom: 15px; background-image: none; line-height: 24px; @@ -398,8 +397,12 @@ td.onholidaymorning, td.onholidayafternoon { td.onholidayallday { background-color: #f4eede; } +td.actionbuttons a { + padding-left: 6px; +} select.flat, form.flat select { font-weight: normal; + height: 2.1em; } .optionblue { color: rgb(); @@ -669,10 +672,9 @@ div.myavailability { padding-bottom: 10px; } .checkallactions { - /* vertical-align: text-bottom; - margin-top: 6px; */ margin-left: 2px; /* left must be same than right to keep checkbox centered */ margin-right: 2px; /* left must be same than right to keep checkbox centered */ + vertical-align: middle; } .selectlimit, .marginrightonly { margin-right: 10px !important; @@ -759,7 +761,9 @@ div.myavailability { box-shadow: 1px 1px 25px #aaa; max-width: calc(100% - 56px); } - +.fa-file-text-o, .fa-file-code-o, .fa-file-powerpoint-o, .fa-file-excel-o, .fa-file-word-o, .fa-file-o, .fa-file-image-o, .fa-file-video-o, .fa-file-audio-o, .fa-file-archive-o, .fa-file-pdf-o { + color: #055; +} /* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */ /*.table-responsive { @@ -1079,7 +1083,14 @@ div.vmenu, td.vmenu { padding-right: 10px !important; } - +/* Try responsive even not on smartphone +#id-container { + width: 100%; +} +#id-right { + width: calc(100% - 200px) !important; +} +*/ /* For smartphone (testmenuhider is on) */ browser->layout == 'phone' && ((GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> @@ -4464,7 +4475,7 @@ dl.dropdown { margin-left: 2px; margin-right: 2px; padding:0px; - vertical-align: text-bottom; + vertical-align: middle; display: inline-block; } .dropdown dd, .dropdown dt { @@ -4844,7 +4855,7 @@ div.tabsElem a.tab { @media only screen and (max-width: 1024px) { div#ecm-layout-west { - width: 100%; + width: calc(100% - 4px); clear: both; } div#ecm-layout-center { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 92f5f44b64f..066cf1e7d72 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -345,7 +345,7 @@ input.buttongen { vertical-align: middle; } input.buttonpayment { - min-width: 290px; + min-width: 300px; margin-bottom: 15px; background-image: none; line-height: 24px; @@ -405,9 +405,12 @@ td.onholidaymorning, td.onholidayafternoon { td.onholidayallday { background-color: #f4eede; } - +td.actionbuttons a { + padding-left: 6px; +} select.flat, form.flat select { font-weight: normal; + height: 2.1em; } .optionblue { color: rgb(); @@ -676,10 +679,9 @@ div.myavailability { padding-bottom: 10px; } .checkallactions { - /*vertical-align: text-bottom; - margin-top: 6px;*/ margin-left: 2px; /* left must be same than right to keep checkbox centered */ margin-right: 2px; /* left must be same than right to keep checkbox centered */ + vertical-align: middle; } .selectlimit, .marginrightonly { margin-right: 10px !important; @@ -766,7 +768,9 @@ div.myavailability { box-shadow: 1px 1px 25px #aaa; max-width: calc(100% - 56px); } - +.fa-file-text-o, .fa-file-code-o, .fa-file-powerpoint-o, .fa-file-excel-o, .fa-file-word-o, .fa-file-o, .fa-file-image-o, .fa-file-video-o, .fa-file-audio-o, .fa-file-archive-o, .fa-file-pdf-o { + color: #505; +} /* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */ /*.table-responsive { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index b9e7378bd31..565e1f014b7 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -40,6 +40,7 @@ class User extends CommonObject { public $element='user'; public $table_element='user'; + public $fk_element='fk_user'; public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $id=0; @@ -53,17 +54,17 @@ class User extends CommonObject public $job; public $signature; public $address; - public $zip; - public $town; - public $state_id; - public $state_code; - public $state; + public $zip; + public $town; + public $state_id; + public $state_code; + public $state; public $office_phone; public $office_fax; public $user_mobile; public $admin; public $login; - public $api_key; + public $api_key; public $entity; //! Clear password in memory diff --git a/htdocs/user/document.php b/htdocs/user/document.php index 27cf4eb757a..ff7fe9b5ab9 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -81,7 +81,7 @@ $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder="ASC"; -if (! $sortfield) $sortfield="name"; +if (! $sortfield) $sortfield="position_name"; $object = new User($db); if ($id > 0 || ! empty($ref)) diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 7e5820dac66..233efc4d8b7 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -220,12 +220,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index f5feba2e606..2a704ae35a3 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -600,7 +600,7 @@ if (! empty($id) || ! empty($ref)) 'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->product->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); */ diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 79eca309e59..d030bdb4647 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -52,7 +52,6 @@ $pageid=GETPOST('pageid', 'int'); $pageref=GETPOST('pageref', 'aZ09'); $action=GETPOST('action','alpha'); - if (GETPOST('delete')) { $action='delete'; } if (GETPOST('preview')) $action='preview'; if (GETPOST('createsite')) { $action='createsite'; } @@ -67,6 +66,18 @@ if (GETPOST('editcontent')) { $action='editcontent'; } if (GETPOST('createfromclone')) { $action='createfromclone'; } if (GETPOST('createpagefromclone')) { $action='createpagefromclone'; } +// Load variable for pagination +$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +//if (! $sortfield) $sortfield='name'; +//if (! $sortorder) $sortorder='ASC'; + if (empty($action)) $action='preview'; $object=new Website($db); @@ -111,7 +122,6 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - /* * Actions */ @@ -1151,6 +1161,8 @@ if ($action == 'edit') $style=''; if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource') $style=' margin-bottom: 5px;'; +if (! GETPOST('hide_websitemenu')) +{ //var_dump($objectpage);exit; print '
'; @@ -1211,6 +1223,23 @@ if (count($object->records) > 0) print '   '; print ''; + /*print ''.dol_escape_htmltag($langs->trans("MediaFiles")).''; + print ''; + */ } print '
'; @@ -1455,8 +1484,10 @@ else $action=''; } - print ''; // end current websitebar +} + + $head = array(); @@ -1792,6 +1823,7 @@ if ($action == 'file_manager') //print '
'.$langs->trans("FeatureNotYetAvailable").''; $module = 'medias'; + if (empty($url)) $url=DOL_URL_ROOT.'/website/index.php'; include DOL_DOCUMENT_ROOT.'/ecm/tpl/filemanager.tpl.php'; }
'.$langs->trans("DolibarrWorkBoard").'
'; - print ''.img_picto('','object_opensurvey').' '.$obj->id_sondage.''; - print ''.dol_htmlentities($obj->titre).''; + print $opensurvey_static->getNomUrl(1); + print ''.dol_htmlentities($obj->titre).''; $type=($obj->format=='A')?'classic':'date'; print img_picto('',dol_buildpath('/opensurvey/img/'.($type == 'classic'?'chart-32.png':'calendar-32.png'),1),'width="16"',1); print ' '.$langs->trans($type=='classic'?"TypeClassic":"TypeDate"); @@ -200,7 +207,7 @@ while ($i < min($num,$limit)) print''.$nbuser.''.dol_print_date($db->jdate($obj->date_fin),'day'); - if ($db->jdate($obj->date_fin) < time()) { print ' ('.$langs->trans("Expired").')'; } + if ($db->jdate($obj->date_fin) < time()) { print img_warning($langs->trans("Expired")); } print ''.$opensurvey_static->getLibStatut(5).'