Merge remote-tracking branch 'upstream/develop' into actioncomm_category

This commit is contained in:
Frédéric FRANCE 2019-11-19 23:26:00 +01:00
commit d182eee4bf
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
28 changed files with 140 additions and 146 deletions

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2014-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2017 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -32,16 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
*/
class BookKeeping extends CommonObject
{
/**
* @var string Error code (or message)
*/
public $error;
/**
* @var string[] Array of Error codes (or messages)
*/
public $errors = array();
/**
* @var string Id to identify managed objects
*/
@ -235,13 +225,13 @@ class BookKeeping extends CommonObject
$this->label_operation = trim($this->label_operation);
}
if (isset($this->debit)) {
$this->debit = trim($this->debit);
$this->debit = (float) $this->debit;
}
if (isset($this->credit)) {
$this->credit = trim($this->credit);
$this->credit = (float) $this->credit;
}
if (isset($this->montant)) {
$this->montant = trim($this->montant);
$this->montant = (float) $this->montant;
}
if (isset($this->sens)) {
$this->sens = trim($this->sens);
@ -258,8 +248,8 @@ class BookKeeping extends CommonObject
if (isset($this->piece_num)) {
$this->piece_num = trim($this->piece_num);
}
if (empty($this->debit)) $this->debit = 0;
if (empty($this->credit)) $this->credit = 0;
if (empty($this->debit)) $this->debit = 0.0;
if (empty($this->credit)) $this->credit = 0.0;
// Check parameters
if (($this->numero_compte == "") || $this->numero_compte == '-1' || $this->numero_compte == 'NotDefined')

View File

@ -629,7 +629,9 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $objmid->labelc;
$accountingaccount->fetch(null, $k, true);
$bookkeeping->label_compte = $accountingaccount->label;
} elseif ($tabtype[$key] == 'payment_vat') {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';

View File

@ -47,7 +47,7 @@ foreach ($linkedObjectBlock as $key => $objectlink)
}
echo '</td>';
echo '<td class="right"></td>';
echo '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
echo '<td class="right"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
echo '</tr>';
}

View File

@ -321,7 +321,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
$newcardbutton = '';
//if ($user->rights->emailcollector->creer)

View File

@ -68,7 +68,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
}
print '</td>';
print '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
print '<td class="linkedcol-action right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
print '<td class="linkedcol-action right"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
print "</tr>\n";
}
if (count($linkedObjectBlock) > 1)

View File

@ -63,7 +63,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo '<td class="linkedcol-action right">';
// For now, shipments must stay linked to order, so link is not deletable
if($object->element != 'shipping') {
echo '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a>';
echo '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a>';
}
echo '</td>';
echo "</tr>\n";

View File

@ -986,7 +986,7 @@ if (empty($reshook))
$object->entity = $originentity;
}
$object->socid = GETPOST('socid', 'int');
$object->number = $_POST['ref'];
$object->ref = $_POST['ref'];
$object->date = $dateinvoice;
$object->date_pointoftax = $date_pointoftax;
$object->note_public = trim(GETPOST('note_public', 'none'));
@ -1166,7 +1166,7 @@ if (empty($reshook))
{
$object->socid = GETPOST('socid', 'int');
$object->type = $_POST['type'];
$object->number = $_POST['ref'];
$object->ref = $_POST['ref'];
$object->date = $dateinvoice;
$object->date_pointoftax = $date_pointoftax;
$object->note_public = trim(GETPOST('note_public', 'none'));
@ -1216,7 +1216,7 @@ if (empty($reshook))
// Si facture standard
$object->socid = GETPOST('socid', 'int');
$object->type = GETPOST('type');
$object->number = $_POST['ref'];
$object->ref = $_POST['ref'];
$object->date = $dateinvoice;
$object->date_pointoftax = $date_pointoftax;
$object->note_public = trim(GETPOST('note_public', 'none'));

View File

@ -980,7 +980,7 @@ class Facture extends CommonInvoice
}
elseif ($this->type == self::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION))
{
$this->fetchObjectLinked('', '', $facture->id, 'facture');
$this->fetchObjectLinked('', '', $this->id, 'facture');
foreach ($this->linkedObjectsIds as $typeObject => $Tfk_object)
{

View File

@ -86,7 +86,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
}
print '</td>';
print '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
print '<td class="linkedcol-action right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
print '<td class="linkedcol-action right"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
print "</tr>\n";
}
if (count($linkedObjectBlock) > 1)

