Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.4' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Nov 20, 2013
2 parents cb53939 + 35596ac commit 358175b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 31 deletions.
Expand Up @@ -529,7 +529,6 @@ function write_file($object,$outputlangs,$srctemplatepath)
else // Text
{
$odfHandler->setVars($key, $value, true, 'UTF-8');
$odfHandler->setVarsHeadFooter($key, $value, true, 'UTF-8');
}
}
catch(OdfException $e)
Expand Down Expand Up @@ -1037,4 +1036,4 @@ function write_file($object,$outputlangs,$srctemplatepath)
}

}
?>
?>
27 changes: 0 additions & 27 deletions htdocs/includes/odtphp/odf.php
Expand Up @@ -128,33 +128,6 @@ public function setVars($key, $value, $encode = true, $charset = 'ISO-8859')
return $this;
}

/**
* Assing a template variable
*
* @param string $key name of the variable within the template
* @param string $value replacement value
* @param bool $encode if true, special XML characters are encoded
* @throws OdfException
* @return odf
*/
public function setVarsHeadFooter($key, $value, $encode = true, $charset = 'ISO-8859')
{
$tag = $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT'];
// TODO Warning string may be:
// <text:span text:style-name="T13">{</text:span><text:span text:style-name="T12">aaa</text:span><text:span text:style-name="T13">}</text:span>
// instead of {aaa} so we should enhance this function.
//print $key.'-'.$value.'-'.strpos($this->contentXml, $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT']).'<br>';
if (strpos($this->stylesXml, $tag) === false && strpos($this->stylesXml , $tag) === false) {
//if (strpos($this->contentXml, '">'. $key . '</text;span>') === false) {
throw new OdfException("var $key not found in the document");
//}
}
$value = $encode ? htmlspecialchars($value) : $value;
$value = ($charset == 'ISO-8859') ? utf8_encode($value) : $value;
$this->vars[$tag] = str_replace("\n", "<text:line-break/>", $value);
return $this;
}

/**
* Evaluating php codes inside the ODT and output the buffer (print, echo) inplace of the code
*
Expand Down
4 changes: 2 additions & 2 deletions htdocs/product/fiche.php
Expand Up @@ -698,7 +698,7 @@
$tmpcode='';
if (! empty($modCodeProduct->code_auto))
$tmpcode=$modCodeProduct->getNextValue($object,$type);
print '<td class="fieldrequired" width="20%">'.$langs->trans("Ref").'</td><td><input name="ref" size="40" maxlength="32" value="'.dol_escape_htmltag(GETPOST('ref')?GETPOST('ref'):$tmpcode).'">';
print '<td class="fieldrequired" width="20%">'.$langs->trans("Ref").'</td><td><input name="ref" size="40" maxlength="128" value="'.dol_escape_htmltag(GETPOST('ref')?GETPOST('ref'):$tmpcode).'">';
if ($_error)
{
print $langs->trans("RefAlreadyExists");
Expand Down Expand Up @@ -881,7 +881,7 @@
print '<table class="border allwidth">';

// Ref
print '<tr><td width="15%" class="fieldrequired">'.$langs->trans("Ref").'</td><td colspan="2"><input name="ref" size="40" maxlength="32" value="'.$object->ref.'"></td></tr>';
print '<tr><td width="15%" class="fieldrequired">'.$langs->trans("Ref").'</td><td colspan="2"><input name="ref" size="40" maxlength="128" value="'.$object->ref.'"></td></tr>';

// Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td colspan="2"><input name="libelle" size="40" maxlength="255" value="'.$object->libelle.'"></td></tr>';
Expand Down

0 comments on commit 358175b

Please sign in to comment.