Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
commit
c2eba28f36
29
build/exakat/README.md
Normal file
29
build/exakat/README.md
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
== Install exakat ==
|
||||
mkdir exakat
|
||||
cd exakat
|
||||
curl -o exakat.phar http://dist.exakat.io/index.php?file=latest
|
||||
curl -o apache-tinkerpop-gremlin-server-3.3.5-bin.zip http://dist.exakat.io/apache-tinkerpop-gremlin-server-3.3.5-bin.zip
|
||||
unzip apache-tinkerpop-gremlin-server-3.3.5-bin.zip
|
||||
mv apache-tinkerpop-gremlin-server-3.3.5 tinkergraph
|
||||
rm -rf apache-tinkerpop-gremlin-server-3.3.5-bin.zip
|
||||
cd tinkergraph ./bin/gremlin-server.sh -i org.apache.tinkerpop neo4j-gremlin 3.3.5
|
||||
cd ..
|
||||
|
||||
php exakat.phar version
|
||||
php exakat.phar doctor
|
||||
|
||||
== Init project ==
|
||||
php
|
||||
|
||||
|
||||
Edit config.ini file to exclude some dirs:
|
||||
ignore_dirs[] = "/htdocs/includes";
|
||||
ignore_dirs[] = "/scripts";
|
||||
ignore_dirs[] = "/build";
|
||||
ignore_dirs[] = "/dev";
|
||||
ignore_dirs[] = "/documents";
|
||||
|
||||
|
||||
== Analyze project ==
|
||||
php
|
||||
File diff suppressed because it is too large
Load Diff
@ -380,7 +380,7 @@ if (! empty($user->rights->produit->lire) || ! empty($user->rights->service->lir
|
||||
print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromproduct')?'checked ':'').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").' ';
|
||||
print '<br>';
|
||||
print '<div class="showforproductselector">';
|
||||
$form->select_produits(GETPOST('productid'), 'productid', '');
|
||||
$form->select_produits(GETPOST('productid'), 'productid', '', '', 0, -1, 2, '', 0, array(), 0, '1', 0, 'minwidth400imp', 1);
|
||||
print ' <input type="submit" id="submitproduct" name="submitproduct" class="button" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
@ -265,6 +265,246 @@ class Categories extends DolibarrApi
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Link an object to a category by id
|
||||
*
|
||||
* @param int $id ID of category
|
||||
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact')
|
||||
* @param int $object_id ID of object
|
||||
*
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*
|
||||
* @url POST {id}/objects/{type}/{object_id}
|
||||
*/
|
||||
public function linkObjectById($id, $type, $object_id)
|
||||
{
|
||||
if (empty($type) || empty($object_id)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->category->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'category not found');
|
||||
}
|
||||
|
||||
// TODO Add all types
|
||||
if ($type === "product") {
|
||||
if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Product($this->db);
|
||||
} else {
|
||||
throw new RestException(401, "this type is not recognized yet.");
|
||||
}
|
||||
|
||||
if (!empty($object)) {
|
||||
$result = $object->fetch($object_id);
|
||||
if ($result > 0) {
|
||||
$result=$this->category->add_type($object, $type);
|
||||
if ($result < 0) {
|
||||
if ($this->category->error != 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
throw new RestException(500, 'Error when linking object', array_merge(array($this->category->error), $this->category->errors));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors));
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Objects succefully linked to the category'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
/**
|
||||
* Link an object to a category by ref
|
||||
*
|
||||
* @param int $id ID of category
|
||||
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact')
|
||||
* @param string $object_ref Reference of object
|
||||
*
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*
|
||||
* @url POST {id}/objects/{type}/ref/{object_ref}
|
||||
*/
|
||||
public function linkObjectByRef($id, $type, $object_ref)
|
||||
{
|
||||
if (empty($type) || empty($object_ref)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->category->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'category not found');
|
||||
}
|
||||
|
||||
// TODO Add all types
|
||||
if ($type === "product") {
|
||||
if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Product($this->db);
|
||||
} else {
|
||||
throw new RestException(401, "this type is not recognized yet.");
|
||||
}
|
||||
|
||||
if (!empty($object)) {
|
||||
$result = $object->fetch('', $object_ref);
|
||||
if ($result > 0) {
|
||||
$result=$this->category->add_type($object, $type);
|
||||
if ($result < 0) {
|
||||
if ($this->category->error != 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
throw new RestException(500, 'Error when linking object', array_merge(array($this->category->error), $this->category->errors));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors));
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Objects succefully linked to the category'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlink an object from a category by id
|
||||
*
|
||||
* @param int $id ID of category
|
||||
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact')
|
||||
* @param int $object_id ID of the object
|
||||
*
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*
|
||||
* @url DELETE {id}/objects/{type}/{object_id}
|
||||
*/
|
||||
public function unlinkObjectById($id, $type, $object_id)
|
||||
{
|
||||
if (empty($type) || empty($object_id)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->category->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'category not found');
|
||||
}
|
||||
|
||||
// TODO Add all types
|
||||
if ($type === "product") {
|
||||
if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Product($this->db);
|
||||
} else {
|
||||
throw new RestException(401, "this type is not recognized yet.");
|
||||
}
|
||||
|
||||
if (!empty($object)) {
|
||||
$result = $object->fetch((int) $object_id);
|
||||
if ($result > 0) {
|
||||
$result=$this->category->del_type($object, $type);
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error when unlinking object', array_merge(array($this->category->error), $this->category->errors));
|
||||
}
|
||||
} else {
|
||||
throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors));
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Objects succefully unlinked from the category'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlink an object from a category by ref
|
||||
*
|
||||
* @param int $id ID of category
|
||||
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact')
|
||||
* @param string $object_ref Reference of the object
|
||||
*
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*
|
||||
* @url DELETE {id}/objects/{type}/ref/{object_ref}
|
||||
*/
|
||||
public function unlinkObjectByRef($id, $type, $object_ref)
|
||||
{
|
||||
if (empty($type) || empty($object_ref)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->category->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'category not found');
|
||||
}
|
||||
|
||||
// TODO Add all types
|
||||
if ($type === "product") {
|
||||
if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Product($this->db);
|
||||
} else {
|
||||
throw new RestException(401, "this type is not recognized yet.");
|
||||
}
|
||||
|
||||
if (!empty($object)) {
|
||||
$result = $object->fetch('', (string) $object_ref);
|
||||
if ($result > 0) {
|
||||
$result=$this->category->del_type($object, $type);
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error when unlinking object', array_merge(array($this->category->error), $this->category->errors));
|
||||
}
|
||||
} else {
|
||||
throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors));
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Objects succefully unlinked from the category'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
|
||||
@ -678,19 +678,12 @@ else
|
||||
print_liste_field_titre("LineRecord", $_SERVER["PHP_SELF"], "b.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
$i = 1;
|
||||
|
||||
$i = 1;
|
||||
if ($num > 0)
|
||||
{
|
||||
while ($objp = $db->fetch_object($resql))
|
||||
{
|
||||
//$account_id = $objp->bid; FIXME not used
|
||||
|
||||
// FIXME $accounts[$objp->bid] is a label
|
||||
/*if (! isset($accounts[$objp->bid]))
|
||||
$accounts[$objp->bid]=0;
|
||||
$accounts[$objp->bid] += 1;*/
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td align="center">'.$i.'</td>';
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->date), 'day').'</td>'; // Date operation
|
||||
@ -751,6 +744,15 @@ else
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
// Cheque denormalized data nbcheque is similar to real number of cheque
|
||||
if ($num > 0 && $i < ($object->nbcheque + 1)) {
|
||||
// Show warning that some records were removed.
|
||||
$langs->load("errors");
|
||||
print info_admin($langs->trans("WarningSomeBankTransactionByChequeWereRemovedAfter"), 0, 0, 'warning');
|
||||
// TODO Fix data ->nbcheque and ->amount
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
}
|
||||
else
|
||||
|
||||
@ -177,7 +177,7 @@ if ($id > 0 || $ref)
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
|
||||
@ -214,7 +214,7 @@ if ($id > 0 || $ref)
|
||||
print '<br>';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
$acc = new Account($db);
|
||||
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||
|
||||
@ -74,6 +74,10 @@ class BonPrelevement extends CommonObject
|
||||
public $invoice_in_error=array();
|
||||
public $thirdparty_in_error=array();
|
||||
|
||||
const STATUS_DRAFT = 0;
|
||||
const STATUS_TRANSFERED = 1;
|
||||
const STATUS_CREDITED = 2;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -2001,49 +2005,23 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (empty($this->labelStatus))
|
||||
// phpcs:enable
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("withdrawals");
|
||||
$this->labelStatus[0]=$langs->trans("StatusWaiting");
|
||||
$this->labelStatus[1]=$langs->trans("StatusTrans");
|
||||
$this->labelStatus[2]=$langs->trans("StatusCredited");
|
||||
//$langs->load("mymodule");
|
||||
$this->labelStatus[self::STATUS_DRAFT] = $langs->trans('StatusWaiting');
|
||||
$this->labelStatus[self::STATUS_TRANSFERED] = $langs->trans('StatusTrans');
|
||||
$this->labelStatus[self::STATUS_CREDITED] = $langs->trans('StatusCredited');
|
||||
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('StatusWaiting');
|
||||
$this->labelStatusShort[self::STATUS_TRANSFERED] = $langs->trans('StatusTrans');
|
||||
$this->labelStatusShort[self::STATUS_CREDITED] = $langs->trans('StatusCredited');
|
||||
}
|
||||
|
||||
if ($mode == 0 || $mode == 1)
|
||||
{
|
||||
return $this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($status==0) return img_picto($this->labelStatus[$status], 'statut1').' '.$this->labelStatus[$status];
|
||||
elseif ($status==1) return img_picto($this->labelStatus[$status], 'statut3').' '.$this->labelStatus[$status];
|
||||
elseif ($status==2) return img_picto($this->labelStatus[$status], 'statut6').' '.$this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($status==0) return img_picto($this->labelStatus[$status], 'statut1');
|
||||
elseif ($status==1) return img_picto($this->labelStatus[$status], 'statut3');
|
||||
elseif ($status==2) return img_picto($this->labelStatus[$status], 'statut6');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($status==0) return img_picto($this->labelStatus[$status], 'statut1').' '.$this->labelStatus[$status];
|
||||
elseif ($status==1) return img_picto($this->labelStatus[$status], 'statut3').' '.$this->labelStatus[$status];
|
||||
elseif ($status==2) return img_picto($this->labelStatus[$status], 'statut6').' '.$this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($status==0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut1');
|
||||
elseif ($status==1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut3');
|
||||
elseif ($status==2) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut6');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($status==0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut1');
|
||||
elseif ($status==1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut3');
|
||||
elseif ($status==2) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut6');
|
||||
}
|
||||
$statusType = 'status1';
|
||||
if ($status == self::STATUS_TRANSFERED) $statusType = 'status3';
|
||||
if ($status == self::STATUS_CREDITED) $statusType = 'status6';
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ if ($prev_id > 0 || $ref)
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
|
||||
@ -111,7 +111,7 @@ if ($prev_id > 0 || $ref)
|
||||
print '<br>';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
$acc = new Account($db);
|
||||
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||
|
||||
@ -75,7 +75,7 @@ if ($prev_id > 0 || $ref)
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">'."\n";
|
||||
print '<table class="border centpercent tableforfield">'."\n";
|
||||
|
||||
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
|
||||
@ -112,7 +112,7 @@ if ($prev_id > 0 || $ref)
|
||||
print '<br>';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
$acc = new Account($db);
|
||||
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||
|
||||
@ -72,7 +72,7 @@ if ($prev_id > 0 || $ref)
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">'."\n";
|
||||
print '<table class="border centpercent tableforfield">'."\n";
|
||||
|
||||
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
|
||||
@ -109,7 +109,7 @@ if ($prev_id > 0 || $ref)
|
||||
print '<br>';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
$acc = new Account($db);
|
||||
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||
|
||||
@ -35,14 +35,14 @@ class ChargeSociales extends CommonObject
|
||||
/**
|
||||
* @var string ID to identify managed object
|
||||
*/
|
||||
public $element='chargesociales';
|
||||
public $element = 'chargesociales';
|
||||
|
||||
public $table='chargesociales';
|
||||
public $table = 'chargesociales';
|
||||
|
||||
/**
|
||||
* @var string Name of table without prefix where object is stored
|
||||
*/
|
||||
public $table_element='chargesociales';
|
||||
public $table_element = 'chargesociales';
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
@ -175,7 +175,7 @@ class ChargeSociales extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -187,10 +187,10 @@ class ChargeSociales extends CommonObject
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
$newamount=price2num($this->amount, 'MT');
|
||||
$newamount = price2num($this->amount, 'MT');
|
||||
|
||||
// Validation parametres
|
||||
if (! $newamount > 0 || empty($this->date_ech) || empty($this->periode))
|
||||
if (!$newamount > 0 || empty($this->date_ech) || empty($this->periode))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -208,55 +208,55 @@ class ChargeSociales extends CommonObject
|
||||
public function create($user)
|
||||
{
|
||||
global $conf;
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$now=dol_now();
|
||||
$now = dol_now();
|
||||
|
||||
// Nettoyage parametres
|
||||
$newamount=price2num($this->amount, 'MT');
|
||||
$newamount = price2num($this->amount, 'MT');
|
||||
|
||||
if (!$this->check()) {
|
||||
$this->error="ErrorBadParameter";
|
||||
$this->error = "ErrorBadParameter";
|
||||
return -2;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, date_creation)";
|
||||
$sql.= " VALUES (".$this->type;
|
||||
$sql.= ", ".($this->fk_account>0 ? $this->fk_account:'NULL');
|
||||
$sql.= ", ".($this->mode_reglement_id>0 ? $this->mode_reglement_id:"NULL");
|
||||
$sql.= ", '".$this->db->escape($this->label?$this->label:$this->lib)."'";
|
||||
$sql.= ", '".$this->db->idate($this->date_ech)."'";
|
||||
$sql.= ", '".$this->db->idate($this->periode)."'";
|
||||
$sql.= ", '".price2num($newamount)."'";
|
||||
$sql.= ", ".($this->fk_project>0?$this->fk_project:'NULL');
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".$user->id;
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ")";
|
||||
$sql .= " VALUES (".$this->type;
|
||||
$sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL');
|
||||
$sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : "NULL");
|
||||
$sql .= ", '".$this->db->escape($this->label ? $this->label : $this->lib)."'";
|
||||
$sql .= ", '".$this->db->idate($this->date_ech)."'";
|
||||
$sql .= ", '".$this->db->idate($this->periode)."'";
|
||||
$sql .= ", '".price2num($newamount)."'";
|
||||
$sql .= ", ".($this->fk_project > 0 ? $this->fk_project : 'NULL');
|
||||
$sql .= ", ".$conf->entity;
|
||||
$sql .= ", ".$user->id;
|
||||
$sql .= ", '".$this->db->idate($now)."'";
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales");
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales");
|
||||
|
||||
//dol_syslog("ChargesSociales::create this->id=".$this->id);
|
||||
$result=$this->call_trigger('SOCIALCONTRIBUTION_CREATE', $user);
|
||||
$result = $this->call_trigger('SOCIALCONTRIBUTION_CREATE', $user);
|
||||
if ($result < 0) $error++;
|
||||
|
||||
if(empty($error)) {
|
||||
if (empty($error)) {
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else {
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
return -1 * $error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error = $this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -271,23 +271,23 @@ class ChargeSociales extends CommonObject
|
||||
*/
|
||||
public function delete($user)
|
||||
{
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Get bank transaction lines for this social contributions
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
$account=new Account($this->db);
|
||||
$lines_url=$account->get_url('', $this->id, 'sc');
|
||||
$account = new Account($this->db);
|
||||
$lines_url = $account->get_url('', $this->id, 'sc');
|
||||
|
||||
// Delete bank urls
|
||||
foreach ($lines_url as $line_url)
|
||||
{
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$accountline=new AccountLine($this->db);
|
||||
$accountline = new AccountLine($this->db);
|
||||
$accountline->fetch($line_url['fk_bank']);
|
||||
$result=$accountline->delete_urls($user);
|
||||
$result = $accountline->delete_urls($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
@ -296,31 +296,31 @@ class ChargeSociales extends CommonObject
|
||||
}
|
||||
|
||||
// Delete payments
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge WHERE fk_charge=".$this->id;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales WHERE rowid=".$this->id;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
@ -342,31 +342,31 @@ class ChargeSociales extends CommonObject
|
||||
*/
|
||||
public function update($user, $notrigger = 0)
|
||||
{
|
||||
$error=0;
|
||||
$error = 0;
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
|
||||
$sql.= " SET libelle='".$this->db->escape($this->label?$this->label:$this->lib)."'";
|
||||
$sql.= ", date_ech='".$this->db->idate($this->date_ech)."'";
|
||||
$sql.= ", periode='".$this->db->idate($this->periode)."'";
|
||||
$sql.= ", amount='".price2num($this->amount, 'MT')."'";
|
||||
$sql.= ", fk_projet=".($this->fk_project>0?$this->db->escape($this->fk_project):"NULL");
|
||||
$sql.= ", fk_user_modif=".$user->id;
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
$sql .= " SET libelle='".$this->db->escape($this->label ? $this->label : $this->lib)."'";
|
||||
$sql .= ", date_ech='".$this->db->idate($this->date_ech)."'";
|
||||
$sql .= ", periode='".$this->db->idate($this->periode)."'";
|
||||
$sql .= ", amount='".price2num($this->amount, 'MT')."'";
|
||||
$sql .= ", fk_projet=".($this->fk_project > 0 ? $this->db->escape($this->fk_project) : "NULL");
|
||||
$sql .= ", fk_user_modif=".$user->id;
|
||||
$sql .= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if (! $resql) {
|
||||
$error++; $this->errors[]="Error ".$this->db->lasterror();
|
||||
if (!$resql) {
|
||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
if (!$notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('SOCIALCHARGES_MODIFY', $user);
|
||||
$result = $this->call_trigger('SOCIALCHARGES_MODIFY', $user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
@ -375,13 +375,13 @@ class ChargeSociales extends CommonObject
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
foreach ($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
return -1 * $error;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -401,9 +401,9 @@ class ChargeSociales extends CommonObject
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT SUM(f.amount) as amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as f";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql.= " AND paye = 0";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as f";
|
||||
$sql .= " WHERE f.entity = ".$conf->entity;
|
||||
$sql .= " AND paye = 0";
|
||||
|
||||
if ($year) {
|
||||
$sql .= " AND f.datev >= '$y-01-01' AND f.datev <= '$y-12-31' ";
|
||||
@ -441,8 +441,8 @@ class ChargeSociales extends CommonObject
|
||||
{
|
||||
// phpcs:enable
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
|
||||
$sql.= " paye = 1";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$sql .= " paye = 1";
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
$return = $this->db->query($sql);
|
||||
if ($return) return 1;
|
||||
else return -1;
|
||||
@ -459,8 +459,8 @@ class ChargeSociales extends CommonObject
|
||||
{
|
||||
// phpcs:enable
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
|
||||
$sql.= " paye = 0";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$sql .= " paye = 0";
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
$return = $this->db->query($sql);
|
||||
if ($return) return 1;
|
||||
else return -1;
|
||||
@ -549,9 +549,9 @@ class ChargeSociales extends CommonObject
|
||||
{
|
||||
global $langs, $conf, $user, $form;
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
|
||||
|
||||
$result='';
|
||||
$result = '';
|
||||
|
||||
$url = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$this->id;
|
||||
|
||||
@ -607,20 +607,20 @@ class ChargeSociales extends CommonObject
|
||||
*/
|
||||
public function getSommePaiement()
|
||||
{
|
||||
$table='paiementcharge';
|
||||
$field='fk_charge';
|
||||
$table = 'paiementcharge';
|
||||
$field = 'fk_charge';
|
||||
|
||||
$sql = 'SELECT sum(amount) as amount';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$table;
|
||||
$sql.= ' WHERE '.$field.' = '.$this->id;
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$table;
|
||||
$sql .= ' WHERE '.$field.' = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$amount=0;
|
||||
$amount = 0;
|
||||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) $amount=$obj->amount?$obj->amount:0;
|
||||
if ($obj) $amount = $obj->amount ? $obj->amount : 0;
|
||||
|
||||
$this->db->free($resql);
|
||||
return $amount;
|
||||
@ -640,12 +640,12 @@ class ChargeSociales extends CommonObject
|
||||
public function info($id)
|
||||
{
|
||||
$sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,";
|
||||
$sql.= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
|
||||
$sql.= " WHERE e.rowid = ".$id;
|
||||
$sql .= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
|
||||
$sql .= " WHERE e.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::info", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
@ -696,14 +696,14 @@ class ChargeSociales extends CommonObject
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
// Initialize parameters
|
||||
$this->id=0;
|
||||
$this->id = 0;
|
||||
$this->ref = 'SPECIMEN';
|
||||
$this->specimen=1;
|
||||
$this->specimen = 1;
|
||||
$this->paye = 0;
|
||||
$this->date = dol_now();
|
||||
$this->date_ech=$this->date+3600*24*30;
|
||||
$this->periode=$this->date+3600*24*30;
|
||||
$this->amount=100;
|
||||
$this->date_ech = $this->date + 3600 * 24 * 30;
|
||||
$this->periode = $this->date + 3600 * 24 * 30;
|
||||
$this->amount = 100;
|
||||
$this->label = 'Social contribution label';
|
||||
$this->type = 1;
|
||||
$this->type_label = 'Type of social contribution';
|
||||
|
||||
@ -78,54 +78,54 @@ if ($action == 'add' && ! empty($permissiontoadd))
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$result=$object->create($user);
|
||||
$result = $object->create($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Creation OK
|
||||
$urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;
|
||||
$urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
|
||||
$urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
|
||||
header("Location: ".$urltogo);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Creation KO
|
||||
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||
if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||
else setEventMessages($object->error, null, 'errors');
|
||||
$action='create';
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$action='create';
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
|
||||
// Action to update record
|
||||
if ($action == 'update' && ! empty($permissiontoadd))
|
||||
if ($action == 'update' && !empty($permissiontoadd))
|
||||
{
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if (! GETPOSTISSET($key)) continue; // The field was not submited to be edited
|
||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
|
||||
if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited
|
||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
|
||||
// Set value to update
|
||||
if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
|
||||
$value = GETPOST($key, 'none');
|
||||
} elseif ($object->fields[$key]['type']=='date') {
|
||||
} elseif ($object->fields[$key]['type'] == 'date') {
|
||||
$value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
|
||||
} elseif ($object->fields[$key]['type']=='datetime') {
|
||||
} elseif ($object->fields[$key]['type'] == 'datetime') {
|
||||
$value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
|
||||
} elseif (in_array($object->fields[$key]['type'], array('price', 'real'))) {
|
||||
$value = price2num(GETPOST($key));
|
||||
} 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;
|
||||
$object->$key = $value;
|
||||
if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default']))
|
||||
{
|
||||
$error++;
|
||||
@ -133,28 +133,28 @@ if ($action == 'update' && ! empty($permissiontoadd))
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$result=$object->update($user);
|
||||
$result = $object->update($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$action='view';
|
||||
$action = 'view';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Creation KO
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='edit';
|
||||
$action = 'edit';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$action='edit';
|
||||
$action = 'edit';
|
||||
}
|
||||
}
|
||||
|
||||
// Action to update one extrafield
|
||||
if ($action == "update_extras" && ! empty($permissiontoadd))
|
||||
if ($action == "update_extras" && !empty($permissiontoadd))
|
||||
{
|
||||
$object->fetch(GETPOST('id', 'int'));
|
||||
|
||||
@ -162,7 +162,7 @@ if ($action == "update_extras" && ! empty($permissiontoadd))
|
||||
$attributekeylong = 'options_'.$attributekey;
|
||||
$object->array_options['options_'.$attributekey] = GETPOST($attributekeylong, ' alpha');
|
||||
|
||||
$result = $object->insertExtraFields(empty($triggermodname)?'':$triggermodname, $user);
|
||||
$result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);
|
||||
if ($result > 0)
|
||||
{
|
||||
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||
@ -176,15 +176,15 @@ if ($action == "update_extras" && ! empty($permissiontoadd))
|
||||
}
|
||||
|
||||
// Action to delete
|
||||
if ($action == 'confirm_delete' && ! empty($permissiontodelete))
|
||||
if ($action == 'confirm_delete' && !empty($permissiontodelete))
|
||||
{
|
||||
if (! ($object->id > 0))
|
||||
if (!($object->id > 0))
|
||||
{
|
||||
dol_print_error('', 'Error, object must be fetched before being deleted');
|
||||
exit;
|
||||
}
|
||||
|
||||
$result=$object->delete($user);
|
||||
$result = $object->delete($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Delete OK
|
||||
@ -194,13 +194,13 @@ if ($action == 'confirm_delete' && ! empty($permissiontodelete))
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||
if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||
else setEventMessages($object->error, null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Remove a line
|
||||
if ($action == 'confirm_deleteline' && $confirm == 'yes' && ! empty($permissiontoadd))
|
||||
if ($action == 'confirm_deleteline' && $confirm == 'yes' && !empty($permissiontoadd))
|
||||
{
|
||||
$result = $object->deleteline($user, $lineid);
|
||||
if ($result > 0)
|
||||
@ -216,7 +216,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && ! empty($permissiont
|
||||
{
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
}
|
||||
if (! empty($newlang)) {
|
||||
if (!empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
@ -248,11 +248,11 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd)
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
if (!empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model=$object->modelpdf;
|
||||
$model = $object->modelpdf;
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
@ -277,11 +277,11 @@ if ($action == 'confirm_close' && $confirm == 'yes' && $permissiontoadd)
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
if (!empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model=$object->modelpdf;
|
||||
$model = $object->modelpdf;
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
@ -320,11 +320,11 @@ if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd)
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
if (!empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model=$object->modelpdf;
|
||||
$model = $object->modelpdf;
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
@ -337,30 +337,30 @@ if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd)
|
||||
}
|
||||
|
||||
// Action clone object
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes' && ! empty($permissiontoadd))
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes' && !empty($permissiontoadd))
|
||||
{
|
||||
if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
|
||||
if (1 == 0 && !GETPOST('clone_content') && !GETPOST('clone_receivers'))
|
||||
{
|
||||
setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
$objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone or if createFromClone modifies the object. We use native clone to keep this->db valid.
|
||||
$objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone or if createFromClone modifies the object. We use native clone to keep this->db valid.
|
||||
//$objectutil->date = dol_mktime(12, 0, 0, GETPOST('newdatemonth', 'int'), GETPOST('newdateday', 'int'), GETPOST('newdateyear', 'int'));
|
||||
// ...
|
||||
$result=$objectutil->createFromClone($user, (($object->id > 0) ? $object->id : $id));
|
||||
$result = $objectutil->createFromClone($user, (($object->id > 0) ? $object->id : $id));
|
||||
if (is_object($result) || $result > 0)
|
||||
{
|
||||
$newid = 0;
|
||||
if (is_object($result)) $newid = $result->id;
|
||||
else $newid = $result;
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$newid); // Open record of new object
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$newid); // Open record of new object
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($objectutil->error, $objectutil->errors, 'errors');
|
||||
$action='';
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -228,9 +228,10 @@ class FormWebsite
|
||||
* @param int $pageid Preselected container ID
|
||||
* @param int $showempty Show empty record
|
||||
* @param string $action Action on page that use this select list
|
||||
* @param string $morecss More CSS
|
||||
* @return string HTML select component with list of type of containers
|
||||
*/
|
||||
public function selectContainer($website, $htmlname = 'pageid', $pageid = 0, $showempty = 0, $action = '')
|
||||
public function selectContainer($website, $htmlname = 'pageid', $pageid = 0, $showempty = 0, $action = '', $morecss = 'minwidth200')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -239,11 +240,11 @@ class FormWebsite
|
||||
$out='';
|
||||
if ($atleastonepage && $action != 'editsource')
|
||||
{
|
||||
$out.='<select name="'.$htmlname.'" id="'.$htmlname.'" class="minwidth200 maxwidth300">';
|
||||
$out.='<select name="'.$htmlname.'" id="'.$htmlname.'" class="maxwidth300'.($morecss ? ' '.$morecss : '').'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.='<select name="pageidbis" id="pageid" class="minwidth200 maxwidth300" disabled="disabled">';
|
||||
$out.='<select name="pageidbis" id="pageid" class="maxwidth300'.($morecss ? ' '.$morecss : '').'" disabled="disabled">';
|
||||
}
|
||||
|
||||
if ($showempty || ! $atleastonepage) $out.='<option value="-1"> </option>';
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io>
|
||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
* Copyright (C) 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
|
||||
@ -180,10 +181,10 @@ function showDirectPublicLink($object)
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a random id
|
||||
* Generate a random id
|
||||
*
|
||||
* @param string $car Char to generate key
|
||||
* @return void
|
||||
* @param int $car Length of string to generate key
|
||||
* @return string
|
||||
*/
|
||||
function generate_random_id($car = 16)
|
||||
{
|
||||
|
||||
@ -420,6 +420,22 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
// Set variables of theme
|
||||
$colorbackhmenu1 = '';
|
||||
$colorbackvmenu1 = '';
|
||||
$colortexttitlenotab = '';
|
||||
$colorbacktitle1 = '';
|
||||
$colortexttitle = '';
|
||||
$colorbacklineimpair1 = '';
|
||||
$colorbacklinepair1 = '';
|
||||
$colortextlink = '';
|
||||
$colorbacklinepairhover = '';
|
||||
$colorbacklinepairhover = '';
|
||||
$colorbacklinepairchecked = '';
|
||||
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php')) {
|
||||
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
||||
}
|
||||
|
||||
// Show logo
|
||||
if ($foruserprofile)
|
||||
{
|
||||
@ -563,8 +579,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
else
|
||||
{
|
||||
$default='5a6482';
|
||||
if ($conf->theme == 'md') $default='5a3278';
|
||||
$default=(empty($colorbackhmenu1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbackhmenu1)));
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
|
||||
@ -612,8 +627,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
else
|
||||
{
|
||||
$default='f0f0f0';
|
||||
if ($conf->theme == 'md') $default='ffffff';
|
||||
$default=(empty($colorbackvmenu1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbackvmenu1)));
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("LeftMenuBackgroundColor").'</td>';
|
||||
@ -641,6 +655,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
else
|
||||
{
|
||||
$default=(empty($colortexttitlenotab) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitlenotab)));
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("TextTitleColor").'</td>';
|
||||
print '<td colspan="'.($colspan-1).'">';
|
||||
@ -652,7 +668,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
{
|
||||
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default"));
|
||||
}
|
||||
print ' <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #643c14">643c14</span></strong>) ';
|
||||
print ' <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #'.$default.'">'.$default.'</span></strong>) ';
|
||||
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
||||
print '</span>';
|
||||
print '</td>';
|
||||
@ -666,6 +682,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
else
|
||||
{
|
||||
$default=(empty($colorbacktitle1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacktitle1)));
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>';
|
||||
print '<td colspan="'.($colspan-1).'">';
|
||||
@ -677,7 +695,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
{
|
||||
print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
|
||||
}
|
||||
print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>f0f0f0</strong>) '; // $colorbacktitle1 in CSS
|
||||
print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; // $colorbacktitle1 in CSS
|
||||
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
||||
print '</span>';
|
||||
print '</td>';
|
||||
@ -691,6 +709,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
else
|
||||
{
|
||||
$default=(empty($colortexttitle) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitle)));
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("BackgroundTableTitleTextColor").'</td>';
|
||||
print '<td colspan="'.($colspan-1).'">';
|
||||
@ -702,7 +722,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
{
|
||||
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default"));
|
||||
}
|
||||
print ' <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #000000">000000</span></strong>) ';
|
||||
print ' <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #'.$default.'">'.$default.'</span></strong>) ';
|
||||
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
||||
print '</span>';
|
||||
print '</td>';
|
||||
@ -716,8 +736,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
else
|
||||
{
|
||||
$default='ffffff';
|
||||
if ($conf->theme == 'md') $default='ffffff';
|
||||
$default=(empty($colorbacklineimpair1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklineimpair1)));
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>';
|
||||
@ -745,8 +764,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
else
|
||||
{
|
||||
$default='f8f8f8';
|
||||
if ($conf->theme == 'md') $default='f8f8f8';
|
||||
$default=(empty($colorbacklinepair1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepair1)));
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>';
|
||||
@ -794,6 +812,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
else
|
||||
{
|
||||
$default=(empty($colortextlink) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortextlink)));
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("LinkColor").'</td>';
|
||||
print '<td colspan="'.($colspan-1).'">';
|
||||
@ -812,7 +832,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
print $langs->trans("Default");
|
||||
}
|
||||
}
|
||||
print ' <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #000078">000078</span></strong>) ';
|
||||
print ' <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #'.$default.'">'.$default.'</span></strong>) ';
|
||||
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
||||
print '</span>';
|
||||
print '</td>';
|
||||
@ -834,6 +854,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
*/
|
||||
}
|
||||
else {
|
||||
$default=(empty($colorbacklinepairhover) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepairhover)));
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("HighlightLinesColor").'</td>';
|
||||
print '<td colspan="'.($colspan-1).'">';
|
||||
@ -841,22 +863,22 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
//print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
|
||||
if ($edit)
|
||||
{
|
||||
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0';
|
||||
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color=colorArrayToHex(colorStringToArray($colorbacklinepairhover));
|
||||
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), '');
|
||||
print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', 'formcolor', 1).' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0';
|
||||
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color=colorArrayToHex(colorStringToArray($colorbacklinepairhover));
|
||||
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), '');
|
||||
if ($color)
|
||||
{
|
||||
if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
if ($color != colorArrayToHex(colorStringToArray($colorbacklinepairhover))) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
else print $langs->trans("Default");
|
||||
}
|
||||
else print $langs->trans("Default");
|
||||
}
|
||||
print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) ';
|
||||
print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
|
||||
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
||||
print '</span>';
|
||||
print '</td>';
|
||||
@ -878,6 +900,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
else
|
||||
{
|
||||
$default=(empty($colorbacklinepairchecked) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepairchecked)));
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("HighlightLinesChecked").'</td>';
|
||||
print '<td colspan="'.($colspan-1).'">';
|
||||
@ -900,7 +924,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
else print $langs->trans("Default");
|
||||
}
|
||||
print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) ';
|
||||
print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
|
||||
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
||||
print '</span>';
|
||||
print '</td>';
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
* \ingroup bom
|
||||
* \brief Description and activation file for module Bom
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -75,7 +75,7 @@ class modBom extends DolibarrModules
|
||||
// Name of image file used for this module.
|
||||
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
|
||||
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
|
||||
$this->picto='bom';
|
||||
$this->picto = 'bom';
|
||||
|
||||
// Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
|
||||
$this->module_parts = array(
|
||||
@ -103,15 +103,15 @@ class modBom extends DolibarrModules
|
||||
$this->config_page_url = array("bom.php");
|
||||
|
||||
// Dependencies
|
||||
$this->hidden = false; // A condition to hide module
|
||||
$this->depends = array('modProduct'); // List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...)
|
||||
$this->requiredby = array('modMrp'); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
|
||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
|
||||
$this->hidden = false; // A condition to hide module
|
||||
$this->depends = array('modProduct'); // List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...)
|
||||
$this->requiredby = array('modMrp'); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
|
||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
|
||||
$this->langfiles = array("mrp");
|
||||
//$this->phpmin = array(5,4); // Minimum version of PHP required by module
|
||||
$this->need_dolibarr_version = array(9,0); // Minimum version of Dolibarr required by module
|
||||
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
||||
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
||||
$this->need_dolibarr_version = array(9, 0); // Minimum version of Dolibarr required by module
|
||||
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
||||
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
||||
//$this->automatic_activation = array('FR'=>'BomWasAutomaticallyActivatedBecauseOfYourCountryChoice');
|
||||
//$this->always_enabled = true; // If true, can't be disabled
|
||||
|
||||
@ -132,10 +132,10 @@ class modBom extends DolibarrModules
|
||||
'fr_FR:ParentCompany'=>'Maison mère ou revendeur'
|
||||
)*/
|
||||
|
||||
if (! isset($conf->bom) || ! isset($conf->bom->enabled))
|
||||
if (!isset($conf->bom) || !isset($conf->bom->enabled))
|
||||
{
|
||||
$conf->bom=new stdClass();
|
||||
$conf->bom->enabled=0;
|
||||
$conf->bom = new stdClass();
|
||||
$conf->bom->enabled = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -281,28 +281,28 @@ class modBom extends DolibarrModules
|
||||
|
||||
|
||||
// Exports
|
||||
$r=1;
|
||||
$r = 1;
|
||||
|
||||
/* BEGIN MODULEBUILDER EXPORT BILLOFMATERIALS */
|
||||
$langs->load("mrp");
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='BomAndBomLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='bom';
|
||||
$keyforclass = 'BOM'; $keyforclassfile='/bom/class/bom.class.php'; $keyforelement='bom';
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = 'BomAndBomLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r] = 'bom';
|
||||
$keyforclass = 'BOM'; $keyforclassfile = '/bom/class/bom.class.php'; $keyforelement = 'bom';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
$keyforclass = 'BOMLine'; $keyforclassfile='/bom/class/bom.class.php'; $keyforelement='bomline'; $keyforalias='tl';
|
||||
$keyforclass = 'BOMLine'; $keyforclassfile = '/bom/class/bom.class.php'; $keyforelement = 'bomline'; $keyforalias = 'tl';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
unset($this->export_fields_array[$r]['tl.fk_bom']);
|
||||
$keyforselect ='bom_bom'; $keyforaliasextra='extra'; $keyforelement='bom';
|
||||
$keyforselect = 'bom_bom'; $keyforaliasextra = 'extra'; $keyforelement = 'bom';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
$keyforselect ='bom_bomline'; $keyforaliasextra='extraline'; $keyforelement='bomline';
|
||||
$keyforselect = 'bom_bomline'; $keyforaliasextra = 'extraline'; $keyforelement = 'bomline';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
$this->export_dependencies_array[$r]=array('bomline'=>'tl.rowid'); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'bom_bom as t';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'bom_bomline as tl ON tl.fk_bom = t.rowid';
|
||||
$this->export_sql_end[$r] .=' WHERE 1 = 1';
|
||||
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('bom').')';
|
||||
$this->export_dependencies_array[$r] = array('bomline'=>'tl.rowid'); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'bom_bom as t';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bom_bomline as tl ON tl.fk_bom = t.rowid';
|
||||
$this->export_sql_end[$r] .= ' WHERE 1 = 1';
|
||||
$this->export_sql_end[$r] .= ' AND t.entity IN ('.getEntity('bom').')';
|
||||
$r++;
|
||||
/* END MODULEBUILDER EXPORT BILLOFMATERIALS */
|
||||
}
|
||||
@ -319,7 +319,7 @@ class modBom extends DolibarrModules
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$result=$this->_load_tables('/bom/sql/');
|
||||
$result = $this->_load_tables('/bom/sql/');
|
||||
if ($result < 0) return -1; // Do not activate module if not allowed errors found on module SQL queries (the _load_table run sql with run_sql with error allowed parameter to 'default')
|
||||
|
||||
// Create extrafields
|
||||
|
||||
@ -127,7 +127,16 @@ if ($permission) {
|
||||
<?php $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); ?>
|
||||
</div>
|
||||
<div class="tagtd maxwidthonsmartphone noborderbottom">
|
||||
<?php $nbofcontacts=$form->select_contacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 1, 'minwidth100imp'); ?>
|
||||
<?php
|
||||
$nbofcontacts=$form->select_contacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 1, 'minwidth100imp');
|
||||
|
||||
$newcardbutton = '';
|
||||
if (! empty($object->socid) && $object->socid > 1 && $user->rights->societe->creer)
|
||||
{
|
||||
$newcardbutton .= '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$object->socid.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'" title="'.$langs->trans('NewContact').'"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
|
||||
}
|
||||
print $newcardbutton;
|
||||
?>
|
||||
</div>
|
||||
<div class="tagtd maxwidthonsmartphone noborderbottom">
|
||||
<?php
|
||||
@ -156,8 +165,6 @@ if ($permission) {
|
||||
</form>
|
||||
|
||||
<?php
|
||||
$var = false;
|
||||
|
||||
$arrayofsource=array('internal','external'); // Show both link to user and thirdparties contacts
|
||||
foreach($arrayofsource as $source) {
|
||||
$tmpobject=$object;
|
||||
@ -168,10 +175,9 @@ foreach($arrayofsource as $source) {
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$var = ! $var;
|
||||
?>
|
||||
|
||||
<form class="tagtr oddeven <?php echo ($var?'impair':'pair') ?>">
|
||||
<form class="tagtr oddeven">
|
||||
<div class="tagtd left">
|
||||
<?php if ($tab[$i]['source']=='internal') echo $langs->trans("User"); ?>
|
||||
<?php if ($tab[$i]['source']=='external') echo $langs->trans("ThirdPartyContact"); ?>
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element;
|
||||
@ -12,40 +12,40 @@ if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$o
|
||||
// Loop to show all columns of extrafields for the search title line
|
||||
if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
|
||||
{
|
||||
if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
|
||||
{
|
||||
if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
|
||||
{
|
||||
if (empty($extrafieldsobjectprefix)) $extrafieldsobjectprefix = 'ef.';
|
||||
if (empty($search_options_pattern)) $search_options_pattern='search_options_';
|
||||
|
||||
foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields[$extrafieldsobjectprefix.$key]['checked'])) {
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$typeofextrafield=$extrafields->attributes[$extrafieldsobjectkey]['type'][$key];
|
||||
foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields[$extrafieldsobjectprefix.$key]['checked'])) {
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$typeofextrafield=$extrafields->attributes[$extrafieldsobjectkey]['type'][$key];
|
||||
|
||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||
$tmpkey=preg_replace('/'.$search_options_pattern.'/', '', $key);
|
||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]))
|
||||
{
|
||||
$searchclass='';
|
||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="'.$search_options_pattern.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options[$search_options_pattern.$tmpkey]).'">';
|
||||
}
|
||||
elseif (in_array($typeofextrafield, array('datetime','timestamp')))
|
||||
{
|
||||
// TODO
|
||||
// Use showInputField in a particular manner to have input with a comparison operator, not input for a specific value date-hour-minutes
|
||||
}
|
||||
else
|
||||
{
|
||||
// for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid')
|
||||
$morecss='';
|
||||
if (in_array($typeofextrafield, array('link', 'sellist'))) $morecss='maxwidth200';
|
||||
echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$tmpkey], '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1);
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||
$tmpkey=preg_replace('/'.$search_options_pattern.'/', '', $key);
|
||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double')) && empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]))
|
||||
{
|
||||
$searchclass='';
|
||||
if (in_array($typeofextrafield, array('varchar'))) $searchclass='searchstring';
|
||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="'.$search_options_pattern.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options[$search_options_pattern.$tmpkey]).'">';
|
||||
}
|
||||
elseif (in_array($typeofextrafield, array('datetime','timestamp')))
|
||||
{
|
||||
// TODO
|
||||
// Use showInputField in a particular manner to have input with a comparison operator, not input for a specific value date-hour-minutes
|
||||
}
|
||||
else
|
||||
{
|
||||
// for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid')
|
||||
$morecss='';
|
||||
if (in_array($typeofextrafield, array('link', 'sellist'))) $morecss='maxwidth200';
|
||||
echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$tmpkey], '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1);
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,9 +21,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
|
||||
* \file htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php
|
||||
* \ingroup agenda
|
||||
* \brief Trigger file for agenda module
|
||||
* \brief Trigger file for company - contactroles
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
||||
@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
||||
class InterfaceContactRoles extends DolibarrTriggers
|
||||
{
|
||||
public $family = 'agenda';
|
||||
public $description = "Triggers of this module add actions in agenda according to setup made in agenda setup.";
|
||||
public $description = "Triggers of this module auto link contact to company.";
|
||||
|
||||
/**
|
||||
* Version of the trigger
|
||||
@ -73,7 +73,6 @@ class InterfaceContactRoles extends DolibarrTriggers
|
||||
$socid=(property_exists($object, 'socid')?$object->socid:$object->fk_soc);
|
||||
|
||||
if (! empty($socid) && $socid > 0) {
|
||||
global $db, $langs;
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
$contactdefault = new Contact($this->db);
|
||||
$contactdefault->socid=$socid;
|
||||
@ -83,7 +82,7 @@ class InterfaceContactRoles extends DolibarrTriggers
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$class = get_class($object);
|
||||
$cloneFrom = new $class($db);
|
||||
$cloneFrom = new $class($this->db);
|
||||
$r = $cloneFrom->fetch($object->id);
|
||||
|
||||
if (!empty($cloneFrom->id)) $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(-1, 'external'), $cloneFrom->liste_contact(-1, 'internal'));
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -35,15 +35,15 @@ $allowinstall = 0;
|
||||
$allowupgrade = false;
|
||||
$checksok = 1;
|
||||
|
||||
$setuplang=GETPOST("selectlang", 'aZ09', 3)?GETPOST("selectlang", 'aZ09', 3):$langs->getDefaultLang();
|
||||
$setuplang = GETPOST("selectlang", 'aZ09', 3) ?GETPOST("selectlang", 'aZ09', 3) : $langs->getDefaultLang();
|
||||
$langs->setDefaultLang($setuplang);
|
||||
|
||||
$langs->load("install");
|
||||
|
||||
// Now we load forced/pre-set values from install.forced.php file.
|
||||
$useforcedwizard=false;
|
||||
$forcedfile="./install.forced.php";
|
||||
if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php";
|
||||
$useforcedwizard = false;
|
||||
$forcedfile = "./install.forced.php";
|
||||
if ($conffile == "/etc/dolibarr/conf.php") $forcedfile = "/etc/dolibarr/install.forced.php";
|
||||
if (@file_exists($forcedfile)) {
|
||||
$useforcedwizard = true;
|
||||
include_once $forcedfile;
|
||||
@ -56,7 +56,7 @@ dolibarr_install_syslog("- check: Dolibarr install/upgrade process started");
|
||||
* View
|
||||
*/
|
||||
|
||||
pHeader('', ''); // No next step for navigation buttons. Next step is defined by click on links.
|
||||
pHeader('', ''); // No next step for navigation buttons. Next step is defined by click on links.
|
||||
|
||||
|
||||
//print "<br>\n";
|
||||
@ -65,28 +65,28 @@ pHeader('', ''); // No next step for navigation buttons. Next step is define
|
||||
print '<h3><img class="valigntextbottom" src="../theme/common/octicons/build/svg/gear.svg" width="20" alt="Database"> '.$langs->trans("MiscellaneousChecks").":</h3>\n";
|
||||
|
||||
// Check browser
|
||||
$useragent=$_SERVER['HTTP_USER_AGENT'];
|
||||
if (! empty($useragent))
|
||||
$useragent = $_SERVER['HTTP_USER_AGENT'];
|
||||
if (!empty($useragent))
|
||||
{
|
||||
$tmp=getBrowserInfo($_SERVER["HTTP_USER_AGENT"]);
|
||||
$browserversion=$tmp['browserversion'];
|
||||
$browsername=$tmp['browsername'];
|
||||
$tmp = getBrowserInfo($_SERVER["HTTP_USER_AGENT"]);
|
||||
$browserversion = $tmp['browserversion'];
|
||||
$browsername = $tmp['browsername'];
|
||||
if ($browsername == 'ie' && $browserversion < 7) print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("WarningBrowserTooOld")."<br>\n";
|
||||
}
|
||||
|
||||
|
||||
// Check PHP version
|
||||
$arrayphpminversionerror = array(5,5,0);
|
||||
$arrayphpminversionwarning = array(5,5,0);
|
||||
$arrayphpminversionerror = array(5, 5, 0);
|
||||
$arrayphpminversionwarning = array(5, 5, 0);
|
||||
if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0) // Minimum to use (error if lower)
|
||||
{
|
||||
print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror));
|
||||
$checksok=0; // 0=error, 1=warning
|
||||
$checksok = 0; // 0=error, 1=warning
|
||||
}
|
||||
elseif (versioncompare(versionphparray(), $arrayphpminversionwarning) < 0) // Minimum supported (warning if lower)
|
||||
{
|
||||
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning));
|
||||
$checksok=0; // 0=error, 1=warning
|
||||
$checksok = 0; // 0=error, 1=warning
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -97,12 +97,12 @@ print "<br>\n";
|
||||
|
||||
|
||||
// Check PHP support for $_POST
|
||||
if (! isset($_GET["testget"]) && ! isset($_POST["testpost"]))
|
||||
if (!isset($_GET["testget"]) && !isset($_POST["testpost"]))
|
||||
{
|
||||
print '<img src="../theme/eldy/img/warning.png" alt="Warning"> '.$langs->trans("PHPSupportPOSTGETKo");
|
||||
print ' (<a href="'.$_SERVER["PHP_SELF"].'?testget=ok">'.$langs->trans("Recheck").'</a>)';
|
||||
print "<br>\n";
|
||||
$checksok=0;
|
||||
$checksok = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -111,10 +111,10 @@ else
|
||||
|
||||
|
||||
// Check if sessions enabled
|
||||
if (! function_exists("session_id"))
|
||||
if (!function_exists("session_id"))
|
||||
{
|
||||
print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportSessions")."<br>\n";
|
||||
$checksok=0;
|
||||
$checksok = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -123,7 +123,7 @@ else
|
||||
|
||||
|
||||
// Check if GD supported (we need GD for image conversion)
|
||||
if (! function_exists("imagecreate"))
|
||||
if (!function_exists("imagecreate"))
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportGD")."<br>\n";
|
||||
@ -136,7 +136,7 @@ else
|
||||
|
||||
|
||||
// Check if Curl supported
|
||||
if (! function_exists("curl_init"))
|
||||
if (!function_exists("curl_init"))
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportCurl")."<br>\n";
|
||||
@ -148,7 +148,7 @@ else
|
||||
}
|
||||
|
||||
// Check if PHP calendar extension is available
|
||||
if (! function_exists("easter_date"))
|
||||
if (!function_exists("easter_date"))
|
||||
{
|
||||
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportCalendar")."<br>\n";
|
||||
}
|
||||
@ -159,7 +159,7 @@ else
|
||||
|
||||
|
||||
// Check if UTF8 supported
|
||||
if (! function_exists("utf8_encode"))
|
||||
if (!function_exists("utf8_encode"))
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportUTF8")."<br>\n";
|
||||
@ -174,7 +174,7 @@ else
|
||||
// Check if intl methods are supported
|
||||
if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@localhost')
|
||||
{
|
||||
if (! function_exists("locale_get_primary_language") || ! function_exists("locale_get_region"))
|
||||
if (!function_exists("locale_get_primary_language") || !function_exists("locale_get_region"))
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportIntl")."<br>\n";
|
||||
@ -188,18 +188,18 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc
|
||||
|
||||
|
||||
// Check memory
|
||||
$memrequiredorig='64M';
|
||||
$memrequired=64*1024*1024;
|
||||
$memmaxorig=@ini_get("memory_limit");
|
||||
$memmax=@ini_get("memory_limit");
|
||||
$memrequiredorig = '64M';
|
||||
$memrequired = 64 * 1024 * 1024;
|
||||
$memmaxorig = @ini_get("memory_limit");
|
||||
$memmax = @ini_get("memory_limit");
|
||||
if ($memmaxorig != '')
|
||||
{
|
||||
preg_match('/([0-9]+)([a-zA-Z]*)/i', $memmax, $reg);
|
||||
if ($reg[2])
|
||||
{
|
||||
if (strtoupper($reg[2]) == 'G') $memmax=$reg[1]*1024*1024*1024;
|
||||
if (strtoupper($reg[2]) == 'M') $memmax=$reg[1]*1024*1024;
|
||||
if (strtoupper($reg[2]) == 'K') $memmax=$reg[1]*1024;
|
||||
if (strtoupper($reg[2]) == 'G') $memmax = $reg[1] * 1024 * 1024 * 1024;
|
||||
if (strtoupper($reg[2]) == 'M') $memmax = $reg[1] * 1024 * 1024;
|
||||
if (strtoupper($reg[2]) == 'K') $memmax = $reg[1] * 1024;
|
||||
}
|
||||
if ($memmax >= $memrequired || $memmax == -1)
|
||||
{
|
||||
@ -216,37 +216,37 @@ if ($memmaxorig != '')
|
||||
clearstatcache();
|
||||
if (is_readable($conffile) && filesize($conffile) > 8)
|
||||
{
|
||||
dolibarr_install_syslog("check: conf file '" . $conffile . "' already defined");
|
||||
$confexists=1;
|
||||
dolibarr_install_syslog("check: conf file '".$conffile."' already defined");
|
||||
$confexists = 1;
|
||||
include_once $conffile;
|
||||
|
||||
$databaseok=1;
|
||||
$databaseok = 1;
|
||||
if ($databaseok)
|
||||
{
|
||||
// Already installed for all parts (config and database). We can propose upgrade.
|
||||
$allowupgrade=true;
|
||||
$allowupgrade = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$allowupgrade=false;
|
||||
$allowupgrade = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If not, we create it
|
||||
dolibarr_install_syslog("check: we try to create conf file '" . $conffile . "'");
|
||||
$confexists=0;
|
||||
dolibarr_install_syslog("check: we try to create conf file '".$conffile."'");
|
||||
$confexists = 0;
|
||||
|
||||
// First we try by copying example
|
||||
if (@copy($conffile.".example", $conffile))
|
||||
{
|
||||
// Success
|
||||
dolibarr_install_syslog("check: successfully copied file " . $conffile . ".example into " . $conffile);
|
||||
dolibarr_install_syslog("check: successfully copied file ".$conffile.".example into ".$conffile);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If failed, we try to create an empty file
|
||||
dolibarr_install_syslog("check: failed to copy file " . $conffile . ".example into " . $conffile . ". We try to create it.", LOG_WARNING);
|
||||
dolibarr_install_syslog("check: failed to copy file ".$conffile.".example into ".$conffile.". We try to create it.", LOG_WARNING);
|
||||
|
||||
$fp = @fopen($conffile, "w");
|
||||
if ($fp)
|
||||
@ -255,17 +255,17 @@ else
|
||||
@fputs($fp, "\n");
|
||||
fclose($fp);
|
||||
}
|
||||
else dolibarr_install_syslog("check: failed to create a new file " . $conffile . " into current dir " . getcwd() . ". Please check permissions.", LOG_ERR);
|
||||
else dolibarr_install_syslog("check: failed to create a new file ".$conffile." into current dir ".getcwd().". Please check permissions.", LOG_ERR);
|
||||
}
|
||||
|
||||
// First install: no upgrade necessary/required
|
||||
$allowupgrade=false;
|
||||
$allowupgrade = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// File is missing and cannot be created
|
||||
if (! file_exists($conffile))
|
||||
if (!file_exists($conffile))
|
||||
{
|
||||
print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ConfFileDoesNotExistsAndCouldNotBeCreated", $conffiletoshow);
|
||||
print "<br><br>";
|
||||
@ -281,7 +281,7 @@ else
|
||||
{
|
||||
print '<img src="../theme/eldy/img/error.png" alt="Warning"> '.$langs->trans("ConfFileMustBeAFileNotADir", $conffiletoshow);
|
||||
|
||||
$allowinstall=0;
|
||||
$allowinstall = 0;
|
||||
}
|
||||
// File exists but cannot be modified
|
||||
elseif (!is_writable($conffile))
|
||||
@ -298,7 +298,7 @@ else
|
||||
print '<img src="../theme/eldy/img/tick.png" alt="Warning"> '.$langs->trans("ConfFileIsNotWritable", $conffiletoshow);
|
||||
print "<br>\n";
|
||||
|
||||
$allowinstall=0;
|
||||
$allowinstall = 0;
|
||||
}
|
||||
// File exists and can be modified
|
||||
else
|
||||
@ -315,37 +315,37 @@ else
|
||||
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("ConfFileIsWritable", $conffiletoshow);
|
||||
print "<br>\n";
|
||||
|
||||
$allowinstall=1;
|
||||
$allowinstall = 1;
|
||||
}
|
||||
print "<br>\n";
|
||||
|
||||
// Requirements met/all ok: display the next step button
|
||||
if ($checksok)
|
||||
{
|
||||
$ok=0;
|
||||
$ok = 0;
|
||||
|
||||
// Try to create db connection
|
||||
if (file_exists($conffile))
|
||||
{
|
||||
include_once $conffile;
|
||||
if (! empty($dolibarr_main_db_type) && ! empty($dolibarr_main_document_root))
|
||||
if (!empty($dolibarr_main_db_type) && !empty($dolibarr_main_document_root))
|
||||
{
|
||||
if (! file_exists($dolibarr_main_document_root."/core/lib/admin.lib.php"))
|
||||
if (!file_exists($dolibarr_main_document_root."/core/lib/admin.lib.php"))
|
||||
{
|
||||
print '<span class="error">A '.$conffiletoshow.' file exists with a dolibarr_main_document_root to '.$dolibarr_main_document_root.' that seems wrong. Try to fix or remove the '.$conffiletoshow.' file.</span><br>'."\n";
|
||||
dol_syslog("A '" . $conffiletoshow . "' file exists with a dolibarr_main_document_root to " . $dolibarr_main_document_root . " that seems wrong. Try to fix or remove the '" . $conffiletoshow . "' file.", LOG_WARNING);
|
||||
dol_syslog("A '".$conffiletoshow."' file exists with a dolibarr_main_document_root to ".$dolibarr_main_document_root." that seems wrong. Try to fix or remove the '".$conffiletoshow."' file.", LOG_WARNING);
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
|
||||
|
||||
// If password is encoded, we decode it
|
||||
if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || ! empty($dolibarr_main_db_encrypted_pass))
|
||||
if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || !empty($dolibarr_main_db_encrypted_pass))
|
||||
{
|
||||
require_once $dolibarr_main_document_root.'/core/lib/security.lib.php';
|
||||
if (preg_match('/crypted:/i', $dolibarr_main_db_pass))
|
||||
{
|
||||
$dolibarr_main_db_encrypted_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); // We need to set this as it is used to know the password was initially crypted
|
||||
$dolibarr_main_db_encrypted_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); // We need to set this as it is used to know the password was initially crypted
|
||||
$dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
|
||||
}
|
||||
else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
|
||||
@ -358,10 +358,10 @@ else
|
||||
$conf->db->name = $dolibarr_main_db_name;
|
||||
$conf->db->user = $dolibarr_main_db_user;
|
||||
$conf->db->pass = $dolibarr_main_db_pass;
|
||||
$db=getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port);
|
||||
$db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port);
|
||||
if ($db->connected && $db->database_selected)
|
||||
{
|
||||
$ok=true;
|
||||
$ok = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -370,26 +370,26 @@ else
|
||||
// If database access is available, we set more variables
|
||||
if ($ok)
|
||||
{
|
||||
if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption=0;
|
||||
if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption = 0;
|
||||
$conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption;
|
||||
if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey='';
|
||||
if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey = '';
|
||||
$conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey;
|
||||
|
||||
$conf->setValues($db);
|
||||
// Reset forced setup after the setValues
|
||||
if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE=constant('SYSLOG_FILE');
|
||||
if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE');
|
||||
$conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
|
||||
|
||||
// Current version is $conf->global->MAIN_VERSION_LAST_UPGRADE
|
||||
// Version to install is DOL_VERSION
|
||||
$dolibarrlastupgradeversionarray=preg_split('/[\.-]/', isset($conf->global->MAIN_VERSION_LAST_UPGRADE) ? $conf->global->MAIN_VERSION_LAST_UPGRADE : (isset($conf->global->MAIN_VERSION_LAST_INSTALL)?$conf->global->MAIN_VERSION_LAST_INSTALL:''));
|
||||
$dolibarrversiontoinstallarray=versiondolibarrarray();
|
||||
$dolibarrlastupgradeversionarray = preg_split('/[\.-]/', isset($conf->global->MAIN_VERSION_LAST_UPGRADE) ? $conf->global->MAIN_VERSION_LAST_UPGRADE : (isset($conf->global->MAIN_VERSION_LAST_INSTALL) ? $conf->global->MAIN_VERSION_LAST_INSTALL : ''));
|
||||
$dolibarrversiontoinstallarray = versiondolibarrarray();
|
||||
}
|
||||
|
||||
// Show title
|
||||
if (! empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ! empty($conf->global->MAIN_VERSION_LAST_INSTALL))
|
||||
if (!empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || !empty($conf->global->MAIN_VERSION_LAST_INSTALL))
|
||||
{
|
||||
print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.(empty($conf->global->MAIN_VERSION_LAST_UPGRADE)?$conf->global->MAIN_VERSION_LAST_INSTALL:$conf->global->MAIN_VERSION_LAST_UPGRADE).'</span></b> - ';
|
||||
print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.(empty($conf->global->MAIN_VERSION_LAST_UPGRADE) ? $conf->global->MAIN_VERSION_LAST_INSTALL : $conf->global->MAIN_VERSION_LAST_UPGRADE).'</span></b> - ';
|
||||
print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b>';
|
||||
//print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired"));
|
||||
print '<br>';
|
||||
@ -400,7 +400,7 @@ else
|
||||
//print $langs->trans("InstallEasy")." ";
|
||||
print '<h3><span class="soustitre">'.$langs->trans("ChooseYourSetupMode").'</span></h3>';
|
||||
|
||||
$foundrecommandedchoice=0;
|
||||
$foundrecommandedchoice = 0;
|
||||
|
||||
$available_choices = array();
|
||||
$notavailable_choices = array();
|
||||
@ -417,7 +417,7 @@ else
|
||||
//print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE);
|
||||
$choice .= '<div class="center"><div class="ok">'.$langs->trans("InstallChoiceSuggested").'</div></div>';
|
||||
// <img src="../theme/eldy/img/tick.png" alt="Ok"> ';
|
||||
$foundrecommandedchoice=1; // To show only once
|
||||
$foundrecommandedchoice = 1; // To show only once
|
||||
}
|
||||
|
||||
$choice .= '</td>';
|
||||
@ -441,14 +441,14 @@ else
|
||||
}
|
||||
|
||||
// Show upgrade lines
|
||||
$allowupgrade=true;
|
||||
$allowupgrade = true;
|
||||
if (empty($dolibarr_main_db_host)) // This means install process was not run
|
||||
{
|
||||
$allowupgrade=false;
|
||||
$allowupgrade = false;
|
||||
}
|
||||
if (defined("MAIN_NOT_INSTALLED")) $allowupgrade=false;
|
||||
if (GETPOST('allowupgrade')) $allowupgrade=true;
|
||||
$migrationscript=array( array('from'=>'3.0.0', 'to'=>'3.1.0'),
|
||||
if (defined("MAIN_NOT_INSTALLED")) $allowupgrade = false;
|
||||
if (GETPOST('allowupgrade')) $allowupgrade = true;
|
||||
$migrationscript = array(array('from'=>'3.0.0', 'to'=>'3.1.0'),
|
||||
array('from'=>'3.1.0', 'to'=>'3.2.0'),
|
||||
array('from'=>'3.2.0', 'to'=>'3.3.0'),
|
||||
array('from'=>'3.3.0', 'to'=>'3.4.0'),
|
||||
@ -467,26 +467,26 @@ else
|
||||
array('from'=>'10.0.0', 'to'=>'11.0.0')
|
||||
);
|
||||
|
||||
$count=0;
|
||||
$count = 0;
|
||||
foreach ($migrationscript as $migarray)
|
||||
{
|
||||
$choice = '';
|
||||
|
||||
$count++;
|
||||
$recommended_choice = false;
|
||||
$version=DOL_VERSION;
|
||||
$versionfrom=$migarray['from'];
|
||||
$versionto=$migarray['to'];
|
||||
$versionarray=preg_split('/[\.-]/', $version);
|
||||
$dolibarrversionfromarray=preg_split('/[\.-]/', $versionfrom);
|
||||
$dolibarrversiontoarray=preg_split('/[\.-]/', $versionto);
|
||||
$version = DOL_VERSION;
|
||||
$versionfrom = $migarray['from'];
|
||||
$versionto = $migarray['to'];
|
||||
$versionarray = preg_split('/[\.-]/', $version);
|
||||
$dolibarrversionfromarray = preg_split('/[\.-]/', $versionfrom);
|
||||
$dolibarrversiontoarray = preg_split('/[\.-]/', $versionto);
|
||||
// Define string newversionxxx that are used for text to show
|
||||
$newversionfrom=preg_replace('/(\.[0-9]+)$/i', '.*', $versionfrom);
|
||||
$newversionto=preg_replace('/(\.[0-9]+)$/i', '.*', $versionto);
|
||||
$newversionfrombis='';
|
||||
$newversionfrom = preg_replace('/(\.[0-9]+)$/i', '.*', $versionfrom);
|
||||
$newversionto = preg_replace('/(\.[0-9]+)$/i', '.*', $versionto);
|
||||
$newversionfrombis = '';
|
||||
if (versioncompare($dolibarrversiontoarray, $versionarray) < -2) // From x.y.z -> x.y.z+1
|
||||
{
|
||||
$newversionfrombis=' '.$langs->trans("or").' '.$versionto;
|
||||
$newversionfrombis = ' '.$langs->trans("or").' '.$versionto;
|
||||
}
|
||||
|
||||
if ($ok)
|
||||
@ -498,7 +498,7 @@ else
|
||||
(versioncompare($dolibarrversiontoarray, $dolibarrlastupgradeversionarray) > 0 || versioncompare($dolibarrversiontoarray, $versionarray) < -2)
|
||||
)
|
||||
{
|
||||
$foundrecommandedchoice=1; // To show only once
|
||||
$foundrecommandedchoice = 1; // To show only once
|
||||
$recommended_choice = true;
|
||||
}
|
||||
}
|
||||
@ -519,7 +519,7 @@ else
|
||||
$choice .= '<br>';
|
||||
//print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE);
|
||||
$choice .= '<div class="center">';
|
||||
$choice .= '<div class="ok">'.$langs->trans("InstallChoiceSuggested").'</div>';
|
||||
$choice .= '<div class="ok">'.$langs->trans("InstallChoiceSuggested").'</div>';
|
||||
if ($count < count($migarray)) // There are other choices after
|
||||
{
|
||||
print $langs->trans("MigrateIsDoneStepByStep", DOL_VERSION);
|
||||
@ -531,10 +531,10 @@ else
|
||||
$choice .= '<td class="center">';
|
||||
if ($allowupgrade)
|
||||
{
|
||||
$disabled=false;
|
||||
$disabled = false;
|
||||
if ($foundrecommandedchoice == 2)
|
||||
{
|
||||
$disabled=true;
|
||||
$disabled = true;
|
||||
}
|
||||
if ($foundrecommandedchoice == 1)
|
||||
{
|
||||
@ -546,7 +546,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
$choice .= '<a class="button runupgrade" href="upgrade.php?action=upgrade'.($count<count($migrationscript)?'_'.$versionto:'').'&selectlang='.$setuplang.'&versionfrom='.$versionfrom.'&versionto='.$versionto.'">'.$langs->trans("Start").'</a>';
|
||||
$choice .= '<a class="button runupgrade" href="upgrade.php?action=upgrade'.($count < count($migrationscript) ? '_'.$versionto : '').'&selectlang='.$setuplang.'&versionfrom='.$versionfrom.'&versionto='.$versionto.'">'.$langs->trans("Start").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -566,8 +566,8 @@ else
|
||||
// If there is no choice at all, we show all of them.
|
||||
if (empty($available_choices))
|
||||
{
|
||||
$available_choices=$notavailable_choices;
|
||||
$notavailable_choices=array();
|
||||
$available_choices = $notavailable_choices;
|
||||
$notavailable_choices = array();
|
||||
}
|
||||
|
||||
// Array of install choices
|
||||
@ -621,4 +621,4 @@ $(".runupgrade").click(function() {
|
||||
</script>';
|
||||
|
||||
dolibarr_install_syslog("- check: end");
|
||||
pFooter(1); // Never display next button
|
||||
pFooter(1); // Never display next button
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -125,7 +125,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_REOPEN','BOM reopen','Executed when a BOM is re-open','bom',653);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_DELETE','BOM deleted','Executed when a BOM deleted','bom',654);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_VALIDATE','MO validated','Executed when a MO is validated','bom',660);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_PRODUCED','MO disabled','Executed when a MO is produced','bom',661);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_PRODUCED','MO produced','Executed when a MO is produced','bom',661);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_DELETE','MO deleted','Executed when a MO is deleted','bom',662);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663);
|
||||
-- actions not enabled by default : they are excluded when we enable the module Agenda (except TASK_...)
|
||||
|
||||
@ -493,7 +493,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_DELETE','BOM deleted','Executed when a BOM deleted','bom',654);
|
||||
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_VALIDATE','MO validated','Executed when a MO is validated','bom',660);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_PRODUCED','MO disabled','Executed when a MO is produced','bom',661);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_PRODUCED','MO produced','Executed when a MO is produced','bom',661);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_DELETE','MO deleted','Executed when a MO is deleted','bom',662);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663);
|
||||
|
||||
|
||||
@ -5030,7 +5030,7 @@ function migrate_users_socialnetworks()
|
||||
dol_print_error($db);
|
||||
$db->rollback();
|
||||
}
|
||||
print '<b>'.$langs->trans('MigrationUsersSocialNetworks')."</b><br>\n";
|
||||
print '<b>'.$langs->trans('MigrationFieldsSocialNetworks', 'Users')."</b><br>\n";
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -5121,7 +5121,7 @@ function migrate_members_socialnetworks()
|
||||
dol_print_error($db);
|
||||
$db->rollback();
|
||||
}
|
||||
print '<b>'.$langs->trans('MigrationMembersSocialNetworks')."</b><br>\n";
|
||||
print '<b>'.$langs->trans('MigrationFieldsSocialNetworks', 'Members')."</b><br>\n";
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -5216,7 +5216,7 @@ function migrate_contacts_socialnetworks()
|
||||
dol_print_error($db);
|
||||
$db->rollback();
|
||||
}
|
||||
print '<b>'.$langs->trans('MigrationContactsSocialNetworks')."</b><br>\n";
|
||||
print '<b>'.$langs->trans('MigrationFieldsSocialNetworks', 'Contacts')."</b><br>\n";
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -5306,6 +5306,6 @@ function migrate_thirdparties_socialnetworks()
|
||||
dol_print_error($db);
|
||||
$db->rollback();
|
||||
}
|
||||
print '<b>'.$langs->trans('MigrationThirdpartiesSocialNetworks')."</b><br>\n";
|
||||
print '<b>'.$langs->trans('MigrationFieldsSocialNetworks', 'Thirdparties')."</b><br>\n";
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -247,4 +247,5 @@ WarningYourLoginWasModifiedPleaseLogin=Your login was modified. For security pur
|
||||
WarningAnEntryAlreadyExistForTransKey=An entry already exists for the translation key for this language
|
||||
WarningNumberOfRecipientIsRestrictedInMassAction=Warning, number of different recipient is limited to <b>%s</b> when using the mass actions on lists
|
||||
WarningDateOfLineMustBeInExpenseReportRange=Warning, the date of line is not in the range of the expense report
|
||||
WarningProjectClosed=Project is closed. You must re-open it first.
|
||||
WarningProjectClosed=Project is closed. You must re-open it first.
|
||||
WarningSomeBankTransactionByChequeWereRemovedAfter=Some bank transaction were removed after that the receipt including them were generated. So nb of cheques and total of receipt may differ from number and total in list.
|
||||
@ -205,10 +205,7 @@ MigrationRemiseExceptEntity=Update entity field value of llx_societe_remise_exce
|
||||
MigrationUserRightsEntity=Update entity field value of llx_user_rights
|
||||
MigrationUserGroupRightsEntity=Update entity field value of llx_usergroup_rights
|
||||
MigrationUserPhotoPath=Migration of photo paths for users
|
||||
MigrationUsersSocialNetworks=Migration of users fields social networks
|
||||
MigrationMembersSocialNetworks=Migration of members fields social networks
|
||||
MigrationContactsSocialNetworks=Migration of contacts fields social networks
|
||||
MigrationThirdpartiesSocialNetworks=Migration of thirdparties fields social networks
|
||||
MigrationFieldsSocialNetworks=Migration of users fields social networks (%s)
|
||||
MigrationReloadModule=Reload module %s
|
||||
MigrationResetBlockedLog=Reset module BlockedLog for v7 algorithm
|
||||
ShowNotAvailableOptions=Show unavailable options
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
// Put here all includes required by your class file
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
|
||||
@ -89,27 +89,27 @@ class MyObject extends CommonObject
|
||||
/**
|
||||
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||
*/
|
||||
public $fields=array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
||||
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'default'=>'', 'notnull'=> 1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>20),
|
||||
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1),
|
||||
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'),
|
||||
'qty' =>array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp'),
|
||||
public $fields = array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
||||
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'default'=>'', 'notnull'=> 1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>20),
|
||||
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1),
|
||||
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'),
|
||||
'qty' =>array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp'),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'),
|
||||
'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1),
|
||||
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60),
|
||||
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61),
|
||||
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62),
|
||||
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>500),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 0, 'position'=>501),
|
||||
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60),
|
||||
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61),
|
||||
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62),
|
||||
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>500),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 0, 'position'=>501),
|
||||
//'date_validation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502),
|
||||
'fk_user_creat' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>510, 'foreignkey'=>'user.rowid'),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
|
||||
'fk_user_creat' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>510, 'foreignkey'=>'user.rowid'),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
|
||||
//'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'notnull'=>-1, 'position'=>1010),
|
||||
'status' =>array('type'=>'smallint', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 9=>'Canceled')),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'notnull'=>-1, 'position'=>1010),
|
||||
'status' =>array('type'=>'smallint', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 9=>'Canceled')),
|
||||
);
|
||||
|
||||
/**
|
||||
@ -214,11 +214,11 @@ class MyObject extends CommonObject
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible']=0;
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled']=0;
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
|
||||
|
||||
// Unset fields that are disabled
|
||||
foreach($this->fields as $key => $val)
|
||||
foreach ($this->fields as $key => $val)
|
||||
{
|
||||
if (isset($val['enabled']) && empty($val['enabled']))
|
||||
{
|
||||
@ -274,7 +274,7 @@ class MyObject extends CommonObject
|
||||
|
||||
// Load source object
|
||||
$result = $object->fetchCommon($fromid);
|
||||
if ($result > 0 && ! empty($object->table_element_line)) $object->fetchLines();
|
||||
if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines();
|
||||
|
||||
// get lines so they will be clone
|
||||
//foreach($this->lines as $line)
|
||||
@ -287,18 +287,18 @@ class MyObject extends CommonObject
|
||||
|
||||
|
||||
// Clear fields
|
||||
$object->ref = empty($this->fields['ref']['default']) ? "copy_of_".$object->ref: $this->fields['ref']['default'];
|
||||
$object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label: $this->fields['label']['default'];
|
||||
$object->ref = empty($this->fields['ref']['default']) ? "copy_of_".$object->ref : $this->fields['ref']['default'];
|
||||
$object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
|
||||
$object->status = self::STATUS_DRAFT;
|
||||
// ...
|
||||
// Clear extrafields that are unique
|
||||
if (is_array($object->array_options) && count($object->array_options) > 0)
|
||||
{
|
||||
$extrafields->fetch_name_optionals_label($this->table_element);
|
||||
foreach($object->array_options as $key => $option)
|
||||
foreach ($object->array_options as $key => $option)
|
||||
{
|
||||
$shortkey = preg_replace('/options_/', '', $key);
|
||||
if (! empty($extrafields->attributes[$this->element]['unique'][$shortkey]))
|
||||
if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey]))
|
||||
{
|
||||
//var_dump($key); var_dump($clonedObj->array_options[$key]); exit;
|
||||
unset($object->array_options[$key]);
|
||||
@ -315,7 +315,7 @@ class MyObject extends CommonObject
|
||||
$this->errors = $object->errors;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
// copy internal contacts
|
||||
if ($this->copy_linked_contact($object, 'internal') < 0)
|
||||
@ -324,7 +324,7 @@ class MyObject extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
// copy external contacts if same company
|
||||
if (property_exists($this, 'socid') && $this->socid == $object->socid)
|
||||
@ -356,7 +356,7 @@ class MyObject extends CommonObject
|
||||
public function fetch($id, $ref = null)
|
||||
{
|
||||
$result = $this->fetchCommon($id, $ref);
|
||||
if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
|
||||
if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines();
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -367,7 +367,7 @@ class MyObject extends CommonObject
|
||||
*/
|
||||
public function fetchLines()
|
||||
{
|
||||
$this->lines=array();
|
||||
$this->lines = array();
|
||||
|
||||
$result = $this->fetchLinesCommon();
|
||||
return $result;
|
||||
@ -391,40 +391,40 @@ class MyObject extends CommonObject
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$records=array();
|
||||
$records = array();
|
||||
|
||||
$sql = 'SELECT ';
|
||||
$sql .= $this->getFieldList();
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
|
||||
else $sql .= ' WHERE 1 = 1';
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
if ($key=='t.rowid') {
|
||||
$sqlwhere[] = $key . '='. $value;
|
||||
if ($key == 't.rowid') {
|
||||
$sqlwhere[] = $key.'='.$value;
|
||||
}
|
||||
elseif (strpos($key, 'date') !== false) {
|
||||
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
|
||||
}
|
||||
elseif ($key=='customsql') {
|
||||
elseif ($key == 'customsql') {
|
||||
$sqlwhere[] = $value;
|
||||
}
|
||||
else {
|
||||
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
$sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND (' . implode(' '.$filtermode.' ', $sqlwhere).')';
|
||||
$sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')';
|
||||
}
|
||||
|
||||
if (!empty($sortfield)) {
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
||||
$sql .= ' '.$this->db->plimit($limit, $offset);
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -446,8 +446,8 @@ class MyObject extends CommonObject
|
||||
|
||||
return $records;
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -587,51 +587,51 @@ class MyObject extends CommonObject
|
||||
{
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
|
||||
|
||||
$result = '';
|
||||
|
||||
$label = '<u>' . $langs->trans("MyObject") . '</u>';
|
||||
$label.= '<br>';
|
||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
$label = '<u>'.$langs->trans("MyObject").'</u>';
|
||||
$label .= '<br>';
|
||||
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
|
||||
$url = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$this->id;
|
||||
|
||||
if ($option != 'nolink')
|
||||
{
|
||||
// Add param to save lastsearch_values or not
|
||||
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
|
||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
|
||||
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
||||
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
|
||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
|
||||
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
|
||||
}
|
||||
|
||||
$linkclose='';
|
||||
$linkclose = '';
|
||||
if (empty($notooltip))
|
||||
{
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("ShowMyObject");
|
||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
$label = $langs->trans("ShowMyObject");
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||
}
|
||||
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
|
||||
else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
$linkstart .= $linkclose.'>';
|
||||
$linkend = '</a>';
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $this->ref;
|
||||
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
if ($withpicto != 2) $result .= $this->ref;
|
||||
$result .= $linkend;
|
||||
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
|
||||
|
||||
global $action,$hookmanager;
|
||||
global $action, $hookmanager;
|
||||
$hookmanager->initHooks(array('myobjectdao'));
|
||||
$parameters=array('id'=>$this->id, 'getnomurl'=>$result);
|
||||
$reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
|
||||
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook > 0) $result = $hookmanager->resPrint;
|
||||
else $result .= $hookmanager->resPrint;
|
||||
|
||||
@ -687,10 +687,10 @@ class MyObject extends CommonObject
|
||||
public function info($id)
|
||||
{
|
||||
$sql = 'SELECT rowid, date_creation as datec, tms as datem,';
|
||||
$sql.= ' fk_user_creat, fk_user_modif';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql.= ' WHERE t.rowid = '.$id;
|
||||
$result=$this->db->query($sql);
|
||||
$sql .= ' fk_user_creat, fk_user_modif';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql .= ' WHERE t.rowid = '.$id;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
@ -701,7 +701,7 @@ class MyObject extends CommonObject
|
||||
{
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_valid)
|
||||
@ -715,7 +715,7 @@ class MyObject extends CommonObject
|
||||
{
|
||||
$cluser = new User($this->db);
|
||||
$cluser->fetch($obj->fk_user_cloture);
|
||||
$this->user_cloture = $cluser;
|
||||
$this->user_cloture = $cluser;
|
||||
}
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
@ -749,7 +749,7 @@ class MyObject extends CommonObject
|
||||
*/
|
||||
public function getLinesArray()
|
||||
{
|
||||
$this->lines=array();
|
||||
$this->lines = array();
|
||||
|
||||
$objectline = new MyObjectLine($this->db);
|
||||
$result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_myobject = '.$this->id));
|
||||
@ -780,16 +780,16 @@ class MyObject extends CommonObject
|
||||
*/
|
||||
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->load("mymodule@mymodule");
|
||||
|
||||
if (! dol_strlen($modele)) {
|
||||
if (!dol_strlen($modele)) {
|
||||
$modele = 'standard';
|
||||
|
||||
if ($this->modelpdf) {
|
||||
$modele = $this->modelpdf;
|
||||
} elseif (! empty($conf->global->MYOBJECT_ADDON_PDF)) {
|
||||
} elseif (!empty($conf->global->MYOBJECT_ADDON_PDF)) {
|
||||
$modele = $conf->global->MYOBJECT_ADDON_PDF;
|
||||
}
|
||||
}
|
||||
@ -814,7 +814,7 @@ class MyObject extends CommonObject
|
||||
|
||||
$error = 0;
|
||||
$this->output = '';
|
||||
$this->error='';
|
||||
$this->error = '';
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
|
||||
@ -35,21 +35,21 @@ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
|
||||
$langs->loadLangs(array('stock', 'other', 'productbatch'));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$id = GETPOST('id', 'int');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$batch = GETPOST('batch', 'alpha');
|
||||
$productid = GETPOST('productid', 'int');
|
||||
$ref = GETPOST('ref', 'alpha'); // ref is productid_batch
|
||||
$ref = GETPOST('ref', 'alpha'); // ref is productid_batch
|
||||
|
||||
$search_entity=GETPOST('search_entity', 'int');
|
||||
$search_fk_product=GETPOST('search_fk_product', 'int');
|
||||
$search_batch=GETPOST('search_batch', 'alpha');
|
||||
$search_fk_user_creat=GETPOST('search_fk_user_creat', 'int');
|
||||
$search_fk_user_modif=GETPOST('search_fk_user_modif', 'int');
|
||||
$search_import_key=GETPOST('search_import_key', 'int');
|
||||
$search_entity = GETPOST('search_entity', 'int');
|
||||
$search_fk_product = GETPOST('search_fk_product', 'int');
|
||||
$search_batch = GETPOST('search_batch', 'alpha');
|
||||
$search_fk_user_creat = GETPOST('search_fk_user_creat', 'int');
|
||||
$search_fk_user_modif = GETPOST('search_fk_user_modif', 'int');
|
||||
$search_import_key = GETPOST('search_import_key', 'int');
|
||||
|
||||
if (empty($action) && empty($id) && empty($ref)) $action='list';
|
||||
if (empty($action) && empty($id) && empty($ref)) $action = 'list';
|
||||
|
||||
|
||||
// Protection if external user
|
||||
@ -73,21 +73,21 @@ if ($id || $ref)
|
||||
{
|
||||
if ($ref)
|
||||
{
|
||||
$tmp=explode('_', $ref);
|
||||
$productid=$tmp[0];
|
||||
$batch=$tmp[1];
|
||||
$tmp = explode('_', $ref);
|
||||
$productid = $tmp[0];
|
||||
$batch = $tmp[1];
|
||||
}
|
||||
$object->fetch($id, $productid, $batch);
|
||||
$object->ref = $object->batch; // For document management ( it use $object->ref)
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('productlotcard','globalcard'));
|
||||
$hookmanager->initHooks(array('productlotcard', 'globalcard'));
|
||||
|
||||
|
||||
$permissionnote = $user->rights->stock->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->stock->creer; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoadd = $user->rights->stock->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissionnote = $user->rights->stock->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->stock->creer; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoadd = $user->rights->stock->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
|
||||
$usercanread = $user->rights->produit->lire;
|
||||
$usercancreate = $user->rights->produit->creer;
|
||||
@ -97,8 +97,8 @@ $usercandelete = $user->rights->produit->supprimer;
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
@ -112,7 +112,7 @@ if (empty($reshook))
|
||||
|
||||
if ($action == 'setsellby' && $user->rights->stock->creer)
|
||||
{
|
||||
$newvalue=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']);
|
||||
$newvalue = dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']);
|
||||
$result = $object->setValueFrom('sellby', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
@ -125,7 +125,7 @@ if (empty($reshook))
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'none'));
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
// Actions on extra fields
|
||||
$result = $object->insertExtraFields('PRODUCT_LOT_MODIFY');
|
||||
@ -145,21 +145,21 @@ if (empty($reshook))
|
||||
{
|
||||
if (GETPOST('cancel', 'alpha'))
|
||||
{
|
||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/stock/list.php', 1);
|
||||
$urltogo = $backtopage ? $backtopage : dol_buildpath('/stock/list.php', 1);
|
||||
header("Location: ".$urltogo);
|
||||
exit;
|
||||
}
|
||||
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
/* object_prop_getpost_prop */
|
||||
|
||||
$object->entity=GETPOST('entity', 'int');
|
||||
$object->fk_product=GETPOST('fk_product', 'int');
|
||||
$object->batch=GETPOST('batch', 'alpha');
|
||||
$object->fk_user_creat=GETPOST('fk_user_creat', 'int');
|
||||
$object->fk_user_modif=GETPOST('fk_user_modif', 'int');
|
||||
$object->import_key=GETPOST('import_key', 'int');
|
||||
$object->entity = GETPOST('entity', 'int');
|
||||
$object->fk_product = GETPOST('fk_product', 'int');
|
||||
$object->batch = GETPOST('batch', 'alpha');
|
||||
$object->fk_user_creat = GETPOST('fk_user_creat', 'int');
|
||||
$object->fk_user_modif = GETPOST('fk_user_modif', 'int');
|
||||
$object->import_key = GETPOST('import_key', 'int');
|
||||
|
||||
if (empty($object->ref))
|
||||
{
|
||||
@ -167,43 +167,43 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Ref")), null, 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$result=$object->create($user);
|
||||
$result = $object->create($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Creation OK
|
||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/stock/list.php', 1);
|
||||
$urltogo = $backtopage ? $backtopage : dol_buildpath('/stock/list.php', 1);
|
||||
header("Location: ".$urltogo);
|
||||
exit;
|
||||
}
|
||||
{
|
||||
// Creation KO
|
||||
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||
if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||
else setEventMessages($object->error, null, 'errors');
|
||||
$action='create';
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$action='create';
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
|
||||
// Cancel
|
||||
if ($action == 'update' && GETPOST('cancel', 'alpha')) $action='view';
|
||||
if ($action == 'update' && GETPOST('cancel', 'alpha')) $action = 'view';
|
||||
|
||||
// Action to update record
|
||||
if ($action == 'update' && ! GETPOST('cancel', 'alpha'))
|
||||
if ($action == 'update' && !GETPOST('cancel', 'alpha'))
|
||||
{
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$object->entity=GETPOST('entity', 'int');
|
||||
$object->fk_product=GETPOST('fk_product', 'int');
|
||||
$object->batch=GETPOST('batch', 'alpha');
|
||||
$object->fk_user_creat=GETPOST('fk_user_creat', 'int');
|
||||
$object->fk_user_modif=GETPOST('fk_user_modif', 'int');
|
||||
$object->import_key=GETPOST('import_key', 'int');
|
||||
$object->entity = GETPOST('entity', 'int');
|
||||
$object->fk_product = GETPOST('fk_product', 'int');
|
||||
$object->batch = GETPOST('batch', 'alpha');
|
||||
$object->fk_user_creat = GETPOST('fk_user_creat', 'int');
|
||||
$object->fk_user_modif = GETPOST('fk_user_modif', 'int');
|
||||
$object->import_key = GETPOST('import_key', 'int');
|
||||
|
||||
if (empty($object->ref))
|
||||
{
|
||||
@ -211,31 +211,31 @@ if (empty($reshook))
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Ref")), null, 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$result=$object->update($user);
|
||||
$result = $object->update($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$action='view';
|
||||
$action = 'view';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Creation KO
|
||||
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||
if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||
else setEventMessages($object->error, null, 'errors');
|
||||
$action='edit';
|
||||
$action = 'edit';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$action='edit';
|
||||
$action = 'edit';
|
||||
}
|
||||
}
|
||||
|
||||
// Action to delete
|
||||
if ($action == 'confirm_delete')
|
||||
{
|
||||
$result=$object->delete($user);
|
||||
$result = $object->delete($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Delete OK
|
||||
@ -245,7 +245,7 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||
if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||
else setEventMessages($object->error, null, 'errors');
|
||||
}
|
||||
}
|
||||
@ -265,7 +265,7 @@ if (empty($reshook))
|
||||
|
||||
llxHeader('', 'ProductLot', '');
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
// Part to create
|
||||
@ -310,15 +310,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
|
||||
if ($action == 'delete') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteBatch'), $langs->trans('ConfirmDeleteBatch'), 'confirm_delete', '', 0, 1);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBatch'), $langs->trans('ConfirmDeleteBatch'), 'confirm_delete', '', 0, 1);
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/product/stock/productlot_list.php?restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/stock/productlot_list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->socid && ! in_array('batch', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
if ($user->socid && !in_array('batch', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav = 0;
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'batch');
|
||||
|
||||
@ -352,7 +352,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
// Other attributes
|
||||
$cols = 2;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -363,8 +363,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
// Buttons
|
||||
print '<div class="tabsAction">'."\n";
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
@ -403,12 +403,12 @@ if (empty($action))
|
||||
|
||||
// Documents
|
||||
$filedir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product_batch').dol_sanitizeFileName($object->ref);
|
||||
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
$genallowed=$usercanread;
|
||||
$delallowed=$usercancreate;
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
$genallowed = $usercanread;
|
||||
$delallowed = $usercancreate;
|
||||
|
||||
print $formfile->showdocuments('product_batch', dol_sanitizeFileName($object->ref), $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object);
|
||||
$somethingshown=$formfile->numoffiles;
|
||||
$somethingshown = $formfile->numoffiles;
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -231,7 +231,24 @@ if ($action == "change") // Change customer for TakePOS
|
||||
$idcustomer = GETPOST('idcustomer', 'int');
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||
|
||||
// @TODO Check if draft invoice already exists, if not create it or return a warning to ask to enter at least one line to have it created automatically
|
||||
// Check if draft invoice already exists, if not create it
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' AND entity IN (".getEntity('invoice').")";
|
||||
$result = $db->query($sql);
|
||||
$num_lines = $db->num_rows($result);
|
||||
if ($num_lines==0)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
$invoice = new Facture($db);
|
||||
$constforthirdpartyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
|
||||
$invoice->socid = $conf->global->$constforthirdpartyid;
|
||||
$invoice->date = dol_now();
|
||||
$invoice->module_source = 'takepos';
|
||||
$invoice->pos_source = $_SESSION["takeposterminal"];
|
||||
$placeid =$invoice->create($user);
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid;
|
||||
$db->query($sql);
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$idcustomer." where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
|
||||
$resql = $db->query($sql);
|
||||
?>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -178,7 +178,7 @@ class Stripe extends CommonObject
|
||||
global $stripearrayofkeysbyenv;
|
||||
\Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$status]['secret_key']);
|
||||
|
||||
dol_syslog(get_class($this)."::customerStripe found stripe customer key_account = ".$tiers." with publishable_key = ".$stripearrayofkeysbyenv[$status]['publishable_key']);
|
||||
dol_syslog(get_class($this)."::customerStripe found stripe customer key_account = ".$tiers.". We will try to read it on Stripe with publishable_key = ".$stripearrayofkeysbyenv[$status]['publishable_key']);
|
||||
|
||||
try {
|
||||
if (empty($key)) { // If the Stripe connect account not set, we use common API usage
|
||||
|
||||
@ -2120,9 +2120,9 @@ img.login, img.printer, img.entity {
|
||||
background-size: contain;
|
||||
}
|
||||
img.userphoto { /* size for user photo in lists */
|
||||
border-radius: 0.75em;
|
||||
width: 1.5em;
|
||||
height: 1.5em;
|
||||
border-radius: 0.725em;
|
||||
width: 1.45em;
|
||||
height: 1.45em;
|
||||
background-size: contain;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
@ -2738,7 +2738,7 @@ div.colorback
|
||||
border-left: 1px solid #ccc;
|
||||
}
|
||||
table.liste, table.noborder, table.formdoc, div.noborder {
|
||||
width: 100%;
|
||||
width: calc(100% - 1px); /* -1 to fix a bug. Without, a scroll appears dur to overflow-x: auto; of div-tableèresponsive
|
||||
|
||||
border-collapse: separate !important;
|
||||
border-spacing: 0px;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2018 Jean-François Ferry <hello@librethic.io>
|
||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
* Copyright (C) 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
|
||||
@ -120,7 +121,7 @@ class Ticket extends CommonObject
|
||||
public $progress;
|
||||
|
||||
/**
|
||||
* @var int Duration for ticket
|
||||
* @var string Duration for ticket
|
||||
*/
|
||||
public $timing;
|
||||
|
||||
@ -250,11 +251,11 @@ class Ticket extends CommonObject
|
||||
}
|
||||
|
||||
if (isset($this->fk_soc)) {
|
||||
$this->fk_soc = trim($this->fk_soc);
|
||||
$this->fk_soc = (int) $this->fk_soc;
|
||||
}
|
||||
|
||||
if (isset($this->fk_project)) {
|
||||
$this->fk_project = trim($this->fk_project);
|
||||
$this->fk_project = (int) $this->fk_project;
|
||||
}
|
||||
|
||||
if (isset($this->origin_email)) {
|
||||
@ -262,11 +263,11 @@ class Ticket extends CommonObject
|
||||
}
|
||||
|
||||
if (isset($this->fk_user_create)) {
|
||||
$this->fk_user_create = trim($this->fk_user_create);
|
||||
$this->fk_user_create = (int) $this->fk_user_create;
|
||||
}
|
||||
|
||||
if (isset($this->fk_user_assign)) {
|
||||
$this->fk_user_assign = trim($this->fk_user_assign);
|
||||
$this->fk_user_assign = (int) $this->fk_user_assign;
|
||||
}
|
||||
|
||||
if (isset($this->subject)) {
|
||||
@ -278,7 +279,7 @@ class Ticket extends CommonObject
|
||||
}
|
||||
|
||||
if (isset($this->fk_statut)) {
|
||||
$this->fk_statut = trim($this->fk_statut);
|
||||
$this->fk_statut = (int) $this->fk_statut;
|
||||
}
|
||||
|
||||
if (isset($this->resolution)) {
|
||||
@ -746,11 +747,11 @@ class Ticket extends CommonObject
|
||||
}
|
||||
|
||||
if (isset($this->fk_soc)) {
|
||||
$this->fk_soc = trim($this->fk_soc);
|
||||
$this->fk_soc = (int) $this->fk_soc;
|
||||
}
|
||||
|
||||
if (isset($this->fk_project)) {
|
||||
$this->fk_project = trim($this->fk_project);
|
||||
$this->fk_project = (int) $this->fk_project;
|
||||
}
|
||||
|
||||
if (isset($this->origin_email)) {
|
||||
@ -758,11 +759,11 @@ class Ticket extends CommonObject
|
||||
}
|
||||
|
||||
if (isset($this->fk_user_create)) {
|
||||
$this->fk_user_create = trim($this->fk_user_create);
|
||||
$this->fk_user_create = (int) $this->fk_user_create;
|
||||
}
|
||||
|
||||
if (isset($this->fk_user_assign)) {
|
||||
$this->fk_user_assign = trim($this->fk_user_assign);
|
||||
$this->fk_user_assign = (int) $this->fk_user_assign;
|
||||
}
|
||||
|
||||
if (isset($this->subject)) {
|
||||
@ -774,7 +775,7 @@ class Ticket extends CommonObject
|
||||
}
|
||||
|
||||
if (isset($this->fk_statut)) {
|
||||
$this->fk_statut = trim($this->fk_statut);
|
||||
$this->fk_statut = (int) $this->fk_statut;
|
||||
}
|
||||
|
||||
if (isset($this->resolution)) {
|
||||
@ -1002,12 +1003,12 @@ class Ticket extends CommonObject
|
||||
$this->ref = 'TI0501-001';
|
||||
$this->track_id = 'XXXXaaaa';
|
||||
$this->origin_email = 'email@email.com';
|
||||
$this->fk_project = '1';
|
||||
$this->fk_user_create = '1';
|
||||
$this->fk_user_assign = '1';
|
||||
$this->fk_project = 1;
|
||||
$this->fk_user_create = 1;
|
||||
$this->fk_user_assign = 1;
|
||||
$this->subject = 'Subject of ticket';
|
||||
$this->message = 'Message of ticket';
|
||||
$this->fk_statut = '0';
|
||||
$this->fk_statut = 0;
|
||||
$this->resolution = '1';
|
||||
$this->progress = '10';
|
||||
$this->timing = '30';
|
||||
|
||||
@ -3059,9 +3059,10 @@ if ($action == 'editmeta' || $action == 'createcontainer')
|
||||
}
|
||||
elseif ($result > 0)
|
||||
{
|
||||
$translationof = $sourcepage->id;
|
||||
$translationof = 0;
|
||||
//$translationof = $sourcepage->id;
|
||||
print '<span class="opacitymedium">'.$langs->trans('ThisPageIsTranslationOf').'</span> ';
|
||||
print $formwebsite->selectContainer($website, 'pageidfortranslation', $sourcepage->id, 1, $action);
|
||||
print $formwebsite->selectContainer($website, 'pageidfortranslation', $translationof, 1, $action, 'minwidth300');
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user