diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index d5f913ae0dd..69db79fe1f7 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -395,4 +395,4 @@ print "\n"; print ''; llxFooter(); -$db->close(); \ No newline at end of file +$db->close(); diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 234a2348590..4d02acc9925 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1032,12 +1032,12 @@ function price2numjs(amount) { if ($langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") { $thousand = $langs->transnoentitiesnoconv("SeparatorThousand"); } - print "var dec='" . $dec . "'; var thousand='" . $thousand . "';\n"; // Set var in javascript + print "var dec='" . dol_escape_js($dec) . "'; var thousand='" . dol_escape_js($thousand) . "';\n"; // Set var in javascript ?> - var main_max_dec_shown = global->MAIN_MAX_DECIMALS_SHOWN); ?>; - var main_rounding_unit = global->MAIN_MAX_DECIMALS_UNIT; ?>; - var main_rounding_tot = global->MAIN_MAX_DECIMALS_TOT; ?>; + var main_max_dec_shown = global->MAIN_MAX_DECIMALS_SHOWN); ?>; + var main_rounding_unit = global->MAIN_MAX_DECIMALS_UNIT; ?>; + var main_rounding_tot = global->MAIN_MAX_DECIMALS_TOT; ?>; var amount = amount.toString(); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 346ccea212b..81f73b98f29 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -648,8 +648,11 @@ class pdf_azur extends ModelePDFPropales */ // Customer signature area - $posy=$this->_signature_area($pdf, $object, $posy, $outputlangs); - + if (empty($conf->global->PROPAL_DISABLE_SIGNATURE)) + { + $posy=$this->_signature_area($pdf, $object, $posy, $outputlangs); + } + // Pied de page $this->_pagefoot($pdf,$object,$outputlangs); if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); diff --git a/htdocs/includes/odtphp/Segment.php b/htdocs/includes/odtphp/Segment.php index f7c250be5a2..39761aa4d04 100644 --- a/htdocs/includes/odtphp/Segment.php +++ b/htdocs/includes/odtphp/Segment.php @@ -268,4 +268,3 @@ IMG; } } -?> \ No newline at end of file diff --git a/htdocs/includes/odtphp/SegmentIterator.php b/htdocs/includes/odtphp/SegmentIterator.php index 5f397c5f838..dbcac5b981f 100644 --- a/htdocs/includes/odtphp/SegmentIterator.php +++ b/htdocs/includes/odtphp/SegmentIterator.php @@ -48,4 +48,3 @@ class SegmentIterator implements RecursiveIterator } } -?> \ No newline at end of file diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index 15b766e6d41..d9a71dd410d 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -39,6 +39,7 @@ class Odf public $userdefined=array(); const PIXEL_TO_CM = 0.026458333; + /** * Class constructor * @@ -108,7 +109,7 @@ class Odf copy($filename, $this->tmpfile); // Now file has been loaded, we must move the [!-- BEGIN and [!-- END tags outside the - // _moveRowSegments(); } @@ -203,7 +204,9 @@ class Odf public function phpEval() { preg_match_all('/[\{\<]\?(php)?\s+(?P.+)\?[\}\>]/iU',$this->contentXml, $matches); // detecting all {?php code ?} or - for ($i=0;$i < count($matches['content']);$i++) { + $nbfound=count($matches['content']); + for ($i=0; $i < $nbfound; $i++) + { try { $ob_output = ''; // flush the output for each code. This var will be filled in by the eval($code) and output buffering : any print or echo or output will be redirected into this variable $code = $matches['content'][$i]; @@ -249,13 +252,18 @@ IMG; /** * Move segment tags for lines of tables - * Called automatically within the constructor + * This function is called automatically within the constructor, so this->contentXml is clean before any other thing * * @return void */ private function _moveRowSegments() { - // Search all possible rows in the document + // Replace BEGINxxx into BEGIN xxx + $this->contentXml = preg_replace('/\[!--\sBEGIN]>(row.[\S]*)\s--\]/sm', '[!-- BEGIN \\1 --]', $this->contentXml); + // Replace ENDxxx into END xxx + $this->contentXml = preg_replace('/\[!--\sEND]>(row.[\S]*)\s--\]/sm', '[!-- END \\1 --]', $this->contentXml); + + // Search all possible rows in the document $reg1 = "#]*>(.*)#smU"; preg_match_all($reg1, $this->contentXml, $matches); for ($i = 0, $size = count($matches[0]); $i < $size; $i++) { @@ -335,7 +343,7 @@ IMG; /** * Add the merged segment to the document * - * @param Segment $segment + * @param Segment $segment Segment * @throws OdfException * @return odf */ @@ -386,7 +394,7 @@ IMG; * Declare a segment in order to use it in a loop. * Extract the segment and store it into $this->segments[]. Return it for next call. * - * @param string $segment + * @param string $segment Segment * @throws OdfException * @return Segment */ @@ -398,7 +406,7 @@ IMG; // $reg = "#\[!--\sBEGIN\s$segment\s--\]<\/text:p>(.*)\[!--\sEND\s$segment\s--\]#sm"; $reg = "#\[!--\sBEGIN\s$segment\s--\](.*)\[!--\sEND\s$segment\s--\]#sm"; if (preg_match($reg, html_entity_decode($this->contentXml), $m) == 0) { - throw new OdfException("'$segment' segment not found in the document"); + throw new OdfException("'".$segment."' segment not found in the document. The tag [!-- BEGIN xxx --] or [!-- END xxx --] is not present into content file."); } $this->segments[$segment] = new Segment($segment, $m[1], $this); return $this->segments[$segment]; @@ -677,9 +685,9 @@ IMG; /** * return the value present on odt in [valuename][/valuename] - * @param string $value name balise in the template - * @return string the value inside the balise - * + * + * @param string $value name balise in the template + * @return string the value inside the balise */ public function getvalue($valuename) { @@ -691,4 +699,3 @@ IMG; } -?> diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index ce2ff974013..faac1a20e10 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -72,6 +72,7 @@ $search_status=GETPOST("search_status",'int'); $search_opp_status=GETPOST("search_opp_status",'alpha'); $search_opp_percent=GETPOST("search_opp_percent",'alpha'); $search_opp_amount=GETPOST("search_opp_amount",'alpha'); +$search_budget_amount=GETPOST("search_budget_amount",'alpha'); $search_public=GETPOST("search_public",'int'); $search_user=GETPOST('search_user','int'); $search_sale=GETPOST('search_sale','int'); @@ -121,6 +122,7 @@ $arrayfields=array( 'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>103), 'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>104), 'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>105), + 'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110), 'p.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500), 'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'p.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), @@ -153,6 +155,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_opp_status=-1; $search_opp_amount=''; $search_opp_percent=''; + $search_budget_amount=''; $search_public=""; $search_sale=""; $search_user=''; @@ -203,7 +206,7 @@ if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0'; $distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. $sql = "SELECT ".$distinct." p.rowid as projectid, p.ref, p.title, p.fk_statut, p.fk_opp_status, p.public, p.fk_user_creat"; -$sql.= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, p.tms as date_update"; +$sql.= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount"; $sql.= ", s.nom as name, s.rowid as socid"; $sql.= ", cls.code as opp_status_code"; // Add fields for extrafields @@ -270,6 +273,8 @@ if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public); if ($search_sale > 0) $sql.= " AND sc.fk_user = " .$search_sale; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; if ($search_user > 0) $sql.= " AND ecp.fk_c_type_contact IN (".join(',',array_keys($listofprojectcontacttype)).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".$search_user; +if ($search_opp_amount != '') $sql .= natural_search('p.opp_amount', $search_opp_amount, 1); +if ($search_budget_amount != '') $sql .= natural_search('p.budget_amount', $search_budget_amount, 1); // Add where from extra fields foreach ($search_array_options as $key => $val) { @@ -327,6 +332,8 @@ if ($resql) if ($search_public != '') $param.='&search_public='.$search_public; if ($search_user > 0) $param.='&search_user='.$search_user; if ($search_sale > 0) $param.='&search_sale='.$search_sale; + if ($search_opp_amount != '') $param.='&search_opp_amount='.$search_opp_amount; + if ($search_budget_amount != '') $param.='&search_budget_amount='.$search_budget_amount; if ($optioncss != '') $param.='&optioncss='.$optioncss; // Add $param from extra fields foreach ($search_array_options as $key => $val) @@ -335,7 +342,7 @@ if ($resql) $tmpkey=preg_replace('/search_options_/','',$key); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); } - + $text=$langs->trans("Projects"); if ($search_user == $user->id) $text=$langs->trans('MyProjects'); @@ -409,7 +416,8 @@ if ($resql) if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'],$_SERVER["PHP_SELF"],'p.opp_amount',"",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre($arrayfields['p.fk_opp_status']['label'],$_SERVER["PHP_SELF"],'p.fk_opp_status',"",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'],$_SERVER["PHP_SELF"],'p.opp_percent',"",$param,'align="right"',$sortfield,$sortorder); - // Extra fields + if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'],$_SERVER["PHP_SELF"],'p.budget_amount',"",$param,'align="center"',$sortfield,$sortorder); + // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { foreach($extrafields->attribute_label as $key => $val) @@ -498,10 +506,16 @@ if ($resql) print ''; print ''; } - // Extra fields - if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + if (! empty($arrayfields['p.budget_amount']['checked'])) { - foreach($extrafields->attribute_label as $key => $val) + print ''; + print ''; + print ''; + } + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) { if (! empty($arrayfields["ef.".$key]['checked'])) { @@ -682,6 +696,12 @@ if ($resql) print ''; if ($obj->opp_percent) print price($obj->opp_percent, 1, '', 1, 0).'%'; print ''; + } + if (! empty($arrayfields['p.budget_amount']['checked'])) + { + print ''; + if ($obj->budget_amount != '') print price($obj->budget_amount, 1, '', 1, -1, -1); + print ''; } // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))