Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New add possibility to move package files #390

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions class/actions_sellyoursaas.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1632,4 +1632,44 @@ public function restrictedArea($parameters, &$action, $hookmanager)

return 0;
}

/**
* Overloading the isLinkedDocumentObjectNotMovable function : check if we enable link document move
*
* @param array $parameters Hook metadatas (context, etc...)
* @param string $object Current object (if set)
* @param HookManager $hookmanager Hook manager propagated to allow calling another hook
* @return int =0 if OK but we want to process standard code,
* >0 if OK and we want to replace standard codeS.
*/
public function isLinkedDocumentObjectNotMovable($parameters, &$object, $hookmanager)
{
global $user;
if (in_array($object->element, array("packages"))) {
$this->results['disablemove'] = 0;
return 1;
}

return 0;
}

/**
* Overloading the checkRowPerms function : check permission on an object
*
* @param array $parameters Hook metadatas (context, etc...)
* @param string $object Current object (if set)
* @param HookManager $hookmanager Hook manager propagated to allow calling another hook
* @return int =0 if OK but we want to process standard code,
* >0 if OK and we want to replace standard codeS.
*/
public function checkRowPerms($parameters, &$object, $hookmanager)
{
global $user;
$res = 0;
if (in_array($parameters["fk_element"], array("no_parent_package"))) {
$this->results['perm'] = $user->hasRight('sellyoursaas', 'write');
$res = 1;
}
return $res;
}
}
2 changes: 1 addition & 1 deletion class/packages.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Packages extends CommonObject
public $module = 'sellyoursaas';

public $element_for_permission = 'sellyoursaas';

public $fk_element = 'no_parent_package';
/**
* @var array Does packages support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/
Expand Down
16 changes: 16 additions & 0 deletions class/sellyoursaasutils.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4381,6 +4381,22 @@ public function sellyoursaasRemoteAction($remoteaction, $object, $appusername =
dol_syslog("No cli after paid file to create or no content");
}
}
if (in_array($remoteaction, array("deploy", "deployall"))) {
dol_syslog("Create meta file ".$tmppackage->datafile1."/sellyoursaas.deploy.meta");
$metadatadeploy = $tmppackage->datafile1."/.sellyoursaas.deploy.meta";
dol_delete_file($metadatadeploy, 0, 1, 0, null, false, 0);
$filearraydeploy = dol_dir_list_in_database('sellyoursaas/packages/'.$tmppackage->ref, '', '', 'position', SORT_ASC, 0, '(filename:like:%.sql)');
$strlistfile = "";
if (!empty($filearraydeploy)) {
foreach ($filearraydeploy as $key => $arr) {
$strlistfile .= $arr["fullname"]."\n";
}
$result = file_put_contents($metadatadeploy, $strlistfile);
@chmod($metadatadeploy, 0664); // so user/group has "rw" ('admin' can delete if owner/group is 'admin' or 'www-data', 'root' can also read using nfs)
} else{
dol_syslog("No meta data file to creaaaate or no content ");
}
}
// Parameters for remote action
$commandurl = $generatedunixlogin.'&'.$generatedunixpassword.'&'.$sldAndSubdomain.'&'.$domainname;
$commandurl.= '&'.$generateddbname.'&'.$generateddbport.'&'.$generateddbusername.'&'.$generateddbpassword;
Expand Down
2 changes: 1 addition & 1 deletion core/modules/modSellYourSaas.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function __construct($db)
'hooks' => array('thirdpartycard','thirdpartycomm','thirdpartysupplier','thirdpartycontact','contactthirdparty','thirdpartyticket','thirdpartynote','thirdpartydocument','thirdpartypartnership',
'projectthirdparty','consumptionthirdparty','thirdpartybancard','thirdpartymargins','ticketlist','thirdpartynotification','agendathirdparty',
'thirdpartydao','formmail','searchform','thirdpartylist','customerlist','prospectlist','contractcard','contractdao','contractlist',
'pdfgeneration','odtgeneration','customreport'));
'pdfgeneration','odtgeneration','customreport','rowinterface'));

// Constants
// List of particular constants to add when module is enabled (key, 'chaine', value, 'desc', visible, 'current' or 'allentities', deleteonunactive)
Expand Down
2 changes: 1 addition & 1 deletion packages_document.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
$sortorder="ASC";
}
if (! $sortfield) {
$sortfield="name";
$sortfield="position";
}

// Initialize technical objects
Expand Down
2 changes: 1 addition & 1 deletion scripts/action_deploy_undeploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,7 @@ if [[ "$mode" == "deploy" || "$mode" == "deployall" ]]; then

# Load dump file
echo `date +'%Y-%m-%d %H:%M:%S'`" Search dumpfile into $dirwithdumpfile"
for dumpfile in `ls $dirwithdumpfile/*.sql 2>/dev/null`
for dumpfile in `cat $dirwithdumpfile/.sellyoursaas.deploy.meta 2>/dev/null`
do
echo "$MYSQL -A -h $dbserverhost -P $dbserverport -u$dbadminuser -pXXXXXX -D $dbname < $dumpfile"
$MYSQL -A -h $dbserverhost -P $dbserverport -u$dbadminuser -p$dbadminpass -D $dbname < $dumpfile
Expand Down