From 5df193ec9325a8ff47cc5a2a7444020365e68c42 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 28 Nov 2015 20:25:50 +0100 Subject: [PATCH] Uniformize code --- htdocs/comm/index.php | 7 +++- htdocs/core/search.php | 5 +++ .../interface_90_all_Demo.class.php-NORUN | 2 +- htdocs/fourn/commande/index.php | 2 +- htdocs/langs/en_US/supplier_proposal.lang | 38 ++++++++++--------- htdocs/langs/fr_FR/supplier_proposal.lang | 32 ++++++++-------- htdocs/supplier_proposal/card.php | 4 +- .../class/supplier_proposal.class.php | 22 +++++------ htdocs/supplier_proposal/index.php | 2 +- htdocs/supplier_proposal/list.php | 34 ++++++++++++++--- 10 files changed, 91 insertions(+), 57 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 86f48d10817..d55c05102d5 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -97,7 +97,12 @@ if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire) // Search contract if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) { - $listofsearchfields['search_contract']=array('text'=>'Contrat'); + $listofsearchfields['search_contract']=array('text'=>'Contrat'); +} +// Search contract +if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) +{ + $listofsearchfields['search_supplier_proposal']=array('text'=>'SupplierProposalShort'); } if (count($listofsearchfields)) diff --git a/htdocs/core/search.php b/htdocs/core/search.php index 0307a8c77d1..5f66c34721d 100644 --- a/htdocs/core/search.php +++ b/htdocs/core/search.php @@ -74,6 +74,11 @@ if (GETPOST('search_supplier_invoice') != '') header("Location: ".DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode(GETPOST('search_supplier_invoice'))); exit; } +if (GETPOST('search_supplier_proposal') != '') +{ + header("Location: ".DOL_URL_ROOT.'/supplier_proposal/list.php?sall='.urlencode(GETPOST('search_supplier_proposal'))); + exit; +} if (GETPOST('search_donation') != '') { header("Location: ".DOL_URL_ROOT.'/don/list.php?sall='.urlencode(GETPOST('search_donation'))); diff --git a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN index bd1328e6eae..f25a99f3b59 100644 --- a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN +++ b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN @@ -150,7 +150,7 @@ class InterfaceDemo extends DolibarrTriggers case 'LINEPROPAL_UPDATE': case 'LINEPROPAL_DELETE': - // Askpricesupplier + // SupplierProposal case 'SUPPLIER_PROPOSAL_CREATE': case 'SUPPLIER_PROPOSAL_CLONE': case 'SUPPLIER_PROPOSAL_MODIFY': diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index c9de3c6a340..1bdec7b9a8d 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -131,7 +131,7 @@ if ($resql) { print '<tr class="impair"><td align="center" colspan="2">'; $data=array('series'=>$dataseries); - dol_print_graph('stats',300,180,$data,1,'pie',1); + dol_print_graph('stats',300,180,$data,1,'pie',1,'',0); print '</td></tr>'; } //if ($totalinprocess != $total) diff --git a/htdocs/langs/en_US/supplier_proposal.lang b/htdocs/langs/en_US/supplier_proposal.lang index b0e2887feb0..7bd743881c1 100644 --- a/htdocs/langs/en_US/supplier_proposal.lang +++ b/htdocs/langs/en_US/supplier_proposal.lang @@ -11,10 +11,12 @@ DraftRequests=Draft requests LastModifiedRequests=Last %s modified price requests RequestsOpened=Open price requests SupplierProposalArea=Supplier proposals area -Askpricesupplier=Supplier proposals +SupplierProposal=Supplier proposal +SupplierProposalShort=Supplier proposal +SupplierProposals=Supplier proposals NewAskPrice=New price request NewAsk=New request -ShowAskpricesupplier=Show price request +ShowSupplierProposal=Show price request AddSupplierProposal=Create a price request SupplierProposalRefFourn=Supplier ref SupplierProposalDate=Delivery date @@ -25,22 +27,22 @@ DateAsk=Date of request DeleteAsk=Delete request ValidateAsk=Validate request AddAsk=Create a request -AskpricesupplierDraft=Drafts -AskpricesupplierOpened=Open -AskpricesupplierStatusDraft=Draft (needs to be validated) -AskpricesupplierStatusValidated=Validated (request is open) -AskpricesupplierStatusOpened=Validated (request is open) -AskpricesupplierStatusClosed=Closed -AskpricesupplierStatusSigned=Accepted -AskpricesupplierStatusNotSigned=Refused -AskpricesupplierStatusBilled=Billed -AskpricesupplierStatusDraftShort=Draft -AskpricesupplierStatusValidatedShort=Validated -AskpricesupplierStatusOpenedShort=Open -AskpricesupplierStatusClosedShort=Closed -AskpricesupplierStatusSignedShort=Accepted -AskpricesupplierStatusNotSignedShort=Refused -AskpricesupplierStatusBilledShort=Billed +SupplierProposalDraft=Drafts +SupplierProposalOpened=Open +SupplierProposalStatusDraft=Draft (needs to be validated) +SupplierProposalStatusValidated=Validated (request is open) +SupplierProposalStatusOpened=Validated (request is open) +SupplierProposalStatusClosed=Closed +SupplierProposalStatusSigned=Accepted +SupplierProposalStatusNotSigned=Refused +SupplierProposalStatusBilled=Billed +SupplierProposalStatusDraftShort=Draft +SupplierProposalStatusValidatedShort=Validated +SupplierProposalStatusOpenedShort=Open +SupplierProposalStatusClosedShort=Closed +SupplierProposalStatusSignedShort=Accepted +SupplierProposalStatusNotSignedShort=Refused +SupplierProposalStatusBilledShort=Billed CopyAskFrom=Create price request by copying existing a request CreateEmptyAsk=Create blank request CloneAsk=Clone price request diff --git a/htdocs/langs/fr_FR/supplier_proposal.lang b/htdocs/langs/fr_FR/supplier_proposal.lang index 2bbf73507ba..3d3037b58a8 100644 --- a/htdocs/langs/fr_FR/supplier_proposal.lang +++ b/htdocs/langs/fr_FR/supplier_proposal.lang @@ -11,10 +11,10 @@ DraftRequests=Demandes brouillons LastModifiedRequests=Les %s dernières demandes de prix modifiées RequestsOpened=Demandes de prix ouvertes SupplierProposalArea=Espace des demandes de prix fournisseurs -Askpricesupplier=Demande de prix fournisseur +SupplierProposal=Demande de prix fournisseur NewAskPrice=Nouvelle demande de prix NewAsk=Nouvelle demande -ShowAskpricesupplier=Afficher la demande de prix +ShowSupplierProposal=Afficher la demande de prix AddSupplierProposal=Créer une demande de prix SupplierProposalRefFourn=Réf. fournisseur SupplierProposalDate=Date de livraison @@ -25,20 +25,20 @@ DateAsk=Date de demande DeleteAsk=Supprimer demande ValidateAsk=Valider demande AddAsk=Créer une demande -AskpricesupplierDraft=Brouillons -AskpricesupplierOpened=Ouvertes -AskpricesupplierStatusDraft=Brouillon (à valider) -AskpricesupplierStatusValidated=Validée (demande ouverte) -AskpricesupplierStatusOpened=Validée (demande ouverte) -AskpricesupplierStatusClosed=Fermée -AskpricesupplierStatusSigned=Acceptée -AskpricesupplierStatusNotSigned=Refusée -AskpricesupplierStatusDraftShort=Brouillon -AskpricesupplierStatusValidatedShort=Validée -AskpricesupplierStatusOpenedShort=Ouverte -AskpricesupplierStatusClosedShort=Fermée -AskpricesupplierStatusSignedShort=Acceptée -AskpricesupplierStatusNotSignedShort=Refusée +SupplierProposalDraft=Brouillons +SupplierProposalOpened=Ouvertes +SupplierProposalStatusDraft=Brouillon (à valider) +SupplierProposalStatusValidated=Validée (demande ouverte) +SupplierProposalStatusOpened=Validée (demande ouverte) +SupplierProposalStatusClosed=Fermée +SupplierProposalStatusSigned=Acceptée +SupplierProposalStatusNotSigned=Refusée +SupplierProposalStatusDraftShort=Brouillon +SupplierProposalStatusValidatedShort=Validée +SupplierProposalStatusOpenedShort=Ouverte +SupplierProposalStatusClosedShort=Fermée +SupplierProposalStatusSignedShort=Acceptée +SupplierProposalStatusNotSignedShort=Refusée CopyAskFrom=Créer demande/devis par recopie d'une demande existante CreateEmptyAsk=Créer demande/devis vierge CloneAsk=Cloner demande de prix diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 878d1c0df01..2a64fa5d4c5 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1607,8 +1607,8 @@ if ($action == 'create') $form_close .= '<input type="hidden" name="action" value="setstatut">'; $form_close .= '<select id="statut" name="statut" class="flat">'; $form_close .= '<option value="0"> </option>'; - $form_close .= '<option value="2">' . $langs->trans('AskpricesupplierStatusSigned') . '</option>'; - $form_close .= '<option value="3">' . $langs->trans('AskpricesupplierStatusNotSigned') . '</option>'; + $form_close .= '<option value="2">' . $langs->trans('SupplierProposalStatusSigned') . '</option>'; + $form_close .= '<option value="3">' . $langs->trans('SupplierProposalStatusNotSigned') . '</option>'; $form_close .= '</select>'; $form_close .= '</td></tr>'; $form_close .= '<tr><td width="150" align="left">' . $langs->trans('Note') . '</td><td align="left"><textarea cols="70" rows="' . ROWS_3 . '" wrap="soft" name="note">'; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 57fc7e50838..799a94a4104 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -151,16 +151,16 @@ class SupplierProposal extends CommonObject $this->remise_absolue = 0; $langs->load("supplier_proposal"); - $this->labelstatut[0]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_DRAFT_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_DRAFT_LABEL : $langs->trans("AskpricesupplierStatusDraft")); - $this->labelstatut[1]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_VALIDATED_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_VALIDATED_LABEL : $langs->trans("AskpricesupplierStatusValidated")); - $this->labelstatut[2]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_SIGNED_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_SIGNED_LABEL : $langs->trans("AskpricesupplierStatusSigned")); - $this->labelstatut[3]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_NOTSIGNED_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_NOTSIGNED_LABEL : $langs->trans("AskpricesupplierStatusNotSigned")); - $this->labelstatut[4]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_BILLED_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_BILLED_LABEL : $langs->trans("AskpricesupplierStatusBilled")); - $this->labelstatut_short[0]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_DRAFTSHORT_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_DRAFTSHORT_LABEL : $langs->trans("AskpricesupplierStatusDraftShort")); + $this->labelstatut[0]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_DRAFT_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_DRAFT_LABEL : $langs->trans("SupplierProposalStatusDraft")); + $this->labelstatut[1]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_VALIDATED_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_VALIDATED_LABEL : $langs->trans("SupplierProposalStatusValidated")); + $this->labelstatut[2]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_SIGNED_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_SIGNED_LABEL : $langs->trans("SupplierProposalStatusSigned")); + $this->labelstatut[3]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_NOTSIGNED_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_NOTSIGNED_LABEL : $langs->trans("SupplierProposalStatusNotSigned")); + $this->labelstatut[4]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_BILLED_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_BILLED_LABEL : $langs->trans("SupplierProposalStatusBilled")); + $this->labelstatut_short[0]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_DRAFTSHORT_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_DRAFTSHORT_LABEL : $langs->trans("SupplierProposalStatusDraftShort")); $this->labelstatut_short[1]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_VALIDATEDSHORT_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_VALIDATEDSHORT_LABEL : $langs->trans("Opened")); - $this->labelstatut_short[2]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_SIGNEDSHORT_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_SIGNEDSHORT_LABEL : $langs->trans("AskpricesupplierStatusSignedShort")); - $this->labelstatut_short[3]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_NOTSIGNEDSHORT_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_NOTSIGNEDSHORT_LABEL : $langs->trans("AskpricesupplierStatusNotSignedShort")); - $this->labelstatut_short[4]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_BILLEDSHORT_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_BILLEDSHORT_LABEL : $langs->trans("AskpricesupplierStatusBilledShort")); + $this->labelstatut_short[2]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_SIGNEDSHORT_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_SIGNEDSHORT_LABEL : $langs->trans("SupplierProposalStatusSignedShort")); + $this->labelstatut_short[3]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_NOTSIGNEDSHORT_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_NOTSIGNEDSHORT_LABEL : $langs->trans("SupplierProposalStatusNotSignedShort")); + $this->labelstatut_short[4]=(! empty($conf->global->SUPPLIER_PROPOSAL_STATUS_BILLEDSHORT_LABEL) ? $conf->global->SUPPLIER_PROPOSAL_STATUS_BILLEDSHORT_LABEL : $langs->trans("SupplierProposalStatusBilledShort")); } @@ -627,7 +627,7 @@ class SupplierProposal extends CommonObject } else { - dol_syslog(get_class($this)."::updateline Erreur -2 Askpricesupplier en mode incompatible pour cette action"); + dol_syslog(get_class($this)."::updateline Erreur -2 SupplierProposal en mode incompatible pour cette action"); return -2; } } @@ -2259,7 +2259,7 @@ class SupplierProposal extends CommonObject global $langs; $result=''; - $label=$langs->trans("ShowAskpricesupplier").': '.$this->ref; + $label=$langs->trans("ShowSupplierProposal").': '.$this->ref; $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if ($option == '') { $link = '<a href="'.DOL_URL_ROOT.'/supplier_proposal/card.php?id='.$this->id. $get_params .$linkclose; diff --git a/htdocs/supplier_proposal/index.php b/htdocs/supplier_proposal/index.php index 4c363ba32ac..9339f801583 100644 --- a/htdocs/supplier_proposal/index.php +++ b/htdocs/supplier_proposal/index.php @@ -133,7 +133,7 @@ if ($resql) { print '<tr '.$bc[false].'><td align="center" colspan="2">'; $data=array('series'=>$dataseries); - dol_print_graph('stats',300,180,$data,1,'pie',1); + dol_print_graph('stats',300,180,$data,1,'pie',1,'',0); print '</td></tr>'; } diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index cfea07b1e48..a1f66e832f0 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -25,9 +25,9 @@ */ /** - * \file htdocs/comm/propal/list.php - * \ingroup propal - * \brief Page of commercial proposals card and list + * \file htdocs/supplier_proposal/list.php + * \ingroup supplier_proposal + * \brief Page of supplier proposals card and list */ require '../main.inc.php'; @@ -96,6 +96,16 @@ if (GETPOST("button_removefilter") || GETPOST("button_removefilter_x")) // Both if($object_statut != '') $viewstatut=$object_statut; +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'p.ref'=>'Ref', + 's.nom'=>'Supplier', + 'pd.description'=>'Description', + 'p.note_private'=>"NotePrivate", + 'p.note_public'=>'NotePublic', +); + + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('supplier_proposallist')); @@ -175,7 +185,7 @@ if ($search_montant_ht) $sql.= " AND p.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'"; } if ($sall) { - $sql .= natural_search(array('s.nom', 'p.note_private', 'p.note_public', 'pd.description'), $sall); + $sql .= natural_search(array_keys($fieldstosearchall), $sall); } if ($socid) $sql.= ' AND s.rowid = '.$socid; if ($viewstatut <> '') @@ -240,7 +250,19 @@ if ($result) // Lignes des champs de filtre print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'; - + if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; + print '<input type="hidden" name="action" value="list">'; + print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; + print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; + + if ($sall) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + //sort($fieldstosearchall); + print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + } + $i = 0; $moreforfilter=''; @@ -276,7 +298,7 @@ if ($result) print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'; print '<tr class="liste_titre">'; print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Supplier'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('SupplierProposalDate'),$_SERVER["PHP_SELF"],'p.date_livraison','',$param, 'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder); -- GitLab