View File

@ -57,7 +57,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
}
?></td>
<td class="linkedcol-statut right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td class="linkedcol-action right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
<td class="linkedcol-action right"><a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}

View File

@ -971,7 +971,7 @@ else
// Civility
print '<tr><td><label for="civility_code">'.$langs->trans("UserTitle").'</label></td><td colspan="3">';
print $formcompany->select_civility(GETPOSTISSET("civility_code") ?GETPOST("civility", "aZ09") : $object->civility_code, 'civility_code');
print $formcompany->select_civility(GETPOSTISSET("civility_code") ? GETPOST("civility_code", "aZ09") : $object->civility_code, 'civility_code');
print '</td></tr>';
print '<tr><td><label for="title">'.$langs->trans("PostOrFunction").'</label></td>';

View File

@ -63,7 +63,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo price($totalcontrat);
} ?></td>
<td class="right"><?php echo $objectlink->getLibStatut(7); ?></td>
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
<td class="right"><a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}

View File

@ -30,22 +30,22 @@
// $backtopage may be defined
// $triggermodname may be defined
if (! empty($permissionedit) && empty($permissiontoadd)) $permissiontoadd = $permissionedit; // For backward compatibility
if (!empty($permissionedit) && empty($permissiontoadd)) $permissiontoadd = $permissionedit; // For backward compatibility
if ($cancel)
{
/*var_dump($cancel);
var_dump($backtopage);exit;*/
if (! empty($backtopage))
if (!empty($backtopage))
{
header("Location: ".$backtopage);
exit;
}
$action='';
$action = '';
}
// Action to add record
if ($action == 'add' && ! empty($permissiontoadd))
if ($action == 'add' && !empty($permissiontoadd))
{
foreach ($object->fields as $key => $val)
{
@ -66,17 +66,17 @@ if ($action == 'add' && ! empty($permissiontoadd))
} elseif ($object->fields[$key]['type'] == 'datetime') {
$value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'));
} elseif ($object->fields[$key]['type'] == 'duration') {
$value = 60*60*GETPOST($key.'hour', 'int') + 60*GETPOST($key.'min', 'int');
$value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int');
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
} else {
$value = GETPOST($key, 'alpha');
}
if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value=''; // This is an implicit foreign key field
if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value=''; // This is an explicit foreign key field
if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value = ''; // This is an implicit foreign key field
if (!empty($object->fields[$key]['foreignkey']) && $value == '-1') $value = ''; // This is an explicit foreign key field
$object->$key=$value;
if ($val['notnull'] > 0 && $object->$key == '' && ! is_null($val['default']) && $val['default'] == '(PROV)')
$object->$key = $value;
if ($val['notnull'] > 0 && $object->$key == '' && !is_null($val['default']) && $val['default'] == '(PROV)')
{
$object->$key = '(PROV)';
}
@ -136,7 +136,7 @@ if ($action == 'update' && !empty($permissiontoadd))
$value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
} elseif ($object->fields[$key]['type'] == 'duration') {
if (GETPOST($key.'hour', 'int') != '' || GETPOST($key.'min', 'int') != '') {
$value = 60*60*GETPOST($key.'hour', 'int') + 60*GETPOST($key.'min', 'int');
$value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int');
} else {
$value = '';
}

View File

@ -548,10 +548,10 @@ abstract class CommonObject
if (empty($lastname)) $lastname = (isset($this->lastname) ? $this->lastname : (isset($this->name) ? $this->name : (isset($this->nom) ? $this->nom : (isset($this->societe) ? $this->societe : (isset($this->company) ? $this->company : '')))));
$ret = '';
if ($option && $this->civility_id)
if ($option && $this->civility_code)
{
if ($langs->transnoentitiesnoconv("Civility".$this->civility_id) != "Civility".$this->civility_id) $ret .= $langs->transnoentitiesnoconv("Civility".$this->civility_id).' ';
else $ret .= $this->civility_id.' ';
if ($langs->transnoentitiesnoconv("Civility".$this->civility_code) != "Civility".$this->civility_code) $ret .= $langs->transnoentitiesnoconv("Civility".$this->civility_code).' ';
else $ret .= $this->civility_code.' ';
}
$ret .= dolGetFirstLastname($firstname, $lastname, $nameorder);
@ -5689,7 +5689,7 @@ abstract class CommonObject
}
elseif (in_array($type, array('duration')))
{
$out=$form->select_duration($keyprefix.$key.$keysuffix, $value, 0, 'text', 0, 1);
$out = $form->select_duration($keyprefix.$key.$keysuffix, $value, 0, 'text', 0, 1);
}
elseif (in_array($type, array('int', 'integer')))
{
@ -6317,13 +6317,13 @@ abstract class CommonObject
elseif ($type == 'duration')
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if (! is_null($value) && $value !== '') {
if (!is_null($value) && $value !== '') {
$value = convertSecondToTime($value, 'allhourmin');
}
}
elseif ($type == 'double' || $type == 'real')
{
if (! is_null($value) && $value !== '') {
if (!is_null($value) && $value !== '') {
$value = price($value);
}
}
@ -6349,7 +6349,7 @@ abstract class CommonObject
}
elseif ($type == 'price')
{
if (! is_null($value) && $value !== '') {
if (!is_null($value) && $value !== '') {
$value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
}
}
@ -7366,7 +7366,7 @@ abstract class CommonObject
}
if ($info['type'] == 'timestamp' && empty($queryarray[$field])) unset($queryarray[$field]);
if (!empty($info['notnull']) && $info['notnull'] == -1 && empty($queryarray[$field])) $queryarray[$field] = null; // May force 0 to null
if (!empty($info['notnull']) && $info['notnull'] == -1 && empty($queryarray[$field])) $queryarray[$field] = null; // May force 0 to null
}
return $queryarray;
@ -7409,7 +7409,7 @@ abstract class CommonObject
}
else
{
if (! is_null($obj->{$field}) || (isset($info['notnull']) && $info['notnull'] == 1)) {
if (!is_null($obj->{$field}) || (isset($info['notnull']) && $info['notnull'] == 1)) {
$this->{$field} = (int) $obj->{$field};
} else {
$this->{$field} = null;
@ -7426,7 +7426,7 @@ abstract class CommonObject
}
else
{
if (! is_null($obj->{$field}) || (isset($info['notnull']) && $info['notnull'] == 1)) {
if (!is_null($obj->{$field}) || (isset($info['notnull']) && $info['notnull'] == 1)) {
$this->{$field} = (double) $obj->{$field};
} else {
$this->{$field} = null;

View File

@ -42,9 +42,9 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
global $db, $langs;
if (empty($objectname)) return -1;
if (empty($readdir)) $readdir=$destdir;
if (empty($readdir)) $readdir = $destdir;
if (! empty($addfieldentry['arrayofkeyval']) && ! is_array($addfieldentry['arrayofkeyval']))
if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval']))
{
dol_print_error('', 'Bad parameter addfieldentry with a property arrayofkeyval defined but that is not an array.');
return -1;
@ -63,17 +63,17 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Label")), null, 'errors');
return -2;
}
if (! preg_match('/^(integer|price|sellist|varchar|double|text|html|duration)/', $addfieldentry['type'])
&& ! preg_match('/^(boolean|real|date|datetime|timestamp)$/', $addfieldentry['type']))
if (!preg_match('/^(integer|price|sellist|varchar|double|text|html|duration)/', $addfieldentry['type'])
&& !preg_match('/^(boolean|real|date|datetime|timestamp)$/', $addfieldentry['type']))
{
setEventMessages($langs->trans('BadValueForType', $objectname), null, 'errors');
return -2;
}
}
$pathoffiletoeditsrc=$readdir.'/class/'.strtolower($objectname).'.class.php';
$pathoffiletoedittarget=$destdir.'/class/'.strtolower($objectname).'.class.php'.($readdir != $destdir ? '.new' : '');
if (! dol_is_file($pathoffiletoeditsrc))
$pathoffiletoeditsrc = $readdir.'/class/'.strtolower($objectname).'.class.php';
$pathoffiletoedittarget = $destdir.'/class/'.strtolower($objectname).'.class.php'.($readdir != $destdir ? '.new' : '');
if (!dol_is_file($pathoffiletoeditsrc))
{
$langs->load("errors");
setEventMessages($langs->trans("ErrorFileNotFound", $pathoffiletoeditsrc), null, 'errors');
@ -86,7 +86,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
try
{
include_once $pathoffiletoeditsrc;
if (class_exists($objectname)) $object=new $objectname($db);
if (class_exists($objectname)) $object = new $objectname($db);
else return -4;
// Backup old file
@ -100,86 +100,86 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
{
if (is_array($addfieldentry) && count($addfieldentry))
{
$name=$addfieldentry['name'];
$name = $addfieldentry['name'];
unset($addfieldentry['name']);
$object->fields[$name]=$addfieldentry;
$object->fields[$name] = $addfieldentry;
}
if (! empty($delfieldentry))
if (!empty($delfieldentry))
{
$name=$delfieldentry;
$name = $delfieldentry;
unset($object->fields[$name]);
}
}
dol_sort_array($object->fields, 'position');
$i=0;
$i = 0;
$texttoinsert = '// BEGIN MODULEBUILDER PROPERTIES'."\n";
$texttoinsert.= "\t".'/**'."\n";
$texttoinsert.= "\t".' * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.'."\n";
$texttoinsert.= "\t".' */'."\n";
$texttoinsert.= "\t".'public $fields=array('."\n";
$texttoinsert .= "\t".'/**'."\n";
$texttoinsert .= "\t".' * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.'."\n";
$texttoinsert .= "\t".' */'."\n";
$texttoinsert .= "\t".'public $fields=array('."\n";
if (count($object->fields))
{
foreach($object->fields as $key => $val)
foreach ($object->fields as $key => $val)
{
$i++;
$texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',";
$texttoinsert.= " 'enabled'=>".($val['enabled']!=''?$val['enabled']:1).",";
$texttoinsert.= " 'position'=>".($val['position']!=''?$val['position']:50).",";
$texttoinsert.= " 'notnull'=>".(empty($val['notnull'])?0:$val['notnull']).",";
$texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).",";
if ($val['noteditable']) $texttoinsert.= " 'noteditable'=>'".$val['noteditable']."',";
if ($val['default']) $texttoinsert.= " 'default'=>'".$val['default']."',";
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
if ($val['foreignkey']) $texttoinsert.= " 'foreignkey'=>'".$val['foreignkey']."',";
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].",";
if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',";
if ($val['css']) $texttoinsert.= " 'css'=>'".$val['css']."',";
if ($val['help']) $texttoinsert.= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
if ($val['showoncombobox']) $texttoinsert.= " 'showoncombobox'=>'".$val['showoncombobox']."',";
if ($val['disabled']) $texttoinsert.= " 'disabled'=>'".$val['disabled']."',";
$texttoinsert .= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',";
$texttoinsert .= " 'enabled'=>".($val['enabled'] != '' ? $val['enabled'] : 1).",";
$texttoinsert .= " 'position'=>".($val['position'] != '' ? $val['position'] : 50).",";
$texttoinsert .= " 'notnull'=>".(empty($val['notnull']) ? 0 : $val['notnull']).",";
$texttoinsert .= " 'visible'=>".($val['visible'] != '' ? $val['visible'] : -1).",";
if ($val['noteditable']) $texttoinsert .= " 'noteditable'=>'".$val['noteditable']."',";
if ($val['default']) $texttoinsert .= " 'default'=>'".$val['default']."',";
if ($val['index']) $texttoinsert .= " 'index'=>".$val['index'].",";
if ($val['foreignkey']) $texttoinsert .= " 'foreignkey'=>'".$val['foreignkey']."',";
if ($val['searchall']) $texttoinsert .= " 'searchall'=>".$val['searchall'].",";
if ($val['isameasure']) $texttoinsert .= " 'isameasure'=>'".$val['isameasure']."',";
if ($val['css']) $texttoinsert .= " 'css'=>'".$val['css']."',";
if ($val['help']) $texttoinsert .= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
if ($val['showoncombobox']) $texttoinsert .= " 'showoncombobox'=>'".$val['showoncombobox']."',";
if ($val['disabled']) $texttoinsert .= " 'disabled'=>'".$val['disabled']."',";
if ($val['arrayofkeyval'])
{
$texttoinsert.= " 'arrayofkeyval'=>array(";
$i=0;
foreach($val['arrayofkeyval'] as $key2 => $val2)
$texttoinsert .= " 'arrayofkeyval'=>array(";
$i = 0;
foreach ($val['arrayofkeyval'] as $key2 => $val2)
{
if ($i) $texttoinsert.=", ";
$texttoinsert.="'".$key2."'=>'".$val2."'";
if ($i) $texttoinsert .= ", ";
$texttoinsert .= "'".$key2."'=>'".$val2."'";
$i++;
}
$texttoinsert.= "),";
$texttoinsert .= "),";
}
if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\"";
if ($val['comment']) $texttoinsert .= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\"";
$texttoinsert.= "),\n";
$texttoinsert .= "),\n";
}
}
$texttoinsert.= "\t".');'."\n";
$texttoinsert .= "\t".');'."\n";
//print ($texttoinsert);exit;
if (count($object->fields))
{
//$typetotypephp=array('integer'=>'integer', 'duration'=>'integer', 'varchar'=>'string');
foreach($object->fields as $key => $val)
foreach ($object->fields as $key => $val)
{
$i++;
//$typephp=$typetotypephp[$val['type']];
$texttoinsert.= "\t".'public $'.$key.";";
$texttoinsert .= "\t".'public $'.$key.";";
//if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
//if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
//$texttoinsert.= ($val['notnull']?' NOT NULL':'');
//if ($i < count($object->fields)) $texttoinsert.=";";
$texttoinsert.= "\n";
$texttoinsert .= "\n";
}
}
$texttoinsert.= "\t".'// END MODULEBUILDER PROPERTIES';
$texttoinsert .= "\t".'// END MODULEBUILDER PROPERTIES';
//print($texttoinsert);exit;
@ -193,7 +193,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
return $object;
}
catch(Exception $e)
catch (Exception $e)
{
print $e->getMessage();
return -5;
@ -219,14 +219,14 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
$error = 0;
if (empty($objectname)) return -1;
if (empty($readdir)) $readdir=$destdir;
if (empty($readdir)) $readdir = $destdir;
$pathoffiletoclasssrc=$readdir.'/class/'.strtolower($objectname).'.class.php';
$pathoffiletoclasssrc = $readdir.'/class/'.strtolower($objectname).'.class.php';
// Edit .sql file
$pathoffiletoeditsrc=$readdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
$pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : '');
if (! dol_is_file($pathoffiletoeditsrc))
$pathoffiletoeditsrc = $readdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
$pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : '');
if (!dol_is_file($pathoffiletoeditsrc))
{
$langs->load("errors");
setEventMessages($langs->trans("ErrorFileNotFound", $pathoffiletoeditsrc), null, 'errors');
@ -236,14 +236,14 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
// Load object from myobject.class.php
try
{
if (! is_object($object))
if (!is_object($object))
{
include_once $pathoffiletoclasssrc;
if (class_exists($objectname)) $object=new $objectname($db);
if (class_exists($objectname)) $object = new $objectname($db);
else return -1;
}
}
catch(Exception $e)
catch (Exception $e)
{
print $e->getMessage();
}
@ -253,38 +253,38 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
$contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');
$i=0;
$i = 0;
$texttoinsert = '-- BEGIN MODULEBUILDER FIELDS'."\n";
if (count($object->fields))
{
foreach($object->fields as $key => $val)
foreach ($object->fields as $key => $val)
{
$i++;
$type = $val['type'];
$type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php'
$type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php'
if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database
elseif ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database
if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database
elseif ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database
elseif (in_array($type, array('link', 'sellist', 'duration'))) $type = 'integer';
$texttoinsert.= "\t".$key." ".$type;
if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
$texttoinsert .= "\t".$key." ".$type;
if ($key == 'rowid') $texttoinsert .= ' AUTO_INCREMENT PRIMARY KEY';
if ($key == 'entity') $texttoinsert .= ' DEFAULT 1';
else
{
if ($val['default'] != '')
{
if (preg_match('/^null$/i', $val['default'])) $texttoinsert.= " DEFAULT NULL";
elseif (preg_match('/varchar/', $type)) $texttoinsert.= " DEFAULT '".$db->escape($val['default'])."'";
else $texttoinsert.= (($val['default'] > 0)?' DEFAULT '.$val['default']:'');
if (preg_match('/^null$/i', $val['default'])) $texttoinsert .= " DEFAULT NULL";
elseif (preg_match('/varchar/', $type)) $texttoinsert .= " DEFAULT '".$db->escape($val['default'])."'";
else $texttoinsert .= (($val['default'] > 0) ? ' DEFAULT '.$val['default'] : '');
}
}
$texttoinsert.= (($val['notnull'] > 0)?' NOT NULL':'');
if ($i < count($object->fields)) $texttoinsert.=", ";
$texttoinsert.= "\n";
$texttoinsert .= (($val['notnull'] > 0) ? ' NOT NULL' : '');
if ($i < count($object->fields)) $texttoinsert .= ", ";
$texttoinsert .= "\n";
}
}
$texttoinsert.= "\t".'-- END MODULEBUILDER FIELDS';
$texttoinsert .= "\t".'-- END MODULEBUILDER FIELDS';
$contentsql = preg_replace('/-- BEGIN MODULEBUILDER FIELDS.*END MODULEBUILDER FIELDS/ims', $texttoinsert, $contentsql);
@ -299,35 +299,35 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
}
// Edit .key.sql file
$pathoffiletoeditsrc=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql';
$pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : '');
$pathoffiletoeditsrc = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql';
$pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : '');
$contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');
$i=0;
$i = 0;
$texttoinsert = '-- BEGIN MODULEBUILDER INDEXES'."\n";
if (count($object->fields))
{
foreach($object->fields as $key => $val)
foreach ($object->fields as $key => $val)
{
$i++;
if (! empty($val['index']))
if (!empty($val['index']))
{
$texttoinsert.= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD INDEX idx_".strtolower($module).'_'.strtolower($objectname)."_".$key." (".$key.");";
$texttoinsert.= "\n";
$texttoinsert .= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD INDEX idx_".strtolower($module).'_'.strtolower($objectname)."_".$key." (".$key.");";
$texttoinsert .= "\n";
}
if (! empty($val['foreignkey']))
if (!empty($val['foreignkey']))
{
$tmp=explode('.', $val['foreignkey']);
if (! empty($tmp[0]) && ! empty($tmp[1]))
$tmp = explode('.', $val['foreignkey']);
if (!empty($tmp[0]) && !empty($tmp[1]))
{
$texttoinsert.= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD CONSTRAINT llx_".strtolower($module).'_'.strtolower($objectname)."_".$key." FOREIGN KEY (".$key.") REFERENCES ".$tmp[0]."(".$tmp[1].");";
$texttoinsert.= "\n";
$texttoinsert .= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD CONSTRAINT llx_".strtolower($module).'_'.strtolower($objectname)."_".$key." FOREIGN KEY (".$key.") REFERENCES ".$tmp[0]."(".$tmp[1].");";
$texttoinsert .= "\n";
}
}
}
}
$texttoinsert.= '-- END MODULEBUILDER INDEXES';
$texttoinsert .= '-- END MODULEBUILDER INDEXES';
$contentsql = preg_replace('/-- BEGIN MODULEBUILDER INDEXES.*END MODULEBUILDER INDEXES/ims', $texttoinsert, $contentsql);

