diff --git a/htdocs/core/modules/modIntracommreport.class.php b/htdocs/core/modules/modIntracommreport.class.php index 50db0307a40..1ab8b11173d 100644 --- a/htdocs/core/modules/modIntracommreport.class.php +++ b/htdocs/core/modules/modIntracommreport.class.php @@ -94,8 +94,8 @@ class modIntracommreport extends DolibarrModules $this->dictionaries=array(); // Permissions - $this->rights_class = 'intracommreport'; - $this->rights = array(); // Permission array used by this module + $this->rights = array(); + $this->rights_class = 'intracommreport'; $r = 0; $r++; @@ -112,12 +112,12 @@ class modIntracommreport extends DolibarrModules $this->rights[$r][3] = 0; $this->rights[$r][4] = 'write'; + $r++; $this->rights[$r][0] = 68004; $this->rights[$r][1] = 'Delete intracomm report'; $this->rights[$r][2] = 'd'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'delete'; - $r++; // Main menu entries $this->menu = array(); // List of menus to add diff --git a/htdocs/intracommreport/list.php b/htdocs/intracommreport/list.php index 8145948cc0d..6c128e0c644 100644 --- a/htdocs/intracommreport/list.php +++ b/htdocs/intracommreport/list.php @@ -107,12 +107,8 @@ $isInEEC=isInEEC($mysoc); // Definition of fields for lists $arrayfields=array( 'i.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), - //'pfi.ref_fourn'=>array('label'=>$langs->trans("RefSupplier"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), 'i.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 'i.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled) && ! empty($conf->service->enabled))), - 'i.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), - 'i.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(! empty($conf->service->enabled))), - 'i.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled))), ); /* // Extra fields @@ -152,11 +148,6 @@ if (empty($reshook)) $sall=""; $search_ref=""; $search_label=""; - $search_barcode=""; - $search_categ=0; - $search_tosell=""; - $search_tobuy=""; - $search_tobatch=''; //$search_type=''; // There is 2 types of list: a list of product and a list of services. No list with both. So when we clear search criteria, we must keep the filter on type. $show_childproducts = ''; @@ -268,18 +259,15 @@ if ($resql) llxHeader('', $title, $helpurl, ''); // Displays product removal confirmation - if (GETPOST('delprod')) { - setEventMessages($langs->trans("ProductDeleted", GETPOST('delprod')), null, 'mesgs'); + if (GETPOST('delreport')) { + setEventMessages($langs->trans("IntracommReportDeleted", GETPOST('delreport')), null, 'mesgs'); } $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($sall) $param.="&sall=".urlencode($sall); - if ($search_categ > 0) $param.="&search_categ=".urlencode($search_categ); if ($search_ref) $param="&search_ref=".urlencode($search_ref); - if ($search_ref_supplier) $param="&search_ref_supplier=".urlencode($search_ref_supplier); - if ($search_barcode) $param.=($search_barcode?"&search_barcode=".urlencode($search_barcode):""); if ($search_label) $param.="&search_label=".urlencode($search_label); // Add $param from extra fields @@ -296,13 +284,9 @@ if ($resql) $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; - $rightskey='DEB'; - if ($type == IntracommReport::TYPE_DES) $rightskey='DES'; - if ($user->rights->{$rightskey}->creer) + if ($user->rights->intracommreport->write) { - $label='NewDEB'; - if ($type == IntracommReport::TYPE_DES) $label = 'NewDES'; - $newcardbutton.= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/intracommreport/card.php?action=create&type='.$type); + $newcardbutton.= dolGetButtonTitle($langs->trans("NewDeclaration"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/intracommreport/card.php?action=create&type='.$type); } print '
'; @@ -357,12 +341,6 @@ if ($resql) print ''; print ''; } - if (! empty($arrayfields['pfi.ref_fourn']['checked'])) - { - print ''; - print ''; - print ''; - } if (! empty($arrayfields['i.label']['checked'])) { print ''; @@ -370,33 +348,23 @@ if ($resql) print ''; } // Type - if (! empty($arrayfields['i.fk_product_type']['checked'])) + // Type (customer/prospect/supplier) + if (!empty($arrayfields['customerorsupplier']['checked'])) + { + print ''; + if ($type != '') print ''; + print $formcompany->selectProspectCustomerType($search_type, 'search_type', 'search_type', 'list'); + print ''; + } + + if (! empty($arrayfields['i.fk_product_type']['checked'])) { print ''; $array=array('-1'=>' ', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service')); print $form->selectarray('search_type', $array, $search_type); print ''; } - // Barcode - if (! empty($arrayfields['i.barcode']['checked'])) - { - print ''; - print ''; - print ''; - } - // Duration - if ((string) $type == '1' && ! empty($arrayfields['i.duration']['checked'])) - { - print ''; - print ''; - } - // Weight - if (! empty($arrayfields['i.weight']['checked'])) - { - print ''; - print ''; - } /* // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -434,15 +402,8 @@ if ($resql) if (! empty($arrayfields['i.fk_product_type']['checked'])) { print_liste_field_titre($arrayfields['i.fk_product_type']['label'], $_SERVER["PHP_SELF"], "i.fk_product_type", "", $param, "", $sortfield, $sortorder); } - if (! empty($arrayfields['i.barcode']['checked'])) { - print_liste_field_titre($arrayfields['i.barcode']['label'], $_SERVER["PHP_SELF"], "i.barcode", "", $param, "", $sortfield, $sortorder); - } - if ((string) $type == '1' && ! empty($arrayfields['i.duration']['checked'])) { - print_liste_field_titre($arrayfields['i.duration']['label'], $_SERVER["PHP_SELF"], "i.duration", "", $param, '', $sortfield, $sortorder, 'center '); - } - if (! empty($arrayfields['i.weight']['checked'])) print_liste_field_titre($arrayfields['i.weight']['label'], $_SERVER["PHP_SELF"], "i.weight", "", $param, '', $sortfield, $sortorder, 'center '); - /* + /* // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; */ @@ -489,73 +450,18 @@ if ($resql) print "\n"; if (! $i) $totalarray['nbfield']++; } - // Ref supplier - if (! empty($arrayfields['pfi.ref_fourn']['checked'])) - { - print ''; - print $intracommreport_static->getNomUrl(1); - print "\n"; - if (! $i) $totalarray['nbfield']++; - } // Label if (! empty($arrayfields['i.label']['checked'])) { print ''.dol_trunc($obj->label, 80).''; if (! $i) $totalarray['nbfield']++; } - // Type if (! empty($arrayfields['i.fk_product_type']['checked'])) { print ''.$obj->fk_product_type.''; if (! $i) $totalarray['nbfield']++; } - - // Barcode - if (! empty($arrayfields['i.barcode']['checked'])) - { - print ''.$obj->barcode.''; - if (! $i) $totalarray['nbfield']++; - } - - // Duration - if ((string) $type == '1' && ! empty($arrayfields['i.duration']['checked'])) - { - print ''; - - if (preg_match('/([^a-z]+)[a-z]$/i', $obj->duration)) - { - $duration_value = substr($obj->duration, 0, dol_strlen($obj->duration)-1); - $duration_unit = substr($obj->duration, -1); - - if ((float) $duration_value > 1) - { - $dur=array("i"=>$langs->trans("Minutes"),"h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years")); - } - elseif ((float) $duration_value > 0) - { - $dur=array("i"=>$langs->trans("Minute"),"h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); - } - print $duration_value; - print (! empty($duration_unit) && isset($dur[$duration_unit]) ? ' '.$langs->trans($dur[$duration_unit]) : ''); - } - else { - print $obj->duration; - } - - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Weight - if (! empty($arrayfields['i.weight']['checked'])) - { - print ''; - print $obj->weight; - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Action print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined diff --git a/htdocs/langs/en_US/intracommreport.lang b/htdocs/langs/en_US/intracommreport.lang index 49752441752..73a2a22709d 100644 --- a/htdocs/langs/en_US/intracommreport.lang +++ b/htdocs/langs/en_US/intracommreport.lang @@ -19,6 +19,7 @@ MenuIntracommReportNew=New declaration MenuIntracommReportList=List # View +NewDeclaration=New declaration Declaration=Declaration AnalysisPeriod=Analysis period TypeOfDeclaration=Type of declaration @@ -36,4 +37,4 @@ IntracommReportTypeDeclaration=Type de déclaration IntracommReportDownload=Télécharger fichier XML # Invoice -IntracommReportTransportMode=Transport mode \ No newline at end of file +IntracommReportTransportMode=Transport mode