View File

@ -60,7 +60,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
// For now, shipments must stay linked to order, so link is not deletable
if($object->element != 'commande') {
?>
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
<a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
<?php
}
?>

View File

@ -49,7 +49,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo price($objectlink->total_ht);
} ?></td>
<td class="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
<td class="right"><a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}

View File

@ -50,7 +50,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
<td class="center"><?php echo dol_print_date($objectlink->datev, 'day'); ?></td>
<td></td>
<td class="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
<td class="right"><a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}

View File

@ -55,7 +55,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo price($objectlink->total_ht);
} ?></td>
<td class="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
<td class="right"><a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}

View File

@ -66,7 +66,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
}
} ?></td>
<td class="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
<td class="right"><a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}

View File

@ -328,6 +328,9 @@ UPDATE llx_c_shipment_mode SET label = 'https://www.laposte.fr/outils/suivre-vos
UPDATE llx_c_shipment_mode SET label = 'https://www.laposte.fr/outils/suivre-vos-envois?code={TRACKID}' WHERE code IN ('LETTREMAX');
-- VMYSQL4.3 ALTER TABLE llx_holiday MODIFY COLUMN ref varchar(30) NULL;
-- VPGSQL8.2 ALTER TABLE llx_holiday ALTER COLUMN ref DROP NOT NULL;
create table llx_reception
(

View File

@ -214,4 +214,4 @@ StockIncrease=Stock increase
StockDecrease=Stock decrease
InventoryForASpecificWarehouse=Inventory for a specific warehouse
InventoryForASpecificProduct=Inventory for a specific product
StockIsRequiredToChooseWhichLotToUse=Stock is required to choose which lot to use

View File

@ -50,7 +50,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
<td class="center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
<td class="right"><?php echo ''; ?></td>
<td class="right"><?php echo $objectlink->getLibStatut(7); ?></td>
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
<td class="right"><a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}

View File

@ -67,7 +67,7 @@ foreach ($linkedObjectBlock as $key => $objectlink)
// For now, receptions must stay linked to order, so link is not deletable
if ($object->element != 'order_supplier') {
?>
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a>
<a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a>
<?php
}
?>

View File

@ -163,7 +163,7 @@ dol_fiche_head($head, 'stripeaccount', '', -1);
$stripearrayofwebhookevents = array('payout.created', 'payout.paid', 'charge.pending', 'charge.refunded', 'charge.succeeded', 'charge.failed', 'payment_intent.succeeded', 'payment_intent.payment_failed', 'payment_method.attached', 'payment_method.updated', 'payment_method.card_automatically_updated', 'payment_method.detached', 'source.chargeable', 'customer.deleted');
print $langs->trans("StripeDesc")."<br>\n";
print '<span class="opacitymedium">'.$langs->trans("StripeDesc")."</span><br>\n";
print '<br>';

View File

@ -53,7 +53,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo price($objectlink->total_ht);
} ?></td>
<td class="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
<td class="right"><a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}

View File

@ -63,7 +63,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
// For now, shipments must stay linked to order, so link is not deletable
if($object->element != 'shipping') {
?>
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a>
<a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a>
<?php
}
?>

View File

@ -115,8 +115,7 @@ if (empty($reshook)) {
$form = new Form($db);
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('', $langs->trans("ThirdParty").' - '.$langs->trans("Files"), $help_url);
llxHeader('', $langs->trans("UserCard").' - '.$langs->trans("Files"));
if ($object->id)
{